gdb: Fix building with latest libc++
authorManoj Gupta <manojgupta@google.com>
Mon, 17 Apr 2023 20:33:15 +0000 (13:33 -0700)
committerRoland McGrath <mcgrathr@google.com>
Sat, 29 Apr 2023 07:35:11 +0000 (00:35 -0700)
commite0f4b3ec5f36ff90dbea21aab2190fb4565ca67b
tree4bc6cccc146f7213100c5f1fc9642a3eb63fbdb4
parentbc752bfbd98b6c2b02d59ed0a6c7ca88fbf4e3e0
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
15 files changed:
gdb/cp-name-parser.y
gdb/cp-support.c
gdb/dictionary.c
gdb/disasm.c
gdb/dwarf2/cooked-index.c
gdb/mi/mi-cmd-stack.c
gdb/minsyms.c
gdb/or1k-tdep.c
gdb/printcmd.c
gdb/riscv-tdep.c
gdb/tui/tui-layout.c
gdb/tui/tui-winsource.c
gdb/xml-support.c
gdbsupport/common-utils.cc
gdbsupport/gdb-safe-ctype.h