bug-gnulib
[Top][All Lists]
Advanced

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

Re: more #include_next patches for iconv_open, netinet_in, sys_stat, etc


From: Bruno Haible
Subject: Re: more #include_next patches for iconv_open, netinet_in, sys_stat, etc.
Date: Wed, 30 May 2007 04:15:49 +0200
User-agent: KMail/1.5.4

Paul Eggert wrote on 2007-05-17:
> 2007-05-16  Paul Eggert  <address@hidden>
> 
>       * lib/dirent_.h: Prefer #include_next <foo.h> to #include
>       @ABSOLUTE_FOO_H@ if @address@hidden  This works better with
>       GCC 4.2, which otherwise issues a lot of warnings.
>       * lib/iconv_.h, lib/locale_.h, lib/netinet_in_.h, lib/sys_select_.h:
>       * lib/sys_socket_.h, lib/sys_stat_.h, lib/sysexits_.h, lib/unistd_.h:
>       Likewise.
>       * modules/fchdir (dirent.h): Substitute @address@hidden
>       * modules/iconv_open (iconv.h): Likewise.
>       * modules/locale (locale.h): Likewise.
>       * modules/netinet_in (netinet/in.h): Likewise.
>       * modules/sys_select (sys_select.h): Likewise.
>       * modules/sys_socket (sys/socket.h): Likewise.
>       * modules/sys_stat (sys/stat.h): Likewise.
>       * modules/sysexits (sysexits.h): Likewise.
>       * modules/unistd (unistd.h): Likewise.

Well, it doesn't work like this.

Take for example the testdir generated by gnulib-tool for the module 'locale',
and try to run it on mingw. Although test-locale.c and test-c-ctype.c include
<locale.h>, and although the system's <locale.h> defines LC_ALL, the compiler
gives a warning about LC_ALL being undefined.

The reason is that there is more than one -I option referring to the directory
that contains gnulib's <locale.h>. So, when test-xyz.c does a
   #include <locale.h>
it refers to gnulib's locale.h. This does
   #include_next <locale.h>
which refers again to gnulib`s locale.h. This does
   #include_next <locale.h>
which finally refers to the system's <locale.h>. But now look at the
   #ifndef _GL_LOCALE_H
double-inclusion guard, and you will understand why the system's <locale.h>
is never actually included.

One could move the #ifndef _GL_LOCALE_H to a point after the #include_next.
But this gives another problem: If a program includes <locale.h> twice, it
will cause the system's <locale.h> to be parsed first, then the definitions
of gnulib's <locale.h>, and then the system's <locale.h> again, and the rest
of gnulib's <locale.h> is skipped. But some of gnulib's files really override
some system definitions (see e.g. <stdlib.h> or <stdint.h>), hence they will
not work correctly if included twice in a row. In other words, gnulib's
include files must be protected with a double-inclusion guard nevertheless.

After playing for a with two different macros _GL_LOCALE_H1 and _GL_LOCALE_H2,
I realized that a single macro _GL_LOCALE_H is nevertheless enough. Think
about it...

I'm committing this fix.

2007-05-29  Bruno Haible  <address@hidden>

        Fix a problem with #include_next.
        * lib/dirent_.h: Split the double-inclusion guard.
        * lib/fcntl_.h: Likewise.
        * lib/float_.h: Likewise.
        * lib/iconv_.h: Likewise.
        * lib/inttypes_.h: Likewise.
        * lib/locale_.h: Likewise.
        * lib/math_.h: Likewise.
        * lib/netinet_in_.h: Likewise.
        * lib/search_.h: Likewise.
        * lib/signal_.h: Likewise.
        * lib/stdint_.h: Likewise.
        * lib/stdio_.h: Likewise.
        * lib/stdlib_.h: Likewise.
        * lib/string_.h: Likewise.
        * lib/sys_select_.h: Likewise.
        * lib/sys_socket_.h: Likewise.
        * lib/sys_stat_.h: Likewise.
        * lib/sys_time_.h: Likewise.
        * lib/sysexits_.h: Likewise.
        * lib/time_.h: Likewise.
        * lib/unistd_.h: Likewise.
        * lib/wchar_.h: Likewise.
        * lib/wctype_.h: Likewise.

*** lib/dirent_.h       17 May 2007 15:56:06 -0000      1.3
--- lib/dirent_.h       30 May 2007 01:52:32 -0000
***************
*** 16,29 ****
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_DIRENT_H
- #define _GL_DIRENT_H
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <dirent.h>
  #else
  # include @ABSOLUTE_DIRENT_H@
  #endif
  
  /* Declare overridden functions.  */
  
  #ifdef __cplusplus
--- 16,33 ----
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_DIRENT_H
  
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <dirent.h>
  #else
  # include @ABSOLUTE_DIRENT_H@
  #endif
  
+ #ifndef _GL_DIRENT_H
+ #define _GL_DIRENT_H
+ 
+ 
  /* Declare overridden functions.  */
  
  #ifdef __cplusplus
***************
*** 43,45 ****
--- 47,50 ----
  
  
  #endif /* _GL_DIRENT_H */
+ #endif /* _GL_DIRENT_H */
*** lib/fcntl_.h        17 May 2007 06:14:29 -0000      1.4
--- lib/fcntl_.h        30 May 2007 01:52:32 -0000
***************
*** 1,6 ****
  /* Like <fcntl.h>, but with non-working flags defined to 0.
  
!    Copyright (C) 2006 Free Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
--- 1,6 ----
  /* Like <fcntl.h>, but with non-working flags defined to 0.
  
!    Copyright (C) 2006-2007 Free Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
***************
*** 19,35 ****
  /* written by Paul Eggert */
  
  #ifndef _GL_FCNTL_H
- #define _GL_FCNTL_H
  
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <unistd.h>
  #if @HAVE_INCLUDE_NEXT@
  # include_next <fcntl.h>
  #else
  # include @ABSOLUTE_FCNTL_H@
  #endif
  
  
  /* Declare overridden functions.  */
  
--- 19,38 ----
  /* written by Paul Eggert */
  
  #ifndef _GL_FCNTL_H
  
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <unistd.h>
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <fcntl.h>
  #else
  # include @ABSOLUTE_FCNTL_H@
  #endif
  
+ #ifndef _GL_FCNTL_H
+ #define _GL_FCNTL_H
+ 
  
  /* Declare overridden functions.  */
  
***************
*** 117,120 ****
  # define O_TEXT 0
  #endif
  
! #endif
--- 120,125 ----
  # define O_TEXT 0
  #endif
  
! 
! #endif /* _GL_FCNTL_H */
! #endif /* _GL_FCNTL_H */
*** lib/float_.h        20 May 2007 08:10:08 -0000      1.2
--- lib/float_.h        30 May 2007 01:52:32 -0000
***************
*** 17,30 ****
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_FLOAT_H
- #define _GL_FLOAT_H
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <float.h>
  #else
  # include @ABSOLUTE_FLOAT_H@
  #endif
  
  /* 'long double' properties.  */
  #if defined __i386__ && defined __BEOS__
  /* Number of mantissa units, in base FLT_RADIX.  */
--- 17,33 ----
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_FLOAT_H
  
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <float.h>
  #else
  # include @ABSOLUTE_FLOAT_H@
  #endif
  
+ #ifndef _GL_FLOAT_H
+ #define _GL_FLOAT_H
+ 
  /* 'long double' properties.  */
  #if defined __i386__ && defined __BEOS__
  /* Number of mantissa units, in base FLT_RADIX.  */
***************
*** 57,59 ****
--- 60,63 ----
  #endif
  
  #endif /* _GL_FLOAT_H */
+ #endif /* _GL_FLOAT_H */
*** lib/iconv_.h        17 May 2007 15:56:06 -0000      1.2
--- lib/iconv_.h        30 May 2007 01:52:32 -0000
***************
*** 17,30 ****
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_ICONV_H
- #define _GL_ICONV_H
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <iconv.h>
  #else
  # include @ABSOLUTE_ICONV_H@
  #endif
  
  #ifdef __cplusplus
  extern "C" {
  #endif
--- 17,33 ----
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_ICONV_H
  
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <iconv.h>
  #else
  # include @ABSOLUTE_ICONV_H@
  #endif
  
+ #ifndef _GL_ICONV_H
+ #define _GL_ICONV_H
+ 
  #ifdef __cplusplus
  extern "C" {
  #endif
***************
*** 42,45 ****
  }
  #endif
  
! #endif
--- 45,49 ----
  }
  #endif
  
! #endif /* _GL_ICONV_H */
! #endif /* _GL_ICONV_H */
*** lib/inttypes_.h     17 May 2007 06:14:29 -0000      1.11
--- lib/inttypes_.h     30 May 2007 01:52:32 -0000
***************
*** 16,24 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  /* Include the original <inttypes.h> if it exists, and if this file
     has not been included yet or if this file includes gnulib stdint.h
!    which in turn includes this file.  */
  #if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
  # if @HAVE_INTTYPES_H@
  #  if @HAVE_INCLUDE_NEXT@
--- 16,30 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
+ /*
+  * ISO C 99 <inttypes.h> for platforms that lack it.
+  * <http://www.opengroup.org/susv3xbd/inttypes.h.html>
+  */
+ 
  /* Include the original <inttypes.h> if it exists, and if this file
     has not been included yet or if this file includes gnulib stdint.h
!    which in turn includes this file.
!    The include_next requires a split double-inclusion guard.  */
  #if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
  # if @HAVE_INTTYPES_H@
  #  if @HAVE_INCLUDE_NEXT@
***************
*** 32,42 ****
  #if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
  #define INTTYPES_H
  
- /*
-  * ISO C 99 <inttypes.h> for platforms that lack it.
-  * <http://www.opengroup.org/susv3xbd/inttypes.h.html>
-  */
- 
  /* Include <stdint.h> or the gnulib replacement.  */
  #include <stdint.h>
  /* Get CHAR_BIT.  */
--- 38,43 ----
*** lib/locale_.h       17 May 2007 15:56:06 -0000      1.2
--- lib/locale_.h       30 May 2007 01:52:32 -0000
***************
*** 16,29 ****
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_LOCALE_H
- #define _GL_LOCALE_H
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <locale.h>
  #else
  # include @ABSOLUTE_LOCALE_H@
  #endif
  
  /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
     On systems that don't define it, use the same value as GNU libintl.  */
  #if !defined LC_MESSAGES
--- 16,32 ----
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_LOCALE_H
  
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <locale.h>
  #else
  # include @ABSOLUTE_LOCALE_H@
  #endif
  
+ #ifndef _GL_LOCALE_H
+ #define _GL_LOCALE_H
+ 
  /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
     On systems that don't define it, use the same value as GNU libintl.  */
  #if !defined LC_MESSAGES
***************
*** 31,33 ****
--- 34,37 ----
  #endif
  
  #endif /* _GL_LOCALE_H */
+ #endif /* _GL_LOCALE_H */
*** lib/math_.h 17 May 2007 06:14:29 -0000      1.12
--- lib/math_.h 30 May 2007 01:52:32 -0000
***************
*** 16,32 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <math.h>
  #endif
  
  #ifndef _GL_MATH_H
  #define _GL_MATH_H
  
- #if ! @HAVE_INCLUDE_NEXT@
- # include @ABSOLUTE_MATH_H@
- #endif
- 
  
  /* The definition of GL_LINK_WARNING is copied here.  */
  
--- 16,33 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
+ #ifndef _GL_MATH_H
+ 
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <math.h>
+ #else
+ # include @ABSOLUTE_MATH_H@
  #endif
  
  #ifndef _GL_MATH_H
  #define _GL_MATH_H
  
  
  /* The definition of GL_LINK_WARNING is copied here.  */
  
***************
*** 264,267 ****
  }
  #endif
  
! #endif
--- 265,269 ----
  }
  #endif
  
! #endif /* _GL_MATH_H */
! #endif /* _GL_MATH_H */
*** lib/netinet_in_.h   17 May 2007 15:56:06 -0000      1.2
--- lib/netinet_in_.h   30 May 2007 01:52:32 -0000
***************
*** 16,35 ****
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_NETINET_IN_H
- #define _GL_NETINET_IN_H
  
  #if @HAVE_NETINET_IN_H@
  
  /* On many platforms, <netinet/in.h> assumes prior inclusion of
     <sys/types.h>.  */
- 
  # include <sys/types.h>
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <netinet/in.h>
  # else
  #  include @ABSOLUTE_NETINET_IN_H@
  # endif
! #else
  
  /* A platform that lacks <netinet/in.h>.  */
  
--- 16,41 ----
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_NETINET_IN_H
  
  #if @HAVE_NETINET_IN_H@
  
  /* On many platforms, <netinet/in.h> assumes prior inclusion of
     <sys/types.h>.  */
  # include <sys/types.h>
+ 
+ /* The include_next requires a split double-inclusion guard.  */
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <netinet/in.h>
  # else
  #  include @ABSOLUTE_NETINET_IN_H@
  # endif
! 
! #endif
! 
! #ifndef _GL_NETINET_IN_H
! #define _GL_NETINET_IN_H
! 
! #if address@hidden@
  
  /* A platform that lacks <netinet/in.h>.  */
  
***************
*** 38,40 ****
--- 44,47 ----
  #endif
  
  #endif /* _GL_NETINET_IN_H */
+ #endif /* _GL_NETINET_IN_H */
*** lib/search_.h       17 May 2007 06:14:29 -0000      1.2
--- lib/search_.h       30 May 2007 01:52:33 -0000
***************
*** 17,24 ****
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_SEARCH_H
- #define _GL_SEARCH_H
  
  #if @HAVE_SEARCH_H@
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <search.h>
--- 17,24 ----
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_SEARCH_H
  
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_SEARCH_H@
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <search.h>
***************
*** 27,32 ****
--- 27,35 ----
  # endif
  #endif
  
+ #ifndef _GL_SEARCH_H
+ #define _GL_SEARCH_H
+ 
  
  /* The definition of GL_LINK_WARNING is copied here.  */
  
***************
*** 112,115 ****
  }
  #endif
  
! #endif
--- 115,119 ----
  }
  #endif
  
! #endif /* _GL_SEARCH_H */
! #endif /* _GL_SEARCH_H */
*** lib/signal_.h       17 May 2007 06:14:29 -0000      1.3
--- lib/signal_.h       30 May 2007 01:52:33 -0000
***************
*** 29,42 ****
  /* Normal invocation convention.  */
  
  #ifndef _GL_SIGNAL_H
- #define _GL_SIGNAL_H
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <signal.h>
  #else
  # include @ABSOLUTE_SIGNAL_H@
  #endif
  
  /* The definition of GL_LINK_WARNING is copied here.  */
  
  
--- 29,45 ----
  /* Normal invocation convention.  */
  
  #ifndef _GL_SIGNAL_H
  
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <signal.h>
  #else
  # include @ABSOLUTE_SIGNAL_H@
  #endif
  
+ #ifndef _GL_SIGNAL_H
+ #define _GL_SIGNAL_H
+ 
  /* The definition of GL_LINK_WARNING is copied here.  */
  
  
***************
*** 99,102 ****
--- 102,106 ----
  #endif
  
  #endif /* _GL_SIGNAL_H */
+ #endif /* _GL_SIGNAL_H */
  #endif
*** lib/stdint_.h       17 May 2007 06:14:29 -0000      1.41
--- lib/stdint_.h       30 May 2007 01:52:33 -0000
***************
*** 16,29 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
- #ifndef _GL_STDINT_H
- #define _GL_STDINT_H
- 
  /*
   * ISO C 99 <stdint.h> for platforms that lack it.
   * <http://www.opengroup.org/susv3xbd/stdint.h.html>
   */
  
  /* Get those types that are already defined in other system include
     files, so that we can "#define int8_t signed char" below without
     worrying about a later system include file containing a "typedef
--- 16,28 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  /*
   * ISO C 99 <stdint.h> for platforms that lack it.
   * <http://www.opengroup.org/susv3xbd/stdint.h.html>
   */
  
+ #ifndef _GL_STDINT_H
+ 
  /* Get those types that are already defined in other system include
     files, so that we can "#define int8_t signed char" below without
     worrying about a later system include file containing a "typedef
***************
*** 42,48 ****
    /* Other systems may have an incomplete or buggy <stdint.h>.
       Include it before <inttypes.h>, since any "#include <stdint.h>"
       in <inttypes.h> would reinclude us, skipping our contents because
!      _GL_STDINT_H is defined.  */
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <stdint.h>
  # else
--- 41,48 ----
    /* Other systems may have an incomplete or buggy <stdint.h>.
       Include it before <inttypes.h>, since any "#include <stdint.h>"
       in <inttypes.h> would reinclude us, skipping our contents because
!      _GL_STDINT_H is defined.
!      The include_next requires a split double-inclusion guard.  */
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <stdint.h>
  # else
***************
*** 50,55 ****
--- 50,58 ----
  # endif
  #endif
  
+ #ifndef _GL_STDINT_H
+ #define _GL_STDINT_H
+ 
  /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
     IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
     AIX 5.2 <sys/types.h> isn't needed and causes troubles.
***************
*** 506,508 ****
--- 509,512 ----
  #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
  
  #endif /* _GL_STDINT_H */
+ #endif /* _GL_STDINT_H */
*** lib/stdio_.h        28 May 2007 15:13:36 -0000      1.30
--- lib/stdio_.h        30 May 2007 01:52:33 -0000
***************
*** 28,44 ****
  #else
  /* Normal invocation convention.  */
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <stdio.h>
  #endif
  
  #ifndef _GL_STDIO_H
  #define _GL_STDIO_H
  
- #if ! @HAVE_INCLUDE_NEXT@
- # include @ABSOLUTE_STDIO_H@
- #endif
- 
  #include <stdarg.h>
  #include <stddef.h>
  
--- 28,45 ----
  #else
  /* Normal invocation convention.  */
  
+ #ifndef _GL_STDIO_H
+ 
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <stdio.h>
+ #else
+ # include @ABSOLUTE_STDIO_H@
  #endif
  
  #ifndef _GL_STDIO_H
  #define _GL_STDIO_H
  
  #include <stdarg.h>
  #include <stddef.h>
  
***************
*** 315,318 ****
--- 316,320 ----
  #endif
  
  #endif /* _GL_STDIO_H */
+ #endif /* _GL_STDIO_H */
  #endif
*** lib/stdlib_.h       17 May 2007 06:14:29 -0000      1.11
--- lib/stdlib_.h       30 May 2007 01:52:33 -0000
***************
*** 28,44 ****
  #else
  /* Normal invocation convention.  */
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <stdlib.h>
  #endif
  
  #ifndef _GL_STDLIB_H
  #define _GL_STDLIB_H
  
- #if ! @HAVE_INCLUDE_NEXT@
- # include @ABSOLUTE_STDLIB_H@
- #endif
- 
  
  /* The definition of GL_LINK_WARNING is copied here.  */
  
--- 28,45 ----
  #else
  /* Normal invocation convention.  */
  
+ #ifndef _GL_STDLIB_H
+ 
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <stdlib.h>
+ #else
+ # include @ABSOLUTE_STDLIB_H@
  #endif
  
  #ifndef _GL_STDLIB_H
  #define _GL_STDLIB_H
  
  
  /* The definition of GL_LINK_WARNING is copied here.  */
  
***************
*** 135,138 ****
--- 136,140 ----
  #endif
  
  #endif /* _GL_STDLIB_H */
+ #endif /* _GL_STDLIB_H */
  #endif
*** lib/string_.h       17 May 2007 06:14:29 -0000      1.32
--- lib/string_.h       30 May 2007 01:52:33 -0000
***************
*** 16,32 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <string.h>
  #endif
  
  #ifndef _GL_STRING_H
  #define _GL_STRING_H
  
- #if ! @HAVE_INCLUDE_NEXT@
- # include @ABSOLUTE_STRING_H@
- #endif
- 
  
  /* The definition of GL_LINK_WARNING is copied here.  */
  
--- 16,33 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
+ #ifndef _GL_STRING_H
+ 
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <string.h>
+ #else
+ # include @ABSOLUTE_STRING_H@
  #endif
  
  #ifndef _GL_STRING_H
  #define _GL_STRING_H
  
  
  /* The definition of GL_LINK_WARNING is copied here.  */
  
***************
*** 541,544 ****
  }
  #endif
  
! #endif
--- 542,546 ----
  }
  #endif
  
! #endif /* _GL_STRING_H */
! #endif /* _GL_STRING_H */
*** lib/sys_select_.h   17 May 2007 15:56:06 -0000      1.2
--- lib/sys_select_.h   30 May 2007 01:52:33 -0000
***************
*** 16,37 ****
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_SYS_SELECT_H
- #define _GL_SYS_SELECT_H
  
  #if @HAVE_SYS_SELECT_H@
  
  /* On many platforms, <sys/select.h> assumes prior inclusion of
     <sys/types.h>.  */
- 
  # include <sys/types.h>
  
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <sys/select.h>
  # else
  #  include @ABSOLUTE_SYS_SELECT_H@
  # endif
  
! #else
  
  /* A platform that lacks <sys/select.h>.  */
  
--- 16,41 ----
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_SYS_SELECT_H
  
  #if @HAVE_SYS_SELECT_H@
  
  /* On many platforms, <sys/select.h> assumes prior inclusion of
     <sys/types.h>.  */
  # include <sys/types.h>
  
+ /* The include_next requires a split double-inclusion guard.  */
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <sys/select.h>
  # else
  #  include @ABSOLUTE_SYS_SELECT_H@
  # endif
  
! #endif
! 
! #ifndef _GL_SYS_SELECT_H
! #define _GL_SYS_SELECT_H
! 
! #if address@hidden@
  
  /* A platform that lacks <sys/select.h>.  */
  
***************
*** 40,42 ****
--- 44,47 ----
  #endif
  
  #endif /* _GL_SYS_SELECT_H */
+ #endif /* _GL_SYS_SELECT_H */
*** lib/sys_socket_.h   17 May 2007 15:56:06 -0000      1.2
--- lib/sys_socket_.h   30 May 2007 01:52:33 -0000
***************
*** 16,43 ****
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
- #ifndef _GL_SYS_SOCKET_H
- #define _GL_SYS_SOCKET_H
- 
  /* This file is supposed to be used on platforms that lack <sys/socket.h>
     and on platforms where <sys/socket.h> cannot be included standalone.
     It is intended to provide definitions and prototypes needed by an
     application.  */
  
  #if @HAVE_SYS_SOCKET_H@
  
  /* On many platforms, <sys/socket.h> assumes prior inclusion of
     <sys/types.h>.  */
- 
  # include <sys/types.h>
  
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <sys/socket.h>
  # else
  #  include @ABSOLUTE_SYS_SOCKET_H@
  # endif
  
! #else
  
  /* A platform that lacks <sys/socket.h>.
  
--- 16,47 ----
     along with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  /* This file is supposed to be used on platforms that lack <sys/socket.h>
     and on platforms where <sys/socket.h> cannot be included standalone.
     It is intended to provide definitions and prototypes needed by an
     application.  */
  
+ #ifndef _GL_SYS_SOCKET_H
+ 
  #if @HAVE_SYS_SOCKET_H@
  
  /* On many platforms, <sys/socket.h> assumes prior inclusion of
     <sys/types.h>.  */
  # include <sys/types.h>
  
+ /* The include_next requires a split double-inclusion guard.  */
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <sys/socket.h>
  # else
  #  include @ABSOLUTE_SYS_SOCKET_H@
  # endif
  
! #endif
! 
! #ifndef _GL_SYS_SOCKET_H
! #define _GL_SYS_SOCKET_H
! 
! #if address@hidden@
  
  /* A platform that lacks <sys/socket.h>.
  
***************
*** 88,90 ****
--- 92,95 ----
  #endif /* HAVE_SYS_SOCKET_H */
  
  #endif /* _GL_SYS_SOCKET_H */
+ #endif /* _GL_SYS_SOCKET_H */
*** lib/sys_stat_.h     17 May 2007 15:56:06 -0000      1.3
--- lib/sys_stat_.h     30 May 2007 01:52:33 -0000
***************
*** 17,35 ****
  
  /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
  
- #ifndef _GL_SYS_STAT_H
- #define _GL_SYS_STAT_H
- 
  /* This file is supposed to be used on platforms where <sys/stat.h> is
     incomplete.  It is intended to provide definitions and prototypes
     needed by an application.  Start with what the system provides.  */
  
  #if @HAVE_INCLUDE_NEXT@
  # include_next <sys/stat.h>
  #else
  # include @ABSOLUTE_SYS_STAT_H@
  #endif
  
  #ifndef S_IFMT
  # define S_IFMT 0170000
  #endif
--- 17,38 ----
  
  /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
  
  /* This file is supposed to be used on platforms where <sys/stat.h> is
     incomplete.  It is intended to provide definitions and prototypes
     needed by an application.  Start with what the system provides.  */
  
+ #ifndef _GL_SYS_STAT_H
+ 
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_INCLUDE_NEXT@
  # include_next <sys/stat.h>
  #else
  # include @ABSOLUTE_SYS_STAT_H@
  #endif
  
+ #ifndef _GL_SYS_STAT_H
+ #define _GL_SYS_STAT_H
+ 
  #ifndef S_IFMT
  # define S_IFMT 0170000
  #endif
***************
*** 278,280 ****
--- 281,284 ----
  #endif
  
  #endif /* _GL_SYS_STAT_H */
+ #endif /* _GL_SYS_STAT_H */
*** lib/sys_time_.h     17 May 2007 06:14:29 -0000      1.5
--- lib/sys_time_.h     30 May 2007 01:52:33 -0000
***************
*** 19,26 ****
  /* Written by Paul Eggert.  */
  
  #ifndef _GL_SYS_TIME_H
- #define _GL_SYS_TIME_H
  
  #if @HAVE_SYS_TIME_H@
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <sys/time.h>
--- 19,26 ----
  /* Written by Paul Eggert.  */
  
  #ifndef _GL_SYS_TIME_H
  
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_SYS_TIME_H@
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <sys/time.h>
***************
*** 31,36 ****
--- 31,39 ----
  # include <time.h>
  #endif
  
+ #ifndef _GL_SYS_TIME_H
+ #define _GL_SYS_TIME_H
+ 
  #if ! @HAVE_STRUCT_TIMEVAL@
  struct timeval
  {
***************
*** 46,48 ****
--- 49,52 ----
  #endif
  
  #endif /* _GL_SYS_TIME_H */
+ #endif /* _GL_SYS_TIME_H */
*** lib/sysexits_.h     17 May 2007 15:56:06 -0000      1.2
--- lib/sysexits_.h     30 May 2007 01:52:33 -0000
***************
*** 18,24 ****
  /* Written by Simon Josefsson based on sysexits(3) man page */
  
  #ifndef _GL_SYSEXITS_H
- #define _GL_SYSEXITS_H
  
  #if @HAVE_SYSEXITS_H@
  
--- 18,23 ----
***************
*** 30,35 ****
--- 29,35 ----
  #  undef EX_OK
  # endif
  
+ /* The include_next requires a split double-inclusion guard.  */
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <sysexits.h>
  # else
***************
*** 41,47 ****
  #  define EX_CONFIG 78
  # endif
  
! #else
  
  # define EX_OK 0 /* same value as EXIT_SUCCESS */
  
--- 41,52 ----
  #  define EX_CONFIG 78
  # endif
  
! #endif
! 
! #ifndef _GL_SYSEXITS_H
! #define _GL_SYSEXITS_H
! 
! #if address@hidden@
  
  # define EX_OK 0 /* same value as EXIT_SUCCESS */
  
***************
*** 64,66 ****
--- 69,72 ----
  #endif
  
  #endif /* _GL_SYSEXITS_H */
+ #endif /* _GL_SYSEXITS_H */
*** lib/time_.h 17 May 2007 06:14:29 -0000      1.5
--- lib/time_.h 30 May 2007 01:52:33 -0000
***************
*** 30,123 ****
  #else
  /* Normal invocation convention.  */
  
- # if @HAVE_INCLUDE_NEXT@
- #  include_next <time.h>
- # endif
- 
  # if ! defined _GL_TIME_H
- #  define _GL_TIME_H
  
! #  if ! @HAVE_INCLUDE_NEXT@
  #   include @ABSOLUTE_TIME_H@
  #  endif
  
! #  ifdef __cplusplus
  extern "C" {
! #  endif
  
  /* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
     Or they define it with the wrong member names or define it in <sys/time.h>
     (e.g., FreeBSD circa 1997).  */
! #  if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
! #   if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
! #    include <sys/time.h>
! #   else
! #    undef timespec
! #    define timespec rpl_timespec
  struct timespec
  {
    time_t tv_sec;
    long int tv_nsec;
  };
  #   endif
- #  endif
  
  /* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
     return -1 and store the remaining time into RMTP.  See
     <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
! #  if @REPLACE_NANOSLEEP@
! #   define nanosleep rpl_nanosleep
  int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
! #  endif
  
  /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
     <http://www.opengroup.org/susv3xsh/localtime_r.html> and
     <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
! #  if @REPLACE_LOCALTIME_R@
! #   undef localtime_r
! #   define localtime_r rpl_localtime_r
! #   undef gmtime_r
! #   define gmtime_r rpl_gmtime_r
  struct tm *localtime_r (time_t const *restrict __timer,
                        struct tm *restrict __result);
  struct tm *gmtime_r (time_t const *restrict __timer,
                     struct tm *restrict __result);
! #  endif
  
  /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
     the resulting broken-down time into TM.  See
     <http://www.opengroup.org/susv3xsh/strptime.html>.  */
! #  if @REPLACE_STRPTIME@
! #   undef strptime
! #   define strptime rpl_strptime
  char *strptime (char const *restrict __buf, char const *restrict __format,
                struct tm *restrict __tm);
! #  endif
  
  /* Convert TM to a time_t value, assuming UTC.  */
! #  if @REPLACE_TIMEGM@
! #   undef timegm
! #   define timegm rpl_timegm
  time_t timegm (struct tm *__tm);
! #  endif
  
  /* Encourage applications to avoid unsafe functions that can overrun
     buffers when given outlandish struct tm values.  Portable
     applications should use strftime (or even sprintf) instead.  */
! #  if GNULIB_PORTCHECK
! #   undef asctime
! #   define asctime eschew_asctime
! #   undef asctime_r
! #   define asctime_r eschew_asctime_r
! #   undef ctime
! #   define ctime eschew_ctime
! #   undef ctime_r
! #   define ctime_r eschew_ctime_r
! #  endif
  
! #  ifdef __cplusplus
  }
! #  endif
  
! # endif
  #endif
--- 30,125 ----
  #else
  /* Normal invocation convention.  */
  
  # if ! defined _GL_TIME_H
  
! /* The include_next requires a split double-inclusion guard.  */
! #  if @HAVE_INCLUDE_NEXT@
! #   include_next <time.h>
! #  else
  #   include @ABSOLUTE_TIME_H@
  #  endif
  
! #  if ! defined _GL_TIME_H
! #   define _GL_TIME_H
! 
! #   ifdef __cplusplus
  extern "C" {
! #   endif
  
  /* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
     Or they define it with the wrong member names or define it in <sys/time.h>
     (e.g., FreeBSD circa 1997).  */
! #   if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
! #    if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
! #     include <sys/time.h>
! #    else
! #     undef timespec
! #     define timespec rpl_timespec
  struct timespec
  {
    time_t tv_sec;
    long int tv_nsec;
  };
+ #    endif
  #   endif
  
  /* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
     return -1 and store the remaining time into RMTP.  See
     <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
! #   if @REPLACE_NANOSLEEP@
! #    define nanosleep rpl_nanosleep
  int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
! #   endif
  
  /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
     <http://www.opengroup.org/susv3xsh/localtime_r.html> and
     <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
! #   if @REPLACE_LOCALTIME_R@
! #    undef localtime_r
! #    define localtime_r rpl_localtime_r
! #    undef gmtime_r
! #    define gmtime_r rpl_gmtime_r
  struct tm *localtime_r (time_t const *restrict __timer,
                        struct tm *restrict __result);
  struct tm *gmtime_r (time_t const *restrict __timer,
                     struct tm *restrict __result);
! #   endif
  
  /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
     the resulting broken-down time into TM.  See
     <http://www.opengroup.org/susv3xsh/strptime.html>.  */
! #   if @REPLACE_STRPTIME@
! #    undef strptime
! #    define strptime rpl_strptime
  char *strptime (char const *restrict __buf, char const *restrict __format,
                struct tm *restrict __tm);
! #   endif
  
  /* Convert TM to a time_t value, assuming UTC.  */
! #   if @REPLACE_TIMEGM@
! #    undef timegm
! #    define timegm rpl_timegm
  time_t timegm (struct tm *__tm);
! #   endif
  
  /* Encourage applications to avoid unsafe functions that can overrun
     buffers when given outlandish struct tm values.  Portable
     applications should use strftime (or even sprintf) instead.  */
! #   if GNULIB_PORTCHECK
! #    undef asctime
! #    define asctime eschew_asctime
! #    undef asctime_r
! #    define asctime_r eschew_asctime_r
! #    undef ctime
! #    define ctime eschew_ctime
! #    undef ctime_r
! #    define ctime_r eschew_ctime_r
! #   endif
  
! #   ifdef __cplusplus
  }
! #   endif
  
! #  endif /* _GL_TIME_H */
! # endif /* _GL_TIME_H */
  #endif
*** lib/unistd_.h       28 May 2007 12:43:30 -0000      1.10
--- lib/unistd_.h       30 May 2007 01:52:33 -0000
***************
*** 16,23 ****
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_UNISTD_H
- #define _GL_UNISTD_H
  
  #if @HAVE_UNISTD_H@
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <unistd.h>
--- 16,23 ----
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
  #ifndef _GL_UNISTD_H
  
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_UNISTD_H@
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <unistd.h>
***************
*** 26,31 ****
--- 26,34 ----
  # endif
  #endif
  
+ #ifndef _GL_UNISTD_H
+ #define _GL_UNISTD_H
+ 
  /* mingw doesn't define the SEEK_* macros in <unistd.h>.  */
  #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
  # include <stdio.h>
***************
*** 236,238 ****
--- 239,242 ----
  
  
  #endif /* _GL_UNISTD_H */
+ #endif /* _GL_UNISTD_H */
*** lib/wchar_.h        17 May 2007 06:14:29 -0000      1.4
--- lib/wchar_.h        30 May 2007 01:52:33 -0000
***************
*** 25,37 ****
   * For now, this just ensures proper prerequisite inclusion order.
   */
  
- #if @HAVE_INCLUDE_NEXT@
- # include <stdio.h>
- # include_next <wchar.h>
- #endif
- 
  #ifndef _GL_WCHAR_H
- #define _GL_WCHAR_H
  
  /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
     <wchar.h>.
--- 25,31 ----
***************
*** 42,49 ****
  #include <time.h>
  
  /* Include the original <wchar.h>.  */
! #if ! @HAVE_INCLUDE_NEXT@
  # include @ABSOLUTE_WCHAR_H@
  #endif
  
  #endif /* _GL_WCHAR_H */
--- 36,50 ----
  #include <time.h>
  
  /* Include the original <wchar.h>.  */
! /* The include_next requires a split double-inclusion guard.  */
! #if @HAVE_INCLUDE_NEXT@
! # include_next <wchar.h>
! #else
  # include @ABSOLUTE_WCHAR_H@
  #endif
  
+ #ifndef _GL_WCHAR_H
+ #define _GL_WCHAR_H
+ 
+ #endif /* _GL_WCHAR_H */
  #endif /* _GL_WCHAR_H */
*** lib/wctype_.h       17 May 2007 06:14:30 -0000      1.12
--- lib/wctype_.h       30 May 2007 01:52:33 -0000
***************
*** 26,31 ****
--- 26,33 ----
   * wctrans_t, and wctype_t are not yet implemented.
   */
  
+ #ifndef _GL_WCTYPE_H
+ 
  #if @HAVE_WINT_T@
  /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
     Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
***************
*** 38,60 ****
  # include <wchar.h>
  #endif
  
  #if @HAVE_WCTYPE_H@
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <wctype.h>
  # endif
  #endif
  
  #ifndef _GL_WCTYPE_H
  #define _GL_WCTYPE_H
  
- /* Include the original <wctype.h> if it exists.
-    BeOS 5 has the functions but no <wctype.h>.  */
- #if @HAVE_WCTYPE_H@
- # if ! @HAVE_INCLUDE_NEXT@
- #  include @ABSOLUTE_WCTYPE_H@
- # endif
- #endif
- 
  #if @HAVE_WINT_T@
  typedef wint_t __wctype_wint_t;
  #else
--- 40,59 ----
  # include <wchar.h>
  #endif
  
+ /* Include the original <wctype.h> if it exists.
+    BeOS 5 has the functions but no <wctype.h>.  */
+ /* The include_next requires a split double-inclusion guard.  */
  #if @HAVE_WCTYPE_H@
  # if @HAVE_INCLUDE_NEXT@
  #  include_next <wctype.h>
+ # else
+ #  include @ABSOLUTE_WCTYPE_H@
  # endif
  #endif
  
  #ifndef _GL_WCTYPE_H
  #define _GL_WCTYPE_H
  
  #if @HAVE_WINT_T@
  typedef wint_t __wctype_wint_t;
  #else
***************
*** 163,165 ****
--- 162,165 ----
  # endif /* ! HAVE_ISWCNTRL */
  
  #endif /* _GL_WCTYPE_H */
+ #endif /* _GL_WCTYPE_H */





reply via email to

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