From patchwork Sun Nov 6 18:03:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 80968 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp673176qge; Sun, 6 Nov 2016 10:03:59 -0800 (PST) X-Received: by 10.98.139.72 with SMTP id j69mr6481700pfe.158.1478455439021; Sun, 06 Nov 2016 10:03:59 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m3si27567731pgd.262.2016.11.06.10.03.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Nov 2016 10:03:59 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-440548-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-440548-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-440548-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version; q=dns; s=default; b=JZoigpvGaaY8EQ6n zXYnz/76+Z3Ri3C0Ii0byrIbxJ+ptbqAH9RuZRDI8Oi1HZM4wCBHP+25US8G6MGT 9AE5UUTcUH2szDFfc6Ei6RB6UHTn30Cx70VCLMy0FnrB02c9WlZJgBBgOhfLmnCl PSUzLwDe++Sb3UdqU9f2L6SgmC0= 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 :message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version; s=default; bh=x3sF0mjOEnN8zJ1uj6DLFE UadoM=; b=ZqH/EzIb/mDN+IcND+PR5PAAMnYV/VwtRhk2dKdR2FR0pX/uykyzIA L+vH+XNUSX58SsVqksDA9RR30f0xj9UUpfXG0DIKE4tyUGQjZJQ4HN7s6QQUHUcy edCbTithB2YOYXmlpyAjXSqjVQaatYQP7r8lrWjHENNuW9rmqC0pE= Received: (qmail 54270 invoked by alias); 6 Nov 2016 18:03:47 -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 54255 invoked by uid 89); 6 Nov 2016 18:03:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=court, H*Ad:D*google.com, Hx-languages-length:2125 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; Sun, 06 Nov 2016 18:03:36 +0000 Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 4B4554001044; Sun, 6 Nov 2016 19:03:34 +0100 (CET) Message-ID: <1478455414.14569.14.camel@klomp.org> Subject: Re: [PATCH] Fix -Wshadow warning in libiberty/cp-demangle.c From: Mark Wielaard To: Eric Gallager Cc: Ian Lance Taylor , gcc-patches , Jason Merrill , Paolo Bonzini Date: Sun, 06 Nov 2016 19:03:34 +0100 In-Reply-To: References: <1473466003-19517-1-git-send-email-mjw@redhat.com> Mime-Version: 1.0 On Sat, 2016-09-10 at 09:51 -0400, Eric Gallager wrote: > On 9/10/16, Ian Lance Taylor wrote: > > I'm not sure about the patch to configure.ac/configure. The last I > > looked -Wshadow would warn if a local variable shadows a global > > variable. That can cause a pointless build break if some system > > header file defines a global variable that happens to have the same > > name as a local variable. It's not a likely scenario but I don't see > > a need to court a build breakage. > > > Maybe if the patch to add -Wshadow-local went in, the configure script > could use that instead? We now have -Wshadow=local. So the attached patch uses that for libiberty. Is the attached patch OK to commit? Thanks, Mark >From f6f938e8053b6caf393c35c6f96c946073ca9373 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 6 Nov 2016 17:36:06 +0100 Subject: [PATCH] libiberty: Add -Wshadow=local to warning flags (if supported). libiberty/ChangeLog: * configure.ac (ac_libiberty_warn_cflags): Add -Wshadow=local. * configure: Regenerated. --- diff --git a/libiberty/configure b/libiberty/configure index 0f8e9b9..5c4dda5 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=local; 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..1aa0c7c 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=local], [ac_libiberty_warn_cflags]) ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([], [ac_libiberty_warn_cflags]) AC_PROG_CC_C_O -- 1.8.3.1