gdbsupport/gdb_proc_service.h: use decltype instead of typeof
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 20 Sep 2021 01:06:10 +0000 (21:06 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 18 Jan 2022 18:14:19 +0000 (13:14 -0500)
commitdde49593693ae8f10babd050d44ec7ca84cf66c0
tree70e0066c94b6b439caf1a079857da3bacb841ba2
parent09dd501f76dd46388626ac87ce9285c9c691356d
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
gdbsupport/gdb_proc_service.h
This page took 0.023833 seconds and 4 git commands to generate.