[PATCH] [v2] Kbuild: move to -std=gnu11

Arnd Bergmann arnd at kernel.org
Mon Feb 28 05:01:06 PST 2022


On Mon, Feb 28, 2022 at 1:36 PM Jani Nikula <jani.nikula at linux.intel.com> wrote:
> >
> > One minor issue that remains is an added gcc warning for shifts of
> > negative integers when building with -Werror, which happens with the
> > 'make W=1' option, as well as for three drivers in the kernel that always
> > enable -Werror, but it was only observed with the i915 driver so far.
> > To be on the safe side, add -Wno-shift-negative-value to any -Wextra
> > in a Makefile.
>
> Do you mean always enable -Wall and/or -Wextra instead of -Werror?
>
> We do use -Werror for our CI and development too, but it's hidden behind
> a config option that depends on COMPILE_TEST=n to avoid any problems
> with allmodconfig/allyesconfig.

What I meant here is that I'm adding -Wno-shift-negative-value to all
four places in the kernel that already use -Wextra.

> For the future, makes me wonder if we couldn't have a way for drivers to
> locally enable -Wall/-Wextra in a way that incorporates the exceptions
> from kbuild instead of having to duplicate them.

I have an older patch series that does this, but it also does a few other
things that I couldn't quite get right in the end with all combinations of
compiler versions and warning levels, so I did not submit that.

What this allows is to have per-directory statements like

KBUILD_WARN1=1
KBUILD_ERROR0=1

to force all the default warnings (-Wall etc) to be errors, while
making the W=1 type warnings (-Wextra etc) normal warnings.

> Anyway, for the i915 changes,
>
> Acked-by: Jani Nikula <jani.nikula at intel.com>

Thanks,

       Arnd



More information about the linux-arm-kernel mailing list