On Mon, Oct 26, 2020 at 6:27 PM Will Deacon <w...@kernel.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.rutl...@arm.com> wrote: > > > On Mon, Oct 26, 2020 at 05:03:31PM +0100, Arnd Bergmann wrote: > > > > From: Arnd Bergmann <a...@arndb.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