bug-gnulib
[Top][All Lists]
Advanced

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

Re: link-warning usage improvements


From: Eric Blake
Subject: Re: link-warning usage improvements
Date: Thu, 31 Dec 2009 07:16:20 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 12/29/2009 10:16 PM:
> According to Bruno Haible on 12/24/2009 1:46 PM:
>> Eric Blake wrote:
>>> Any objections to a patch that
>>> makes replacement of these headers unconditional, so that
>>> GNULIB_POSIXCHECK will work better?
>>>
>> modules/spawn and modules/sys_times will be some work, because currently the
>> replacement header file will not work on systems which already have the
>> typedefs.
> 
> modules/sys_utsname also needs help (sys_tims and sys_utsname need to use
> include_next, and spawn just needs to special-case type existence).

Here's the series that fixes all of these, then flips the switch to
unconditionally build all replacement headers that contain a use of
link-warning.  Tested on Linux, cygwin, and mingw.

Eric Blake (4):
      [1/4] sys_times, sys_utsname: use include_next
Even though these headers only define one function, they need to wrap the
system header for link warning to be useful on that function.  Doing so
requires protecting a type from inconsistent redeclaration.

      [2/4] spawn: improve wrapper support
Similar to the previous patch, although include_next was already supported.

      [3/4] signal, spawn: use link warnings
These modules depended on link-warning, then didn't use it.  Mark all
functions with a declared replacement (although signal.h has other
functions that we don't replace).  Also beef up test-signal.c, including a
fix for mingw.

      [4/4] link-warning: always build headers with link warnings
Tested with:
 grep -l link-warning modules/* | sed '/link/d; s,modules/,,' \
  | xargs ./gnulib-tool --create-testdir --dir=testdir0 --with-tests

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAks8sjMACgkQ84KuGfSFAYC9ZgCeIf2iyz6RCKcYCLFCt3U0W0Tv
0IYAoMVC20K9XdV4617oX0L8jY6XUkg3
=05k8
-----END PGP SIGNATURE-----
From f2f428037cd5dcf93c4cc8cfacf4dd92f0f250bd Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 30 Dec 2009 09:47:55 -0700
Subject: [PATCH 1/4] sys_times, sys_utsname: use include_next

Another step towards being able to make GL_LINK_WARNING useful.

* m4/sys_times_h.m4 (gl_SYS_TIMES_H): Support wrapping an existing
header.
(gl_SYS_TIMES_H_DEFAULTS): Add another variable.
* m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H)
(gl_SYS_UTSNAME_H_DEFAULTS): Likewise.
* modules/sys_times (Depends-on): Add include_next.
(Makefile.am): Substitute additional values.
* modules/sys_utsname (Depends-on, Makefile.am): Likewise.
* lib/sys_times.in.h (includes): Include native header, if
available.
* lib/sys_utsname.in.h (includes): Likewise.
* tests/test-sys_times.c (main): Enhance test.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog              |   14 ++++++++++++++
 lib/sys_times.in.h     |   13 +++++++++++++
 lib/sys_utsname.in.h   |   44 +++++++++++++++++++++++++++-----------------
 m4/sys_times_h.m4      |   13 ++++++++++++-
 m4/sys_utsname_h.m4    |   18 ++++++++++++++----
 modules/sys_times      |   11 +++++++++--
 modules/sys_utsname    |   10 ++++++++--
 tests/test-sys_times.c |    5 +++--
 8 files changed, 100 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ffecc44..2b82077 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2009-12-31  Eric Blake  <address@hidden>

+       sys_times, sys_utsname: use include_next
+       * m4/sys_times_h.m4 (gl_SYS_TIMES_H): Support wrapping an existing
+       header.
+       (gl_SYS_TIMES_H_DEFAULTS): Add another variable.
+       * m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H)
+       (gl_SYS_UTSNAME_H_DEFAULTS): Likewise.
+       * modules/sys_times (Depends-on): Add include_next.
+       (Makefile.am): Substitute additional values.
+       * modules/sys_utsname (Depends-on, Makefile.am): Likewise.
+       * lib/sys_times.in.h (includes): Include native header, if
+       available.
+       * lib/sys_utsname.in.h (includes): Likewise.
+       * tests/test-sys_times.c (main): Enhance test.
+
        fdutimensat: revert prior patch
        * modules/fdutimensat (Depends-on): Re-add inline; it is needed by
        utimens.h.
diff --git a/lib/sys_times.in.h b/lib/sys_times.in.h
index 2af1e58..31ab4ce 100644
--- a/lib/sys_times.in.h
+++ b/lib/sys_times.in.h
@@ -21,6 +21,15 @@
    is missing.  */

 #ifndef _GL_SYS_TIMES_H
+
+# if __GNUC__ >= 3
address@hidden@
+# endif
+
+# if @HAVE_SYS_TIMES_H@
+#  @INCLUDE_NEXT@ @NEXT_SYS_TIMES_H@
+# endif
+
 # define _GL_SYS_TIMES_H

 /* Get clock_t. */
@@ -34,6 +43,7 @@
 extern "C" {
 # endif

+# if address@hidden@
   /* Structure describing CPU time used by a process and its children.  */
   struct tms
   {
@@ -43,9 +53,12 @@ extern "C" {
     clock_t tms_cutime;         /* User CPU time of dead children.  */
     clock_t tms_cstime;         /* System CPU time of dead children.  */
   };
+# endif

 # if @GNULIB_TIMES@
+#  if address@hidden@
   extern clock_t times (struct tms *buffer) _GL_ARG_NONNULL ((1));
+#  endif
 # elif defined GNULIB_POSIXCHECK
 #  undef times
 #  define times(s)                                              \
diff --git a/lib/sys_utsname.in.h b/lib/sys_utsname.in.h
index 2a26348..0e3d7cd 100644
--- a/lib/sys_utsname.in.h
+++ b/lib/sys_utsname.in.h
@@ -16,6 +16,15 @@
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */

 #ifndef _GL_SYS_UTSNAME_H
+
+#if __GNUC__ >= 3
address@hidden@
+#endif
+
+#if @HAVE_SYS_UTSNAME_H@
+# @INCLUDE_NEXT@ @NEXT_SYS_UTSNAME_H@
+#endif
+
 #define _GL_SYS_UTSNAME_H

 /* The definition of GL_LINK_WARNING is copied here.  */
@@ -27,25 +36,25 @@
 extern "C" {
 #endif

-
+#if address@hidden@
 /* Length of the entries in 'struct utsname' is 256.  */
-#define _UTSNAME_LENGTH 256
+# define _UTSNAME_LENGTH 256

-#ifndef _UTSNAME_NODENAME_LENGTH
-# define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
-#endif
-#ifndef _UTSNAME_SYSNAME_LENGTH
-# define _UTSNAME_SYSNAME_LENGTH _UTSNAME_LENGTH
-#endif
-#ifndef _UTSNAME_RELEASE_LENGTH
-# define _UTSNAME_RELEASE_LENGTH _UTSNAME_LENGTH
-#endif
-#ifndef _UTSNAME_VERSION_LENGTH
-# define _UTSNAME_VERSION_LENGTH _UTSNAME_LENGTH
-#endif
-#ifndef _UTSNAME_MACHINE_LENGTH
-# define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
-#endif
+# ifndef _UTSNAME_NODENAME_LENGTH
+#  define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
+# endif
+# ifndef _UTSNAME_SYSNAME_LENGTH
+#  define _UTSNAME_SYSNAME_LENGTH _UTSNAME_LENGTH
+# endif
+# ifndef _UTSNAME_RELEASE_LENGTH
+#  define _UTSNAME_RELEASE_LENGTH _UTSNAME_LENGTH
+# endif
+# ifndef _UTSNAME_VERSION_LENGTH
+#  define _UTSNAME_VERSION_LENGTH _UTSNAME_LENGTH
+# endif
+# ifndef _UTSNAME_MACHINE_LENGTH
+#  define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
+# endif

 /* Structure describing the system and machine.  */
 struct utsname
@@ -63,6 +72,7 @@ struct utsname
     /* Name of the hardware type the system is running on.  */
     char machine[_UTSNAME_MACHINE_LENGTH];
   };
+#endif /* address@hidden@ */


 #if @GNULIB_UNAME@
diff --git a/m4/sys_times_h.m4 b/m4/sys_times_h.m4
index aaff00a..2fe9f24 100644
--- a/m4/sys_times_h.m4
+++ b/m4/sys_times_h.m4
@@ -1,4 +1,5 @@
 # Configure a replacement for <sys/times.h>.
+# serial 2

 # Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -11,13 +12,21 @@ AC_DEFUN([gl_SYS_TIMES_H],
 [
   AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS])

+  gl_CHECK_NEXT_HEADERS([sys/times.h])
   AC_CHECK_HEADERS_ONCE([sys/times.h])
   if test $ac_cv_header_sys_times_h = yes; then
     SYS_TIMES_H=
+    HAVE_SYS_TIMES_H=1
+    AC_CHECK_TYPES([struct tms], [], [HAVE_STRUCT_TMS=0], [[
+#include <sys/times.h>
+      ]])
   else
     SYS_TIMES_H=sys/times.h
+    HAVE_SYS_TIMES_H=0
+    HAVE_STRUCT_TMS=0
   fi
   AC_SUBST([SYS_TIMES_H])
+  AC_SUBST([HAVE_SYS_TIMES_H])
 ])

 AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR],
@@ -29,5 +38,7 @@ AC_DEFUN([gl_SYS_TIMES_MODULE_INDICATOR],

 AC_DEFUN([gl_SYS_TIMES_H_DEFAULTS],
 [
-  GNULIB_TIMES=0; AC_SUBST([GNULIB_TIMES])
+  GNULIB_TIMES=0;     AC_SUBST([GNULIB_TIMES])
+  HAVE_STRUCT_TMS=1;  AC_SUBST([HAVE_STRUCT_TMS])
+  HAVE_TIMES=1;       AC_SUBST([HAVE_TIMES])
 ])
diff --git a/m4/sys_utsname_h.m4 b/m4/sys_utsname_h.m4
index 2e688fb..84b781f 100644
--- a/m4/sys_utsname_h.m4
+++ b/m4/sys_utsname_h.m4
@@ -1,4 +1,4 @@
-# sys_utsname_h.m4 serial 1
+# sys_utsname_h.m4 serial 2
 dnl Copyright (C) 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,10 +12,19 @@ AC_DEFUN([gl_SYS_UTSNAME_H],
   dnl once only, before all statements that occur in other macros.
   AC_REQUIRE([gl_SYS_UTSNAME_H_DEFAULTS])

+  gl_CHECK_NEXT_HEADERS([sys/utsname.h])
   AC_CHECK_HEADERS_ONCE([sys/utsname.h])
   if test $ac_cv_header_sys_utsname_h != yes; then
     SYS_UTSNAME_H='sys/utsname.h'
+    HAVE_SYS_UTSNAME_H=0
+    HAVE_STRUCT_UTSNAME=0
+  else
+    HAVE_SYS_UTSNAME_H=1
+    AC_CHECK_TYPES([struct utsname], [], [HAVE_STRUCT_UTSNAME=0], [[
+#include <sys/utsname.h>
+      ]])
   fi
+  AC_SUBST([HAVE_SYS_UTSNAME_H])
 ])

 AC_DEFUN([gl_SYS_UTSNAME_MODULE_INDICATOR],
@@ -27,8 +36,9 @@ AC_DEFUN([gl_SYS_UTSNAME_MODULE_INDICATOR],

 AC_DEFUN([gl_SYS_UTSNAME_H_DEFAULTS],
 [
-  GNULIB_UNAME=0;   AC_SUBST([GNULIB_UNAME])
+  GNULIB_UNAME=0;         AC_SUBST([GNULIB_UNAME])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_UNAME=1;     AC_SUBST([HAVE_UNAME])
-  SYS_UTSNAME_H=''; AC_SUBST([SYS_UTSNAME_H])
+  HAVE_UNAME=1;           AC_SUBST([HAVE_UNAME])
+  HAVE_STRUCT_UTSNAME=1;  AC_SUBST([HAVE_STRUCT_UTSNAME])
+  SYS_UTSNAME_H='';       AC_SUBST([SYS_UTSNAME_H])
 ])
diff --git a/modules/sys_times b/modules/sys_times
index 23af537..8ccf5da 100644
--- a/modules/sys_times
+++ b/modules/sys_times
@@ -6,8 +6,9 @@ lib/sys_times.in.h
 m4/sys_times_h.m4

 Depends-on:
-link-warning
 arg-nonnull
+include_next
+link-warning

 configure.ac:
 gl_SYS_TIMES_H
@@ -22,7 +23,13 @@ sys/times.h: sys_times.in.h $(LINK_WARNING_H) 
$(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GNULIB_TIMES''@|$(GNULIB_TIMES)|g' \
+         sed -e 's/@''HAVE_SYS_TIMES_H''@/$(HAVE_SYS_TIMES_H)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_SYS_TIMES_H''@|$(NEXT_SYS_TIMES_H)|g' \
+             -e 's|@''GNULIB_TIMES''@|$(GNULIB_TIMES)|g' \
+             -e 's|@''HAVE_STRUCT_TMS''@|$(HAVE_STRUCT_TMS)|g' \
+             -e 's|@''HAVE_TIMES''@|$(HAVE_TIMES)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              < $(srcdir)/sys_times.in.h; \
diff --git a/modules/sys_utsname b/modules/sys_utsname
index 83e337d..cdb3468 100644
--- a/modules/sys_utsname
+++ b/modules/sys_utsname
@@ -6,8 +6,9 @@ lib/sys_utsname.in.h
 m4/sys_utsname_h.m4

 Depends-on:
-link-warning
 arg-nonnull
+include_next
+link-warning

 configure.ac:
 gl_SYS_UTSNAME_H
@@ -22,7 +23,12 @@ sys/utsname.h: sys_utsname.in.h $(LINK_WARNING_H) 
$(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's|@''GNULIB_UNAME''@|$(GNULIB_UNAME)|g' \
+         sed -e 's/@''HAVE_SYS_UTSNAME_H''@/$(HAVE_SYS_UTSNAME_H)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_SYS_UTSNAME_H''@|$(NEXT_SYS_UTSNAME_H)|g' \
+             -e 's|@''GNULIB_UNAME''@|$(GNULIB_UNAME)|g' \
+             -e 's|@''HAVE_STRUCT_UTSNAME''@|$(HAVE_STRUCT_UTSNAME)|g' \
              -e 's|@''HAVE_UNAME''@|$(HAVE_UNAME)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
diff --git a/tests/test-sys_times.c b/tests/test-sys_times.c
index 5f36747..22e4bc6 100644
--- a/tests/test-sys_times.c
+++ b/tests/test-sys_times.c
@@ -20,10 +20,11 @@

 #include <sys/times.h>

-struct tms tms;
+static struct tms tms;

 int
 main (void)
 {
-  return 0;
+  clock_t t = tms.tms_utime + tms.tms_stime + tms.tms_cutime + tms.tms_cstime;
+  return t;
 }
-- 
1.6.4.2


From 0bf85001e78afe170ee53158a5ca3c2036b5da99 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 30 Dec 2009 11:52:31 -0700
Subject: [PATCH 2/4] spawn: improve wrapper support

Avoid type conflicts if overriding system header.

* m4/spawn_h.m4 (gl_SPAWN_H): Check for type existence.
(gl_SPAWN_H_DEFAULTS): New defaults.
* modules/spawn (Makefile.am): Substitute them.
* lib/spawn.in.h: (posix_spawnattr_t, posix_spawn_file_actions_t):
Only declare if missing or broken.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    7 +++++++
 lib/spawn.in.h |    4 ++++
 m4/spawn_h.m4  |   20 ++++++++++++++++----
 modules/spawn  |    2 ++
 4 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2b82077..dff8ae9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-12-31  Eric Blake  <address@hidden>

+       spawn: improve wrapper support
+       * m4/spawn_h.m4 (gl_SPAWN_H): Check for type existence.
+       (gl_SPAWN_H_DEFAULTS): New defaults.
+       * modules/spawn (Makefile.am): Substitute them.
+       * lib/spawn.in.h: (posix_spawnattr_t, posix_spawn_file_actions_t):
+       Only declare if missing or broken.
+
        sys_times, sys_utsname: use include_next
        * m4/sys_times_h.m4 (gl_SYS_TIMES_H): Support wrapping an existing
        header.
diff --git a/lib/spawn.in.h b/lib/spawn.in.h
index 61c82ae..29b388b 100644
--- a/lib/spawn.in.h
+++ b/lib/spawn.in.h
@@ -74,6 +74,7 @@
 #if @REPLACE_POSIX_SPAWN@
 # define posix_spawnattr_t rpl_posix_spawnattr_t
 #endif
+#if @REPLACE_POSIX_SPAWN@ || address@hidden@
 typedef struct
 {
   short int _flags;
@@ -84,6 +85,7 @@ typedef struct
   int _policy;
   int __pad[16];
 } posix_spawnattr_t;
+#endif


 /* Data structure to contain information about the actions to be
@@ -91,6 +93,7 @@ typedef struct
 #if @REPLACE_POSIX_SPAWN@
 # define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
 #endif
+#if @REPLACE_POSIX_SPAWN@ || address@hidden@
 typedef struct
 {
   int _allocated;
@@ -98,6 +101,7 @@ typedef struct
   struct __spawn_action *_actions;
   int __pad[16];
 } posix_spawn_file_actions_t;
+#endif


 /* Flags to be set in the `posix_spawnattr_t'.  */
diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4
index dd915fa..a369c27 100644
--- a/m4/spawn_h.m4
+++ b/m4/spawn_h.m4
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 3
+# spawn_h.m4 serial 4
 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,8 +19,17 @@ AC_DEFUN([gl_SPAWN_H],
   AC_CHECK_HEADERS_ONCE([spawn.h])
   if test $ac_cv_header_spawn_h = yes; then
     HAVE_SPAWN_H=1
+    AC_CHECK_TYPES([posix_spawnattr_t], [], [HAVE_POSIX_SPAWNATTR_T=0], [[
+#include <spawn.h>
+      ]])
+    AC_CHECK_TYPES([posix_spawn_file_actions_t], [],
+      [HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0], [[
+#include <spawn.h>
+      ]])
   else
     HAVE_SPAWN_H=0
+    HAVE_POSIX_SPAWNATTR_T=0
+    HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0
     gl_REPLACE_SPAWN_H
   fi
   AC_SUBST([HAVE_SPAWN_H])
@@ -66,7 +75,10 @@ AC_DEFUN([gl_SPAWN_H_DEFAULTS],
   GNULIB_POSIX_SPAWNATTR_SETSIGMASK=0;        
AC_SUBST([GNULIB_POSIX_SPAWNATTR_SETSIGMASK])
   GNULIB_POSIX_SPAWNATTR_DESTROY=0;           
AC_SUBST([GNULIB_POSIX_SPAWNATTR_DESTROY])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_POSIX_SPAWN=1;     AC_SUBST([HAVE_POSIX_SPAWN])
-  REPLACE_POSIX_SPAWN=0;  AC_SUBST([REPLACE_POSIX_SPAWN])
-  SPAWN_H='';             AC_SUBST([SPAWN_H])
+  HAVE_POSIX_SPAWN=1;        AC_SUBST([HAVE_POSIX_SPAWN])
+  HAVE_POSIX_SPAWNATTR_T=1;  AC_SUBST([HAVE_POSIX_SPAWNATTR_T])
+  HAVE_POSIX_SPAWN_FILE_ACTIONS_T=1;
+                             AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_T])
+  REPLACE_POSIX_SPAWN=0;     AC_SUBST([REPLACE_POSIX_SPAWN])
+  SPAWN_H='';                AC_SUBST([SPAWN_H])
 ])
diff --git a/modules/spawn b/modules/spawn
index 616cc45..1882152 100644
--- a/modules/spawn
+++ b/modules/spawn
@@ -48,6 +48,8 @@ spawn.h: spawn.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 
's|@''GNULIB_POSIX_SPAWNATTR_SETSIGMASK''@|$(GNULIB_POSIX_SPAWNATTR_SETSIGMASK)|g'
 \
              -e 
's|@''GNULIB_POSIX_SPAWNATTR_DESTROY''@|$(GNULIB_POSIX_SPAWNATTR_DESTROY)|g' \
              -e 's|@''HAVE_POSIX_SPAWN''@|$(HAVE_POSIX_SPAWN)|g' \
+             -e 's|@''HAVE_POSIX_SPAWNATTR_T''@|$(HAVE_POSIX_SPAWNATTR_T)|g' \
+             -e 
's|@''HAVE_POSIX_SPAWN_FILE_ACTIONS_T''@|$(HAVE_POSIX_SPAWN_FILE_ACTIONS_T)|g' \
              -e 's|@''REPLACE_POSIX_SPAWN''@|$(REPLACE_POSIX_SPAWN)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-- 
1.6.4.2


From 2adf9eb9d57d54eea767e18b550ee26f70d27dcf Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 30 Dec 2009 14:42:41 -0700
Subject: [PATCH 3/4] signal, spawn: use link warnings

These modules depended on link-warning, then didn't use it.

* lib/signal.in.h (sigset_t): Make unconditional.
(sigismember, sigemptyset, sigaddset, sigdelset, sigfillset)
(sigpending, sigprocmask, sigaction): Add link warnings.
* lib/spawn.in.h (posix_spawn, posix_spawnp, posix_spawnattr_init)
(posix_spawnattr_destroy, posix_spawnattr_getsigdefault)
(posix_spawnattr_setsigdefault, posix_spawnattr_getsigmask)
(posix_spawnattr_setsigmask, posix_spawnattr_getflags)
(posix_spawnattr_setflags, posix_spawnattr_getpgroup)
(posix_spawnattr_setpgroup, posix_spawnattr_getschedpolicy)
(posix_spawnattr_setschedpolicy, posix_spawnattr_getschedparam)
(posix_spawnattr_setschedparam, posix_spawn_file_actions_init)
(posix_spawn_file_actions_destroy)
(posix_spawn_file_actions_addopen)
(posix_spawn_file_actions_addclose)
(posix_spawwn_file_actions_adddup2): Likewise.
* m4/signal_h.m4 (gl_SIGNAL_H): Guarantee uid_t.
* tests/test-signal.c (main): Enhance test.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog           |   21 +++++++++
 lib/signal.in.h     |  113 +++++++++++++++++++++++++++++++++--------------
 lib/spawn.in.h      |  120 +++++++++++++++++++++++++++++++++++++++++++++++++++
 m4/signal_h.m4      |    3 +-
 tests/test-signal.c |  103 +++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 323 insertions(+), 37 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dff8ae9..ed0bbb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
 2009-12-31  Eric Blake  <address@hidden>

+       signal, spawn: use link warnings
+       * lib/signal.in.h (sigset_t): Make unconditional.
+       (sigismember, sigemptyset, sigaddset, sigdelset, sigfillset)
+       (sigpending, sigprocmask, sigaction): Add link warnings.
+       * lib/spawn.in.h (posix_spawn, posix_spawnp, posix_spawnattr_init)
+       (posix_spawnattr_destroy, posix_spawnattr_getsigdefault)
+       (posix_spawnattr_setsigdefault, posix_spawnattr_getsigmask)
+       (posix_spawnattr_setsigmask, posix_spawnattr_getflags)
+       (posix_spawnattr_setflags, posix_spawnattr_getpgroup)
+       (posix_spawnattr_setpgroup, posix_spawnattr_getschedpolicy)
+       (posix_spawnattr_setschedpolicy, posix_spawnattr_getschedparam)
+       (posix_spawnattr_setschedparam, posix_spawn_file_actions_init)
+       (posix_spawn_file_actions_destroy)
+       (posix_spawn_file_actions_addopen)
+       (posix_spawn_file_actions_addclose)
+       (posix_spawwn_file_actions_adddup2): Likewise.
+       * m4/signal_h.m4 (gl_SIGNAL_H): Guarantee uid_t.
+       * tests/test-signal.c (main): Enhance test.
+
+2009-12-31  Eric Blake  <address@hidden>
+
        spawn: improve wrapper support
        * m4/spawn_h.m4 (gl_SPAWN_H): Check for type existence.
        (gl_SPAWN_H_DEFAULTS): New defaults.
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 3a957cd..365f497 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -52,6 +52,11 @@ typedef int rpl_sig_atomic_t;
 # define sig_atomic_t rpl_sig_atomic_t
 #endif

+/* A set or mask of signals.  */
+#if address@hidden@
+typedef unsigned int sigset_t;
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -68,21 +73,17 @@ extern "C" {
 #endif


-#if address@hidden@
+#if @GNULIB_SIGPROCMASK@
+# if address@hidden@

 /* Maximum signal number + 1.  */
-# ifndef NSIG
-#  define NSIG 32
-# endif
+#  ifndef NSIG
+#   define NSIG 32
+#  endif

 /* This code supports only 32 signals.  */
 typedef int verify_NSIG_constraint[2 * (NSIG <= 32) - 1];

-/* A set or mask of signals.  */
-# if address@hidden@
-typedef unsigned int sigset_t;
-# endif
-
 /* Test whether a given signal is contained in a signal set.  */
 extern int sigismember (const sigset_t *set, int sig) _GL_ARG_NONNULL ((1));

@@ -106,31 +107,69 @@ extern int sigpending (sigset_t *set) _GL_ARG_NONNULL 
((1));
    combining it with *SET as indicated in OPERATION.
    In this implementation, you are not allowed to change a signal handler
    while the signal is blocked.  */
-# define SIG_BLOCK   0  /* blocked_set = blocked_set | *set; */
-# define SIG_SETMASK 1  /* blocked_set = *set; */
-# define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
+#  define SIG_BLOCK   0  /* blocked_set = blocked_set | *set; */
+#  define SIG_SETMASK 1  /* blocked_set = *set; */
+#  define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
 extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set);

-# define signal rpl_signal
+#  define signal rpl_signal
 /* Install the handler FUNC for signal SIG, and return the previous
    handler.  */
 extern void (*signal (int sig, void (*func) (int))) (int);

-# if GNULIB_defined_SIGPIPE
+#  if GNULIB_defined_SIGPIPE

 /* Raise signal SIG.  */
-#  undef raise
-#  define raise rpl_raise
+#   undef raise
+#   define raise rpl_raise
 extern int raise (int sig);

-# endif
-
-#endif /* address@hidden@ */
-
-
-#if address@hidden@
-
-# if address@hidden@
+#  endif
+
+# endif /* address@hidden@ */
+#elif defined GNULIB_POSIXCHECK
+# undef sigaddset
+# define sigaddset(s,n) \
+  (GL_LINK_WARNING ("sigaddset is unportable - "        \
+                    "use gnulib module sigprocmask for portability"),   \
+   sigaddset (s, n))
+# undef sigdelset
+# define sigdelset(s,n) \
+  (GL_LINK_WARNING ("sigdelset is unportable - "        \
+                    "use gnulib module sigprocmask for portability"),   \
+   sigdelset (s, n))
+# undef sigemptyset
+# define sigemptyset(s) \
+  (GL_LINK_WARNING ("sigemptyset is unportable - "        \
+                    "use gnulib module sigprocmask for portability"),   \
+   sigemptyset (s))
+# undef sigfillset
+# define sigfillset(s) \
+  (GL_LINK_WARNING ("sigfillset is unportable - "        \
+                    "use gnulib module sigprocmask for portability"),   \
+   sigfillset (s))
+# undef sigismember
+# define sigismember(s,n) \
+  (GL_LINK_WARNING ("sigismember is unportable - "        \
+                    "use gnulib module sigprocmask for portability"),   \
+   sigismember (s, n))
+# undef sigpending
+# define sigpending(s) \
+  (GL_LINK_WARNING ("sigpending is unportable - "        \
+                    "use gnulib module sigprocmask for portability"),   \
+   sigpending (s))
+# undef sigprocmask
+# define sigprocmask(h,s,o)                               \
+  (GL_LINK_WARNING ("sigprocmask is unportable - "        \
+                    "use gnulib module sigprocmask for portability"),   \
+   sigprocmask (h, s, o))
+#endif /* @GNULIB_SIGPROCMASK@ */
+
+
+#if @GNULIB_SIGACTION@
+# if address@hidden@
+
+#  if address@hidden@
 /* Present to allow compilation, but unsupported by gnulib.  */
 union sigval
 {
@@ -152,7 +191,7 @@ struct siginfo_t
   union sigval si_value;
 };
 typedef struct siginfo_t siginfo_t;
-# endif /* address@hidden@ */
+#  endif /* address@hidden@ */

 /* We assume that platforms which lack the sigaction() function also lack
    the 'struct sigaction' type, and vice versa.  */
@@ -172,22 +211,28 @@ struct sigaction
   /* Not all POSIX flags are supported.  */
   int sa_flags;
 };
-# define sa_handler _sa_func._sa_handler
-# define sa_sigaction _sa_func._sa_sigaction
+#  define sa_handler _sa_func._sa_handler
+#  define sa_sigaction _sa_func._sa_sigaction
 /* Unsupported flags are not present.  */
-# define SA_RESETHAND 1
-# define SA_NODEFER 2
-# define SA_RESTART 4
+#  define SA_RESETHAND 1
+#  define SA_NODEFER 2
+#  define SA_RESTART 4

 extern int sigaction (int, const struct sigaction *restrict,
                       struct sigaction *restrict);

-#elif address@hidden@
+# elif address@hidden@

-# define sa_sigaction sa_handler
-
-#endif /* address@hidden@, address@hidden@ */
+#  define sa_sigaction sa_handler

+# endif /* address@hidden@, address@hidden@ */
+#elif defined GNULIB_POSIXCHECK
+# undef sigaction
+# define sigaction(s,a,o)                               \
+  (GL_LINK_WARNING ("sigaction is unportable - "        \
+                    "use gnulib module sigaction for portability"),   \
+   sigaction (s, a, o))
+#endif

 /* Some systems don't have SA_NODEFER.  */
 #ifndef SA_NODEFER
diff --git a/lib/spawn.in.h b/lib/spawn.in.h
index 29b388b..8f86a97 100644
--- a/lib/spawn.in.h
+++ b/lib/spawn.in.h
@@ -156,6 +156,12 @@ extern int posix_spawn (pid_t *_Restrict_ __pid,
                         char *const envp[_Restrict_arr_])
      _GL_ARG_NONNULL ((2, 5, 6));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn
+# define posix_spawn(a,b,c,d,e,f)                   \
+  (GL_LINK_WARNING ("posix_spawn is unportable - "        \
+                    "use gnulib module posix_spawn for portability"),   \
+   posix_spawn (a, b, c, d, e, f))
 #endif

 #if @GNULIB_POSIX_SPAWNP@
@@ -173,6 +179,12 @@ extern int posix_spawnp (pid_t *__pid, const char *__file,
                          char *const argv[], char *const envp[])
      _GL_ARG_NONNULL ((2, 5, 6));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnp
+# define posix_spawnp(a,b,c,d,e,f)                   \
+  (GL_LINK_WARNING ("posix_spawnp is unportable - "        \
+                    "use gnulib module posix_spawnp for portability"),   \
+   posix_spawnp (a, b, c, d, e, f))
 #endif


@@ -185,6 +197,12 @@ extern int posix_spawnp (pid_t *__pid, const char *__file,
 extern int posix_spawnattr_init (posix_spawnattr_t *__attr)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_init
+# define posix_spawnattr_init(a)                   \
+  (GL_LINK_WARNING ("posix_spawnattr_init is unportable - "        \
+                    "use gnulib module posix_spawnattr_init for portability"), 
\
+   posix_spawnattr_init (a))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
@@ -196,6 +214,12 @@ extern int posix_spawnattr_init (posix_spawnattr_t *__attr)
 extern int posix_spawnattr_destroy (posix_spawnattr_t *__attr)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_destroy
+# define posix_spawnattr_destroy(a)                   \
+  (GL_LINK_WARNING ("posix_spawnattr_destroy is unportable - "        \
+                    "use gnulib module posix_spawnattr_destroy for 
portability"), \
+   posix_spawnattr_destroy (a))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
@@ -209,6 +233,12 @@ extern int posix_spawnattr_getsigdefault (const 
posix_spawnattr_t *_Restrict_ __
                                           sigset_t *_Restrict_ __sigdefault)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getsigdefault
+# define posix_spawnattr_getsigdefault(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_getsigdefault is unportable - "        \
+                    "use gnulib module posix_spawnattr_getsigdefault for 
portability"), \
+   posix_spawnattr_getsigdefault (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
@@ -221,6 +251,12 @@ extern int posix_spawnattr_setsigdefault 
(posix_spawnattr_t *_Restrict_ __attr,
                                           const sigset_t *_Restrict_ 
__sigdefault)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setsigdefault
+# define posix_spawnattr_setsigdefault(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_setsigdefault is unportable - "        \
+                    "use gnulib module posix_spawnattr_setsigdefault for 
portability"), \
+   posix_spawnattr_setsigdefault (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
@@ -233,6 +269,12 @@ extern int posix_spawnattr_getsigmask (const 
posix_spawnattr_t *_Restrict_ __att
                                        sigset_t *_Restrict_ __sigmask)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getsigmask
+# define posix_spawnattr_getsigmask(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_getsigmask is unportable - "        \
+                    "use gnulib module posix_spawnattr_getsigmask for 
portability"), \
+   posix_spawnattr_getsigmask (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
@@ -245,6 +287,12 @@ extern int posix_spawnattr_setsigmask (posix_spawnattr_t 
*_Restrict_ __attr,
                                        const sigset_t *_Restrict_ __sigmask)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setsigmask
+# define posix_spawnattr_setsigmask(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_setsigmask is unportable - "        \
+                    "use gnulib module posix_spawnattr_setsigmask for 
portability"), \
+   posix_spawnattr_setsigmask (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
@@ -257,6 +305,12 @@ extern int posix_spawnattr_getflags (const 
posix_spawnattr_t *_Restrict_ __attr,
                                      short int *_Restrict_ __flags)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getsigdefault
+# define posix_spawnattr_getsigdefault(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_getsigdefault is unportable - "        \
+                    "use gnulib module posix_spawnattr_getsigdefault for 
portability"), \
+   posix_spawnattr_getsigdefault (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
@@ -269,6 +323,12 @@ extern int posix_spawnattr_setflags (posix_spawnattr_t 
*__attr,
                                      short int __flags)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getflags
+# define posix_spawnattr_getflags(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_getflags is unportable - "        \
+                    "use gnulib module posix_spawnattr_getflags for 
portability"), \
+   posix_spawnattr_getflags (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
@@ -281,6 +341,12 @@ extern int posix_spawnattr_getpgroup (const 
posix_spawnattr_t *_Restrict_ __attr
                                       pid_t *_Restrict_ __pgroup)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setflags
+# define posix_spawnattr_setflags(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_setflags is unportable - "        \
+                    "use gnulib module posix_spawnattr_setflags for 
portability"), \
+   posix_spawnattr_setflags (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
@@ -305,6 +371,12 @@ extern int posix_spawnattr_getschedpolicy (const 
posix_spawnattr_t *_Restrict_ _
                                            int *_Restrict_ __schedpolicy)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getschedpolicy
+# define posix_spawnattr_getschedpolicy(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_getschedpolicy is unportable - "        \
+                    "use gnulib module posix_spawnattr_getschedpolicy for 
portability"), \
+   posix_spawnattr_getschedpolicy (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
@@ -317,6 +389,12 @@ extern int posix_spawnattr_setschedpolicy 
(posix_spawnattr_t *__attr,
                                            int __schedpolicy)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setschedpolicy
+# define posix_spawnattr_setschedpolicy(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_setschedpolicy is unportable - "        \
+                    "use gnulib module posix_spawnattr_setschedpolicy for 
portability"), \
+   posix_spawnattr_setschedpolicy (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
@@ -329,6 +407,12 @@ extern int posix_spawnattr_getschedparam (const 
posix_spawnattr_t *_Restrict_ __
                                           struct sched_param *_Restrict_ 
__schedparam)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getschedparam
+# define posix_spawnattr_getschedparam(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_getschedparam is unportable - "        \
+                    "use gnulib module posix_spawnattr_getschedparam for 
portability"), \
+   posix_spawnattr_getschedparam (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
@@ -341,6 +425,12 @@ extern int posix_spawnattr_setschedparam 
(posix_spawnattr_t *_Restrict_ __attr,
                                           const struct sched_param *_Restrict_ 
__schedparam)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setschedparam
+# define posix_spawnattr_setschedparam(a, b)                         \
+  (GL_LINK_WARNING ("posix_spawnattr_setschedparam is unportable - "        \
+                    "use gnulib module posix_spawnattr_setschedparam for 
portability"), \
+   posix_spawnattr_setschedparam (a, b))
 #endif


@@ -353,6 +443,12 @@ extern int posix_spawnattr_setschedparam 
(posix_spawnattr_t *_Restrict_ __attr,
 extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t 
*__file_actions)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_init
+# define posix_spawn_file_actions_init(a)                         \
+  (GL_LINK_WARNING ("posix_spawn_file_actions_init is unportable - "        \
+                    "use gnulib module posix_spawn_file_actions_init for 
portability"), \
+   posix_spawn_file_actions_init (a))
 #endif

 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
@@ -364,6 +460,12 @@ extern int posix_spawn_file_actions_init 
(posix_spawn_file_actions_t *__file_act
 extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t 
*__file_actions)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_destroy
+# define posix_spawn_file_actions_destroy(a)                         \
+  (GL_LINK_WARNING ("posix_spawn_file_actions_destroy is unportable - "        
\
+                    "use gnulib module posix_spawn_file_actions_destroy for 
portability"), \
+   posix_spawn_file_actions_destroy (a))
 #endif

 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
@@ -379,6 +481,12 @@ extern int posix_spawn_file_actions_addopen 
(posix_spawn_file_actions_t *_Restri
                                              int __oflag, mode_t __mode)
      __THROW _GL_ARG_NONNULL ((1, 3));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_addopen
+# define posix_spawn_file_actions_addopen(a, b, c, d, e)                     \
+  (GL_LINK_WARNING ("posix_spawn_file_actions_addopen is unportable - "        
\
+                    "use gnulib module posix_spawn_file_actions_addopen for 
portability"), \
+   posix_spawn_file_actions_addopen (a, b, c, d, e))
 #endif

 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
@@ -392,6 +500,12 @@ extern int posix_spawn_file_actions_addclose 
(posix_spawn_file_actions_t *__file
                                               int __fd)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_addclose
+# define posix_spawn_file_actions_addclose(a,b)                          \
+  (GL_LINK_WARNING ("posix_spawn_file_actions_addclose is unportable - "       
 \
+                    "use gnulib module posix_spawn_file_actions_addclose for 
portability"), \
+   posix_spawn_file_actions_addclose (a, b))
 #endif

 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
@@ -405,6 +519,12 @@ extern int posix_spawn_file_actions_adddup2 
(posix_spawn_file_actions_t *__file_
                                              int __fd, int __newfd)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_adddup2
+# define posix_spawn_file_actions_adddup2(a,b,c)                         \
+  (GL_LINK_WARNING ("posix_spawn_file_actions_adddup2 is unportable - "        
\
+                    "use gnulib module posix_spawn_file_actions_adddup2 for 
portability"), \
+   posix_spawn_file_actions_adddup2 (a, b, c))
 #endif


diff --git a/m4/signal_h.m4 b/m4/signal_h.m4
index e69befd..df6a3ba 100644
--- a/m4/signal_h.m4
+++ b/m4/signal_h.m4
@@ -1,4 +1,4 @@
-# signal_h.m4 serial 7
+# signal_h.m4 serial 8
 dnl Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,6 +14,7 @@ AC_DEFUN([gl_SIGNAL_H],
     [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
 #include <signal.h>
     ]])
+  AC_REQUIRE([AC_TYPE_UID_T])
 ])

 AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR],
diff --git a/tests/test-signal.c b/tests/test-signal.c
index 5154f4e..b0c11cf 100644
--- a/tests/test-signal.c
+++ b/tests/test-signal.c
@@ -20,10 +20,109 @@

 #include <signal.h>

-volatile sig_atomic_t s;
+/* Check for required types.  */
+struct
+{
+  size_t a;
+  uid_t b;
+  volatile sig_atomic_t c;
+  sigset_t d;
+  pid_t e;
+#if 0
+  /* Not guaranteed by gnulib.  */
+  pthread_t f;
+  struct timespec g;
+#endif
+} s;

 int
 main (void)
 {
-  return s;
+  switch (0)
+    {
+      /* The following are guaranteed by C.  */
+    case 0:
+    case SIGABRT:
+    case SIGFPE:
+    case SIGILL:
+    case SIGINT:
+    case SIGSEGV:
+    case SIGTERM:
+      /* The following is guaranteed by gnulib.  */
+#if GNULIB_SIGPIPE || defined SIGPIPE
+    case SIGPIPE:
+#endif
+      /* Ensure no conflict with other standardized names.  */
+#ifdef SIGALRM
+    case SIGALRM:
+#endif
+#ifdef SIGBUS
+    case SIGBUS:
+#endif
+#ifdef SIGCHLD
+    case SIGCHLD:
+#endif
+#ifdef SIGCONT
+    case SIGCONT:
+#endif
+#ifdef SIGHUP
+    case SIGHUP:
+#endif
+#ifdef SIGKILL
+    case SIGKILL:
+#endif
+#ifdef SIGQUIT
+    case SIGQUIT:
+#endif
+#ifdef SIGSTOP
+    case SIGSTOP:
+#endif
+#ifdef SIGTSTP
+    case SIGTSTP:
+#endif
+#ifdef SIGTTIN
+    case SIGTTIN:
+#endif
+#ifdef SIGTTOU
+    case SIGTTOU:
+#endif
+#ifdef SIGUSR1
+    case SIGUSR1:
+#endif
+#ifdef SIGUSR2
+    case SIGUSR2:
+#endif
+#ifdef SIGSYS
+    case SIGSYS:
+#endif
+#ifdef SIGTRAP
+    case SIGTRAP:
+#endif
+#ifdef SIGURG
+    case SIGURG:
+#endif
+#ifdef SIGVTALRM
+    case SIGVTALRM:
+#endif
+#ifdef SIGXCPU
+    case SIGXCPU:
+#endif
+#ifdef SIGXFSZ
+    case SIGXFSZ:
+#endif
+#ifdef SIG
+    case SIG:
+#endif
+      /* SIGRTMIN and SIGRTMAX need not be compile-time constants.  */
+#if 0
+# ifdef SIGRTMIN
+    case SIGRTMIN:
+# endif
+# ifdef SIGRTMAX
+    case SIGRTMAX:
+# endif
+#endif
+      ;
+    }
+  return s.a + s.b + s.c + s.e;
 }
-- 
1.6.4.2


From d1a73882fc992d3184bec3a4ccd57b52d95a7458 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 24 Dec 2009 12:06:48 -0700
Subject: [PATCH 4/4] link-warning: always build headers with link warnings

Replacement headers must be built unconditionally if they use
GL_LINK_WARNING, if the warning is to ever trigger on a
glibc system during CFLAGS=-DGNULIB_POSIXCHECK.

* modules/arpa_inet (Makefile.am): Always build replacement
header.
* modules/ctype (Makefile.am): Likewise.
* modules/dirent (Makefile.am): Likewise.
* modules/inttypes (Makefile.am): Likewise.
* modules/langinfo (Makefile.am): Likewise.
* modules/locale (Makefile.am): Likewise.
* modules/spawn (Makefile.am): Likewise.
* modules/sys_file (Makefile.am): Likewise.
* modules/sys_ioctl (Makefile.am): Likewise.
* modules/sys_select (Makefile.am): Likewise.
* modules/sys_socket (Makefile.am): Likewise.
* modules/sys_times (Makefile.am): Likewise.
* modules/sys_utsname (Makefile.am): Likewise.
* modules/sys_wait (Makefile.am): Likewise.
* modules/wchar (Makefile.am): Likewise.
* m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET)
(gl_ARPA_INET_H_DEFAULTS): Drop unneeded variable.
* m4/ctype.m4 (gl_CTYPE_H_DEFAULTS): Likewise.
* m4/isblank.m4 (gl_FUNC_ISBLANK): Likewise.
* m4/dirent_h.m4 (gl_REPLACE_DIRENT_H, gl_DIRENT_H_DEFAULTS):
Likewise.
* m4/inttypes.m4 (gl_INTTYPES_H): Likewise.
* m4/langinfo_h.m4 (gl_LANGINFO_H): Likewise.
* m4/locale_h.m4 (gl_REPLACE_LOCALE_H, gl_LOCALE_H_DEFAULTS):
Likewise.
* m4/spawn_h.m4 (gl_REPLACE_SPAWN_H, gl_SPAWN_H_DEFAULTS):
Likewise.
* m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H): Likewise.
* m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H, gl_REPLACE_SYS_IOCTL_H)
(gl_SYS_IOCTL_H_DEFAULTS): Likewise.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
* m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise.
* m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H)
(gl_SYS_UTSNAME_H_DEFAULTS): Likewise.
* m4/wchar.m4 (gl_WCHAR_H, gl_REPLACE_WCHAR_H)
(gl_WCHAR_H_DEFAULTS): Likewise.
---
 ChangeLog           |   43 ++++++++++++-
 m4/arpa_inet_h.m4   |    6 +-
 m4/ctype.m4         |    3 +-
 m4/dirent_h.m4      |    5 +-
 m4/inttypes.m4      |  181 ++++++++++++++++++++++++---------------------------
 m4/isblank.m4       |    3 +-
 m4/langinfo_h.m4    |    9 +--
 m4/locale_h.m4      |    5 +-
 m4/spawn_h.m4       |    5 +-
 m4/sys_file_h.m4    |    4 +-
 m4/sys_ioctl_h.m4   |    9 +--
 m4/sys_select_h.m4  |   20 ++----
 m4/sys_times_h.m4   |    5 +-
 m4/sys_utsname_h.m4 |    3 +-
 m4/sys_wait_h.m4    |    4 +-
 m4/wchar.m4         |    9 +--
 modules/arpa_inet   |    2 +-
 modules/ctype       |    2 +-
 modules/dirent      |    2 +-
 modules/inttypes    |    2 +-
 modules/langinfo    |    2 +-
 modules/locale      |    2 +-
 modules/spawn       |    2 +-
 modules/sys_file    |    2 +-
 modules/sys_ioctl   |    2 +-
 modules/sys_select  |    2 +-
 modules/sys_socket  |    2 +-
 modules/sys_times   |    2 +-
 modules/sys_utsname |    2 +-
 modules/sys_wait    |    2 +-
 modules/wchar       |    2 +-
 31 files changed, 170 insertions(+), 174 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ed0bbb1..d1e6234 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,46 @@
 2009-12-31  Eric Blake  <address@hidden>

+       link-warning: always build headers with link warnings
+       * modules/arpa_inet (Makefile.am): Always build replacement
+       header.
+       * modules/ctype (Makefile.am): Likewise.
+       * modules/dirent (Makefile.am): Likewise.
+       * modules/inttypes (Makefile.am): Likewise.
+       * modules/langinfo (Makefile.am): Likewise.
+       * modules/locale (Makefile.am): Likewise.
+       * modules/spawn (Makefile.am): Likewise.
+       * modules/sys_file (Makefile.am): Likewise.
+       * modules/sys_ioctl (Makefile.am): Likewise.
+       * modules/sys_select (Makefile.am): Likewise.
+       * modules/sys_socket (Makefile.am): Likewise.
+       * modules/sys_times (Makefile.am): Likewise.
+       * modules/sys_utsname (Makefile.am): Likewise.
+       * modules/sys_wait (Makefile.am): Likewise.
+       * modules/wchar (Makefile.am): Likewise.
+       * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET)
+       (gl_ARPA_INET_H_DEFAULTS): Drop unneeded variable.
+       * m4/ctype.m4 (gl_CTYPE_H_DEFAULTS): Likewise.
+       * m4/isblank.m4 (gl_FUNC_ISBLANK): Likewise.
+       * m4/dirent_h.m4 (gl_REPLACE_DIRENT_H, gl_DIRENT_H_DEFAULTS):
+       Likewise.
+       * m4/inttypes.m4 (gl_INTTYPES_H): Likewise.
+       * m4/langinfo_h.m4 (gl_LANGINFO_H): Likewise.
+       * m4/locale_h.m4 (gl_REPLACE_LOCALE_H, gl_LOCALE_H_DEFAULTS):
+       Likewise.
+       * m4/spawn_h.m4 (gl_REPLACE_SPAWN_H, gl_SPAWN_H_DEFAULTS):
+       Likewise.
+       * m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H): Likewise.
+       * m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H, gl_REPLACE_SYS_IOCTL_H)
+       (gl_SYS_IOCTL_H_DEFAULTS): Likewise.
+       * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
+       * m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise.
+       * m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H)
+       (gl_SYS_UTSNAME_H_DEFAULTS): Likewise.
+       * m4/wchar.m4 (gl_WCHAR_H, gl_REPLACE_WCHAR_H)
+       (gl_WCHAR_H_DEFAULTS): Likewise.
+
+2009-12-31  Eric Blake  <address@hidden>
+
        signal, spawn: use link warnings
        * lib/signal.in.h (sigset_t): Make unconditional.
        (sigismember, sigemptyset, sigaddset, sigdelset, sigfillset)
@@ -19,8 +60,6 @@
        * m4/signal_h.m4 (gl_SIGNAL_H): Guarantee uid_t.
        * tests/test-signal.c (main): Enhance test.

-2009-12-31  Eric Blake  <address@hidden>
-
        spawn: improve wrapper support
        * m4/spawn_h.m4 (gl_SPAWN_H): Check for type existence.
        (gl_SPAWN_H_DEFAULTS): New defaults.
diff --git a/m4/arpa_inet_h.m4 b/m4/arpa_inet_h.m4
index c97b1a8..84f3e57 100644
--- a/m4/arpa_inet_h.m4
+++ b/m4/arpa_inet_h.m4
@@ -1,4 +1,4 @@
-# arpa_inet_h.m4 serial 5
+# arpa_inet_h.m4 serial 6
 dnl Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,6 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
   if test $ac_cv_header_arpa_inet_h = yes; then
     HAVE_ARPA_INET_H=1
   else
-    ARPA_INET_H='arpa/inet.h'
     HAVE_ARPA_INET_H=0
   fi
   AC_SUBST([HAVE_ARPA_INET_H])
@@ -29,7 +28,7 @@ dnl Unconditionally enables the replacement of <arpa/inet.h>.
 AC_DEFUN([gl_REPLACE_ARPA_INET_H],
 [
   AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
-  ARPA_INET_H='arpa/inet.h'
+  :
 ])

 AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
@@ -46,5 +45,4 @@ AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DECL_INET_NTOP=1;  AC_SUBST([HAVE_DECL_INET_NTOP])
   HAVE_DECL_INET_PTON=1;  AC_SUBST([HAVE_DECL_INET_PTON])
-  ARPA_INET_H='';         AC_SUBST([ARPA_INET_H])
 ])
diff --git a/m4/ctype.m4 b/m4/ctype.m4
index 51e5333..b25c62b 100644
--- a/m4/ctype.m4
+++ b/m4/ctype.m4
@@ -1,4 +1,4 @@
-# ctype_h.m4 serial 1
+# ctype_h.m4 serial 2
 dnl Copyright (C) 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -24,5 +24,4 @@ AC_DEFUN([gl_CTYPE_H_DEFAULTS],
   GNULIB_ISBLANK=0; AC_SUBST([GNULIB_ISBLANK])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_ISBLANK=1;   AC_SUBST([HAVE_ISBLANK])
-  CTYPE_H='';       AC_SUBST([CTYPE_H])
 ])
diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4
index 481212b..54dea8e 100644
--- a/m4/dirent_h.m4
+++ b/m4/dirent_h.m4
@@ -1,4 +1,4 @@
-# dirent_h.m4 serial 7
+# dirent_h.m4 serial 8
 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,7 @@ dnl Unconditionally enables the replacement of <dirent.h>.
 AC_DEFUN([gl_REPLACE_DIRENT_H],
 [
   AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
-  DIRENT_H='dirent.h'
+  :
 ])

 AC_DEFUN([gl_DIRENT_MODULE_INDICATOR],
@@ -46,5 +46,4 @@ AC_DEFUN([gl_DIRENT_H_DEFAULTS],
   REPLACE_CLOSEDIR=0;   AC_SUBST([REPLACE_CLOSEDIR])
   REPLACE_FDOPENDIR=0;  AC_SUBST([REPLACE_FDOPENDIR])
   REPLACE_OPENDIR=0;    AC_SUBST([REPLACE_OPENDIR])
-  DIRENT_H='';          AC_SUBST([DIRENT_H])
 ])
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index e1c656d..45bbac8 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 14
+# inttypes.m4 serial 15
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -136,25 +136,20 @@ const char *l = /* implicit string concatenation */
      fi])

   dnl Override <inttypes.h> always, so that the portability warnings work.
-  if false && test $gl_cv_header_working_inttypes_h = yes; then
-    dnl Use the existing <inttypes.h>.
-    INTTYPES_H=''
-  else
-
-    AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
-    gl_CHECK_NEXT_HEADERS([inttypes.h])
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+  gl_CHECK_NEXT_HEADERS([inttypes.h])

-    AC_REQUIRE([gl_MULTIARCH])
+  AC_REQUIRE([gl_MULTIARCH])

-    dnl Ensure that <stdint.h> defines the limit macros, since gnulib's
-    dnl <inttypes.h> relies on them.  This macro is only needed when a
-    dnl C++ compiler is in use; it has no effect for a C compiler.
-    dnl Also be careful to define __STDC_LIMIT_MACROS only when gnulib's
-    dnl <inttypes.h> is going to be created, and to avoid redefinition warnings
-    dnl if the __STDC_LIMIT_MACROS is already defined through the CPPFLAGS.
-    AC_DEFINE([GL_TRIGGER_STDC_LIMIT_MACROS], [1],
-      [Define to make the limit macros in <stdint.h> visible.])
-    AH_VERBATIM([__STDC_LIMIT_MACROS_ZZZ],
+  dnl Ensure that <stdint.h> defines the limit macros, since gnulib's
+  dnl <inttypes.h> relies on them.  This macro is only needed when a
+  dnl C++ compiler is in use; it has no effect for a C compiler.
+  dnl Also be careful to define __STDC_LIMIT_MACROS only when gnulib's
+  dnl <inttypes.h> is going to be created, and to avoid redefinition warnings
+  dnl if the __STDC_LIMIT_MACROS is already defined through the CPPFLAGS.
+  AC_DEFINE([GL_TRIGGER_STDC_LIMIT_MACROS], [1],
+    [Define to make the limit macros in <stdint.h> visible.])
+  AH_VERBATIM([__STDC_LIMIT_MACROS_ZZZ],
 [/* Ensure that <stdint.h> defines the limit macros, since gnulib's
    <inttypes.h> relies on them.  */
 #if defined __cplusplus && !defined __STDC_LIMIT_MACROS && 
GL_TRIGGER_STDC_LIMIT_MACROS
@@ -162,85 +157,81 @@ const char *l = /* implicit string concatenation */
 #endif
 ])

-    PRIPTR_PREFIX=
-    if test -n "$STDINT_H"; then
-      dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'.
-      PRIPTR_PREFIX='"l"'
-    else
-      dnl Using the system's <stdint.h>.
-      for glpfx in '' l ll I64; do
-        case $glpfx in
-          '')  gltype1='int';;
-          l)   gltype1='long int';;
-          ll)  gltype1='long long int';;
-          I64) gltype1='__int64';;
-        esac
-        AC_COMPILE_IFELSE(
-          [AC_LANG_PROGRAM([[#include <stdint.h>
-             extern intptr_t foo;
-             extern $gltype1 foo;]])],
-          [PRIPTR_PREFIX='"'$glpfx'"'])
-        test -n "$PRIPTR_PREFIX" && break
-      done
-    fi
-    AC_SUBST([PRIPTR_PREFIX])
+  PRIPTR_PREFIX=
+  if test -n "$STDINT_H"; then
+    dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'.
+    PRIPTR_PREFIX='"l"'
+  else
+    dnl Using the system's <stdint.h>.
+    for glpfx in '' l ll I64; do
+      case $glpfx in
+        '')  gltype1='int';;
+        l)   gltype1='long int';;
+        ll)  gltype1='long long int';;
+        I64) gltype1='__int64';;
+      esac
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[#include <stdint.h>
+           extern intptr_t foo;
+           extern $gltype1 foo;]])],
+        [PRIPTR_PREFIX='"'$glpfx'"'])
+      test -n "$PRIPTR_PREFIX" && break
+    done
+  fi
+  AC_SUBST([PRIPTR_PREFIX])

-    if test "$ac_cv_have_decl_imaxabs" = yes; then
-      HAVE_DECL_IMAXABS=1
-    else
-      HAVE_DECL_IMAXABS=0
-    fi
+  if test "$ac_cv_have_decl_imaxabs" = yes; then
+    HAVE_DECL_IMAXABS=1
+  else
+    HAVE_DECL_IMAXABS=0
+  fi

-    if test "$ac_cv_have_decl_imaxdiv" = yes; then
-      HAVE_DECL_IMAXDIV=1
-    else
-      HAVE_DECL_IMAXDIV=0
-    fi
+  if test "$ac_cv_have_decl_imaxdiv" = yes; then
+    HAVE_DECL_IMAXDIV=1
+  else
+    HAVE_DECL_IMAXDIV=0
+  fi

-    if test "$ac_cv_have_decl_strtoimax" = yes; then
-      HAVE_DECL_STRTOIMAX=1
-    else
-      HAVE_DECL_STRTOIMAX=0
-    fi
+  if test "$ac_cv_have_decl_strtoimax" = yes; then
+    HAVE_DECL_STRTOIMAX=1
+  else
+    HAVE_DECL_STRTOIMAX=0
+  fi

-    if test "$ac_cv_have_decl_strtoumax" = yes; then
-      HAVE_DECL_STRTOUMAX=1
-    else
-      HAVE_DECL_STRTOUMAX=0
-    fi
+  if test "$ac_cv_have_decl_strtoumax" = yes; then
+    HAVE_DECL_STRTOUMAX=1
+  else
+    HAVE_DECL_STRTOUMAX=0
+  fi

+  gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
+    [INT32_MAX_LT_INTMAX_MAX],
+    [defined INT32_MAX && defined INTMAX_MAX],
+    [INT32_MAX < INTMAX_MAX],
+    [sizeof (int) < sizeof (long long int)])
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
     gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
-      [INT32_MAX_LT_INTMAX_MAX],
-      [defined INT32_MAX && defined INTMAX_MAX],
-      [INT32_MAX < INTMAX_MAX],
-      [sizeof (int) < sizeof (long long int)])
-    if test $APPLE_UNIVERSAL_BUILD = 0; then
-      gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
-        [INT64_MAX_EQ_LONG_MAX],
-        [defined INT64_MAX],
-        [INT64_MAX == LONG_MAX],
-        [sizeof (long long int) == sizeof (long int)])
-    else
-      INT64_MAX_EQ_LONG_MAX=-1
-    fi
+      [INT64_MAX_EQ_LONG_MAX],
+      [defined INT64_MAX],
+      [INT64_MAX == LONG_MAX],
+      [sizeof (long long int) == sizeof (long int)])
+  else
+    INT64_MAX_EQ_LONG_MAX=-1
+  fi
+  gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
+    [UINT32_MAX_LT_UINTMAX_MAX],
+    [defined UINT32_MAX && defined UINTMAX_MAX],
+    [UINT32_MAX < UINTMAX_MAX],
+    [sizeof (unsigned int) < sizeof (unsigned long long int)])
+  if test $APPLE_UNIVERSAL_BUILD = 0; then
     gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
-      [UINT32_MAX_LT_UINTMAX_MAX],
-      [defined UINT32_MAX && defined UINTMAX_MAX],
-      [UINT32_MAX < UINTMAX_MAX],
-      [sizeof (unsigned int) < sizeof (unsigned long long int)])
-    if test $APPLE_UNIVERSAL_BUILD = 0; then
-      gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
-        [UINT64_MAX_EQ_ULONG_MAX],
-        [defined UINT64_MAX],
-        [UINT64_MAX == ULONG_MAX],
-        [sizeof (unsigned long long int) == sizeof (unsigned long int)])
-    else
-      UINT64_MAX_EQ_ULONG_MAX=-1
-    fi
-
-    INTTYPES_H='inttypes.h'
+      [UINT64_MAX_EQ_ULONG_MAX],
+      [defined UINT64_MAX],
+      [UINT64_MAX == ULONG_MAX],
+      [sizeof (unsigned long long int) == sizeof (unsigned long int)])
+  else
+    UINT64_MAX_EQ_ULONG_MAX=-1
   fi
-  AC_SUBST([INTTYPES_H])
 ])

 # Define the symbol $1 to be 1 if the condition is true, 0 otherwise.
diff --git a/m4/isblank.m4 b/m4/isblank.m4
index 37f1a75..890c2fd 100644
--- a/m4/isblank.m4
+++ b/m4/isblank.m4
@@ -1,4 +1,4 @@
-# isblank.m4 serial 1
+# isblank.m4 serial 2
 dnl Copyright (C) 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,6 @@ AC_DEFUN([gl_FUNC_ISBLANK],
   AC_CHECK_FUNCS_ONCE([isblank])
   if test $ac_cv_func_isblank = no; then
     HAVE_ISBLANK=0
-    CTYPE_H='ctype.h'
     AC_LIBOBJ([isblank])
   fi
 ])
diff --git a/m4/langinfo_h.m4 b/m4/langinfo_h.m4
index 4975734..4ea23a4 100644
--- a/m4/langinfo_h.m4
+++ b/m4/langinfo_h.m4
@@ -1,4 +1,4 @@
-# langinfo_h.m4 serial 1
+# langinfo_h.m4 serial 2
 dnl Copyright (C) 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -51,13 +51,6 @@ int a = ERA;
   AC_SUBST([HAVE_LANGINFO_H])
   AC_SUBST([HAVE_LANGINFO_CODESET])
   AC_SUBST([HAVE_LANGINFO_ERA])
-
-  if test $HAVE_LANGINFO_H = 1 && test $HAVE_LANGINFO_CODESET = 1 && test 
$HAVE_LANGINFO_ERA = 1; then
-    LANGINFO_H=
-  else
-    LANGINFO_H='langinfo.h'
-  fi
-  AC_SUBST([LANGINFO_H])
 ])

 AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
diff --git a/m4/locale_h.m4 b/m4/locale_h.m4
index 35b8b32..9228118 100644
--- a/m4/locale_h.m4
+++ b/m4/locale_h.m4
@@ -1,4 +1,4 @@
-# locale_h.m4 serial 5
+# locale_h.m4 serial 6
 dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -63,7 +63,7 @@ dnl Unconditionally enables the replacement of <locale.h>.
 AC_DEFUN([gl_REPLACE_LOCALE_H],
 [
   AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
-  LOCALE_H=locale.h
+  :
 ])

 AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
@@ -78,5 +78,4 @@ AC_DEFUN([gl_LOCALE_H_DEFAULTS],
   GNULIB_DUPLOCALE=0;  AC_SUBST([GNULIB_DUPLOCALE])
   dnl Assume proper GNU behavior unless another module says otherwise.
   REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
-  LOCALE_H='';         AC_SUBST([LOCALE_H])
 ])
diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4
index a369c27..5b4b214 100644
--- a/m4/spawn_h.m4
+++ b/m4/spawn_h.m4
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 4
+# spawn_h.m4 serial 5
 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -41,7 +41,7 @@ dnl Unconditionally enables the replacement of <spawn.h>.
 AC_DEFUN([gl_REPLACE_SPAWN_H],
 [
   AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
-  SPAWN_H='spawn.h'
+  :
 ])

 AC_DEFUN([gl_SPAWN_MODULE_INDICATOR],
@@ -80,5 +80,4 @@ AC_DEFUN([gl_SPAWN_H_DEFAULTS],
   HAVE_POSIX_SPAWN_FILE_ACTIONS_T=1;
                              AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_T])
   REPLACE_POSIX_SPAWN=0;     AC_SUBST([REPLACE_POSIX_SPAWN])
-  SPAWN_H='';                AC_SUBST([SPAWN_H])
 ])
diff --git a/m4/sys_file_h.m4 b/m4/sys_file_h.m4
index f24de0b..419dda8 100644
--- a/m4/sys_file_h.m4
+++ b/m4/sys_file_h.m4
@@ -7,6 +7,8 @@

 # Written by Richard W.M. Jones.

+# serial 2
+
 AC_DEFUN([gl_HEADER_SYS_FILE_H],
 [
   AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS])
@@ -16,8 +18,6 @@ AC_DEFUN([gl_HEADER_SYS_FILE_H],
   AC_CHECK_FUNCS_ONCE([flock])

   gl_CHECK_NEXT_HEADERS([sys/file.h])
-  SYS_FILE_H='sys/file.h'
-  AC_SUBST([SYS_FILE_H])

   AC_CHECK_HEADERS_ONCE([sys/file.h])
   if test $ac_cv_header_sys_file_h = yes; then
diff --git a/m4/sys_ioctl_h.m4 b/m4/sys_ioctl_h.m4
index 22aa83e..1de3b44 100644
--- a/m4/sys_ioctl_h.m4
+++ b/m4/sys_ioctl_h.m4
@@ -1,4 +1,4 @@
-# sys_ioctl_h.m4 serial 3
+# sys_ioctl_h.m4 serial 4
 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -27,12 +27,8 @@ AC_DEFUN([gl_SYS_IOCTL_H],
          [gl_cv_decl_ioctl_in_sys_ioctl_h=yes],
          [gl_cv_decl_ioctl_in_sys_ioctl_h=no])
       ])
-    if test $gl_cv_decl_ioctl_in_sys_ioctl_h != yes; then
-      SYS_IOCTL_H='sys/ioctl.h'
-    fi
   else
     HAVE_SYS_IOCTL_H=0
-    SYS_IOCTL_H='sys/ioctl.h'
   fi
   AC_SUBST([HAVE_SYS_IOCTL_H])
   dnl Execute this unconditionally, because SYS_IOCTL_H may be set by other
@@ -44,7 +40,7 @@ dnl Unconditionally enables the replacement of <sys/ioctl.h>.
 AC_DEFUN([gl_REPLACE_SYS_IOCTL_H],
 [
   AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
-  SYS_IOCTL_H='sys/ioctl.h'
+  :
 ])

 AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR],
@@ -61,5 +57,4 @@ AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS],
   SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H])
   SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
                         AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
-  SYS_IOCTL_H='';                AC_SUBST([SYS_IOCTL_H])
 ])
diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4
index 991c7b7..a652dac 100644
--- a/m4/sys_select_h.m4
+++ b/m4/sys_select_h.m4
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 8
+# sys_select_h.m4 serial 9
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -45,20 +45,16 @@ AC_DEFUN([gl_HEADER_SYS_SELECT],
           ])
       fi
     ])
-  if test $gl_cv_header_sys_select_h_selfcontained = yes; then
-    SYS_SELECT_H=''
+  if test $ac_cv_header_sys_select_h = yes; then
+    HAVE_SYS_SELECT_H=1
   else
-    SYS_SELECT_H='sys/select.h'
-    gl_CHECK_NEXT_HEADERS([sys/select.h])
-    if test $ac_cv_header_sys_select_h = yes; then
-      HAVE_SYS_SELECT_H=1
-    else
-      HAVE_SYS_SELECT_H=0
-    fi
-    AC_SUBST([HAVE_SYS_SELECT_H])
+    HAVE_SYS_SELECT_H=0
+  fi
+  AC_SUBST([HAVE_SYS_SELECT_H])
+  gl_CHECK_NEXT_HEADERS([sys/select.h])
+  if test $gl_cv_header_sys_select_h_selfcontained != yes; then
     gl_PREREQ_SYS_H_WINSOCK2
   fi
-  AC_SUBST([SYS_SELECT_H])
 ])

 AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
diff --git a/m4/sys_times_h.m4 b/m4/sys_times_h.m4
index 2fe9f24..1389d2b 100644
--- a/m4/sys_times_h.m4
+++ b/m4/sys_times_h.m4
@@ -1,5 +1,5 @@
 # Configure a replacement for <sys/times.h>.
-# serial 2
+# serial 3

 # Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -15,17 +15,14 @@ AC_DEFUN([gl_SYS_TIMES_H],
   gl_CHECK_NEXT_HEADERS([sys/times.h])
   AC_CHECK_HEADERS_ONCE([sys/times.h])
   if test $ac_cv_header_sys_times_h = yes; then
-    SYS_TIMES_H=
     HAVE_SYS_TIMES_H=1
     AC_CHECK_TYPES([struct tms], [], [HAVE_STRUCT_TMS=0], [[
 #include <sys/times.h>
       ]])
   else
-    SYS_TIMES_H=sys/times.h
     HAVE_SYS_TIMES_H=0
     HAVE_STRUCT_TMS=0
   fi
-  AC_SUBST([SYS_TIMES_H])
   AC_SUBST([HAVE_SYS_TIMES_H])
 ])

diff --git a/m4/sys_utsname_h.m4 b/m4/sys_utsname_h.m4
index 84b781f..33f2895 100644
--- a/m4/sys_utsname_h.m4
+++ b/m4/sys_utsname_h.m4
@@ -1,4 +1,4 @@
-# sys_utsname_h.m4 serial 2
+# sys_utsname_h.m4 serial 3
 dnl Copyright (C) 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,7 +15,6 @@ AC_DEFUN([gl_SYS_UTSNAME_H],
   gl_CHECK_NEXT_HEADERS([sys/utsname.h])
   AC_CHECK_HEADERS_ONCE([sys/utsname.h])
   if test $ac_cv_header_sys_utsname_h != yes; then
-    SYS_UTSNAME_H='sys/utsname.h'
     HAVE_SYS_UTSNAME_H=0
     HAVE_STRUCT_UTSNAME=0
   else
diff --git a/m4/sys_wait_h.m4 b/m4/sys_wait_h.m4
index 8fb099a..999da1c 100644
--- a/m4/sys_wait_h.m4
+++ b/m4/sys_wait_h.m4
@@ -1,4 +1,4 @@
-# sys_wait_h.m4 serial 1
+# sys_wait_h.m4 serial 2
 dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,6 @@ AC_DEFUN([gl_SYS_WAIT_H],
   AC_REQUIRE([gl_SYS_WAIT_H_DEFAULTS])

   gl_CHECK_NEXT_HEADERS([sys/wait.h])
-  SYS_WAIT_H='sys/wait.h'
-  AC_SUBST([SYS_WAIT_H])
 ])

 AC_DEFUN([gl_SYS_WAIT_MODULE_INDICATOR],
diff --git a/m4/wchar.m4 b/m4/wchar.m4
index ad19376..daf532a 100644
--- a/m4/wchar.m4
+++ b/m4/wchar.m4
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.

 dnl Written by Eric Blake.

-# wchar.m4 serial 27
+# wchar.m4 serial 28

 AC_DEFUN([gl_WCHAR_H],
 [
@@ -31,10 +31,6 @@ wchar_t w;]],
   dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced.
   AC_REQUIRE([gl_STDDEF_H])

-  if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != 
yes || test -n "$STDDEF_H"; then
-    WCHAR_H=wchar.h
-  fi
-
   dnl Prepare for creating substitute <wchar.h>.
   dnl Do it always: WCHAR_H may be empty here but can be set later.
   dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
@@ -103,7 +99,7 @@ dnl Unconditionally enables the replacement of <wchar.h>.
 AC_DEFUN([gl_REPLACE_WCHAR_H],
 [
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
-  WCHAR_H=wchar.h
+  :
 ])

 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
@@ -150,5 +146,4 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   REPLACE_WCSRTOMBS=0;  AC_SUBST([REPLACE_WCSRTOMBS])
   REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
   REPLACE_WCWIDTH=0;    AC_SUBST([REPLACE_WCWIDTH])
-  WCHAR_H='';           AC_SUBST([WCHAR_H])
 ])
diff --git a/modules/arpa_inet b/modules/arpa_inet
index e76c7e4..27eccc3 100644
--- a/modules/arpa_inet
+++ b/modules/arpa_inet
@@ -16,7 +16,7 @@ gl_HEADER_ARPA_INET
 AC_PROG_MKDIR_P

 Makefile.am:
-BUILT_SOURCES += $(ARPA_INET_H)
+BUILT_SOURCES += arpa/inet.h

 # We need the following in order to create <arpa/inet.h> when the system
 # doesn't have one.
diff --git a/modules/ctype b/modules/ctype
index e896814..8847f2c 100644
--- a/modules/ctype
+++ b/modules/ctype
@@ -13,7 +13,7 @@ configure.ac:
 gl_CTYPE_H

 Makefile.am:
-BUILT_SOURCES += $(CTYPE_H)
+BUILT_SOURCES += ctype.h

 # We need the following in order to create <ctype.h> when the system
 # doesn't have one that works with the given compiler.
diff --git a/modules/dirent b/modules/dirent
index aed61e4..5a92d5d 100644
--- a/modules/dirent
+++ b/modules/dirent
@@ -15,7 +15,7 @@ configure.ac:
 gl_DIRENT_H

 Makefile.am:
-BUILT_SOURCES += $(DIRENT_H)
+BUILT_SOURCES += dirent.h

 # We need the following in order to create <dirent.h> when the system
 # doesn't have one that works with the given compiler.
diff --git a/modules/inttypes b/modules/inttypes
index 7a49b77..743add4 100644
--- a/modules/inttypes
+++ b/modules/inttypes
@@ -17,7 +17,7 @@ configure.ac:
 gl_INTTYPES_H

 Makefile.am:
-BUILT_SOURCES += $(INTTYPES_H)
+BUILT_SOURCES += inttypes.h

 # We need the following in order to create <inttypes.h> when the system
 # doesn't have one that works with the given compiler.
diff --git a/modules/langinfo b/modules/langinfo
index fb413d0..cc71779 100644
--- a/modules/langinfo
+++ b/modules/langinfo
@@ -14,7 +14,7 @@ configure.ac:
 gl_LANGINFO_H

 Makefile.am:
-BUILT_SOURCES += $(LANGINFO_H)
+BUILT_SOURCES += langinfo.h

 # We need the following in order to create an empty placeholder for
 # <langinfo.h> when the system doesn't have one.
diff --git a/modules/locale b/modules/locale
index 2541300..75d1eaf 100644
--- a/modules/locale
+++ b/modules/locale
@@ -16,7 +16,7 @@ configure.ac:
 gl_LOCALE_H

 Makefile.am:
-BUILT_SOURCES += $(LOCALE_H)
+BUILT_SOURCES += locale.h

 # We need the following in order to create <locale.h> when the system
 # doesn't have one that provides all definitions.
diff --git a/modules/spawn b/modules/spawn
index 1882152..8a80bbf 100644
--- a/modules/spawn
+++ b/modules/spawn
@@ -15,7 +15,7 @@ configure.ac:
 gl_SPAWN_H

 Makefile.am:
-BUILT_SOURCES += $(SPAWN_H)
+BUILT_SOURCES += spawn.h

 # We need the following in order to create a replacement for <spawn.h> when
 # the system doesn't have one.
diff --git a/modules/sys_file b/modules/sys_file
index 61c6202..5cbd9f0 100644
--- a/modules/sys_file
+++ b/modules/sys_file
@@ -14,7 +14,7 @@ gl_HEADER_SYS_FILE_H
 AC_PROG_MKDIR_P

 Makefile.am:
-BUILT_SOURCES += $(SYS_FILE_H)
+BUILT_SOURCES += sys/file.h

 # We need the following in order to create <sys/file.h> when the system
 # has one that is incomplete.
diff --git a/modules/sys_ioctl b/modules/sys_ioctl
index 5ae8c84..e1cce96 100644
--- a/modules/sys_ioctl
+++ b/modules/sys_ioctl
@@ -15,7 +15,7 @@ gl_SYS_IOCTL_H
 AC_PROG_MKDIR_P

 Makefile.am:
-BUILT_SOURCES += $(SYS_IOCTL_H)
+BUILT_SOURCES += sys/ioctl.h

 # We need the following in order to create <sys/ioctl.h> when the system
 # does not have a complete one.
diff --git a/modules/sys_select b/modules/sys_select
index 093e5e5..7ddcf88 100644
--- a/modules/sys_select
+++ b/modules/sys_select
@@ -16,7 +16,7 @@ gl_HEADER_SYS_SELECT
 AC_PROG_MKDIR_P

 Makefile.am:
-BUILT_SOURCES += $(SYS_SELECT_H)
+BUILT_SOURCES += sys/select.h

 # We need the following in order to create <sys/select.h> when the system
 # doesn't have one that works with the given compiler.
diff --git a/modules/sys_socket b/modules/sys_socket
index b1b9ad2..47408fe 100644
--- a/modules/sys_socket
+++ b/modules/sys_socket
@@ -18,7 +18,7 @@ gl_HEADER_SYS_SOCKET
 AC_PROG_MKDIR_P

 Makefile.am:
-BUILT_SOURCES += $(SYS_SOCKET_H)
+BUILT_SOURCES += sys/socket.h

 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
diff --git a/modules/sys_times b/modules/sys_times
index 8ccf5da..64683d9 100644
--- a/modules/sys_times
+++ b/modules/sys_times
@@ -15,7 +15,7 @@ gl_SYS_TIMES_H
 AC_PROG_MKDIR_P

 Makefile.am:
-BUILT_SOURCES += $(SYS_TIMES_H)
+BUILT_SOURCES += sys/times.h

 # We need the following in order to create <sys/times.h> when the system
 # doesn't have one that works with the given compiler.
diff --git a/modules/sys_utsname b/modules/sys_utsname
index cdb3468..ddb1d8e 100644
--- a/modules/sys_utsname
+++ b/modules/sys_utsname
@@ -15,7 +15,7 @@ gl_SYS_UTSNAME_H
 AC_PROG_MKDIR_P

 Makefile.am:
-BUILT_SOURCES += $(SYS_UTSNAME_H)
+BUILT_SOURCES += sys/utsname.h

 # We need the following in order to create <sys/utsname.h> when the system
 # does not have one.
diff --git a/modules/sys_wait b/modules/sys_wait
index 2a073d3..376b08c 100644
--- a/modules/sys_wait
+++ b/modules/sys_wait
@@ -13,7 +13,7 @@ gl_SYS_WAIT_H
 AC_PROG_MKDIR_P

 Makefile.am:
-BUILT_SOURCES += $(SYS_WAIT_H)
+BUILT_SOURCES += sys/wait.h

 # We need the following in order to create <sys/wait.h> when the system
 # has one that is incomplete.
diff --git a/modules/wchar b/modules/wchar
index eb8615c..27194fc 100644
--- a/modules/wchar
+++ b/modules/wchar
@@ -16,7 +16,7 @@ configure.ac:
 gl_WCHAR_H

 Makefile.am:
-BUILT_SOURCES += $(WCHAR_H)
+BUILT_SOURCES += wchar.h

 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-- 
1.6.4.2


reply via email to

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