https://sourceware.org/bugzilla/show_bug.cgi?id=28341
Bug ID: 28341 Summary: gdb_proc_service.h use of non-standard typeof Product: binutils Version: 2.38 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: liulk at likai dot org Target Milestone: --- This commit introduced a macro PS_EXPORT that uses a non-standard typeof. https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=790f17188a22e722bab9915e1d50307f8cb7c0f9 This causes problems when CXX is set to "g++ -std=c++11", which does not recognize the non-standard typeof. It must use the alternate keyword __typeof__. https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html#Alternate-Keywords 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. https://gcc.gnu.org/install/build.html When using non-standard typeof with "g++ -std=c++11", it causes compilation errors like these: make[2]: Entering directory '/tmp/build/binutils/gdbserver' g++ -std=c++11 -I. -I/sources/gcc/binutils/gdbserver -I/sources/gcc/binutils /gdbserver/../gdb/regformats -I/sources/gcc/binutils/gdbserver/.. -I/sources/gcc /binutils/gdbserver/../include -I/sources/gcc/binutils/gdbserver/../gdb -I/sourc es/gcc/binutils/gdbserver/../gnulib/import -I../gnulib/import -I/sources/gcc/bin utils/gdbserver/.. -I.. -pthread -Wall -Wpointer-arith -Wno-unused -Wunused-va lue -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty -body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wn o-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-f allthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-cop y-dtor -Wredundant-move -Wmissing-declarations -Wstrict-null-sentinel -Wformat - Wformat-nonliteral -DGDBSERVER -g -c -o linux-x86-low.o -MT linux-x86-low.o -MMD -MP -MF ./.deps/linux-x86-low.Tpo /sources/gcc/binutils/gdbserver/linux-x8 6-low.cc In file included from /sources/gcc/binutils/gdbserver/gdb_proc_service.h:22, from /sources/gcc/binutils/gdbserver/linux-low.h:27, from /sources/gcc/binutils/gdbserver/linux-x86-low.cc:24: /sources/gcc/binutils/gdbserver/../gdbsupport/gdb_proc_service.h:177:50: error: expected constructor, destructor, or type conversion before '(' token 177 | __attribute__((visibility ("default"))) typeof (SYM) SYM | ^ /sources/gcc/binutils/gdbserver/../gdbsupport/gdb_proc_service.h:179:1: note: in expansion of macro 'PS_EXPORT' 179 | PS_EXPORT (ps_get_thread_area); | ^~~~~~~~~ /sources/gcc/binutils/gdbserver/../gdbsupport/gdb_proc_service.h:177:50: error: expected constructor, destructor, or type conversion before '(' token 177 | __attribute__((visibility ("default"))) typeof (SYM) SYM | ^ /sources/gcc/binutils/gdbserver/../gdbsupport/gdb_proc_service.h:180:1: note: in expansion of macro 'PS_EXPORT' 180 | PS_EXPORT (ps_getpid); | ^~~~~~~~~ /sources/gcc/binutils/gdbserver/../gdbsupport/gdb_proc_service.h:177:50: error: expected constructor, destructor, or type conversion before '(' token 177 | __attribute__((visibility ("default"))) typeof (SYM) SYM | ^ /sources/gcc/binutils/gdbserver/../gdbsupport/gdb_proc_service.h:181:1: note: in expansion of macro 'PS_EXPORT' 181 | PS_EXPORT (ps_lcontinue); | ^~~~~~~~~ The fix is simply to change the definition of PS_EXPORT to use __typeof__ like this: #define PS_EXPORT(SYM) \ __attribute__((visibility ("default"))) __typeof__ (SYM) SYM -- You are receiving this mail because: You are on the CC list for the bug.