[Lldb-commits] [lldb] 0ca7d57 - [NFCI][lldb][test] Enable GNU POSIX extensions where necessary (#166768)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 6 10:48:50 PST 2025
Author: Raul Tambre
Date: 2025-11-06T18:48:45Z
New Revision: 0ca7d57d745ed2adcbf6b012135dc3036f5c8792
URL: https://github.com/llvm/llvm-project/commit/0ca7d57d745ed2adcbf6b012135dc3036f5c8792
DIFF: https://github.com/llvm/llvm-project/commit/0ca7d57d745ed2adcbf6b012135dc3036f5c8792.diff
LOG: [NFCI][lldb][test] Enable GNU POSIX extensions where necessary (#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.
Added:
Modified:
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/test/Shell/Commands/Inputs/sigchld.c
lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 63a35224b0435..0122fe8409c29 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -294,6 +294,11 @@ ifeq "$(MAKE_DEBUG_NAMES)" "YES"
CFLAGS += -gpubnames
endif
+# Enable GNU POSIX extensions (e.g. kill(), usleep(), getpgid(), ...)
+ifeq "$(OS)" "Linux"
+ CFLAGS += -D_DEFAULT_SOURCE
+endif
+
ifeq "$(USE_PRIVATE_MODULE_CACHE)" "YES"
THE_CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/private-module-cache
else
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 -
More information about the lldb-commits
mailing list