bug-gnulib
[Top][All Lists]
Advanced

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

Re: sysexit_.h fix


From: Bruno Haible
Subject: Re: sysexit_.h fix
Date: Sat, 31 Mar 2007 01:54:06 +0200
User-agent: KMail/1.5.4

Sergey Poznyakoff wrote:
> I propose the following change to sysexit_.h. Reason: if HAVE_SYSEXITS_H
> is expanded to 1, then the included header file might be protected by
> `#ifdef _SYSEXITS_H' (in fact, it is, on GNU/Linux) which will prevent
> its contents from being included.

Well spotted. Many thanks for reporting this!

Since there is a danger of repetition of this mistake for other header files
that don't have a gnulib-specific guard macro, I'm changing a few other
header files (excluding those that come from glibc).

$ grep -h '#ifndef .*_H$' *_.h
#ifndef _GNULIB_ALLOCA_H
#ifndef _BYTESWAP_H
#ifndef _GL_DIRENT_H
#ifndef _GL_FCNTL_H
#ifndef _GETOPT_H
#ifndef GLOB_H
#ifndef _GL_ICONV_H
#ifndef _GL_MATH_H
#ifndef _GL_NETDB_H
#ifndef _GL_NETINET_IN_H
#ifndef GNULIB_POLL_H
#ifndef _GL_SEARCH_H
#ifndef _GL_SYS_SOCKET_H
#ifndef _gl_SYS_STAT_H
#ifndef _STDBOOL_H
#ifndef _GL_STDINT_H
#ifndef _GL_STDIO_H
#ifndef _GL_STDLIB_H
#ifndef _GL_STRING_H
#ifndef _GL_SYS_SELECT_H
#ifndef _gl_SYS_TIME_H
#ifndef _SYSEXITS_H
#ifndef _GL_UNISTD_H
#ifndef _GL_WCHAR_H
#ifndef _GL_WCTYPE_H

Also, there's no need to have 4 different gnulib-specific guard macro
prefixes (_GNULIB_, GNULIB_, _GL_, _gl_). Let's converge on the predominant
one.

2007-03-30  Bruno Haible  <address@hidden>

        * lib/alloca_.h: Change prefix of double-inclusion guard macro to _GL_.
        * lib/poll_.h: Likewise.
        * lib/stat_.h: Likewise.
        * lib/sys_time_.h: Likewise.
        * lib/sysexit_.h: Likewise.
        * lib/glob_.h: Prefix double-inclusion guard macro with _GL_.
        * lib/stdbool_.h: Likewise.
        * lib/byteswap_.h: Add double-inclusion guard.

2007-03-30  Sergey Poznyakoff  <address@hidden>

        * lib/sysexit_.h: Prefix double-inclusion guard macro with _GNULIB.

--- lib/alloca_.h       19 Jun 2006 09:39:50 -0000      1.9
+++ lib/alloca_.h       30 Mar 2007 23:48:02 -0000
@@ -1,6 +1,6 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004, 2006 Free Software
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2007 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
@@ -20,8 +20,8 @@
 
 /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
    means there is a real alloca function.  */
-#ifndef _GNULIB_ALLOCA_H
-# define _GNULIB_ALLOCA_H
+#ifndef _GL_ALLOCA_H
+#define _GL_ALLOCA_H
 
 /* alloca (N) returns a pointer to N bytes of memory
    allocated on the stack, which will last until the function returns.
@@ -51,4 +51,4 @@
 # endif
 #endif
 
-#endif /* _GNULIB_ALLOCA_H */
+#endif /* _GL_ALLOCA_H */
--- lib/byteswap_.h     7 Mar 2007 22:59:46 -0000       1.5
+++ lib/byteswap_.h     30 Mar 2007 23:48:02 -0000
@@ -16,7 +16,8 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef _BYTESWAP_H
+#ifndef _GL_BYTESWAP_H
+#define _GL_BYTESWAP_H
 
 /* Given an unsigned 16-bit argument X, return the value corresponding to
    X with reversed byte order.  */
@@ -41,4 +42,4 @@
                     (((x) & 0x00FF000000000000ULL) >> 40) | \
                     (((x) & 0xFF00000000000000ULL) >> 56))
 
-#endif
+#endif /* _GL_BYTESWAP_H */
--- lib/glob_.h 25 Mar 2007 19:36:17 -0000      1.8
+++ lib/glob_.h 30 Mar 2007 23:48:02 -0000
@@ -18,8 +18,8 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef GLOB_H
-#define GLOB_H 1
+#ifndef _GL_GLOB_H
+#define _GL_GLOB_H
 
 #ifdef HAVE_SYS_CDEFS_H
 # include <sys/cdefs.h>
@@ -57,4 +57,4 @@
 /* Now the standard GNU C Library header should work.  */
 #include "glob-libc.h"
 
-#endif /* GLOB_H */
+#endif /* _GL_GLOB_H */
--- lib/poll_.h 14 May 2005 06:03:58 -0000      1.3
+++ lib/poll_.h 30 Mar 2007 23:48:02 -0000
@@ -1,7 +1,7 @@
 /* Header for poll(2) emulation
    Contributed by Paolo Bonzini.
 
-   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
 
    This file is part of gnulib.
 
@@ -19,8 +19,8 @@
    with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef GNULIB_POLL_H
-#define GNULIB_POLL_H
+#ifndef _GL_POLL_H
+#define _GL_POLL_H
 
 /* fake a poll(2) environment */
 #define POLLIN      0x0001     /* any readable data available   */
@@ -50,4 +50,4 @@
 #define INFTIM (-1)
 #endif
 
-#endif
+#endif /* _GL_POLL_H */
--- lib/stat_.h 27 Oct 2006 20:46:43 -0000      1.6
+++ lib/stat_.h 30 Mar 2007 23:48:02 -0000
@@ -1,5 +1,5 @@
 /* Provide a more complete sys/stat header file.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   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
@@ -17,8 +17,8 @@
 
 /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
 
-#ifndef _gl_SYS_STAT_H
-#define _gl_SYS_STAT_H
+#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
@@ -272,4 +272,4 @@
 # define mkdir rpl_mkdir
 #endif
 
-#endif /* _gl_SYS_STAT_H */
+#endif /* _GL_SYS_STAT_H */
--- lib/stdbool_.h      5 Feb 2007 00:22:55 -0000       1.11
+++ lib/stdbool_.h      30 Mar 2007 23:48:02 -0000
@@ -15,8 +15,8 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef _STDBOOL_H
-#define _STDBOOL_H
+#ifndef _GL_STDBOOL_H
+#define _GL_STDBOOL_H
 
 /* ISO C 99 <stdbool.h> for platforms that lack it.  */
 
@@ -115,4 +115,4 @@
 #define true 1
 #define __bool_true_false_are_defined 1
 
-#endif /* _STDBOOL_H */
+#endif /* _GL_STDBOOL_H */
--- lib/sys_time_.h     4 Mar 2007 23:41:27 -0000       1.3
+++ lib/sys_time_.h     30 Mar 2007 23:48:02 -0000
@@ -18,8 +18,8 @@
 
 /* Written by Paul Eggert.  */
 
-#ifndef _gl_SYS_TIME_H
-#define _gl_SYS_TIME_H
+#ifndef _GL_SYS_TIME_H
+#define _GL_SYS_TIME_H
 
 #if @HAVE_SYS_TIME_H@
 # include @ABSOLUTE_SYS_TIME_H@
@@ -41,4 +41,4 @@
 int gettimeofday (struct timeval *restrict, void *restrict);
 #endif
 
-#endif /* _gl_SYS_TIME_H */
+#endif /* _GL_SYS_TIME_H */
--- lib/sysexit_.h      26 Mar 2007 10:16:08 -0000      1.4
+++ lib/sysexit_.h      30 Mar 2007 23:48:02 -0000
@@ -17,8 +17,8 @@
 
 /* Written by Simon Josefsson based on sysexits(3) man page */
 
-#ifndef _SYSEXITS_H
-#define _SYSEXITS_H
+#ifndef _GL_SYSEXITS_H
+#define _GL_SYSEXITS_H
 
 #if @HAVE_SYSEXITS_H@
 
@@ -51,4 +51,4 @@
 
 #endif
 
-#endif /* _SYSEXITS_H */
+#endif /* _GL_SYSEXITS_H */





reply via email to

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