git: 05b766ab84a9 - stable/13 - Disable -Wreturn-type on GCC.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 11 May 2022 00:30:10 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=05b766ab84a9d968984c8a4df127841c0df966f7

commit 05b766ab84a9d968984c8a4df127841c0df966f7
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-02-14 19:48:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-05-11 00:11:44 +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
    
    (cherry picked from commit 2f6a842484675bb8fe9fafd40d90c06f13e02403)
---
 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 50039a1f5f63..fefad7996eef 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 34f3447b8572..be396d0c3706 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