kbuild: enforce -Werror=return-type
PATCH 1/1 kbuild: enforce -Werror=return-type
Catch errors which at least gcc tolerates by default:
warning: 'return' with no value, in function returning non-void [-Wreturn-type]
Signed-off-by Olaf Hering <[email protected]>
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -942,6 +942,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) # enforce correct pointer usage KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) +# enforce correct return type +KBUILD_CFLAGS += $(call cc-option,-Werror=return-type) + # Require designated initializers for all marked structures KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
Quoted 14 lines · Olaf Hering
Catch errors which at least gcc tolerates by default:
warning: 'return' with no value, in function returning non-void [-Wreturn-type]Signed-off-by Olaf Hering <[email protected]>--- Makefile | 3 +++ 1 file changed, 3 insertions(+)Makefile +0
-0
Makefile KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) · line 947
Quoted 6 lines
Makefile +3
-0@@ -942,6 +942,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) # enforce correct pointer usage KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) +# enforce correct return type +KBUILD_CFLAGS += $(call cc-option,-Werror=return-type) +
cc-option is unneeded because the minimal supported versions of GCC/Clang support -Werror=return-type.
You can hard-code and add it around line 500.
Quoted 3 lines
Makefile +0
-0# Require designated initializers for all marked structures KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
Signature · 2 lines
Best Regards Masahiro Yamada