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(+)
diff --git a/Makefile b/Makefile
index f84d7e4ca0be..7b2e63e7be18 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
On Mon, Oct 5, 2020 at 7:13 PM Olaf Hering <[email protected]> wrote:
>
> 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(+)
>
> diff --git a/Makefile b/Makefile
> index f84d7e4ca0be..7b2e63e7be18 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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.
> # Require designated initializers for all marked structures
> KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
>
--
Best Regards
Masahiro Yamada