[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1mcNwCn-7fgujyQGrDAXR1ZJnEdPchAGUsegQtnSHabw@mail.gmail.com>
Date: Mon, 26 Oct 2020 20:28:45 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Will Deacon <will@...nel.org>
Cc: Peter Maydell <peter.maydell@...aro.org>,
Mark Rutland <mark.rutland@....com>,
Catalin Marinas <catalin.marinas@....com>,
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, Oct 26, 2020 at 6:27 PM Will Deacon <will@...nel.org> wrote:
> On Mon, Oct 26, 2020 at 05:13:30PM +0000, Peter Maydell wrote:
> > On Mon, 26 Oct 2020 at 16:23, Mark Rutland <mark.rutland@....com> wrote:
> > > 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.
>
> Yes, I'm inclined to agree. The code is fine, and "fixing" it just leads to
> churn and the possible introduction of bugs.
Ok, shall we just disable it for all of arch/arm64/kernel then?
The other parts of the kernel that follow the same line of thinking
are drivers/gpu/drm/amd/ and drivers/ata, for which I already
just turn them off. The rest of the kernel is mostly clean for
the warning, or there are actual bugs that it finds.
Arnd
Powered by blists - more mailing lists