bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what does regex depend on sys_wait?


From: Bruno Haible
Subject: Re: what does regex depend on sys_wait?
Date: Tue, 28 Sep 2010 22:30:28 +0200
User-agent: KMail/1.9.9

Paul Eggert wrote:
> perhaps "system-posix" instead?

Yes, indeed. The system() function is specified by ISO C and by POSIX. In
ISO C the return value is "an implementation-defined value", whereas in
POSIX the return value can be analyzed with WIFEXITED etc.

Here is an updated proposed patch.

Bruno


2010-09-28  Bruno Haible  <address@hidden>

        New module 'system-posix'.
        * modules/system-posix: New file.
        * lib/stdlib.in.h: Include <sys/wait.h> 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 <address@hidden>.

============================ modules/system-posix ============================
Description:
system() function: execute a shell command

Files:

Depends-on:
stdlib
sys_wait

configure.ac:
gl_STDLIB_MODULE_INDICATOR([system-posix])

Makefile.am:

Include:
<stdlib.h>

License:
LGPL

Maintainer:
Bruno Haible
==============================================================================
--- doc/posix-functions/system.texi.orig        Tue Sep 28 22:28:18 2010
+++ doc/posix-functions/system.texi     Tue Sep 28 22:20:23 2010
@@ -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
address@hidden
+The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED},
address@hidden, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED},
address@hidden are not defined in @code{<stdlib.h>} (only in
address@hidden<sys/wait.h>}) on some platforms:
+MirBSD 10.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- doc/posix-headers/stdlib.texi.orig  Tue Sep 28 22:28:18 2010
+++ doc/posix-headers/stdlib.texi       Tue Sep 28 22:20:37 2010
@@ -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 @@
 Some platforms provide a @code{NULL} macro that cannot be used in arbitrary
 expressions:
 NetBSD 5.0
address@hidden itemize
 
+Portability problems fixed by the Gnulib module @code{system-posix}:
address@hidden
 @item
 The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED},
 @code{WTERMSIG}, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED},
--- lib/stdlib.in.h.orig        Tue Sep 28 22:28:18 2010
+++ lib/stdlib.in.h     Tue Sep 28 22:20:48 2010
@@ -39,7 +39,7 @@
 #include <stddef.h>
 
 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.  */
-#ifndef WEXITSTATUS
+#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
 # include <sys/wait.h>
 #endif
 
--- m4/stdlib_h.m4.orig Tue Sep 28 22:28:18 2010
+++ m4/stdlib_h.m4      Tue Sep 28 22:21:19 2010
@@ -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 @@
   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.
--- modules/stdlib.orig Tue Sep 28 22:28:18 2010
+++ modules/stdlib      Tue Sep 28 22:21:09 2010
@@ -11,7 +11,6 @@
 include_next
 stddef
 stdint
-sys_wait
 unistd
 warn-on-use
 
@@ -52,6 +51,7 @@
              -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' \
--- tests/test-stdlib.c.orig    Tue Sep 28 22:28:18 2010
+++ tests/test-stdlib.c Tue Sep 28 22:23:33 2010
@@ -38,7 +38,11 @@
    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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]