Re: [PATCH] Makefile: Yes. Finally remove '-Wdeclaration-after-statement'

From: Michael Witten
Date: Wed Aug 19 2020 - 17:16:58 EST


The quick RFC patch I just proposed in the parent email is
broken in its implementation. I will submit an updated
version soon.

Michael Witten (Tue, 18 Aug 2020 22:05:00 -0000):

> I think there's an important distinction to make between
> the following 2 kinds of code:
>
> * The curated code people just want to build.
> * The new patches that maintainers are reviewing.
>
> Certainly, maintainers should have a wide range of tools
> at their disposal to probe the quality of a patch; then,
> after bending rules of style to taste, the maintainers
> declare the merged code to be curated, after which that
> merged code need not be probed so invasively every time
> it is built.
>
> To this end, I propose the following new patch, which
> introduces some build-time switches that will help
> people make this distinction.
>
> As you know, you can save this email to some path:
>
> /path/to/email.eml
>
> Then apply and review the patch as follows:
>
> $ cd /path/to/linux/repo
> $ git reset --hard HEAD
> $ git checkout --detach origin/master
> $ git am --scissors /path/to/email.eml
> $ git log -1 -p
>
> At this point, the patch is intended as a[n] RFC;
> I haven't tested it, and just wanted to get the
> idea out there.
>
> Sincerely,
> Michael Witten
>
> ---8<------8<------8<------8<------8<------8<------8<------8<---
> Subject: [PATCH] kbuild: Introduce "Warnings for maintainers"
> This commit introduces the following new Kconfig options:
>
> CONFIG_MAINTAINERS_WARNINGS
> |
> +-> CONFIG_WARN_DECLARATION_AFTER_STATEMENT
> |
> +-> CONFIG_WARN_MAYBE_UNINITIALIZED
>
> These produce the following menu items:
>
> -> Kernel hacking
> -> Compile-time checks and compiler options
> -> Warnings for maintainers [NEW]
> * Warn about mixing variable definitions and statements [NEW]
> * Warn about use of potentially uninitialized variables [NEW]
>
> In short:
>
> * CONFIG_MAINTAINERS_WARNINGS
> is the umbrella control.
>
> * CONFIG_WARN_DECLARATION_AFTER_STATEMENT
> determines whether "-Wdeclaration-after-statement" is used.
>
> * CONFIG_WARN_MAYBE_UNINITIALIZED
> determines whether "-Wmaybe-uninitialized" is used.
>
> Currently, the default is "y" for each, but it is expected that
> eventually the default will be "n" for CONFIG_MAINTAINERS_WARNINGS.
>
> Running "make" with "W=2" should turn both warnings on, unless
> they are thwarted by some other Kbuild logic.
>
> Signed-off-by: Michael Witten <mfwitten@xxxxxxxxx>
>
> [... PATCH ...]