gdb: use decltype instead of typeof in dwarf2/read.c
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 12 Apr 2022 16:30:09 +0000 (12:30 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 12 Apr 2022 18:09:55 +0000 (14:09 -0400)
When building with -std=c++11, I get:

  CXX    dwarf2/read.o
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c: In function â€˜void dwarf2_build_psymtabs_hard(dwarf2_per_objfile*)’:
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:7130:23: error: expected type-specifier before â€˜typeof’
 7130 |     using iter_type = typeof (per_bfd->all_comp_units.begin ());
      |                       ^~~~~~

This is because typeof is a GNU extension.  Use C++'s decltype keyword
instead.

Change-Id: Ieca2e8d25e50f71dc6c615a405a972a54de3ef14

gdb/dwarf2/read.c

index 9e8527a7fc13a132e52e9914688b50e78c8bebc3..7c148aecdf5aec45b02374b90a0d4f92c14cd909 100644 (file)
@@ -7127,7 +7127,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
     /* Ensure that complaints are handled correctly.  */
     complaint_interceptor complaint_handler;
 
-    using iter_type = typeof (per_bfd->all_comp_units.begin ());
+    using iter_type = decltype (per_bfd->all_comp_units.begin ());
 
     /* Each thread returns a pair holding a cooked index, and a vector
        of errors that should be printed.  The latter is done because