git: ad79b018dc00 - main - bsd.sys.mk: Add NO_WUNUSED_BUT_SET_VARIABLE helper variable.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 20 Jun 2023 19:39:16 UTC
The branch main has been updated by jhb:

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

commit ad79b018dc00c2b64e65ebb5c8a14fafa0e99a3e
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-06-20 19:36:15 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-06-20 19:36:15 +0000

    bsd.sys.mk: Add NO_WUNUSED_BUT_SET_VARIABLE helper variable.
    
    This is already present in sys/conf/kern.mk and can be used to
    selectively disable -Wunused-but-set-variable.
    
    Reviewed by:    emaste
    Differential Revision:  https://reviews.freebsd.org/D40663
---
 share/mk/bsd.sys.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index b4a417236c65..f3eb1fe99b2f 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -116,6 +116,9 @@ CWARNFLAGS.clang+=	-Wno-array-bounds
       ${COMPILER_TYPE} == "gcc")
 CWARNFLAGS+=		-Wno-misleading-indentation
 .endif # NO_WMISLEADING_INDENTATION
+.if ${COMPILER_VERSION} >= 130000
+NO_WUNUSED_BUT_SET_VARIABLE=	-Wno-unused-but-set-variable
+.endif
 .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 140000
 NO_WBITWISE_INSTEAD_OF_LOGICAL=	-Wno-bitwise-instead-of-logical
 .endif
@@ -124,6 +127,9 @@ NO_WARRAY_PARAMETER=	-Wno-array-parameter
 NO_WSTRICT_PROTOTYPES=	-Wno-strict-prototypes
 NO_WDEPRECATED_NON_PROTOTYPE=-Wno-deprecated-non-prototype
 .endif
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 50200
+NO_WUNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable
+.endif
 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 100100
 NO_WZERO_LENGTH_BOUNDS=	-Wno-zero-length-bounds
 .endif