This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_26-branch] PR gold/17473: Fix gold build with system C++ headers that use <ctype.h>.;h=03f87942b6a216bc5cd07c5cfbb5ce5ad8185133

commit 03f87942b6a216bc5cd07c5cfbb5ce5ad8185133
Author: Roland McGrath <>
Date:   Wed Dec 16 16:35:59 2015 -0800

    PR gold/17473: Fix gold build with system C++ headers that use <ctype.h>.
    	PR gold/17473
    	* Move #include "safe-ctype.h" to be last #include.
    (cherry picked from commit 95c29a83ebadd0038fd304539a83c5e90798c1b9)

 gold/ChangeLog | 5 +++++
 gold/ | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/gold/ChangeLog b/gold/ChangeLog
index 5f3ec40..b283a88 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-16  Roland McGrath  <>
+	PR ld/17473
+	* Move #include "safe-ctype.h" to be last #include.
 2015-12-10  Alan Modra  <>
 	Apply from master.
diff --git a/gold/ b/gold/
index 12ca296..52df81a 100644
--- a/gold/
+++ b/gold/
@@ -24,7 +24,6 @@
 #include <cerrno>
 #include <cstring>
-#include "safe-ctype.h"
 #include "elfcpp.h"
 #include "stringpool.h"
@@ -32,6 +31,13 @@
 #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:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]