-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[NFCI][lldb][test] Enable GNU POSIX extensions where necessary #166768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-lldb Author: Raul Tambre (tambry) ChangesOtherwise 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 Full diff: https://github.com/llvm/llvm-project/pull/166768.diff 7 Files Affected:
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 -
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
8f553e7 to
f33087e
Compare
lldb/test/API/commands/expression/call-restarts/lotta-signals.c
Outdated
Show resolved
Hide resolved
f33087e to
317aa04
Compare
JDevlieghere
left a comment
There was a problem hiding this 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.
317aa04 to
3d9fff8
Compare
|
Pushed back one of the earlier test changes that I had inadvertently removed when re-doing tests that use |
…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.
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=c2yin Clang's C frotend's config file.