Don't check dwarf2_name in process_enumeration_scope

Message ID 20240826192305.77171-1-tromey@adacore.com
State New
Headers
Series Don't check dwarf2_name in process_enumeration_scope |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom Tromey Aug. 26, 2024, 7:23 p.m. UTC
  I noticed that process_enumeration_scope checks the result of
dwarf2_name.  However, this isn't needed, because new_symbol does the
same check.  This patch removes the unnecessary code.
---
 gdb/dwarf2/read.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
  

Comments

Keith Seitz Aug. 28, 2024, 7:52 p.m. UTC | #1
On 8/26/24 12:23 PM, Tom Tromey wrote:
> I noticed that process_enumeration_scope checks the result of
> dwarf2_name.  However, this isn't needed, because new_symbol does the
> same check.  This patch removes the unnecessary code.

Yes, indeed it does! Good catch.

Reviewed-by: Keith Seitz <keiths@redhat.com>

Keith
  

Patch

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index e75bfb7ab04..189011dd144 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -13262,7 +13262,6 @@  process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
   if (die->child != NULL)
     {
       struct die_info *child_die;
-      const char *name;
 
       child_die = die->child;
       while (child_die && child_die->tag)
@@ -13272,11 +13271,7 @@  process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
 	      process_die (child_die, cu);
 	    }
 	  else
-	    {
-	      name = dwarf2_name (child_die, cu);
-	      if (name)
-		new_symbol (child_die, this_type, cu);
-	    }
+	    new_symbol (child_die, this_type, cu);
 
 	  child_die = child_die->sibling;
 	}