Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2445348imd; Sun, 28 Oct 2018 10:10:10 -0700 (PDT) X-Google-Smtp-Source: AJdET5eqbXb6F2ic2WMGJ+Ihd71uPX7MG2WwDBBjhsHRtTlIB5KvHq9kd8u0vOIwEN2N4IEiMKaB X-Received: by 2002:a62:5ac3:: with SMTP id o186-v6mr12072181pfb.40.1540746610661; Sun, 28 Oct 2018 10:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540746610; cv=none; d=google.com; s=arc-20160816; b=aqSjkh7hR90NQ0/W9MlVeT6D1SBWo9BM+hmtTLPZcqoVLlagANGn5a4VnVsMRfodAr XkQX3bydSphITqYsllicYKlhRbI/IvfnjR8rPZDYAxaYXbkej6Dk/0771Ypm57iG9jEQ 84lev1Kt6Ib8CBWMzC/f+5Y56kjLhvq8NyEwIbI9fsT3Ujng7F9ZgQ2TfAhgY2qpH0si 7BpIU4UIpU041JijpvV3RqUJLbowH+eEGRAF+D/8N3zP+ll8p1hEvqLDC8RxQ3jU+Ako Xm7Wsg7QLnvjW//heoXFL1sBJeDQo0f9suTn1iqhs70hJWwJElIydkOv5EJT8Jg1cjDb C8kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:dkim-filter; bh=cRrPPvaf1GZ+1Lxh56L1YkMQ2Em6HvpMNZC0LYrzlvU=; b=toygESuNgBgZ9hVhqwcxZGm7pSTEFwUbeKB1YBFA15mksFz4IxHNCoVyGQd/yARYP1 zNvHclT8DNoDP8vwOJxPLzSGz2g9/1YzfSrafngqaPqnv3hhIlEdS6eqDG26oncM3J1o DPXnZOvruFbA301NoS9tSKRUsmVpk72NsdLtysB3uLU3Pp25IMgmtneLwlOnWFAE1M8+ NMiAZZnR3F/qxHhuAxJgr4FF7YvFg8aeyq0ET9LIbcJ8KmCE4J4Cr6nqN5CRzVVsMXSa maxWVU8mFjJq8X7QNNLVm7kLFAXOwvtbGy6SU+yILxnMYyWmimtzw0k/gB3JTJTR7ZrS XK3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=V2uNg7CS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11-v6si17653834pgl.40.2018.10.28.10.09.55; Sun, 28 Oct 2018 10:10:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=V2uNg7CS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727997AbeJ2BkK (ORCPT + 99 others); Sun, 28 Oct 2018 21:40:10 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:46007 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbeJ2BkK (ORCPT ); Sun, 28 Oct 2018 21:40:10 -0400 Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (authenticated) by conssluserg-03.nifty.com with ESMTP id w9SGsn34009985; Mon, 29 Oct 2018 01:54:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com w9SGsn34009985 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1540745690; bh=cRrPPvaf1GZ+1Lxh56L1YkMQ2Em6HvpMNZC0LYrzlvU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=V2uNg7CS61CIuFEk5OXtlN8VrIM2RDgFGzRIDSuuj1IwSn7hTC3uRyZbTVKHVj+O6 yCAJHRNytnQXrf/qOzkwM5T2KEVNSlyuYMeXwvPmBB8t29HCYLuz0zYZqRq/CakYSv hOxW45ZlLVi5L1323mcgNN6CpF2CF9nmaezFU1sy+Hicc+bCuhJk52xMwIj+fA0ex2 fgzzqG28y+fI7SlHzMHDhQcs4PD4iyi1fzf3mp86yOq5HJn/5VRprF2IPrM1mPmz4J 7HiH+bRVRyb4efc4jGC32dqSJMXioX66nF6T0n+Ih8OGcczH9mqRG1J3nz7nrv+H0r cI+AvbY3lD2HA== X-Nifty-SrcIP: [209.85.217.54] Received: by mail-vs1-f54.google.com with SMTP id 124so3766454vsp.12; Sun, 28 Oct 2018 09:54:49 -0700 (PDT) X-Gm-Message-State: AGRZ1gI7HnZfdmr3cMjhCRezEXGt3khz/GlD6pWv81SSkFKRbVAHbCN1 0kuKE50Wt/xpcPalvpUrtuNOTjnj4sI0vUYhjLo= X-Received: by 2002:a67:5fc7:: with SMTP id t190mr4804635vsb.155.1540745688741; Sun, 28 Oct 2018 09:54:48 -0700 (PDT) MIME-Version: 1.0 References: <20181017000809.GA21292@WindFlash> <20181017081115.GA22535@zn.tnic> <20181017083126.GB22535@zn.tnic> <20181018091606.GA20831@zn.tnic> <7b87404e2a0347968013e024e52e4cb2@AcuMS.aculab.com> In-Reply-To: <7b87404e2a0347968013e024e52e4cb2@AcuMS.aculab.com> From: Masahiro Yamada Date: Mon, 29 Oct 2018 01:54:12 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/4] Adds -Wshadow=local on KBUILD_HOSTCFLAGS To: David.Laight@aculab.com Cc: Borislav Petkov , =?UTF-8?Q?Leonardo_Br=C3=A1s?= , lkcamp@lists.libreplanetbr.org, Matthew Wilcox , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , X86 ML , Michal Marek , Linux Kernel Mailing List , Linux Kbuild mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 19, 2018 at 8:28 PM David Laight wrot= e: > > From: Masahiro Yamada > > Sent: 18 October 2018 17:39 > > > > On Thu, Oct 18, 2018 at 6:18 PM Borislav Petkov wrote: > > > > > > On Wed, Oct 17, 2018 at 09:40:53PM -0300, Leonardo Bras wrote: > > > > The idea was to put it as default and fix all the shadowing warning= s. > > > > What do you think? I am open to suggestions. > > > > > > That's Masahiro's call. In the rest of the kernel, those warnings are= behind > > > the W=3D2 switch - i.e., not enabled by default. > > > > > > It is not realistic to enable this warning option by default. > > Even -Wshadow=3Dlocal emits tons of warnings. > > (More with -Wshadow) > > The question is, how many of them are actual bugs. > IMHO -Wshadow is a good idea. > > > The problem of this flag is, > > it is false positive in macro expansions. > > Right, but macro expansions inside macro definitions could accidentally > use the same local variable - leading to choas. I do not think so. The macro definitions are surrounded by { ... } so that local variables are properly separated from the outside world. > > For example, I think the following is a legitimate case. > ... > > arch/arm64/kernel/fpsimd.c:713:2: note: in expansion of macro =E2=80=98= write_sysreg=E2=80=99 > > write_sysreg(read_sysreg(CPACR_EL1) | CPACR_EL1_ZEN_EL1EN, CPACR_EL1)= ; > > ^~~~~~~~~~~~ > > Easily fixed by using different named temporaries in the two macros. > There probably aren't that many macro pairs where that happens. > Especially since many are now inlined functions. But, theoretically, any arbitrary macros could be used in pairs. This means a new constraint where a local variable name must be unique, it means 'local variable' is not literally 'local'. I'd like to use short names such as 'x', 'tmp', etc. for local variables. > It might be that a small number of changes get rid of most of the warning= s. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1= 1PT, UK > Registration No: 1397386 (Wales) -- Best Regards Masahiro Yamada