On Sun, Oct 11, 2020 at 3:04 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote: > On Tue, Oct 6, 2020 at 6:08 AM Andrew Lunn <andrew@xxxxxxx> wrote: > > > I am not a big fan of KBUILD_CFLAGS_W1_<timestamp> > since it is ugly. > > I'd like to start with adding individual flags > like drivers/gpu/drm/i915/Makefile, and see > how difficult it would be to maintain it. I don't really like that either, to be honest, mostly because that is somewhat incompatible with my plan to move all the warning flags out the command line and into _Pragma() lines in header files. > One drawback of your approach is that > you cannot set KBUILD_CFLAGS_W1_20200930 > until you eliminate all the warnings in the > sub-directory in interest. > (i.e. all or nothing approach) > > At best, you can only work out from 'old -> new' order > because KBUILD_CFLAGS_W1_20200326 is a suer-set of > KBUILD_CFLAGS_W1_20190907, which is a suer-set of > KBUILD_CFLAGS_W1_20190617 ... > > > > If you add flags individually, you can start with > low-hanging fruits, or ones with higher priority > as Arnd mentions about -Wmissing-{declaration,prototypes}. > > > For example, you might be able to set > 'subdir-ccflags-y += -Wmissing-declarations' > to drivers/net/Makefile, while > 'subdir-ccflags-y += -Wunused-but-set-variable' > stays in drivers/net/ethernet/Makefile. I agree with the goal though. In particular it may be helpful to pick a set of warning flags to always be enabled without also setting -Wextra, which has different meanings depending on compiler version, or between gcc and clang. I wonder how different they really are, and we can probably find out from https://github.com/Barro/compiler-warnings, but I have not checked myself. Arnd