Linux-KBuild Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v1] kbuild: enforce -Werror=return-type
@ 2020-10-05 10:10 Olaf Hering
  2020-10-11 13:27 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2020-10-05 10:10 UTC (permalink / raw)
  To: linux-kbuild, linux-kernel; +Cc: Olaf Hering, Masahiro Yamada, Michal Marek

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 <olaf@aepfle.de>
---
 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)
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] kbuild: enforce -Werror=return-type
  2020-10-05 10:10 [PATCH v1] kbuild: enforce -Werror=return-type Olaf Hering
@ 2020-10-11 13:27 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2020-10-11 13:27 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Linux Kbuild mailing list, Linux Kernel Mailing List, Michal Marek

On Mon, Oct 5, 2020 at 7:13 PM Olaf Hering <olaf@aepfle.de> 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 <olaf@aepfle.de>
> ---
>  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 10:10 [PATCH v1] kbuild: enforce -Werror=return-type Olaf Hering
2020-10-11 13:27 ` Masahiro Yamada

Linux-KBuild Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-kbuild/0 linux-kbuild/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-kbuild linux-kbuild/ https://lore.kernel.org/linux-kbuild \
		linux-kbuild@vger.kernel.org
	public-inbox-index linux-kbuild

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kbuild


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git