Collin Funk wrote: > The only change to sys/wait.h in POSIX 2024 is that WCOREDUMP is now > standardized. I've pushed the two attached patches updating a source > comment and adding a test for the definition that was missing.
The CI reports a compilation error on all glibc systems. How to reproduce: $ ./gnulib-tool --test --single-configure system-posix ... In file included from ../../gltests/test-stdlib-h.c:40: ../../gltests/test-sys_wait-h.h:41:55: error: call to undeclared function 'WCOREDUMP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 41 | i = WEXITSTATUS (i) + WSTOPSIG (i) + WTERMSIG (i) + WCOREDUMP (i); | ^ 1 error generated. make[4]: *** [Makefile:27801: test-stdlib-h.o] Error 1 This patch fixes it. 2025-01-13 Bruno Haible <br...@clisp.org> stdlib-h: Define WCOREDUMP, as required by POSIX:2024. * lib/stdlib.in.h: Include <sys/wait.h> also when WCOREDUMP is not defined. * doc/posix-headers/stdlib.texi: Document the glibc bug. diff --git a/doc/posix-headers/stdlib.texi b/doc/posix-headers/stdlib.texi index 6c62771c13..ee7ab19449 100644 --- a/doc/posix-headers/stdlib.texi +++ b/doc/posix-headers/stdlib.texi @@ -33,6 +33,11 @@ @code{WSTOPSIG} are not defined in this header file (only in @code{<sys/wait.h>}) on some platforms: MirBSD 10. +@item +The macro @code{WCOREDUMP} is not defined in this header file (only in +@code{<sys/wait.h>}) on some platforms: +@c https://sourceware.org/bugzilla/show_bug.cgi?id=32551 +glibc 2.40. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index f8e2a6ce34..bd82086ff3 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -62,8 +62,9 @@ /* NetBSD 5.0 mis-defines NULL. */ #include <stddef.h> -/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */ -#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS +/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. + glibc 2.40 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */ +#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP) # include <sys/wait.h> #endif