git: 2f6a84248467 - main - Disable -Wreturn-type on GCC.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 14 Feb 2022 19:49:16 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f6a842484675bb8fe9fafd40d90c06f13e02403

commit 2f6a842484675bb8fe9fafd40d90c06f13e02403
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-02-14 19:48:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-02-14 19:48:47 +0000

    Disable -Wreturn-type on GCC.
    
    GCC is more pedantic than clang about warning when a function doesn't
    handle undefined enum values (see GCC bug 87950).  Clang's warning
    gives a more pragmatic coverage and should find any real bugs, so
    disable the warning for GCC rather than adding __unreachable
    annotations to appease GCC.
    
    Reviewed by:    imp, emaste
    Differential Revision:  https://reviews.freebsd.org/D34147
---
 share/mk/bsd.sys.mk | 4 ++++
 sys/conf/kern.mk    | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 694cc66c3f18..cf48411d3d4d 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -206,6 +206,10 @@ CWARNFLAGS+=	-Wno-error=overflow
 .endif
 .endif
 
+# GCC produces false positives for functions that switch on an
+# enum (GCC bug 87950)
+CWARNFLAGS+=	-Wno-return-type
+
 # GCC's own arm_neon.h triggers various warnings
 .if ${MACHINE_CPUARCH} == "aarch64"
 CWARNFLAGS+=	-Wno-system-headers
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index 4c497623bf7c..06a0c1272704 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -75,6 +75,10 @@ CWARNEXTRA+=	-Wno-error=packed-not-aligned
 CWARNEXTRA+=	-Wno-address-of-packed-member			\
 		-Wno-error=alloca-larger-than=
 .endif
+
+# GCC produces false positives for functions that switch on an
+# enum (GCC bug 87950)
+CWARNFLAGS+=	-Wno-return-type
 .endif	# gcc
 
 # This warning is utter nonsense