From: Bruno Haible <bruno@clisp.org>
Date: Tue, 30 Mar 2010 00:35:49 +0000 (+0200)
Subject: Emit #pragma system_header after the inclusion guard, not before.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e046ffb123d352dec87f91fc638490572ef4d31d;p=pspp

Emit #pragma system_header after the inclusion guard, not before.
---

diff --git a/ChangeLog b/ChangeLog
index b6f1dc11e5..b8c880be35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2010-03-29  Bruno Haible  <bruno@clisp.org>
+
+	Emit #pragma system_header after the inclusion guard, not before.
+	* lib/arpa_inet.in.h: Emit #pragma system_header after the inclusion
+	guard that spans the entire file, not before. This enables an
+	optimization in GCC's preprocessor.
+	* lib/ctype.in.h: Likewise.
+	* lib/dirent.in.h: Likewise.
+	* lib/errno.in.h: Likewise.
+	* lib/float.in.h: Likewise.
+	* lib/getopt.in.h: Likewise.
+	* lib/iconv.in.h: Likewise.
+	* lib/langinfo.in.h: Likewise.
+	* lib/locale.in.h: Likewise.
+	* lib/math.in.h: Likewise.
+	* lib/netdb.in.h: Likewise.
+	* lib/netinet_in.in.h: Likewise.
+	* lib/pty.in.h: Likewise.
+	* lib/sched.in.h: Likewise.
+	* lib/se-selinux.in.h: Likewise.
+	* lib/search.in.h: Likewise.
+	* lib/spawn.in.h: Likewise.
+	* lib/stdarg.in.h: Likewise.
+	* lib/stdint.in.h: Likewise.
+	* lib/string.in.h: Likewise.
+	* lib/strings.in.h: Likewise.
+	* lib/sys_file.in.h: Likewise.
+	* lib/sys_ioctl.in.h: Likewise.
+	* lib/sys_time.in.h: Likewise.
+	* lib/sys_times.in.h: Likewise.
+	* lib/sys_utsname.in.h: Likewise.
+	* lib/sys_wait.in.h: Likewise.
+	* lib/sysexits.in.h: Likewise.
+	* lib/wctype.in.h: Likewise.
+
 2010-03-28  James Youngman  <jay@gnu.org>
 
 	save-cwd: don't leak a file descriptor when the caller execs.
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index c1d088b8bc..da4740b227 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -16,12 +16,12 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-# if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-# endif
-
 #ifndef _GL_ARPA_INET_H
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 /* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
    under MinGW.
    But avoid namespace pollution on glibc systems.  */
diff --git a/lib/ctype.in.h b/lib/ctype.in.h
index fdf9e1e55a..ccf222d76a 100644
--- a/lib/ctype.in.h
+++ b/lib/ctype.in.h
@@ -23,12 +23,12 @@
  * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html>
  */
 
+#ifndef _GL_CTYPE_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_CTYPE_H
-
 /* Include the original <ctype.h>.  */
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_CTYPE_H@
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index 15d488b356..3989a2546e 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -14,12 +14,12 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifndef _GL_DIRENT_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_DIRENT_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_DIRENT_H@
 
diff --git a/lib/errno.in.h b/lib/errno.in.h
index f5166bcf61..9ac3a5b4e8 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -16,12 +16,12 @@
    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_ERRNO_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_ERRNO_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_ERRNO_H@
 
diff --git a/lib/float.in.h b/lib/float.in.h
index b4ea3436fe..caf822f1d0 100644
--- a/lib/float.in.h
+++ b/lib/float.in.h
@@ -15,12 +15,12 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifndef _GL_FLOAT_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_FLOAT_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_FLOAT_H@
 
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index c90baa53cd..57a8e8992d 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -16,12 +16,12 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifndef _GL_GETOPT_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_GETOPT_H
-
 /* The include_next requires a split double-inclusion guard.  We must
    also inform the replacement unistd.h to not recursively use
    <getopt.h>; our definitions will be present soon enough.  */
diff --git a/lib/iconv.in.h b/lib/iconv.in.h
index 162d980dec..c8f516b067 100644
--- a/lib/iconv.in.h
+++ b/lib/iconv.in.h
@@ -16,12 +16,12 @@
    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_ICONV_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_ICONV_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_ICONV_H@
 
diff --git a/lib/langinfo.in.h b/lib/langinfo.in.h
index 04834ce665..54fa1af350 100644
--- a/lib/langinfo.in.h
+++ b/lib/langinfo.in.h
@@ -20,12 +20,12 @@
  * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
  */
 
+#ifndef _GL_LANGINFO_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_LANGINFO_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_LANGINFO_H@
 # @INCLUDE_NEXT@ @NEXT_LANGINFO_H@
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 26059bae3d..ad92d8f2b0 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -14,12 +14,12 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifndef _GL_LOCALE_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_LOCALE_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_LOCALE_H@
 
diff --git a/lib/math.in.h b/lib/math.in.h
index dd7a634498..5aad1a8e92 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -15,12 +15,12 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifndef _GL_MATH_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_MATH_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
 
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index 461d12f4c9..8f091411f8 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -20,12 +20,12 @@
    It is intended to provide definitions and prototypes needed by an
    application.  */
 
-# if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-# endif
-
 #ifndef _GL_NETDB_H
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 #if @HAVE_NETDB_H@
 
 /* The include_next requires a split double-inclusion guard.  */
diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h
index 8e79bdb100..cbb38f3ff0 100644
--- a/lib/netinet_in.in.h
+++ b/lib/netinet_in.in.h
@@ -15,12 +15,12 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-# if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-# endif
-
 #ifndef _GL_NETINET_IN_H
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 #if @HAVE_NETINET_IN_H@
 
 /* On many platforms, <netinet/in.h> assumes prior inclusion of
diff --git a/lib/pty.in.h b/lib/pty.in.h
index 98106bb1d5..af98dfe2ae 100644
--- a/lib/pty.in.h
+++ b/lib/pty.in.h
@@ -15,12 +15,12 @@
    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_PTY_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_PTY_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_PTY_H@
 # @INCLUDE_NEXT@ @NEXT_PTY_H@
diff --git a/lib/sched.in.h b/lib/sched.in.h
index bc280362da..a164133bbd 100644
--- a/lib/sched.in.h
+++ b/lib/sched.in.h
@@ -14,12 +14,12 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifndef _GL_SCHED_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_SCHED_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_SCHED_H@
 # @INCLUDE_NEXT@ @NEXT_SCHED_H@
diff --git a/lib/se-selinux.in.h b/lib/se-selinux.in.h
index d756b69bc9..d00f81bfa2 100644
--- a/lib/se-selinux.in.h
+++ b/lib/se-selinux.in.h
@@ -14,13 +14,13 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-
 #ifndef _GL_SELINUX_SELINUX_H
 # define _GL_SELINUX_SELINUX_H
 
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
+
 # if HAVE_SELINUX_SELINUX_H
 
 #@INCLUDE_NEXT@ @NEXT_SELINUX_SELINUX_H@
diff --git a/lib/search.in.h b/lib/search.in.h
index 9689d58cc6..20551a94af 100644
--- a/lib/search.in.h
+++ b/lib/search.in.h
@@ -15,12 +15,12 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifndef _GL_SEARCH_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_SEARCH_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_SEARCH_H@
 # @INCLUDE_NEXT@ @NEXT_SEARCH_H@
diff --git a/lib/spawn.in.h b/lib/spawn.in.h
index 6a15e5f3a3..cc8d9a9c47 100644
--- a/lib/spawn.in.h
+++ b/lib/spawn.in.h
@@ -15,12 +15,12 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifndef _GL_SPAWN_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_SPAWN_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_SPAWN_H@
 # @INCLUDE_NEXT@ @NEXT_SPAWN_H@
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h
index 99fff31618..9a8d02930c 100644
--- a/lib/stdarg.in.h
+++ b/lib/stdarg.in.h
@@ -15,12 +15,12 @@
    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_STDARG_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_STDARG_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_STDARG_H@
 
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 0979a95682..a861c07940 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -21,12 +21,12 @@
  * <http://www.opengroup.org/susv3xbd/stdint.h.html>
  */
 
-# if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-# endif
-
 #ifndef _GL_STDINT_H
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 /* When including a system file that in turn includes <inttypes.h>,
    use the system <inttypes.h>, not our substitute.  This avoids
    problems with (for example) VMS, whose <sys/bitypes.h> includes
diff --git a/lib/string.in.h b/lib/string.in.h
index 4a98302c11..4788a195e2 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -16,12 +16,12 @@
    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
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_STRING_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_STRING_H@
 
diff --git a/lib/strings.in.h b/lib/strings.in.h
index e2487bcc09..093189921d 100644
--- a/lib/strings.in.h
+++ b/lib/strings.in.h
@@ -16,12 +16,12 @@
    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_STRINGS_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_STRINGS_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_STRINGS_H@
 
diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h
index bf7600111f..9ace671b91 100644
--- a/lib/sys_file.in.h
+++ b/lib/sys_file.in.h
@@ -18,16 +18,16 @@
 
 /* Written by Richard W.M. Jones.  */
 
-# if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-# endif
-
 #ifndef _GL_SYS_FILE_H
 
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+
 /* The include_next requires a split double-inclusion guard.  */
-# if @HAVE_SYS_FILE_H@
-#  @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@
-# endif
+#if @HAVE_SYS_FILE_H@
+# @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@
+#endif
 
 #ifndef _GL_SYS_FILE_H
 #define _GL_SYS_FILE_H
diff --git a/lib/sys_ioctl.in.h b/lib/sys_ioctl.in.h
index 50d0e9d24f..6066ecf72d 100644
--- a/lib/sys_ioctl.in.h
+++ b/lib/sys_ioctl.in.h
@@ -15,12 +15,12 @@
    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_IOCTL_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_SYS_IOCTL_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_SYS_IOCTL_H@
 # @INCLUDE_NEXT@ @NEXT_SYS_IOCTL_H@
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 6e0c7db984..6d818d1e81 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -18,12 +18,12 @@
 
 /* Written by Paul Eggert.  */
 
+#if defined _GL_SYS_TIME_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#if defined _GL_SYS_TIME_H
-
 /* Simply delegate to the system's header, without adding anything.  */
 # if @HAVE_SYS_TIME_H@
 #  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
diff --git a/lib/sys_times.in.h b/lib/sys_times.in.h
index 1b66bbdf98..57f3a7209d 100644
--- a/lib/sys_times.in.h
+++ b/lib/sys_times.in.h
@@ -20,12 +20,12 @@
 /* This file is supposed to be used on platforms where <sys/times.h>
    is missing.  */
 
+#ifndef _GL_SYS_TIMES_H
+
 # if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 # endif
 
-#ifndef _GL_SYS_TIMES_H
-
 # if @HAVE_SYS_TIMES_H@
 #  @INCLUDE_NEXT@ @NEXT_SYS_TIMES_H@
 # endif
diff --git a/lib/sys_utsname.in.h b/lib/sys_utsname.in.h
index 2d576056cf..c0dabccb2e 100644
--- a/lib/sys_utsname.in.h
+++ b/lib/sys_utsname.in.h
@@ -15,12 +15,12 @@
    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_UTSNAME_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_SYS_UTSNAME_H
-
 #if @HAVE_SYS_UTSNAME_H@
 # @INCLUDE_NEXT@ @NEXT_SYS_UTSNAME_H@
 #endif
diff --git a/lib/sys_wait.in.h b/lib/sys_wait.in.h
index 623c8d5e30..6699c61f07 100644
--- a/lib/sys_wait.in.h
+++ b/lib/sys_wait.in.h
@@ -16,12 +16,12 @@
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 
+#ifndef _GL_SYS_WAIT_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_SYS_WAIT_H
-
 /* The include_next requires a split double-inclusion guard.  */
 #if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
 # @INCLUDE_NEXT@ @NEXT_SYS_WAIT_H@
diff --git a/lib/sysexits.in.h b/lib/sysexits.in.h
index b477111f28..45255dfa53 100644
--- a/lib/sysexits.in.h
+++ b/lib/sysexits.in.h
@@ -16,12 +16,12 @@
 
 /* Written by Simon Josefsson based on sysexits(3) man page */
 
+#ifndef _GL_SYSEXITS_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#ifndef _GL_SYSEXITS_H
-
 #if @HAVE_SYSEXITS_H@
 
 /* IRIX 6.5 has an <unistd.h> that defines a macro EX_OK with a nonzero
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index 400f250259..8016203060 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -26,12 +26,12 @@
  * wctrans_t, and wctype_t are not yet implemented.
  */
 
+#ifndef _GL_WCTYPE_H
+
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#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