bug-gnulib
[Top][All Lists]
Advanced

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

Re: definition of waitpid in sys_wait.in.h for C++ on windows


From: Bruno Haible
Subject: Re: definition of waitpid in sys_wait.in.h for C++ on windows
Date: Wed, 29 Sep 2010 16:14:39 +0200
User-agent: KMail/1.9.9

> ... for C++ it's needed to make 'waitpid' a function instead of a macro.

Additionally, it it suboptimal if the 'sys_wait' module implies the 'waitpid'
module:
  1. since the GNULIB_POSIXCHECK functionality does not work then,
  2. since people who use the 'stdlib' module then will ask "why does stdlib
     depend on waitpid".

This patch completes the separation of the 'sys_wait' and 'waitpid' modules.


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

        Separate the module 'waitpid' from the module 'sys_wait'.
        * lib/sys_wait.in.h (waitpid): Declare only if the 'waitpid' module is
        present.
        * m4/sys_wait_h.m4 (gl_SYS_WAIT_MODULE_INDICATOR): Invoke
        gl_MODULE_INDICATOR_FOR_TESTS.
        (gl_SYS_WAIT_H_DEFAULTS): Initialize GNULIB_WAITPID.
        * modules/sys_wait (Depends-on): Remove waitpid.
        (Makefile.am): Substitute GNULIB_WAITPID.
        * modules/waitpid (configure.ac): Invoke gl_SYS_WAIT_MODULE_INDICATOR.
        * tests/test-sys_wait-c++.cc (GNULIB_NAMESPACE::waitpid): Check the
        signature only if the 'waitpid' module is present.
        * doc/posix-functions/waitpid.texi: Mention the 'waitpid' module.
        * NEWS: Mention the change.
        * modules/grantpt (Depends-on): Add waitpid.
        * modules/wait-process (Depends-on): Likewise.

--- NEWS.orig   Wed Sep 29 16:00:26 2010
+++ NEWS        Wed Sep 29 15:36:35 2010
@@ -12,6 +12,10 @@
 
 Date        Modules         Changes
 
+2010-09-29  sys_wait        This module no longer provides the waitpid()
+                            function. If you need this function, you now need
+                            to request the 'waitpid' module.
+
 2010-09-17  utimens         The function gl_futimens is removed, and its
                             signature has been migrated to fdutimens.  Callers
                             of gl_futimens should change function name, and
--- doc/posix-functions/waitpid.texi.orig       Wed Sep 29 16:00:26 2010
+++ doc/posix-functions/waitpid.texi    Wed Sep 29 15:35:15 2010
@@ -4,15 +4,15 @@
 
 POSIX specification:@* 
@url{http://www.opengroup.org/onlinepubs/9699919799/functions/waitpid.html}
 
-Gnulib module: ---
+Gnulib module: waitpid
 
 Portability problems fixed by Gnulib:
 @itemize
address@hidden
+This function is missing on some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
address@hidden
-This function is missing on some platforms:
-mingw.
 @end itemize
--- lib/sys_wait.in.h.orig      Wed Sep 29 16:00:26 2010
+++ lib/sys_wait.in.h   Wed Sep 29 15:29:19 2010
@@ -113,7 +113,7 @@
 
 /* Declarations of functions.  */
 
-#if 1 /* @GNULIB_WAITPID@ */
+#if @GNULIB_WAITPID@
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 _GL_FUNCDECL_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
 # endif
--- m4/sys_wait_h.m4.orig       Wed Sep 29 16:00:26 2010
+++ m4/sys_wait_h.m4    Wed Sep 29 15:52:23 2010
@@ -22,9 +22,12 @@
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
   AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_SYS_WAIT_H_DEFAULTS],
 [
+  GNULIB_WAITPID=0; AC_SUBST([GNULIB_WAITPID])
   dnl Assume proper GNU behavior unless another module says otherwise.
 ])
--- modules/grantpt.orig        Wed Sep 29 16:00:26 2010
+++ modules/grantpt     Wed Sep 29 15:41:06 2010
@@ -9,6 +9,7 @@
 stdlib
 extensions
 pt_chown
+waitpid
 configmake
 
 configure.ac:
--- modules/sys_wait.orig       Wed Sep 29 16:00:26 2010
+++ modules/sys_wait    Wed Sep 29 15:32:50 2010
@@ -9,7 +9,6 @@
 c++defs
 include_next
 warn-on-use
-waitpid
 
 configure.ac:
 gl_SYS_WAIT_H
@@ -27,6 +26,7 @@
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_SYS_WAIT_H''@|$(NEXT_SYS_WAIT_H)|g' \
+             -e 's|@''GNULIB_WAITPID''@|$(GNULIB_WAITPID)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_wait.in.h; \
--- modules/wait-process.orig   Wed Sep 29 16:00:26 2010
+++ modules/wait-process        Wed Sep 29 15:41:06 2010
@@ -17,6 +17,7 @@
 sys_wait
 unistd
 atexit
+waitpid
 
 configure.ac:
 gl_WAIT_PROCESS
--- modules/waitpid.orig        Wed Sep 29 16:00:26 2010
+++ modules/waitpid     Wed Sep 29 15:32:00 2010
@@ -10,6 +10,7 @@
 
 configure.ac:
 gl_FUNC_WAITPID
+gl_SYS_WAIT_MODULE_INDICATOR([waitpid])
 
 Makefile.am:
 
--- tests/test-sys_wait-c++.cc.orig     Wed Sep 29 16:00:26 2010
+++ tests/test-sys_wait-c++.cc  Wed Sep 29 15:50:07 2010
@@ -24,7 +24,9 @@
 #include "signature.h"
 
 
+#if GNULIB_TEST_WAITPID
 SIGNATURE_CHECK (GNULIB_NAMESPACE::waitpid, pid_t, (pid_t, int *, int));
+#endif
 
 
 int



reply via email to

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