[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFEAcA_sA+sAneWwi8ZtN1WmHhcHte0k_3_JcDybYWviW_18qg@mail.gmail.com>
Date: Mon, 26 Oct 2020 17:13:30 +0000
From: Peter Maydell <peter.maydell@...aro.org>
To: Mark Rutland <mark.rutland@....com>
Cc: Arnd Bergmann <arnd@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Christoffer Dall <christoffer.dall@...aro.org>,
Marc Zyngier <marc.zyngier@....com>,
Will Deacon <will.deacon@....com>,
Dave Martin <Dave.Martin@....com>,
Mark Brown <broonie@...nel.org>,
Dmitry Safonov <0x7f454c46@...il.com>,
James Morse <james.morse@....com>,
Amit Daniel Kachhap <amit.kachhap@....com>,
Gavin Shan <gshan@...hat.com>,
arm-mail-list <linux-arm-kernel@...ts.infradead.org>,
lkml - Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/4] arm64: traps: fix -Woverride-init warnings
On Mon, 26 Oct 2020 at 16:23, Mark Rutland <mark.rutland@....com> wrote:
>
> Hi Arnd,
>
> On Mon, Oct 26, 2020 at 05:03:31PM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@...db.de>
> >
> > There are many warnings in this file when we re-enable the
> > Woverride-init flag:
> >
> > arch/arm64/kernel/traps.c:704:26: warning: initialized field overwritten [-Woverride-init]
> > 704 | [ESR_ELx_EC_UNKNOWN] = "Unknown/Uncategorized",
> > | ^~~~~~~~~~~~~~~~~~~~~~~
> > arch/arm64/kernel/traps.c:704:26: note: (near initialization for 'esr_class_str[0]')
> > arch/arm64/kernel/traps.c:705:22: warning: initialized field overwritten [-Woverride-init]
> > 705 | [ESR_ELx_EC_WFx] = "WFI/WFE",
> > | ^~~~~~~~~
> >
> > This is harmless since they are only informational strings,
> > but it's easy to change the code to ignore missing initialization
> > and instead warn about possible duplicate initializers.
>
> This has come up before, and IMO the warning is more hindrance than
> helpful, given the prevalance of spurious warnings, and the (again IMO)
> the rework needed to avoid those making the code harder to reason about
FWIW in QEMU we turn the clang version of this off with
-Wno-initializer-overrides because we agree that the code is
fine and the compiler is being unhelpful in this case. (There's
a reason gcc doesn't put it in -Wall.)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91688 is a request
for something that would catch bugs without breaking ranged-array
initializer syntax usage, but the gcc devs don't seem to have
responded.
thanks
-- PMM
Powered by blists - more mailing lists