forked from Imagelibrary/binutils-gdb
gdb: Fix building with latest libc++
Latest libc++[1] causes transitive include to <locale> when <mutex> or <thread> header is included. This causes gdb to not build[2] since <locale> defines isupper/islower etc. functions that are explicitly macroed-out in safe-ctype.h to prevent their use. Use the suggestion from libc++ to include <locale> internally when building in C++ mode to avoid build errors. Use safe-gdb-ctype.h as the include instead of "safe-ctype.h" to keep this isolated to gdb since rest of binutils does not seem to use much C++. [1]: https://reviews.llvm.org/D144331 [2]: https://issuetracker.google.com/issues/277967395
This commit is contained in:
committed by
Roland McGrath
parent
bc752bfbd9
commit
e0f4b3ec5f
@@ -23,7 +23,9 @@
|
||||
/* After safe-ctype.h is included, we can no longer use the host's
|
||||
ctype routines. Trying to do so results in compile errors. Code
|
||||
that uses safe-ctype.h that wants to refer to the locale-dependent
|
||||
ctype functions must call these wrapper versions instead. */
|
||||
ctype functions must call these wrapper versions instead.
|
||||
When compiling in C++ mode, also include <locale> before "safe-ctype.h"
|
||||
which also defines is* functions. */
|
||||
|
||||
static inline int
|
||||
gdb_isprint (int ch)
|
||||
@@ -41,6 +43,7 @@ gdb_isprint (int ch)
|
||||
#undef ISUPPER
|
||||
#undef ISXDIGIT
|
||||
|
||||
#include <locale>
|
||||
#include "safe-ctype.h"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user