[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.
This commit is contained in:
Raul Tambre 2025-11-06 20:48:45 +02:00 committed by GitHub
parent f84c4c4683
commit 0ca7d57d74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -1,3 +1,7 @@
#if defined(__linux__)
#define _XOPEN_SOURCE 500 /* for CLD_EXITED */
#endif
#include <assert.h>
#include <signal.h>
#include <stdio.h>

View File

@ -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 -