From 479f291727987aeda01eb0554f5e9b28c7a9ce0b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 2 Oct 2010 11:44:20 +0200 Subject: [PATCH] New module 'system-posix'. * modules/system-posix: New file. * lib/stdlib.in.h: Include only when the 'system-posix' module is present. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_SYSTEM_POSIX. * modules/stdlib (Depends-on): Remove sys_wait. (Makefile.am): Substitute GNULIB_SYSTEM_POSIX. * doc/posix-functions/system.texi: Mention the new module. * doc/posix-headers/stdlib.texi: Likewise. * tests/test-stdlib.c: If GNULIB_TEST_SYSTEM_POSIX is not defined, define test_sys_wait_macros to a no-op. Reported by Sam Steingold . --- ChangeLog | 16 ++++++++++++++++ doc/posix-functions/system.texi | 8 +++++++- doc/posix-headers/stdlib.texi | 7 +++++-- lib/stdlib.in.h | 2 +- m4/stdlib_h.m4 | 3 ++- modules/stdlib | 2 +- modules/system-posix | 22 ++++++++++++++++++++++ tests/test-stdlib.c | 6 +++++- 8 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 modules/system-posix diff --git a/ChangeLog b/ChangeLog index 6b15b1c1a1..361d1f3f91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2010-10-02 Bruno Haible + + New module 'system-posix'. + * modules/system-posix: New file. + * lib/stdlib.in.h: Include only when the 'system-posix' + module is present. + * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize + GNULIB_SYSTEM_POSIX. + * modules/stdlib (Depends-on): Remove sys_wait. + (Makefile.am): Substitute GNULIB_SYSTEM_POSIX. + * doc/posix-functions/system.texi: Mention the new module. + * doc/posix-headers/stdlib.texi: Likewise. + * tests/test-stdlib.c: If GNULIB_TEST_SYSTEM_POSIX is not defined, + define test_sys_wait_macros to a no-op. + Reported by Sam Steingold . + 2010-09-30 Bruno Haible More renaming from 'getdate' to 'get_date'. diff --git a/doc/posix-functions/system.texi b/doc/posix-functions/system.texi index 30622a3986..efeab407ea 100644 --- a/doc/posix-functions/system.texi +++ b/doc/posix-functions/system.texi @@ -4,10 +4,16 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/system.html} -Gnulib module: --- +Gnulib module: system-posix Portability problems fixed by Gnulib: @itemize +@item +The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED}, +@code{WTERMSIG}, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED}, +@code{WSTOPSIG} are not defined in @code{} (only in +@code{}) on some platforms: +MirBSD 10. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-headers/stdlib.texi b/doc/posix-headers/stdlib.texi index 0c164d52b3..2c3a0740d6 100644 --- a/doc/posix-headers/stdlib.texi +++ b/doc/posix-headers/stdlib.texi @@ -3,9 +3,9 @@ POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stdlib.h.html} -Gnulib module: stdlib +Gnulib module: stdlib, system-posix -Portability problems fixed by Gnulib: +Portability problems fixed by the Gnulib module @code{stdlib}: @itemize @item The macros @code{EXIT_SUCCESS} and @code{EXIT_FAILURE} are not defined on @@ -17,7 +17,10 @@ The macro @code{EXIT_FAILURE} is incorrectly defined on Tandem/NSK. Some platforms provide a @code{NULL} macro that cannot be used in arbitrary expressions: NetBSD 5.0 +@end itemize +Portability problems fixed by the Gnulib module @code{system-posix}: +@itemize @item The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED}, @code{WTERMSIG}, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED}, diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index f4309ed73f..de13bf7f81 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -39,7 +39,7 @@ #include /* MirBSD 10 defines WEXITSTATUS in , not in . */ -#ifndef WEXITSTATUS +#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS # include #endif diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index fc150197b1..e4697ce213 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 30 +# stdlib_h.m4 serial 31 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -73,6 +73,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) + GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) dnl Assume proper GNU behavior unless another module says otherwise. diff --git a/modules/stdlib b/modules/stdlib index f822aa3ebe..3392c8df30 100644 --- a/modules/stdlib +++ b/modules/stdlib @@ -11,7 +11,6 @@ c++defs include_next stddef stdint -sys_wait unistd warn-on-use @@ -52,6 +51,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ + -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \ -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ diff --git a/modules/system-posix b/modules/system-posix new file mode 100644 index 0000000000..d5dc66915a --- /dev/null +++ b/modules/system-posix @@ -0,0 +1,22 @@ +Description: +system() function: execute a shell command + +Files: + +Depends-on: +stdlib +sys_wait + +configure.ac: +gl_STDLIB_MODULE_INDICATOR([system-posix]) + +Makefile.am: + +Include: + + +License: +LGPL + +Maintainer: +Bruno Haible diff --git a/tests/test-stdlib.c b/tests/test-stdlib.c index ec8af178b1..1e7956b68c 100644 --- a/tests/test-stdlib.c +++ b/tests/test-stdlib.c @@ -38,7 +38,11 @@ static int exitcode = EXIT_SUCCESS; per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); -#include "test-sys_wait.h" +#if GNULIB_TEST_SYSTEM_POSIX +# include "test-sys_wait.h" +#else +# define test_sys_wait_macros() 0 +#endif int main (void) -- 2.30.2