]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
dwarf2read: fix compilation issue with gcc 4.8
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 26 Aug 2019 01:30:02 +0000 (21:30 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 26 Aug 2019 01:30:12 +0000 (21:30 -0400)
gcc 4.8 (and probably other versions too) doesn't like that the local
variable symbol_linkage has the same name as the enum class defined in
the same context:

      CXX    dwarf2read.o
    /home/smarchi/src/binutils-gdb/gdb/dwarf2read.c: In member function ‘dwarf2_per_cu_data* dw2_debug_names_iterator::next()’:
    /home/smarchi/src/binutils-gdb/gdb/dwarf2read.c:5850:22: error: ‘symbol_linkage’ is not a class, namespace, or enumeration
       } symbol_linkage = symbol_linkage::unknown;
                      ^

Rename the local variable to avoid this.

This problem was originally reported with the Netbsd builder on the
buildbot, which uses gcc 5.5, I believe.  I am not able to test it on
that builder right now, but chances are that the fix will work there
too.

gdb/ChangeLog:

* dwarf2read.c (dw2_debug_names_iterator::next): Rename local
variable symbol_linkage to symbol_linkage_.

gdb/ChangeLog
gdb/dwarf2read.c

index 5f64ca6d4a94d3b47ddb99ee7a1ffd6e947a78e0..d4b1e539c392e28f4dddafb309ffb70523732a83 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-25  Simon Marchi  <simon.marchi@efficios.com>
+
+       * dwarf2read.c (dw2_debug_names_iterator::next): Rename local
+       variable symbol_linkage to symbol_linkage_.
+
 2019-08-25  Simon Marchi  <simon.marchi@efficios.com>
 
        * dwarf2read.c (dw2_debug_names_iterator::next): Use enum to
index a0b989fd0c2e5d508399eee4c808404638f3d3c2..af4af195a0925ae2036754f762eec339b231ea3a 100644 (file)
@@ -5847,7 +5847,7 @@ dw2_debug_names_iterator::next ()
     unknown,
     static_,
     extern_,
-  } symbol_linkage = symbol_linkage::unknown;
+  } symbol_linkage_ = symbol_linkage::unknown;
   dwarf2_per_cu_data *per_cu = NULL;
   for (const mapped_debug_names::index_val::attr &attr : indexval.attr_vec)
     {
@@ -5899,12 +5899,12 @@ dw2_debug_names_iterator::next ()
        case DW_IDX_GNU_internal:
          if (!m_map.augmentation_is_gdb)
            break;
-         symbol_linkage = symbol_linkage::static_;
+         symbol_linkage_ = symbol_linkage::static_;
          break;
        case DW_IDX_GNU_external:
          if (!m_map.augmentation_is_gdb)
            break;
-         symbol_linkage = symbol_linkage::extern_;
+         symbol_linkage_ = symbol_linkage::extern_;
          break;
        }
     }
@@ -5914,10 +5914,11 @@ dw2_debug_names_iterator::next ()
     goto again;
 
   /* Check static vs global.  */
-  if (symbol_linkage != symbol_linkage::unknown && m_block_index.has_value ())
+  if (symbol_linkage_ != symbol_linkage::unknown && m_block_index.has_value ())
     {
        const bool want_static = *m_block_index == STATIC_BLOCK;
-       const bool symbol_is_static = symbol_linkage == symbol_linkage::static_;
+       const bool symbol_is_static =
+         symbol_linkage_ == symbol_linkage::static_;
        if (want_static != symbol_is_static)
          goto again;
     }