diff mbox series

[v3,6/6] Makefile.extrawarn: turn on missing-prototypes globally

Message ID 20231123110506.707903-7-arnd@kernel.org
State New
Headers show
Series Treewide: enable -Wmissing-prototypes | expand

Commit Message

Arnd Bergmann Nov. 23, 2023, 11:05 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

Over the years we went from > 1000 of warnings to under 100 earlier
this year, and I sent patches to address all the ones that I saw with
compile testing randcom configs on arm64, arm and x86 kernels. This is a
really useful warning, as it catches real bugs when there are mismatched
prototypes. In particular with kernel control flow integrity enabled,
those are no longer allowed.

I have done extensive testing to ensure that there are no new build
errors or warnings on any configuration of x86, arm and arm64 builds.
I also made sure that at least the both the normal defconfig and an
allmodconfig build is clean for arc, csky, loongarch, m68k, microblaze,
openrisc, parisc, powerpc, riscv, s390, and xtensa, with the respective
maintainers doing most of the patches.

At this point, there are five architectures with a number of known
regressions: alpha, nios2, mips, sh and sparc. In the previous version
of this patch, I had turned off the missing prototype warnings for the 15
architectures that still had issues, but since there are only five left,
I think we can leave the rest to the maintainers (Cc'd here) as well.

Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-alpha@vger.kernel.org
Cc: linux-mips@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Link: https://lore.kernel.org/lkml/20230810141947.1236730-1-arnd@kernel.org/
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com> # RISC-V
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.extrawarn | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Guenter Roeck Jan. 10, 2024, 7:45 p.m. UTC | #1
On Thu, Nov 23, 2023 at 12:05:06PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Over the years we went from > 1000 of warnings to under 100 earlier
> this year, and I sent patches to address all the ones that I saw with
> compile testing randcom configs on arm64, arm and x86 kernels. This is a
> really useful warning, as it catches real bugs when there are mismatched
> prototypes. In particular with kernel control flow integrity enabled,
> those are no longer allowed.
> 
> I have done extensive testing to ensure that there are no new build
> errors or warnings on any configuration of x86, arm and arm64 builds.
> I also made sure that at least the both the normal defconfig and an
> allmodconfig build is clean for arc, csky, loongarch, m68k, microblaze,
> openrisc, parisc, powerpc, riscv, s390, and xtensa, with the respective
> maintainers doing most of the patches.
> 
> At this point, there are five architectures with a number of known
> regressions: alpha, nios2, mips, sh and sparc. In the previous version
> of this patch, I had turned off the missing prototype warnings for the 15
> architectures that still had issues, but since there are only five left,
> I think we can leave the rest to the maintainers (Cc'd here) as well.
> 

Not sure I understand why this was so important that it warrants the
resulting buildtest failures.

FWIW, I'll disable WERROR in my build tests for the affected architectures.
That is kind of counter-productive, but the only real alternative would be
to stop build (and sometimes, such as for ppc, runtime) tests entirely,
which would be even worse.

Guenter
Arnd Bergmann Jan. 10, 2024, 8:43 p.m. UTC | #2
On Wed, Jan 10, 2024, at 20:45, Guenter Roeck wrote:
> On Thu, Nov 23, 2023 at 12:05:06PM +0100, Arnd Bergmann wrote:
>> At this point, there are five architectures with a number of known
>> regressions: alpha, nios2, mips, sh and sparc. In the previous version
>> of this patch, I had turned off the missing prototype warnings for the 15
>> architectures that still had issues, but since there are only five left,
>> I think we can leave the rest to the maintainers (Cc'd here) as well.
>> 
>
> Not sure I understand why this was so important that it warrants the
> resulting buildtest failures.
>
> FWIW, I'll disable WERROR in my build tests for the affected architectures.
> That is kind of counter-productive, but the only real alternative would be
> to stop build (and sometimes, such as for ppc, runtime) tests entirely,
> which would be even worse.

If you prefer, I can go back to the older version and just disable
the warning for the architectures with defconfig build failures. I did
a lot of fixes for mips, so at least defconfig and allmodconfig
should be fine now, leaving only alpha, nios2, sh and sparc as
far as I can tell, at least once Linus merges the asm-generic
pull request hat has a bunch of the currently missing fixes.

   Arnd
diff mbox series

Patch

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 1527199161d7..8e9170f932ea 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -17,6 +17,8 @@  KBUILD_CFLAGS += -Wno-format-security
 KBUILD_CFLAGS += -Wno-trigraphs
 KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
 KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
+KBUILD_CFLAGS += -Wmissing-declarations
+KBUILD_CFLAGS += -Wmissing-prototypes
 
 ifneq ($(CONFIG_FRAME_WARN),0)
 KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN)
@@ -95,10 +97,8 @@  export KBUILD_EXTRA_WARN
 ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
 
 KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
-KBUILD_CFLAGS += -Wmissing-declarations
 KBUILD_CFLAGS += $(call cc-option, -Wrestrict)
 KBUILD_CFLAGS += -Wmissing-format-attribute
-KBUILD_CFLAGS += -Wmissing-prototypes
 KBUILD_CFLAGS += -Wold-style-definition
 KBUILD_CFLAGS += -Wmissing-include-dirs
 KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable)