From: Simon Marchi Date: Wed, 30 May 2018 00:13:04 +0000 (-0400) Subject: Remove "struct" keyword in range-based for loops X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=5294170687db7d997a00f88b765ef353121aa441;p=deliverable%2Fbinutils-gdb.git Remove "struct" keyword in range-based for loops 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ff2f145fb9..0a730c88f9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2018-05-29 Simon Marchi + + * 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 * minsyms.h (lookup_minimal_symbol_and_objfile): Remove declaration. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 0cc968894b..f3101af96f 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 c5acae9583..1b524ec0e2 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 834bce776a..d5b890b4ab 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 835650750c..a60f2742db 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3697,7 +3697,7 @@ find_superclass_methods (std::vector &&superclasses, { std::vector 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 a57bd6a593..05545cddfa 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::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 a09d7e0ba0..f5a29f5cc1 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;