From patchwork Sat Sep 10 00:06:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 668318 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sWDsL5DyWz9sxS for ; Sat, 10 Sep 2016 10:07:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=oD/15dHU; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=yPtuJe5qC1saXTQv ON2TA1enuTjqy0WDl3lg1kp2w4jx9htDZbbKN4aeOKu1J2mmSXnFYQUNJF6RX0mN 7y/PHmSZvMUuOILrKl7+LLG1I5aBqgEHcnMbJbOCtlh/BNBvQOoq2mWmGiAgP47d WUpskLciPUot1JKSLyGntpHAKfk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=/oxYjkLopy7NXhxjQRREfk DvRYo=; b=oD/15dHUiwH8eshNBRUiY/nD1amQ3Q5nH1jsIjl8AY3jwQE1VhhrXa td9Db2gXGCDqSVqt8ohM7mQDL6P8AYF0dSgAind+fgvRZhUI2gKc9TVwUarzn3XR pFqzQbX5L5VnmPcoRKXHIkmuLSN2KjEzMeRn88gvyZkqeW0OJskHU= Received: (qmail 67675 invoked by alias); 10 Sep 2016 00:07:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 67666 invoked by uid 89); 10 Sep 2016 00:07:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 spammy=H*Ad:U*bonzini X-HELO: tarox.wildebeest.org Received: from herd.wildebeest.org (HELO tarox.wildebeest.org) (80.127.118.209) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 10 Sep 2016 00:06:57 +0000 Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 85FD441BBA1B; Sat, 10 Sep 2016 02:06:55 +0200 (CEST) From: Mark Wielaard To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Paolo Bonzini , Mark Wielaard Subject: [PATCH] Fix -Wshadow warning in libiberty/cp-demangle.c Date: Sat, 10 Sep 2016 02:06:43 +0200 Message-Id: <1473466003-19517-1-git-send-email-mjw@redhat.com> MIME-Version: 1.0 valgrind contains a copy of the libiberty demangler which gets compiled with -Wshadow. That shows the following warning: cp-demangle.c: In function ‘d_substitution’: cp-demangle.c:3772:35: warning: declaration of ‘c’ shadows a previous local struct demangle_component *c; ^ cp-demangle.c:3708:8: note: shadowed declaration is here char c; ^ Fix that by renaming the struct demangle_component variable to dc and add -Wshadow to ac_libiberty_warn_cflags (the only warning is this one). libiberty/ChangeLog: * cp-demangle.c (d_substitution): Change struct demangle_component variable name from c to dc. * configure.ac (ac_libiberty_warn_cflags): Add -Wshadow. * configure: Regenerate. diff --git a/libiberty/configure b/libiberty/configure index 0f8e9b9..91a051c 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -4398,7 +4398,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_libiberty_warn_cflags= save_CFLAGS="$CFLAGS" for real_option in -W -Wall -Wwrite-strings -Wc++-compat \ - -Wstrict-prototypes; do + -Wstrict-prototypes \ + -Wshadow; do # Do the check with the no- prefix removed since gcc silently # accepts any -Wno-* option on purpose case $real_option in diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 9d3f298..44bed8f 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -160,7 +160,8 @@ AC_SYS_LARGEFILE AC_PROG_CPP_WERROR ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wc++-compat \ - -Wstrict-prototypes], [ac_libiberty_warn_cflags]) + -Wstrict-prototypes \ + -Wshadow], [ac_libiberty_warn_cflags]) ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([], [ac_libiberty_warn_cflags]) AC_PROG_CC_C_O diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 1c2bce2..a843dc3 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3769,7 +3769,7 @@ d_substitution (struct d_info *di, int prefix) { const char *s; int len; - struct demangle_component *c; + struct demangle_component *dc; if (p->set_last_name != NULL) di->last_name = d_make_sub (di, p->set_last_name, @@ -3785,15 +3785,15 @@ d_substitution (struct d_info *di, int prefix) len = p->simple_len; } di->expansion += len; - c = d_make_sub (di, s, len); + dc = d_make_sub (di, s, len); if (d_peek_char (di) == 'B') { /* If there are ABI tags on the abbreviation, it becomes a substitution candidate. */ - c = d_abi_tags (di, c); - d_add_substitution (di, c); + dc = d_abi_tags (di, dc); + d_add_substitution (di, dc); } - return c; + return dc; } }