On Mon, Feb 28, 2022 at 02:01:06PM +0100, Arnd Bergmann wrote: > On Mon, Feb 28, 2022 at 1:36 PM Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx> 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 We've added the individual warnings to the per-directory flags so it's a bit more flexible than just enabling W=1. The idea is to add possibly stricter warnings once we make sure it builds fine and does not produce false reports. Extending W=1 in the same way would affect everybody.