[PATCH 1/3] KVM: arm64: fix override-init warnings in W=1 builds

Marc Zyngier maz at kernel.org
Mon Jul 15 07:40:10 PDT 2024


On Mon, 15 Jul 2024 11:28:06 +0100,
Sebastian Ott <sebott at redhat.com> wrote:
> 
> On Fri, 12 Jul 2024, Marc Zyngier wrote:
> > On Fri, 12 Jul 2024 12:03:30 +0100,
> > Sebastian Ott <sebott at redhat.com> wrote:
> >> 
> >> -static const exit_handler_fn hyp_exit_handlers[] = {
> >> -	[0 ... ESR_ELx_EC_MAX]		= NULL,
> >> +static const exit_handler_fn hyp_exit_handlers[ESR_ELx_EC_MAX + 1] = {
> > 
> > Is this really any better? I don't think so. It makes the intent
> > disappear instead of making it explicit. Intent matters *a lot*.
> 
> I'm not claiming that it's an improvement to the code.

<rant>
Silencing pointless warnings should never have priority over keeping
the code maintainable and understandable. I hope we can agree we are
not in the business of making the kernel *worse* than it already is on
that front, right?
</rant>

I like good tooling as much as the next kernel tinkerer. But W=1 is,
in its current form, quite the opposite. Mark posted a link to a 5
year old thread, showing a number of ways compilers could use extra
annotation to lift the multiple initialisation ambiguity. This
approach has seen no traction, which is a bit sad.

> But yea, I see your point. How about disabling that flag in the
> makefile?

Yes, that'd be a reasonable workaround until someone fixes the
toolchains. I see that Loongarch is already doing it for the exact
same purpose.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list