git: c227269e2f9d - main - Stop adding -Wredundant-decls to CWARNFLAGS.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 07 Feb 2022 20:50:33 UTC
The branch main has been updated by jhb:

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

commit c227269e2f9dc2695d00be9e5a72b5fdeec5712a
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-02-07 20:47:51 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-02-07 20:47:51 +0000

    Stop adding -Wredundant-decls to CWARNFLAGS.
    
    clang doesn't implement it, and Linux doesn't enforce it.  As a
    result, new instances keep cropping up both in FreeBSD's code and in
    upstream sources from vendors.
    
    Reviewed by:    emaste
    Differential Revision:  https://reviews.freebsd.org/D34144
---
 share/mk/bsd.sys.mk               | 3 +--
 sys/conf/Makefile.powerpc         | 1 -
 sys/conf/kern.mk                  | 2 +-
 sys/conf/kern.pre.mk              | 3 +--
 sys/conf/kmod.mk                  | 3 +--
 sys/modules/ibcore/Makefile       | 2 +-
 sys/powerpc/conf/QORIQ64          | 2 +-
 sys/powerpc/conf/dpaa/DPAA        | 2 +-
 sys/powerpc/conf/dpaa/config.dpaa | 1 -
 9 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 14b643fe0a20..13be4c1442fc 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -60,7 +60,7 @@ CWARNFLAGS+=	-Wcast-align
 .endif # !NO_WCAST_ALIGN !NO_WCAST_ALIGN.${COMPILER_TYPE}
 .endif # WARNS >= 4
 .if ${WARNS} >= 6
-CWARNFLAGS+=	-Wchar-subscripts -Wnested-externs -Wredundant-decls\
+CWARNFLAGS+=	-Wchar-subscripts -Wnested-externs \
 		-Wold-style-definition
 .if !defined(NO_WMISSING_VARIABLE_DECLARATIONS)
 CWARNFLAGS.clang+=	-Wmissing-variable-declarations
@@ -163,7 +163,6 @@ CWARNFLAGS+=	-Wno-error=address			\
 CWARNFLAGS+=	-Wno-error=empty-body			\
 		-Wno-error=maybe-uninitialized		\
 		-Wno-error=nonnull-compare		\
-		-Wno-error=redundant-decls		\
 		-Wno-error=shift-negative-value		\
 		-Wno-error=tautological-compare		\
 		-Wno-error=unused-const-variable
diff --git a/sys/conf/Makefile.powerpc b/sys/conf/Makefile.powerpc
index a933c6b42090..839fde10f9b2 100644
--- a/sys/conf/Makefile.powerpc
+++ b/sys/conf/Makefile.powerpc
@@ -53,7 +53,6 @@ DPAAWARNFLAGS += \
         -Wno-error=enum-conversion
 .elif "${COMPILER_TYPE}" == "gcc"
 DPAAWARNFLAGS += \
-	-Wno-error=redundant-decls \
 	-Wno-error=int-in-bool-context
 .endif
 
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index 3d71f9e2b5e2..b009d64324da 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -3,7 +3,7 @@
 #
 # Warning flags for compiling the kernel and components of the kernel:
 #
-CWARNFLAGS?=	-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
+CWARNFLAGS?=	-Wall -Wnested-externs -Wstrict-prototypes \
 		-Wmissing-prototypes -Wpointer-arith -Wcast-qual \
 		-Wundef -Wno-pointer-sign ${FORMAT_EXTENSIONS} \
 		-Wmissing-include-dirs -fdiagnostics-show-option \
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index ac0580927ef8..8c753783b527 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -228,7 +228,6 @@ CDDL_CFLAGS=	\
 	-Wno-nested-externs \
 	-Wno-parentheses \
 	-Wno-pointer-arith \
-	-Wno-redundant-decls \
 	-Wno-strict-prototypes \
 	-Wno-switch \
 	-Wno-undef \
@@ -298,7 +297,7 @@ LINUXKPI_C=		${NORMAL_C} ${LINUXKPI_INCLUDES}
 # Infiniband C flags.  Correct include paths and omit errors that linux
 # does not honor.
 OFEDINCLUDES=	-I$S/ofed/include -I$S/ofed/include/uapi ${LINUXKPI_INCLUDES}
-OFEDNOERR=	-Wno-cast-qual -Wno-pointer-arith -Wno-redundant-decls
+OFEDNOERR=	-Wno-cast-qual -Wno-pointer-arith
 OFEDCFLAGS=	${CFLAGS:N-I*} -DCONFIG_INFINIBAND_USER_MEM \
 		${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR}
 OFED_C_NOIMP=	${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR}
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 54d57b069435..e01a982d4793 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -544,8 +544,7 @@ OPENZFS_CFLAGS=     \
 	-I${SYSDIR}/cddl/contrib/opensolaris/uts/common \
 	-include ${ZINCDIR}/os/freebsd/spl/sys/ccompile.h
 OPENZFS_CWARNFLAGS= \
-	-Wno-nested-externs \
-	-Wno-redundant-decls
+	-Wno-nested-externs
 
 .include <bsd.dep.mk>
 .include <bsd.clang-analyze.mk>
diff --git a/sys/modules/ibcore/Makefile b/sys/modules/ibcore/Makefile
index d3fc9096f315..4cabde88f885 100644
--- a/sys/modules/ibcore/Makefile
+++ b/sys/modules/ibcore/Makefile
@@ -56,4 +56,4 @@ EXPORT_SYMS=	YES
 
 .include <bsd.kmod.mk>
 
-CWARNFLAGS+= -Wno-cast-qual -Wno-pointer-arith -Wno-redundant-decls
+CWARNFLAGS+= -Wno-cast-qual -Wno-pointer-arith
diff --git a/sys/powerpc/conf/QORIQ64 b/sys/powerpc/conf/QORIQ64
index 4131ed5935b5..5db473c5393b 100644
--- a/sys/powerpc/conf/QORIQ64
+++ b/sys/powerpc/conf/QORIQ64
@@ -14,7 +14,7 @@ machine		powerpc	powerpc64
 include 	"dpaa/config.dpaa"
 makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
 makeoptions	WITH_CTF=1
-#makeoptions	WERROR="-Werror -Wno-format -Wno-redundant-decls"
+#makeoptions	WERROR="-Werror -Wno-format"
 
 options 	FPU_EMU
 
diff --git a/sys/powerpc/conf/dpaa/DPAA b/sys/powerpc/conf/dpaa/DPAA
index 23b708591378..4032c2ddd446 100644
--- a/sys/powerpc/conf/dpaa/DPAA
+++ b/sys/powerpc/conf/dpaa/DPAA
@@ -12,7 +12,7 @@ cpu		BOOKE_E500
 
 machine		powerpc powerpc
 #makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
-#makeoptions	WERROR="-Werror -Wno-format -Wno-redundant-decls"
+#makeoptions	WERROR="-Werror -Wno-format"
 makeoptions	NO_MODULES=yes
 
 # Platform support
diff --git a/sys/powerpc/conf/dpaa/config.dpaa b/sys/powerpc/conf/dpaa/config.dpaa
index a40e3e5ea8bc..6161eb7db4a6 100644
--- a/sys/powerpc/conf/dpaa/config.dpaa
+++ b/sys/powerpc/conf/dpaa/config.dpaa
@@ -6,7 +6,6 @@ makeoptions DPAA_COMPILE_CMD="${LINUXKPI_C} ${DPAAWARNFLAGS} \
 	-Wno-cast-qual -Wno-unused-function -Wno-init-self -fms-extensions \
 	-include $S/contrib/ncsw/build/dflags.h \
 	-Wno-error=missing-prototypes \
-	-Wno-redundant-decls \
 	-I$S/contrib/ncsw/build/ \
 	-I$S/contrib/ncsw/inc \
 	-I$S/contrib/ncsw/inc/cores \