Sourceware Bugzilla – Attachment 6397 Details for
Bug 14072
Incorrect handling of config.h and/or sysdep.h causing problems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Draft implementation of config.h include-guard
binutils-include-guard.patch (text/plain), 6.85 KB, created by
Daniel Richard G.
on 2012-05-07 17:08:59 UTC
(
hide
)
Description:
Draft implementation of config.h include-guard
Filename:
MIME Type:
Creator:
Daniel Richard G.
Created:
2012-05-07 17:08:59 UTC
Size:
6.85 KB
patch
obsolete
>Index: bfd/configure.in >=================================================================== >RCS file: /cvs/src/src/bfd/configure.in,v >retrieving revision 1.313 >diff -u -r1.313 configure.in >--- bfd/configure.in 3 May 2012 13:11:54 -0000 1.313 >+++ bfd/configure.in 7 May 2012 16:42:05 -0000 >@@ -117,6 +117,14 @@ > > AC_CONFIG_HEADERS(config.h:config.in) > >+AH_VERBATIM([00_CONFIG_H_CHECK], >+[/* Check that config.h is #included before system headers >+ * (this works only for glibc, but that should be enough) >+ */ >+#if defined(__GLIBC__) >+# error config.h must be #included before system headers >+#endif]) >+ > if test -z "$target" ; then > AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) > fi >Index: bfd/bfd-in.h >=================================================================== >RCS file: /cvs/src/src/bfd/bfd-in.h,v >retrieving revision 1.162 >diff -u -r1.162 bfd-in.h >--- bfd/bfd-in.h 24 Apr 2012 05:12:29 -0000 1.162 >+++ bfd/bfd-in.h 7 May 2012 16:42:05 -0000 >@@ -25,6 +25,10 @@ > #ifndef __BFD_H_SEEN__ > #define __BFD_H_SEEN__ > >+#ifndef PACKAGE >+#error config.h must be included before this header >+#endif >+ > #ifdef __cplusplus > extern "C" { > #endif >Index: bfd/sysdep.h >=================================================================== >RCS file: /cvs/src/src/bfd/sysdep.h,v >retrieving revision 1.21 >diff -u -r1.21 sysdep.h >--- bfd/sysdep.h 2 Sep 2009 07:18:37 -0000 1.21 >+++ bfd/sysdep.h 7 May 2012 16:42:05 -0000 >@@ -23,6 +23,10 @@ > #ifndef BFD_SYSDEP_H > #define BFD_SYSDEP_H > >+#ifdef PACKAGE >+#error sysdep.h must be included in lieu of config.h >+#endif >+ > #include "config.h" > > #include "ansidecl.h" >Index: binutils/configure.in >=================================================================== >RCS file: /cvs/src/src/binutils/configure.in,v >retrieving revision 1.109 >diff -u -r1.109 configure.in >--- binutils/configure.in 2 May 2012 14:51:05 -0000 1.109 >+++ binutils/configure.in 7 May 2012 16:42:05 -0000 >@@ -44,6 +44,14 @@ > > AC_CONFIG_HEADERS(config.h:config.in) > >+AH_VERBATIM([00_CONFIG_H_CHECK], >+[/* Check that config.h is #included before system headers >+ * (this works only for glibc, but that should be enough) >+ */ >+#if defined(__GLIBC__) >+# error config.h must be #included before system headers >+#endif]) >+ > if test -z "$target" ; then > AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) > fi >Index: gas/configure.in >=================================================================== >RCS file: /cvs/src/src/gas/configure.in,v >retrieving revision 1.228 >diff -u -r1.228 configure.in >--- gas/configure.in 6 Apr 2012 16:48:57 -0000 1.228 >+++ gas/configure.in 7 May 2012 16:42:05 -0000 >@@ -58,6 +58,14 @@ > # Generate a header file > AC_CONFIG_HEADERS(config.h:config.in) > >+AH_VERBATIM([00_CONFIG_H_CHECK], >+[/* Check that config.h is #included before system headers >+ * (this works only for glibc, but that should be enough) >+ */ >+#if defined(__GLIBC__) >+# error config.h must be #included before system headers >+#endif]) >+ > # If we are on a DOS filesystem, we must use gdb.ini rather than > # .gdbinit. > case "${host}" in >Index: ld/configure.in >=================================================================== >RCS file: /cvs/src/src/ld/configure.in,v >retrieving revision 1.74 >diff -u -r1.74 configure.in >--- ld/configure.in 6 Apr 2012 16:49:02 -0000 1.74 >+++ ld/configure.in 7 May 2012 16:42:06 -0000 >@@ -124,6 +124,14 @@ > > AC_CONFIG_HEADERS([config.h:config.in]) > >+AH_VERBATIM([00_CONFIG_H_CHECK], >+[/* Check that config.h is #included before system headers >+ * (this works only for glibc, but that should be enough) >+ */ >+#if defined(__GLIBC__) >+# error config.h must be #included before system headers >+#endif]) >+ > if test -z "$target" ; then > AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) > fi >Index: ld/sysdep.h >=================================================================== >RCS file: /cvs/src/src/ld/sysdep.h,v >retrieving revision 1.10 >diff -u -r1.10 sysdep.h >--- ld/sysdep.h 15 Oct 2010 16:21:41 -0000 1.10 >+++ ld/sysdep.h 7 May 2012 16:42:06 -0000 >@@ -22,6 +22,10 @@ > #ifndef LD_SYSDEP_H > #define LD_SYSDEP_H > >+#ifdef PACKAGE >+#error sysdep.h must be included in lieu of config.h >+#endif >+ > #include "config.h" > > #include <stdio.h> >Index: opcodes/configure.in >=================================================================== >RCS file: /cvs/src/src/opcodes/configure.in,v >retrieving revision 1.103 >diff -u -r1.103 configure.in >--- opcodes/configure.in 3 May 2012 13:12:05 -0000 1.103 >+++ opcodes/configure.in 7 May 2012 16:42:06 -0000 >@@ -45,6 +45,14 @@ > > AC_CONFIG_HEADERS(config.h:config.in) > >+AH_VERBATIM([00_CONFIG_H_CHECK], >+[/* Check that config.h is #included before system headers >+ * (this works only for glibc, but that should be enough) >+ */ >+#if defined(__GLIBC__) >+# error config.h must be #included before system headers >+#endif]) >+ > if test -z "$target" ; then > AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) > fi >Index: opcodes/sysdep.h >=================================================================== >RCS file: /cvs/src/src/opcodes/sysdep.h,v >retrieving revision 1.8 >diff -u -r1.8 sysdep.h >--- opcodes/sysdep.h 2 Sep 2009 07:20:30 -0000 1.8 >+++ opcodes/sysdep.h 7 May 2012 16:42:06 -0000 >@@ -27,6 +27,10 @@ > trying to replace often did that. If it can be dropped from this > file (check in a non-ANSI environment!), it should be. */ > >+#ifdef PACKAGE >+#error sysdep.h must be included in lieu of config.h >+#endif >+ > #include "config.h" > > #include "ansidecl.h" >Index: gold/configure.ac >=================================================================== >RCS file: /cvs/src/src/gold/configure.ac,v >retrieving revision 1.72 >diff -u -r1.72 configure.ac >--- gold/configure.ac 6 Apr 2012 16:48:58 -0000 1.72 >+++ gold/configure.ac 7 May 2012 16:42:06 -0000 >@@ -11,6 +11,14 @@ > > AM_CONFIG_HEADER(config.h:config.in) > >+AH_VERBATIM([00_CONFIG_H_CHECK], >+[/* Check that config.h is #included before system headers >+ * (this works only for glibc, but that should be enough) >+ */ >+#if defined(__GLIBC__) >+# error config.h must be #included before system headers >+#endif]) >+ > AC_ARG_WITH(sysroot, > [ --with-sysroot[=DIR] search for usr/lib et al within DIR], > [sysroot=$withval], [sysroot=no]) >Index: libiberty/configure.ac >=================================================================== >RCS file: /cvs/src/src/libiberty/configure.ac,v >retrieving revision 1.60 >diff -u -r1.60 configure.ac >--- libiberty/configure.ac 22 Aug 2011 17:16:25 -0000 1.60 >+++ libiberty/configure.ac 7 May 2012 16:42:06 -0000 >@@ -163,6 +163,14 @@ > dnl AM_CONFIG_HEADER(config.h:config.in) > AC_CONFIG_HEADER(config.h:config.in) > >+AH_VERBATIM([00_CONFIG_H_CHECK], >+[/* Check that config.h is #included before system headers >+ * (this works only for glibc, but that should be enough) >+ */ >+#if defined(__GLIBC__) >+# error config.h must be #included before system headers >+#endif]) >+ > dnl When we start using automake: > dnl AM_MAINTAINER_MODE > dnl AC_EXEEXT
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 14072
: 6397 |
6408
|
6409
|
6413