Remove "struct" keyword in range-based for loops
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 30 May 2018 00:13:04 +0000 (20:13 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Wed, 30 May 2018 00:13:06 +0000 (20:13 -0400)
I get this kind of errors with GCC 6.3.0:

/home/simark/src/binutils-gdb/gdb/breakpoint.c: In function 'void print_solib_event(int)':
/home/simark/src/binutils-gdb/gdb/breakpoint.c:4618:12: error: types may not be defined in a for-range-declaration [-Werror]
       for (struct so_list *iter : current_program_space->added_solibs)
            ^~~~~~

Removing the struct keyword makes it happy.

gdb/ChangeLog:

* breakpoint.c (print_solib_event, check_status_catch_solib):
Remove struct keyword in range-based for loops.
* dbxread.c (find_corresponding_bincl_psymtab): Likewise.
* dwarf2read.c (compute_delayed_physnames, rust_union_quirks);
Likewise.
* linespec.c (find_superclass_methods, search_minsyms_for_name):
Likewise.
* symfile.c (addr_info_make_relative): Likewise.
* thread.c (value_in_thread_stack_temporaries): Likewise.

gdb/ChangeLog
gdb/breakpoint.c
gdb/dbxread.c
gdb/dwarf2read.c
gdb/linespec.c
gdb/symfile.c
gdb/thread.c

index ff2f145fb99654dd48311a3a105227322eb4931d..0a730c88f94a31792cacd6a2c097ffdfea8c0338 100644 (file)
@@ -1,3 +1,15 @@
+2018-05-29  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * breakpoint.c (print_solib_event, check_status_catch_solib):
+       Remove struct keyword in range-based for loops.
+       * dbxread.c (find_corresponding_bincl_psymtab): Likewise.
+       * dwarf2read.c (compute_delayed_physnames, rust_union_quirks);
+       Likewise.
+       * linespec.c (find_superclass_methods, search_minsyms_for_name):
+       Likewise.
+       * symfile.c (addr_info_make_relative): Likewise.
+       * thread.c (value_in_thread_stack_temporaries): Likewise.
+
 2018-05-29  Weimin Pan  <weimin.pan@oracle.com>
 
        * minsyms.h (lookup_minimal_symbol_and_objfile): Remove declaration.
index 0cc968894b8e99cbbe303e0b56fa72961268a127..f3101af96fbd80d73e9a35e228b706de3b5a0c84 100644 (file)
@@ -4615,7 +4615,7 @@ print_solib_event (int is_catchpoint)
       current_uiout->text (_("  Inferior loaded "));
       ui_out_emit_list list_emitter (current_uiout, "added");
       bool first = true;
-      for (struct so_list *iter : current_program_space->added_solibs)
+      for (so_list *iter : current_program_space->added_solibs)
        {
          if (!first)
            current_uiout->text ("    ");
@@ -8004,7 +8004,7 @@ check_status_catch_solib (struct bpstats *bs)
 
   if (self->is_load)
     {
-      for (struct so_list *iter : current_program_space->added_solibs)
+      for (so_list *iter : current_program_space->added_solibs)
        {
          if (!self->regex
              || self->compiled->exec (iter->so_name, 0, NULL, 0) == 0)
index c5acae9583f09ebe1c11eee9a743eda0f12e7182..1b524ec0e227f49d6bfa2ba16bbbc5829b8f60d2 100644 (file)
@@ -864,7 +864,7 @@ dbx_next_symbol_text (struct objfile *objfile)
 static struct partial_symtab *
 find_corresponding_bincl_psymtab (const char *name, int instance)
 {
-  for (struct header_file_location &bincl : *bincl_list)
+  for (const header_file_location &bincl : *bincl_list)
     if (bincl.instance == instance
        && strcmp (name, bincl.name) == 0)
       return bincl.pst;
index 834bce776ab3f7323c440a68a8ffcb019347d2f9..d5b890b4ab3fea964b4bc9bfac046b7f6fb6b06e 100644 (file)
@@ -9667,7 +9667,7 @@ compute_delayed_physnames (struct dwarf2_cu *cu)
     return;
   gdb_assert (cu->language == language_cplus);
 
-  for (struct delayed_method_info &mi : cu->method_list)
+  for (const delayed_method_info &mi : cu->method_list)
     {
       const char *physname;
       struct fn_fieldlist *fn_flp
@@ -10086,8 +10086,8 @@ static void
 rust_union_quirks (struct dwarf2_cu *cu)
 {
   gdb_assert (cu->language == language_rust);
-  for (struct type *type : cu->rust_unions)
-    quirk_rust_enum (type, cu->per_cu->dwarf2_per_objfile->objfile);
+  for (type *type_ : cu->rust_unions)
+    quirk_rust_enum (type_, cu->per_cu->dwarf2_per_objfile->objfile);
   /* We don't need this any more.  */
   cu->rust_unions.clear ();
 }
index 835650750cfd165d3f09764d9ff6f47deab2a5b6..a60f2742db1992d8abd27ce790d70742f3778768 100644 (file)
@@ -3697,7 +3697,7 @@ find_superclass_methods (std::vector<struct type *> &&superclasses,
     {
       std::vector<struct type *> new_supers;
 
-      for (struct type *t : superclasses)
+      for (type *t : superclasses)
        find_methods (t, name_lang, name, result_names, &new_supers);
 
       if (result_names->size () != old_len || new_supers.empty ())
@@ -4464,7 +4464,7 @@ search_minsyms_for_name (struct collect_info *info,
         classification as the very first minsym in the list.  */
       classification = classify_mtype (MSYMBOL_TYPE (minsyms[0].minsym));
 
-      for (const struct bound_minimal_symbol &item : minsyms)
+      for (const bound_minimal_symbol &item : minsyms)
        {
          if (classify_mtype (MSYMBOL_TYPE (item.minsym)) != classification)
            break;
index a57bd6a59370b562a63b9f9a9052ac7a04e1ca8c..05545cddfaa02d093a78e6f1712d34ff583768a5 100644 (file)
@@ -541,7 +541,7 @@ addr_info_make_relative (section_addr_info *addrs, bfd *abfd)
 
   std::vector<const struct other_sections *>::iterator abfd_sorted_iter
     = abfd_addrs_sorted.begin ();
-  for (const struct other_sections *sect : addrs_sorted)
+  for (const other_sections *sect : addrs_sorted)
     {
       const char *sect_name = addr_section_name (sect->name.c_str ());
 
index a09d7e0ba086e224645d89adf0ba034522dc4d6a..f5a29f5cc142cf82a90c5dae296e9e5fe97598e4 100644 (file)
@@ -783,7 +783,7 @@ value_in_thread_stack_temporaries (struct value *val, ptid_t ptid)
   struct thread_info *tp = find_thread_ptid (ptid);
 
   gdb_assert (tp != NULL && tp->stack_temporaries_enabled);
-  for (struct value *v : tp->stack_temporaries)
+  for (value *v : tp->stack_temporaries)
     if (v == val)
       return true;