]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Clean up DW_TAG_namelist handling in new_symbol
authorTom Tromey <tom@tromey.com>
Sat, 8 Feb 2025 19:43:21 +0000 (12:43 -0700)
committerTom Tromey <tom@tromey.com>
Thu, 20 Feb 2025 00:55:26 +0000 (17:55 -0700)
In dwarf2/read.c:new_symbol, DW_TAG_namelist is listed in the same
part of the "switch" as other tags.  However, it effectively shares no
code with these.  This patch splits it into its own case.

Longer term I think new_symbol should be split up drastically.

gdb/dwarf2/read.c

index 4e30a5665c6c51c5bc510a939f3414b2a4256a0c..475269dad57cb50407393c55919ad482691d5e29 100644 (file)
@@ -18780,17 +18780,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
        case DW_TAG_union_type:
        case DW_TAG_set_type:
        case DW_TAG_enumeration_type:
-       case DW_TAG_namelist:
-         if (die->tag == DW_TAG_namelist)
-           {
-             sym->set_aclass_index (LOC_STATIC);
-             sym->set_domain (VAR_DOMAIN);
-           }
-         else if (cu->lang () == language_c
-                  || cu->lang () == language_cplus
-                  || cu->lang () == language_objc
-                  || cu->lang () == language_opencl
-                  || cu->lang () == language_minimal)
+         if (cu->lang () == language_c
+             || cu->lang () == language_cplus
+             || cu->lang () == language_objc
+             || cu->lang () == language_opencl
+             || cu->lang () == language_minimal)
            {
              /* These languages have a tag namespace.  Note that
                 there's a special hack for C++ in the matching code,
@@ -18884,6 +18878,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
          sym->set_domain (COMMON_BLOCK_DOMAIN);
          list_to_add = cu->list_in_scope;
          break;
+       case DW_TAG_namelist:
+         sym->set_aclass_index (LOC_STATIC);
+         sym->set_domain (VAR_DOMAIN);
+         list_to_add = cu->list_in_scope;
+         break;
        default:
          /* Not a tag we recognize.  Hopefully we aren't processing
             trash data, but since we must specifically ignore things