Skip to content

Conversation

@tambry
Copy link
Contributor

@tambry tambry commented Nov 6, 2025

Otherwise these tests are reliant on the compiler defaulting to having the extensions on. Rest of LLVM's codebase doesn't seem to make such assumptions.

Tested by building with -std=c2y in Clang's C frotend's config file.

@tambry tambry self-assigned this Nov 6, 2025
@tambry tambry requested a review from JDevlieghere as a code owner November 6, 2025 13:11
@llvmbot llvmbot added the lldb label Nov 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 6, 2025

@llvm/pr-subscribers-lldb

Author: Raul Tambre (tambry)

Changes

Otherwise these tests are reliant on the compiler defaulting to having the extensions on. Rest of LLVM's codebase doesn't seem to make such assumptions.

Tested by building with -std=c2y in Clang's C frotend's config file.


Full diff: https://github.com/llvm/llvm-project/pull/166768.diff

7 Files Affected:

  • (modified) lldb/test/API/commands/expression/call-restarts/lotta-signals.c (+6-2)
  • (modified) lldb/test/API/driver/quit_speed/main.c (+4)
  • (modified) lldb/test/API/functionalities/process_group/main.c (+4)
  • (modified) lldb/test/API/lang/c/tls_globals/a.c (+4)
  • (modified) lldb/test/API/lang/c/tls_globals/main.c (+4-1)
  • (modified) lldb/test/Shell/Commands/Inputs/sigchld.c (+4)
  • (modified) lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test (+2-2)
diff --git a/lldb/test/API/commands/expression/call-restarts/lotta-signals.c b/lldb/test/API/commands/expression/call-restarts/lotta-signals.c
index f5c15b41e2de3..149ceb787f707 100644
--- a/lldb/test/API/commands/expression/call-restarts/lotta-signals.c
+++ b/lldb/test/API/commands/expression/call-restarts/lotta-signals.c
@@ -1,3 +1,7 @@
+#if defined(__linux__)
+#define _DEFAULT_SOURCE /* for kill(), usleep() and GNU's signal() */
+#endif
+
 #include <unistd.h>
 #include <stdio.h>
 #include <signal.h>
@@ -46,12 +50,12 @@ call_me_nosig (int some_value)
   return some_value;
 }
 
-int 
+int
 main ()
 {
   int ret_val;
   signal (SIGCHLD, sigchld_handler);
-  
+
   ret_val = call_me (2);  // Stop here in main.
 
   ret_val = call_me_nosig (10);
diff --git a/lldb/test/API/driver/quit_speed/main.c b/lldb/test/API/driver/quit_speed/main.c
index 3d6d45ce5e806..95e4de911ccfa 100644
--- a/lldb/test/API/driver/quit_speed/main.c
+++ b/lldb/test/API/driver/quit_speed/main.c
@@ -1,3 +1,7 @@
+#if defined(__linux__)
+#define _XOPEN_SOURCE 500 /* for usleep() */
+#endif
+
 #include <unistd.h>
 
 int main (int argc, char **argv) {
diff --git a/lldb/test/API/functionalities/process_group/main.c b/lldb/test/API/functionalities/process_group/main.c
index b4d5abc58169c..75c2b41351c3e 100644
--- a/lldb/test/API/functionalities/process_group/main.c
+++ b/lldb/test/API/functionalities/process_group/main.c
@@ -1,3 +1,7 @@
+#if defined(__linux__)
+#define _XOPEN_SOURCE 500 /* for getpgid() */
+#endif
+
 #include "attach.h"
 #include <stdio.h>
 #include <sys/wait.h>
diff --git a/lldb/test/API/lang/c/tls_globals/a.c b/lldb/test/API/lang/c/tls_globals/a.c
index f63108d8cceb1..16bfeaeca0a78 100644
--- a/lldb/test/API/lang/c/tls_globals/a.c
+++ b/lldb/test/API/lang/c/tls_globals/a.c
@@ -1,3 +1,7 @@
+#if defined(__linux__)
+#define _XOPEN_SOURCE 500 /* for usleep() */
+#endif
+
 #include <unistd.h>
 
 __thread int var_shared = 33;
diff --git a/lldb/test/API/lang/c/tls_globals/main.c b/lldb/test/API/lang/c/tls_globals/main.c
index fac760b350ab2..e6a6d3c868462 100644
--- a/lldb/test/API/lang/c/tls_globals/main.c
+++ b/lldb/test/API/lang/c/tls_globals/main.c
@@ -1,4 +1,7 @@
-#include <stdio.h>
+#if defined(__linux__)
+#define _XOPEN_SOURCE 500 /* for usleep() */
+#endif
+
 #include <pthread.h>
 #include <unistd.h>
 
diff --git a/lldb/test/Shell/Commands/Inputs/sigchld.c b/lldb/test/Shell/Commands/Inputs/sigchld.c
index ba8c5ef45365b..0121e70c1bdd0 100644
--- a/lldb/test/Shell/Commands/Inputs/sigchld.c
+++ b/lldb/test/Shell/Commands/Inputs/sigchld.c
@@ -1,3 +1,7 @@
+#if defined(__linux__)
+#define _XOPEN_SOURCE 500 /* for CLD_EXITED */
+#endif
+
 #include <assert.h>
 #include <signal.h>
 #include <stdio.h>
diff --git a/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test b/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test
index fa4a93e5904aa..9987efedd8020 100644
--- a/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test
+++ b/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test
@@ -4,7 +4,7 @@
 # RUN: %lldb %t.out -b -s %s 2>&1 | FileCheck %s
 
 list
-# CHECK: note: No source available 
+# CHECK: note: No source available
 
 b main
 # CHECK: Breakpoint 1:
@@ -18,7 +18,7 @@ list
 list -
 # CHECK: int main()
 
-list -10
+list -13
 # CHECK: #include <assert.h>
 
 list -

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Otherwise these tests are reliant on the compiler defaulting to having the extensions on.
Rest of LLVM's codebase doesn't seem to make such assumptions.

Tested by building with `-std=c2y` in Clang's C frotend's config file.
@tambry
Copy link
Contributor Author

tambry commented Nov 6, 2025

Pushed back one of the earlier test changes that I had inadvertently removed when re-doing tests that use Makefile.rules.

@tambry tambry enabled auto-merge (squash) November 6, 2025 18:44
@tambry tambry merged commit 0ca7d57 into llvm:main Nov 6, 2025
7 of 9 checks passed
vinay-deshmukh pushed a commit to vinay-deshmukh/llvm-project that referenced this pull request Nov 8, 2025
…166768)

Otherwise these tests are reliant on the compiler defaulting to having the extensions on.
Rest of LLVM's codebase doesn't seem to make such assumptions.

Tested by building with `-std=c2y` in Clang's C frotend's config file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants