[pushed] Remove "struct" keyword in range-based for loops

Message ID 20180530001838.23796-1-simon.marchi@polymtl.ca
State New, archived
Headers

Commit Message

Simon Marchi May 30, 2018, 12:18 a.m. UTC
  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    | 12 ++++++++++++
 gdb/breakpoint.c |  4 ++--
 gdb/dbxread.c    |  2 +-
 gdb/dwarf2read.c |  6 +++---
 gdb/linespec.c   |  4 ++--
 gdb/symfile.c    |  2 +-
 gdb/thread.c     |  2 +-
 7 files changed, 22 insertions(+), 10 deletions(-)
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ff2f145fb996..0a730c88f94a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0cc968894b8e..f3101af96fbd 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -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)
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index c5acae9583f0..1b524ec0e227 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -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;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 834bce776ab3..d5b890b4ab3f 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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 ();
 }
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 835650750cfd..a60f2742db19 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -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;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index a57bd6a59370..05545cddfaa0 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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 ());
 
diff --git a/gdb/thread.c b/gdb/thread.c
index a09d7e0ba086..f5a29f5cc142 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -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;