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
This commit is contained in:
John Baldwin 2022-02-14 11:48:47 -08:00
parent 047eec4966
commit 2f6a842484
2 changed files with 8 additions and 0 deletions

View File

@ -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

View File

@ -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