From patchwork Wed May 30 00:18:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 27547 Received: (qmail 105194 invoked by alias); 30 May 2018 00:18:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 105173 invoked by uid 89); 30 May 2018 00:18:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=H*Ad:D*ca, sk:header_, H*RU:sk:barracu, Hx-spam-relays-external:sk:barracu X-HELO: barracuda.ebox.ca Received: from barracuda.ebox.ca (HELO barracuda.ebox.ca) (96.127.255.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 May 2018 00:18:47 +0000 X-ASG-Debug-ID: 1527639519-0c856e5f35661670001-fS2M51 Received: from smtp.ebox.ca (smtp.electronicbox.net [96.127.255.82]) by barracuda.ebox.ca with ESMTP id zgLQQQS8Wcll3pHi (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 29 May 2018 20:18:39 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.lan (unknown [192.222.164.54]) by smtp.ebox.ca (Postfix) with ESMTP id 840BB441B21; Tue, 29 May 2018 20:18:39 -0400 (EDT) From: Simon Marchi X-Barracuda-Effective-Source-IP: 192-222-164-54.qc.cable.ebox.net[192.222.164.54] X-Barracuda-Apparent-Source-IP: 192.222.164.54 X-Barracuda-RBL-IP: 192.222.164.54 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [pushed] Remove "struct" keyword in range-based for loops Date: Tue, 29 May 2018 20:18:38 -0400 X-ASG-Orig-Subj: [pushed] Remove "struct" keyword in range-based for loops Message-Id: <20180530001838.23796-1-simon.marchi@polymtl.ca> X-Barracuda-Connect: smtp.electronicbox.net[96.127.255.82] X-Barracuda-Start-Time: 1527639519 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 6137 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_SC0_MV0713, BSF_SC0_MV0713_2 X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.51404 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.30 BSF_SC0_MV0713_2 BSF_SC0_MV0713_2 0.20 BSF_SC0_MV0713 Custom rule MV0713 X-IsSubscribed: yes 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(-) 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 + + * 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 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 &&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 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::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;