summaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-09-19 21:06:10 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-09-20 07:59:53 -0400
commit56d9e3c5623d9ebaffb4532a503e67203e4d5488 (patch)
tree66f05e448a0cbcd0fedc33acee4a4a456559790a /gdbsupport
parent6a7f57668afcd841e8fc6b507a27bb20e9209fa9 (diff)
gdbsupport/gdb_proc_service.h: use decltype instead of typeof
Bug 28341 shows that GDB fails to compile when built with -std=c++11. I don't know much about the use case, but according to the author of the bug: I encountered the scenario where CXX is set to "g++ -std=c++11" when I try to compile binutils under GCC as part of the GCC 3-stage compilation, which is common for building a cross-compiler. The author of the bug suggests using __typeof__ instead of typeof. But since we're using C++, we might as well use decltype, which is standard. This is what this patch does. The failure (and fix) can be observed by configuring GDB with CXX="g++ -std=c++11": CXX linux-low.o In file included from /home/simark/src/binutils-gdb/gdbserver/gdb_proc_service.h:22, from /home/simark/src/binutils-gdb/gdbserver/linux-low.h:27, from /home/simark/src/binutils-gdb/gdbserver/linux-low.cc:20: /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/gdb_proc_service.h:177:50: error: expected constructor, destructor, or type conversion before (token 177 | __attribute__((visibility ("default"))) typeof (SYM) SYM | ^ /home/simark/src/binutils-gdb/gdbserver/../gdbsupport/gdb_proc_service.h:179:1: note: in expansion of macro PS_EXPORT 179 | PS_EXPORT (ps_get_thread_area); | ^~~~~~~~~ Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28341 Change-Id: I84fbaae938209d8d935ca08dec9b7e6a0dd1bda0
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/gdb_proc_service.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdbsupport/gdb_proc_service.h b/gdbsupport/gdb_proc_service.h
index db169acc8c..1131a40f7d 100644
--- a/gdbsupport/gdb_proc_service.h
+++ b/gdbsupport/gdb_proc_service.h
@@ -174,7 +174,7 @@ EXTERN_C_POP
-fvisibility=hidden. */
#define PS_EXPORT(SYM) \
- __attribute__((visibility ("default"))) typeof (SYM) SYM
+ __attribute__((visibility ("default"))) decltype (SYM) SYM
PS_EXPORT (ps_get_thread_area);
PS_EXPORT (ps_getpid);