From patchwork Mon Oct 16 14:15:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 23614 Received: (qmail 15516 invoked by alias); 16 Oct 2017 14:15:52 -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 15505 invoked by uid 89); 16 Oct 2017 14:15:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Oct 2017 14:15:50 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C6BC80465 for ; Mon, 16 Oct 2017 14:15:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3C6BC80465 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DB8B5FCA8 for ; Mon, 16 Oct 2017 14:15:48 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Work around GCC 6.3.1 bug Date: Mon, 16 Oct 2017 15:15:47 +0100 Message-Id: <1508163347-20268-1-git-send-email-palves@redhat.com> This commit works around a GCC 6.3.1 bug several people are hitting: https://sourceware.org/ml/gdb-patches/2017-09/msg00270.html https://sourceware.org/ml/gdb-patches/2017-10/msg00418.html It manifests like this: ../../../binutils-gdb/gdb/probe.c:68:12: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : probes) ^~~~~~ Fix it by renaming the range-for named variables to something different from their type's name. gdb/ChangeLog: 2017-10-16 Pedro Alves * elfread.c (probe_key_free): Rename range-for variable. * probe.c (parse_probes_in_pspace, find_probes_in_objfile) (find_probe_by_pc, collect_probes): Rename range-for variable. --- gdb/ChangeLog | 6 ++++++ gdb/elfread.c | 4 ++-- gdb/probe.c | 36 ++++++++++++++++++------------------ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1f72a24..cc81af8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-10-16 Pedro Alves + + * elfread.c (probe_key_free): Rename range-for variable. + * probe.c (parse_probes_in_pspace, find_probes_in_objfile) + (find_probe_by_pc, collect_probes): Rename range-for variable. + 2017-10-16 Yao Qi * features/Makefile (XMLTOC): Remove tic6x-*.xml. diff --git a/gdb/elfread.c b/gdb/elfread.c index 436d9b5..4e11071 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1340,8 +1340,8 @@ probe_key_free (bfd *abfd, void *d) { std::vector *probes = (std::vector *) d; - for (struct probe *probe : *probes) - probe->pops->destroy (probe); + for (probe *p : *probes) + p->pops->destroy (p); delete probes; } diff --git a/gdb/probe.c b/gdb/probe.c index b3dbf89..eb6f537 100644 --- a/gdb/probe.c +++ b/gdb/probe.c @@ -65,23 +65,23 @@ parse_probes_in_pspace (const struct probe_ops *probe_ops, const std::vector &probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); - for (struct probe *probe : probes) + for (probe *p : probes) { - if (probe_ops != &probe_ops_any && probe->pops != probe_ops) + if (probe_ops != &probe_ops_any && p->pops != probe_ops) continue; - if (provider && strcmp (probe->provider, provider) != 0) + if (provider && strcmp (p->provider, provider) != 0) continue; - if (strcmp (probe->name, name) != 0) + if (strcmp (p->name, name) != 0) continue; symtab_and_line sal; - sal.pc = get_probe_address (probe, objfile); + sal.pc = get_probe_address (p, objfile); sal.explicit_pc = 1; sal.section = find_pc_overlay (sal.pc); sal.pspace = search_pspace; - sal.probe = probe; + sal.probe = p; sal.objfile = objfile; result->push_back (std::move (sal)); @@ -210,15 +210,15 @@ find_probes_in_objfile (struct objfile *objfile, const char *provider, const std::vector &probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); - for (struct probe *probe : probes) + for (probe *p : probes) { - if (strcmp (probe->provider, provider) != 0) + if (strcmp (p->provider, provider) != 0) continue; - if (strcmp (probe->name, name) != 0) + if (strcmp (p->name, name) != 0) continue; - VEC_safe_push (probe_p, result, probe); + VEC_safe_push (probe_p, result, p); } return result; @@ -244,11 +244,11 @@ find_probe_by_pc (CORE_ADDR pc) /* If this proves too inefficient, we can replace with a hash. */ const std::vector &probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); - for (struct probe *probe : probes) - if (get_probe_address (probe, objfile) == pc) + for (probe *p : probes) + if (get_probe_address (p, objfile) == pc) { result.objfile = objfile; - result.probe = probe; + result.probe = p; return result; } } @@ -294,20 +294,20 @@ collect_probes (const std::string &objname, const std::string &provider, const std::vector &probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); - for (struct probe *probe : probes) + for (probe *p : probes) { - if (pops != NULL && probe->pops != pops) + if (pops != NULL && p->pops != pops) continue; if (prov_pat - && prov_pat->exec (probe->provider, 0, NULL, 0) != 0) + && prov_pat->exec (p->provider, 0, NULL, 0) != 0) continue; if (probe_pat - && probe_pat->exec (probe->name, 0, NULL, 0) != 0) + && probe_pat->exec (p->name, 0, NULL, 0) != 0) continue; - result.emplace_back (probe, objfile); + result.emplace_back (p, objfile); } }