From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18429C0650F for ; Thu, 8 Aug 2019 10:38:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8FF920820 for ; Thu, 8 Aug 2019 10:38:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389806AbfHHKiM (ORCPT ); Thu, 8 Aug 2019 06:38:12 -0400 Received: from foss.arm.com ([217.140.110.172]:59796 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389565AbfHHKiM (ORCPT ); Thu, 8 Aug 2019 06:38:12 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C465028; Thu, 8 Aug 2019 03:38:11 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D9D2F3F694; Thu, 8 Aug 2019 03:38:10 -0700 (PDT) Date: Thu, 8 Aug 2019 11:38:08 +0100 From: Mark Rutland To: Qian Cai Cc: will@kernel.org, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64/cache: silence -Woverride-init warnings Message-ID: <20190808103808.GC46901@lakrids.cambridge.arm.com> References: <20190808032916.879-1-cai@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190808032916.879-1-cai@lca.pw> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 07, 2019 at 11:29:16PM -0400, Qian Cai wrote: > The commit 155433cb365e ("arm64: cache: Remove support for ASID-tagged > VIVT I-caches") introduced some compiation warnings from GCC (and > Clang) with -Winitializer-overrides), > > arch/arm64/kernel/cpuinfo.c:38:26: warning: initialized field > overwritten [-Woverride-init] > [ICACHE_POLICY_VIPT] = "VIPT", > ^~~~~~ > arch/arm64/kernel/cpuinfo.c:38:26: note: (near initialization for > 'icache_policy_str[2]') > arch/arm64/kernel/cpuinfo.c:39:26: warning: initialized field > overwritten [-Woverride-init] > [ICACHE_POLICY_PIPT] = "PIPT", > ^~~~~~ > arch/arm64/kernel/cpuinfo.c:39:26: note: (near initialization for > 'icache_policy_str[3]') > arch/arm64/kernel/cpuinfo.c:40:27: warning: initialized field > overwritten [-Woverride-init] > [ICACHE_POLICY_VPIPT] = "VPIPT", > ^~~~~~~ > arch/arm64/kernel/cpuinfo.c:40:27: note: (near initialization for > 'icache_policy_str[0]') > > because it initializes icache_policy_str[0 ... 3] twice. Since > arm64 developers are keen to keep the style of initializing a static > array with a non-zero pattern first, just disable those warnings for > both GCC and Clang of this file. > > Fixes: 155433cb365e ("arm64: cache: Remove support for ASID-tagged VIVT I-caches") > Signed-off-by: Qian Cai This is _not_ a fix, and should not require backporting to stable trees. What about all the other instances that we have in mainline? I really don't think that we need to go down this road; we're just going to end up adding this to every file that happens to include a header using this scheme... Please just turn this off by default for clang. If we want to enable this, we need a mechanism to permit overridable assignments as we use range initializers for. Thanks, Mark. > --- > arch/arm64/kernel/Makefile | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile > index 478491f07b4f..397ed5f7be1e 100644 > --- a/arch/arm64/kernel/Makefile > +++ b/arch/arm64/kernel/Makefile > @@ -11,6 +11,9 @@ CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) > CFLAGS_REMOVE_insn.o = $(CC_FLAGS_FTRACE) > CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_FTRACE) > > +CFLAGS_cpuinfo.o += $(call cc-disable-warning, override-init) > +CFLAGS_cpuinfo.o += $(call cc-disable-warning, initializer-overrides) > + > # Object file lists. > obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ > entry-fpsimd.o process.o ptrace.o setup.o signal.o \ > -- > 2.20.1 (Apple Git-117) >