aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <mcgrathr@chromium.org>2015-12-16 16:35:43 -0800
committerRoland McGrath <mcgrathr@chromium.org>2015-12-16 16:35:43 -0800
commitaae60b2c1f276263ad100952e3c3364c7baa6a2b (patch)
tree86b19e6afce3b54dde69eb973e96a94615c2dd26
parente5127652315bb1f1dfb07168c1f4152938740776 (diff)
downloadgdb-aae60b2c1f276263ad100952e3c3364c7baa6a2b.zip
gdb-aae60b2c1f276263ad100952e3c3364c7baa6a2b.tar.gz
gdb-aae60b2c1f276263ad100952e3c3364c7baa6a2b.tar.bz2
PR gold/17473: Fix gold build with system C++ headers that use <ctype.h>.
gold/ PR gold/17473 * binary.cc: Move #include "safe-ctype.h" to be last #include. (cherry picked from commit 95c29a83ebadd0038fd304539a83c5e90798c1b9)
-rw-r--r--gold/ChangeLog5
-rw-r--r--gold/binary.cc8
2 files changed, 12 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index dbe5a9e..c6ce6f3 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -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
diff --git a/gold/binary.cc b/gold/binary.cc
index 4dab52c..94973a1 100644
--- a/gold/binary.cc
+++ b/gold/binary.cc
@@ -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: