]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR gold/17473: Fix gold build with system C++ headers that use <ctype.h>.
authorRoland McGrath <mcgrathr@chromium.org>
Thu, 17 Dec 2015 00:35:43 +0000 (16:35 -0800)
committerRoland McGrath <mcgrathr@chromium.org>
Thu, 17 Dec 2015 00:35:43 +0000 (16:35 -0800)
gold/
PR gold/17473
* binary.cc: Move #include "safe-ctype.h" to be last #include.

(cherry picked from commit 95c29a83ebadd0038fd304539a83c5e90798c1b9)

gold/ChangeLog
gold/binary.cc

index dbe5a9e559c1537a09bb650f7eb3e1f40fe04b9f..c6ce6f366e54ef99c5aa9ae836a59e890c3cae8f 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-16  Roland McGrath  <mcgrathr@google.com>
+
+       PR ld/17473
+       * binary.cc: Move #include "safe-ctype.h" to be last #include.
+
 2015-07-26  Doug Kwan  <dougkwan@google.com>
 
        Apply from master
index 4dab52cd6bfd108b849bf4b21cf3221c2618b5b7..94973a1ba0116973e6576fd30be3c5a42bb545e2 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <cerrno>
 #include <cstring>
-#include "safe-ctype.h"
 
 #include "elfcpp.h"
 #include "stringpool.h"
 #include "output.h"
 #include "binary.h"
 
+// safe-ctype.h interferes with macros defined by the system <ctype.h>.
+// Some C++ system headers might include <ctype.h> and rely on its macro
+// definitions being intact.  So make sure that safe-ctype.h is included
+// only after any C++ system headers, whether directly here (above) or via
+// other local header files (e.g. #include <string> in "binary.h").
+#include "safe-ctype.h"
+
 // Support for reading binary files as input.  These become blobs in
 // the final output.  These files are treated as though they have a
 // single .data section and define three symbols: