]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove "struct" from foreach statements
authorTom Tromey <tom@tromey.com>
Fri, 3 May 2019 23:21:36 +0000 (17:21 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 4 May 2019 00:06:37 +0000 (18:06 -0600)
Some versions of gcc have a bug that causes

    for (struct mumble : something)

... to give a compiler error.  We routinely work around this bug in
gdb, but apparently had not done so in a while.  This patch fixes the
remaining known cases of this problem.

gdb/ChangeLog
2019-05-03  Sandra Loosemore  <sandra@codesourcery.com>
    Tom Tromey  <tom@tromey.com>

* dictionary.c (collate_pending_symbols_by_language): Remove
"struct" from foreach.
* symtab.c (lookup_global_symbol_from_objfile)
(lookup_symbol_in_objfile_from_linkage_name): Remove "struct" from
foreach.
* ser-tcp.c (net_open): Remove "struct" from foreach.
* objfiles.c (objfile_relocate, objfile_rebase)
(objfile_has_symbols): Remove "struct" from foreach.
* minsyms.c (lookup_minimal_symbol_by_pc_section): Remove "struct"
from foreach.
* dwarf2read.c (handle_struct_member_die): Remove "struct" from
foreach.
* darwin-nat.c (thread_info_from_private_thread_info): Remove
"struct" from foreach.
* ada-lang.c (create_excep_cond_exprs)
(ada_exception_catchpoint_cond_string): Remove "struct" from
foreach.

gdb/ChangeLog
gdb/ada-lang.c
gdb/darwin-nat.c
gdb/dictionary.c
gdb/dwarf2read.c
gdb/minsyms.c
gdb/objfiles.c
gdb/ser-tcp.c
gdb/symtab.c

index 2172a030c7dedcf1bd3ac3216fc829232c8621eb..b4e3a55fe58f0330a209e925fbf5c613ee5d5f8f 100644 (file)
@@ -1,3 +1,24 @@
+2019-05-03  Sandra Loosemore  <sandra@codesourcery.com>
+           Tom Tromey  <tom@tromey.com>
+
+       * dictionary.c (collate_pending_symbols_by_language): Remove
+       "struct" from foreach.
+       * symtab.c (lookup_global_symbol_from_objfile)
+       (lookup_symbol_in_objfile_from_linkage_name): Remove "struct" from
+       foreach.
+       * ser-tcp.c (net_open): Remove "struct" from foreach.
+       * objfiles.c (objfile_relocate, objfile_rebase)
+       (objfile_has_symbols): Remove "struct" from foreach.
+       * minsyms.c (lookup_minimal_symbol_by_pc_section): Remove "struct"
+       from foreach.
+       * dwarf2read.c (handle_struct_member_die): Remove "struct" from
+       foreach.
+       * darwin-nat.c (thread_info_from_private_thread_info): Remove
+       "struct" from foreach.
+       * ada-lang.c (create_excep_cond_exprs)
+       (ada_exception_catchpoint_cond_string): Remove "struct" from
+       foreach.
+
 2019-05-03  Tom Tromey  <tromey@adacore.com>
 
        * ada-exp.y (convert_char_literal): Check suffix of each
index 1a566635b2dd02222d3614fc374180ee3244a9b2..20fb3497c034cacd34926b806736828f4ce991c6 100644 (file)
@@ -12483,7 +12483,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
      because the expression may hold the addresses of multiple symbols
      in some cases.  */
   std::multimap<program_space *, struct bp_location *> loc_map;
-  for (struct bp_location *bl = c->loc; bl != NULL; bl = bl->next)
+  for (bp_location *bl = c->loc; bl != NULL; bl = bl->next)
     loc_map.emplace (bl->pspace, bl);
 
   scoped_restore_current_program_space save_pspace;
@@ -13231,7 +13231,7 @@ ada_exception_catchpoint_cond_string (const char *excep_string,
   excep_string = ada_encode (excep_string);
   std::vector<struct bound_minimal_symbol> symbols
     = ada_lookup_simple_minsyms (excep_string);
-  for (const struct bound_minimal_symbol &msym : symbols)
+  for (const bound_minimal_symbol &msym : symbols)
     {
       if (!result.empty ())
        result += " or ";
index 8282ef27e61168307556ccfa4370a92c9335ee5a..e3368ce64716cd20c8acba408005b2ca454a9bfb 100644 (file)
@@ -1706,7 +1706,7 @@ darwin_attach_pid (struct inferior *inf)
 static struct thread_info *
 thread_info_from_private_thread_info (darwin_thread_info *pti)
 {
-  for (struct thread_info *it : all_threads ())
+  for (thread_info *it : all_threads ())
     {
       darwin_thread_info *iter_pti = get_darwin_thread_info (it);
 
index 88eff2fa439a2a4c60d5db0687ba5b07f26271d5..4e38b2e23401d08a6359006396e66cd0bd24ffdc 100644 (file)
@@ -932,7 +932,7 @@ collate_pending_symbols_by_language (const struct pending *symbol_list)
 {
   std::unordered_map<enum language, std::vector<symbol *>> nsyms;
 
-  for (const struct pending *list_counter = symbol_list;
+  for (const pending *list_counter = symbol_list;
        list_counter != nullptr; list_counter = list_counter->next)
     {
       for (int i = list_counter->nsyms - 1; i >= 0; --i)
index b0bdecf96fc8cc289aaf8953f67d1610da39b266..b5ea9e3cc0a7fffd1632b62751418bdb6f7469b8 100644 (file)
@@ -15962,7 +15962,7 @@ handle_struct_member_die (struct die_info *child_die, struct type *type,
         field for our sole member child.  */
       struct attribute *discr = dwarf2_attr (child_die, DW_AT_discr_value, cu);
 
-      for (struct die_info *variant_child = child_die->child;
+      for (die_info *variant_child = child_die->child;
           variant_child != NULL;
           variant_child = sibling_die (variant_child))
        {
index 8037329a862f020344c03a01281c755a19f099c4..9d29d880aabe1848a33f8fc35c21d524be6fa5b1 100644 (file)
@@ -721,7 +721,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
 
   gdb_assert (section != NULL);
 
-  for (struct objfile *objfile : section->objfile->separate_debug_objfiles ())
+  for (objfile *objfile : section->objfile->separate_debug_objfiles ())
     {
       CORE_ADDR pc = pc_in;
 
index 1b0ea29980d4f5592f3b949fb6181e80e3a81972..30823c2d8895ba55b4ff3757e41435091fd490ae 100644 (file)
@@ -864,7 +864,7 @@ objfile_relocate (struct objfile *objfile,
 
   changed |= objfile_relocate1 (objfile, new_offsets);
 
-  for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
+  for (::objfile *debug_objfile : objfile->separate_debug_objfiles ())
     {
       if (debug_objfile == objfile)
        continue;
@@ -919,7 +919,7 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
 {
   int changed = 0;
 
-  for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
+  for (::objfile *debug_objfile : objfile->separate_debug_objfiles ())
     changed |= objfile_rebase1 (debug_objfile, slide);
 
   /* Relocate breakpoints as necessary, after things are relocated.  */
@@ -960,7 +960,7 @@ objfile_has_full_symbols (struct objfile *objfile)
 int
 objfile_has_symbols (struct objfile *objfile)
 {
-  for (struct objfile *o : objfile->separate_debug_objfiles ())
+  for (::objfile *o : objfile->separate_debug_objfiles ())
     if (objfile_has_partial_symbols (o) || objfile_has_full_symbols (o))
       return 1;
   return 0;
index 927a28545700ce646d5a79453ebeb97088be69a6..5aa7105dc2cb4e8549f286994d918e3e7e4cd06a 100644 (file)
@@ -319,7 +319,7 @@ net_open (struct serial *scb, const char *name)
     {
       got_connrefused = false;
 
-      for (struct addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
+      for (addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
        {
          /* Iterate over the list of possible addresses to connect
             to.  For each, we'll try to connect and see if it
index 16e641a830b597b2fd4879d2baf51f333c37c7cb..0e1f7ead2941f4b7577771084f473463bcf66785 100644 (file)
@@ -2246,7 +2246,7 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
                                   const char *name,
                                   const domain_enum domain)
 {
-  for (struct objfile *objfile : main_objfile->separate_debug_objfiles ())
+  for (objfile *objfile : main_objfile->separate_debug_objfiles ())
     {
       struct block_symbol result
         = lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK, name, domain);
@@ -2333,7 +2333,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
   else
     main_objfile = objfile;
 
-  for (struct objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
+  for (::objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
     {
       struct block_symbol result;