git: e8e691983bb7 - main - suppress set but not used warnings for kernel builds
Date: Tue, 05 Apr 2022 21:43:35 UTC
The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=e8e691983bb75e80153b802f47733f1531615fa2 commit e8e691983bb75e80153b802f47733f1531615fa2 Author: Robert Wing <rew@FreeBSD.org> AuthorDate: 2022-04-05 21:28:54 +0000 Commit: Robert Wing <rew@FreeBSD.org> CommitDate: 2022-04-05 21:34:34 +0000 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 --- sys/conf/kern.mk | 6 +++++- sys/conf/kern.opts.mk | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index f97be774ea10..67756b7fb986 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -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 diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index 077009baebf0..19789180ee93 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -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