ath: fix older clang build.

Define NO_WUNUSED_BUT_SET_VARIABLE for newer clang, and use it in ATH_C
to account for different clang versions. Use it in Makefiles as well.

Sponsored by:		Netflix
Reviewed by:		kevans, jhb
Differential Revision:	https://reviews.freebsd.org/D34408
This commit is contained in:
Warner Losh 2022-03-01 22:54:58 -07:00
parent 3b17e19f02
commit 369216b039
14 changed files with 18 additions and 14 deletions

View File

@ -47,7 +47,7 @@ CWARNFLAGS+= -Wno-error=unused-but-set-variable
.if ${COMPILER_TYPE} == "gcc"
# Catch-all for all the things that are in our tree, but for which we're
# not yet ready for this compiler.
NO_WUNUSED_BUT_SET_VARIABLE = -Wno-unused-but-set-variable
NO_WUNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable
CWARNEXTRA?= -Wno-error=address \
-Wno-error=aggressive-loop-optimizations \
-Wno-error=array-bounds \
@ -90,6 +90,10 @@ CWARNFLAGS+= -Wno-format-zero-length
FORMAT_EXTENSIONS= -Wno-format
.elif ${COMPILER_TYPE} == "clang"
FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
# Only newer versions of clang have -Wno-unused-but-set-variable
.if ${COMPILER_VERSION} >= 130000
NO_WUNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable
.endif
.else
FORMAT_EXTENSIONS= -fformat-extensions
.endif

View File

@ -263,7 +263,7 @@ ZFS_RPC_C= ${CC} -c ${ZFS_CFLAGS} -DHAVE_RPC_TYPES ${WERROR} ${.IMPSRC}
ZFS_S= ${CC} -c ${ZFS_ASM_CFLAGS} ${WERROR} ${.IMPSRC}
# ATH driver
ATH_CFLAGS= -I${SRCTOP}/sys/dev/ath -Wno-unused-but-set-variable
ATH_CFLAGS= -I${SRCTOP}/sys/dev/ath ${NO_WUNUSED_BUT_SET_VARIABLE}
ATH_C= ${CC} -c ${CFLAGS} ${WERROR} ${ATH_CFLAGS} ${.IMPSRC}
# Special flags for managing the compat compiles for DTrace

View File

@ -42,4 +42,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
.include <bsd.kmod.mk>
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -40,4 +40,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
.include <bsd.kmod.mk>
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -46,4 +46,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
.include <bsd.kmod.mk>
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -47,4 +47,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
EXPORT_SYMS= YES
CWARNFLAGS.ah_regdomain.c= ${NO_WSHIFT_COUNT_NEGATIVE} ${NO_WSHIFT_COUNT_OVERFLOW}
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -52,4 +52,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
.include <bsd.kmod.mk>
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -54,4 +54,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
.include <bsd.kmod.mk>
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -59,4 +59,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
.include <bsd.kmod.mk>
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -90,4 +90,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
.include <bsd.kmod.mk>
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -57,4 +57,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
# AR9300 HAL build overrides, as there's still some code to tidy up
CWARNFLAGS.ar9300_eeprom.c= ${NO_WCONSTANT_CONVERSION}
CWARNFLAGS.ar9300_reset.c= ${NO_WSOMETIMES_UNINITIALIZED} -Wno-unused-function
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -50,4 +50,4 @@ CFLAGS+= ${ATH_CFLAGS}
# XXX Work around clang warnings, until maintainer approves fix.
CWARNFLAGS.if_ath.c= ${NO_WSOMETIMES_UNINITIALIZED}
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -40,4 +40,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
.include <bsd.kmod.mk>
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}

View File

@ -56,4 +56,4 @@ CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/
.include <bsd.kmod.mk>
CWARNFLAGS+= -Wno-unused-but-set-variable
CWARNFLAGS+= ${NO_WUNUSED_BUT_SET_VARIABLE}