suppress set but not used warnings for kernel builds

Use -Wno-unused-but-set-variable for kernel builds with clang13.

To turn this warning back on, set the following in src.conf:
    WITH_SET_BUT_NOTUSED_KERNEL_WARNINGS=

Reviewed by:	mjg, imp
Differential Revision:	https://reviews.freebsd.org/D34784
This commit is contained in:
Robert Wing
2022-04-05 13:28:54 -08:00
parent 56cc89585d
commit e8e691983b
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -43,7 +43,11 @@ CWARNEXTRA?= -Wno-error=tautological-compare -Wno-error=empty-body \
CWARNEXTRA+= -Wno-error=shift-negative-value
CWARNEXTRA+= -Wno-address-of-packed-member
.if ${COMPILER_VERSION} >= 130000
CWARNFLAGS+= -Wno-error=unused-but-set-variable
.if ${MK_SET_BUT_NOTUSED_KERNEL_WARNINGS} == "no"
CWARNEXTRA+= ${NO_WUNUSED_BUT_SET_VARIABLE}
.else
CWARNEXTRA+= -Wno-error=unused-but-set-variable
.endif
.endif
.endif # clang
+2 -1
View File
@@ -60,7 +60,8 @@ __DEFAULT_NO_OPTIONS = \
INIT_ALL_ZERO \
KERNEL_RETPOLINE \
RATELIMIT \
REPRODUCIBLE_BUILD
REPRODUCIBLE_BUILD \
SET_BUT_NOTUSED_KERNEL_WARNINGS
# Some options are totally broken on some architectures. We disable
# them. If you need to enable them on an experimental basis, you