git: 7fa2f2a62f04 - main - Rename NO_WERROR -> MK_WERROR=no

Alex Richardson arichardson at FreeBSD.org
Thu Jan 7 11:05:55 UTC 2021


The branch main has been updated by arichardson:

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

commit 7fa2f2a62f04f095e1e27ad55aa22a8f59b1df8f
Author:     Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
AuthorDate: 2021-01-06 17:55:06 +0000
Commit:     Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-01-07 09:31:03 +0000

    Rename NO_WERROR -> MK_WERROR=no
    
    As suggested in D27598. This also supports MK_WERROR.clang=no and
    MK_WERROR.gcc=no to support the existing NO_WERROR.<compiler> uses.
    
    Reviewed By:    brooks
    Differential Revision: https://reviews.freebsd.org/D27601
---
 Makefile                                 |  2 +-
 Makefile.inc1                            | 10 +++++-----
 Makefile.libcompat                       |  2 +-
 lib/googletest/tests/gmock/Makefile      |  2 +-
 lib/googletest/tests/gmock_main/Makefile |  2 +-
 lib/googletest/tests/gtest/Makefile      |  2 +-
 lib/googletest/tests/gtest_main/Makefile |  2 +-
 lib/libalias/libalias/Makefile           |  2 +-
 lib/libc/tests/ssp/Makefile              |  2 +-
 lib/libcompiler_rt/Makefile              |  2 +-
 lib/libgcc_s/Makefile                    |  2 +-
 share/man/man5/style.Makefile.5          |  2 +-
 share/man/man7/build.7                   |  2 +-
 share/mk/bsd.README                      |  2 +-
 share/mk/bsd.lib.mk                      |  4 +++-
 share/mk/bsd.opts.mk                     |  6 ++++--
 share/mk/bsd.prog.mk                     |  4 +++-
 share/mk/bsd.progs.mk                    |  2 +-
 share/mk/bsd.sys.mk                      |  8 ++++----
 targets/pseudo/bootstrap-tools/Makefile  |  2 +-
 tools/build/options/WITHOUT_WERROR       |  4 ++++
 usr.bin/drill/Makefile                   |  2 +-
 usr.bin/kdump/Makefile                   |  2 --
 usr.bin/truss/Makefile                   |  1 -
 usr.sbin/unbound/Makefile.inc            |  2 +-
 25 files changed, 40 insertions(+), 33 deletions(-)

diff --git a/Makefile b/Makefile
index 90549cadba08..1a1739acb0fe 100644
--- a/Makefile
+++ b/Makefile
@@ -459,7 +459,7 @@ MMAKE=		${MMAKEENV} ${MAKE} \
 		OBJROOT='$${OBJTOP}/' \
 		MAKEOBJDIRPREFIX= \
 		MAN= -DNO_SHARED \
-		-DNO_CPU_CFLAGS -DNO_WERROR \
+		-DNO_CPU_CFLAGS MK_WERROR=no \
 		-DNO_SUBDIR \
 		DESTDIR= PROGNAME=${MYMAKE:T}
 
diff --git a/Makefile.inc1 b/Makefile.inc1
index 4bb8ef282f4a..c4e656c79ceb 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -731,7 +731,7 @@ BSARGS= 	DESTDIR= \
 		SSP_CFLAGS= \
 		MK_HTML=no NO_LINT=yes MK_MAN=no MK_MAN_UTILS=yes \
 		-DNO_PIC MK_PROFILE=no -DNO_SHARED \
-		-DNO_CPU_CFLAGS -DNO_WERROR MK_CTF=no \
+		-DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \
 		MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \
 		MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no \
 		MK_INCLUDES=yes
@@ -752,7 +752,7 @@ TMAKE=		\
 		BWPHASE=${.TARGET:C,^_,,} \
 		SSP_CFLAGS= \
 		-DNO_LINT \
-		-DNO_CPU_CFLAGS -DNO_WERROR MK_CTF=no \
+		-DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \
 		MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \
 		MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no
 
@@ -780,7 +780,7 @@ KTMAKE=		\
 		SSP_CFLAGS= \
 		MK_HTML=no -DNO_LINT MK_MAN=no \
 		-DNO_PIC MK_PROFILE=no -DNO_SHARED \
-		-DNO_CPU_CFLAGS MK_RETPOLINE=no -DNO_WERROR MK_CTF=no
+		-DNO_CPU_CFLAGS MK_RETPOLINE=no MK_WERROR=no MK_CTF=no
 
 # world stage
 WMAKEENV=	${CROSSENV} \
@@ -2748,7 +2748,7 @@ NXBMAKEARGS+= \
 	MK_SENDMAIL=no \
 	MK_SVNLITE=no \
 	MK_TESTS=no \
-	-DNO_WERROR \
+	MK_WERROR=no \
 	MK_ZFS=no
 
 .if make(native-xtools*) && \
@@ -3367,7 +3367,7 @@ XDEV_CPUTYPE?=${TARGET_CPUTYPE}
 
 NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \
 	MK_MAN=no MK_NLS=no MK_PROFILE=no \
-	MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no -DNO_WERROR \
+	MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WERROR=no \
 	TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
 	CPUTYPE=${XDEV_CPUTYPE}
 
diff --git a/Makefile.libcompat b/Makefile.libcompat
index 8b5b31e99387..ec4402586558 100644
--- a/Makefile.libcompat
+++ b/Makefile.libcompat
@@ -104,7 +104,7 @@ build${libcompat}: .PHONY
 	    OBJROOT='$${OBJTOP}/' \
 	    MAKEOBJDIRPREFIX= \
 	    DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \
-	    MK_CTF=no MK_RETPOLINE=no -DNO_WERROR \
+	    MK_CTF=no MK_RETPOLINE=no MK_WERROR=no \
 	    ${_t}
 .endfor
 .endfor
diff --git a/lib/googletest/tests/gmock/Makefile b/lib/googletest/tests/gmock/Makefile
index 0e311abfe3e1..0f31e87018de 100644
--- a/lib/googletest/tests/gmock/Makefile
+++ b/lib/googletest/tests/gmock/Makefile
@@ -9,6 +9,6 @@ GTESTS+=	gmock_stress_test
 LIBADD+=	pthread gtest gmock
 
 # The next release will resolve a number of build warnings issues.
-NO_WERROR=
+MK_WERROR=	no
 
 .include <bsd.test.mk>
diff --git a/lib/googletest/tests/gmock_main/Makefile b/lib/googletest/tests/gmock_main/Makefile
index 444c9ae3cb5d..a44d893b96f0 100644
--- a/lib/googletest/tests/gmock_main/Makefile
+++ b/lib/googletest/tests/gmock_main/Makefile
@@ -32,6 +32,6 @@ SRCS.gmock_link_test=		\
 LIBADD=		gmock_main gmock gtest
 
 # The next release will resolve a number of build warnings issues.
-NO_WERROR=
+MK_WERROR=	no
 
 .include <bsd.test.mk>
diff --git a/lib/googletest/tests/gtest/Makefile b/lib/googletest/tests/gtest/Makefile
index 9ab69ede2d6e..07b43884dedd 100644
--- a/lib/googletest/tests/gtest/Makefile
+++ b/lib/googletest/tests/gtest/Makefile
@@ -41,6 +41,6 @@ LIBADD+=	gtest
 LIBADD.gtest_stress_test+=	pthread
 
 # The next release will resolve a number of build warnings issues.
-NO_WERROR=
+MK_WERROR=	no
 
 .include <bsd.test.mk>
diff --git a/lib/googletest/tests/gtest_main/Makefile b/lib/googletest/tests/gtest_main/Makefile
index 8d2e9e68d5e1..0d4175735b1c 100644
--- a/lib/googletest/tests/gtest_main/Makefile
+++ b/lib/googletest/tests/gtest_main/Makefile
@@ -39,6 +39,6 @@ LIBADD.googletest-port-test+=	pthread
 LIBADD.gtest_unittest+=		pthread
 
 # The next release will resolve a number of build warnings issues.
-NO_WERROR=
+MK_WERROR=	no
 
 .include <bsd.test.mk>
diff --git a/lib/libalias/libalias/Makefile b/lib/libalias/libalias/Makefile
index eba0e3098017..17d4c2458abf 100644
--- a/lib/libalias/libalias/Makefile
+++ b/lib/libalias/libalias/Makefile
@@ -10,6 +10,6 @@ SHLIB_MAJOR= 7
 MAN=	libalias.3
 SRCS=	alias.c alias_db.c alias_proxy.c alias_util.c alias_mod.c
 INCS=	alias.h
-NO_WERROR=
+MK_WERROR=	no
 
 .include <bsd.lib.mk>
diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile
index c6b625a91d7b..655130ab309d 100644
--- a/lib/libc/tests/ssp/Makefile
+++ b/lib/libc/tests/ssp/Makefile
@@ -2,7 +2,7 @@
 
 .include <bsd.own.mk>
 
-NO_WERROR=
+MK_WERROR=	no
 WARNS?=	2
 
 CFLAGS.h_raw+=	-fstack-protector-all -Wstack-protector
diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile
index 0f42dd516c51..a2325221d0b1 100644
--- a/lib/libcompiler_rt/Makefile
+++ b/lib/libcompiler_rt/Makefile
@@ -15,7 +15,7 @@ CFLAGS+=	-I${SRCTOP}/contrib/libcxxrt
 
 # gcc has incompatible internal declarations for __divtc3 and __multc3, but has
 # no option to silence its warning, so make warnings non-fatal.
-NO_WERROR.gcc=
+MK_WERROR.gcc=	no
 
 .include "Makefile.inc"
 
diff --git a/lib/libgcc_s/Makefile b/lib/libgcc_s/Makefile
index f245069aee40..84477ee00818 100644
--- a/lib/libgcc_s/Makefile
+++ b/lib/libgcc_s/Makefile
@@ -26,7 +26,7 @@ SYMBOL_MAPS+=	${.CURDIR}/SymbolDefault.map
 
 # gcc has incompatible internal declarations for __divtc3 and __multc3, but has
 # no option to silence its warning, so make warnings non-fatal.
-NO_WERROR.gcc=
+MK_WERROR.gcc=	no
 
 LIBCSRCDIR=	${SRCTOP}/lib/libc
 LIBMSRCDIR=	${SRCTOP}/lib/msun/src
diff --git a/share/man/man5/style.Makefile.5 b/share/man/man5/style.Makefile.5
index 6bd1b7738c98..67991869ff57 100644
--- a/share/man/man5/style.Makefile.5
+++ b/share/man/man5/style.Makefile.5
@@ -156,7 +156,7 @@ is spelled
 so that it may be overridden on the command line or in
 .Xr make.conf 5 .
 .It
-.Dq Li "NO_WERROR= yes"
+.Dq Li "MK_WERROR=no"
 should not be used,
 it defeats the purpose of
 .Va WARNS .
diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
index aa45d846fd87..72a1dc3078d1 100644
--- a/share/man/man7/build.7
+++ b/share/man/man7/build.7
@@ -492,7 +492,7 @@ and not via
 or
 .Pa /etc/src.conf
 or the command line.
-.It Va NO_WERROR
+.It Va WITHOUT_WERROR
 If defined, compiler warnings will not cause the build to halt,
 even if the makefile says otherwise.
 .It Va WITH_CTF
diff --git a/share/mk/bsd.README b/share/mk/bsd.README
index e50772151d06..9eb91c1bce3c 100644
--- a/share/mk/bsd.README
+++ b/share/mk/bsd.README
@@ -417,7 +417,7 @@ PROGS_CXX	PROG and PROG_CXX in one Makefile.  To define
 		- LINKS
 		- MAN
 		- MLINKS
-		- NO_WERROR
+		- MK_WERROR=no
 		- PROGNAME
 		- SRCS
 		- STRIP
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 3d429a6b5b8a..9a31c72255f7 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -47,7 +47,9 @@ CFLAGS+=	${CRUNCH_CFLAGS}
 
 .if ${MK_ASSERT_DEBUG} == "no"
 CFLAGS+= -DNDEBUG
-NO_WERROR=
+# XXX: shouldn't we ensure that !asserts marks potentially unused variables as
+# __unused instead of disabling -Werror globally?
+MK_WERROR=	no
 .endif
 
 .if defined(DEBUG_FLAGS)
diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk
index d0e7f1cb00ba..88c73cc6bfe4 100644
--- a/share/mk/bsd.opts.mk
+++ b/share/mk/bsd.opts.mk
@@ -65,7 +65,8 @@ __DEFAULT_YES_OPTIONS = \
     SSP \
     TESTS \
     TOOLCHAIN \
-    WARNS
+    WARNS \
+    WERROR
 
 __DEFAULT_NO_OPTIONS = \
     BIND_NOW \
@@ -103,7 +104,8 @@ __DEFAULT_DEPENDENT_OPTIONS = \
     INSTALLLIB \
     MAN \
     PROFILE \
-    WARNS
+    WARNS \
+    WERROR
 .if defined(NO_${var})
 .error "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead."
 MK_${var}:=no
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 401915b3f525..5e7aaaeb37f8 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -15,7 +15,9 @@ CFLAGS+=${COPTS}
 
 .if ${MK_ASSERT_DEBUG} == "no"
 CFLAGS+= -DNDEBUG
-NO_WERROR=
+# XXX: shouldn't we ensure that !asserts marks potentially unused variables as
+# __unused instead of disabling -Werror globally?
+MK_WERROR=	no
 .endif
 
 .if defined(DEBUG_FLAGS)
diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk
index d56626805a44..54266a335177 100644
--- a/share/mk/bsd.progs.mk
+++ b/share/mk/bsd.progs.mk
@@ -23,7 +23,7 @@ PROGS += ${PROGS_CXX}
 .if defined(PROG)
 # just one of many
 PROG_OVERRIDE_VARS +=	BINDIR BINGRP BINOWN BINMODE CSTD CXXSTD DPSRCS MAN \
-			NO_SHARED NO_WERROR PROGNAME SRCS STRIP WARNS
+			NO_SHARED MK_WERROR PROGNAME SRCS STRIP WARNS
 PROG_VARS +=	CFLAGS CXXFLAGS DEBUG_FLAGS DPADD INTERNALPROG LDADD LIBADD \
 		LINKS LDFLAGS MLINKS ${PROG_OVERRIDE_VARS}
 .for v in ${PROG_VARS:O:u}
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 0d6fcf05f683..497283fc95da 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -41,9 +41,9 @@ WARNS=	${DEFAULTWARNS}
 .if defined(WARNS)
 .if ${WARNS} >= 1
 CWARNFLAGS+=	-Wsystem-headers
-.if !defined(NO_WERROR) && !defined(NO_WERROR.${COMPILER_TYPE})
+.if ${MK_WERROR} != "no" && ${MK_WERROR.${COMPILER_TYPE}:Uyes} != "no"
 CWARNFLAGS+=	-Werror
-.endif # !NO_WERROR && !NO_WERROR.${COMPILER_TYPE}
+.endif # ${MK_WERROR} != "no" && ${MK_WERROR.${COMPILER_TYPE}:Uyes} != "no"
 .endif # WARNS >= 1
 .if ${WARNS} >= 2
 CWARNFLAGS+=	-Wall -Wno-format-y2k
@@ -120,9 +120,9 @@ CWARNFLAGS+=	-Wformat=2 -Wno-format-extra-args
 .if ${WARNS} <= 3
 CWARNFLAGS.clang+=	-Wno-format-nonliteral
 .endif # WARNS <= 3
-.if !defined(NO_WERROR) && !defined(NO_WERROR.${COMPILER_TYPE})
+.if ${MK_WERROR} != "no" && ${MK_WERROR.${COMPILER_TYPE}:Uyes} != "no"
 CWARNFLAGS+=	-Werror
-.endif # !NO_WERROR && !NO_WERROR.${COMPILER_TYPE}
+.endif # ${MK_WERROR} != "no" && ${MK_WERROR.${COMPILER_TYPE}:Uyes} != "no"
 .endif # WFORMAT > 0
 .endif # WFORMAT
 .if defined(NO_WFORMAT) || defined(NO_WFORMAT.${COMPILER_TYPE})
diff --git a/targets/pseudo/bootstrap-tools/Makefile b/targets/pseudo/bootstrap-tools/Makefile
index d370538c361d..0023f763af83 100644
--- a/targets/pseudo/bootstrap-tools/Makefile
+++ b/targets/pseudo/bootstrap-tools/Makefile
@@ -42,7 +42,7 @@ BSARGS= 	DESTDIR= \
 		SSP_CFLAGS= \
 		MK_HTML=no NO_LINT=yes MK_MAN=no \
 		-DNO_PIC MK_PROFILE=no -DNO_SHARED \
-		-DNO_CPU_CFLAGS -DNO_WERROR MK_CTF=no \
+		-DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \
 		MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \
 		MK_LLDB=no MK_TESTS=no \
 		MK_INCLUDES=yes
diff --git a/tools/build/options/WITHOUT_WERROR b/tools/build/options/WITHOUT_WERROR
new file mode 100644
index 000000000000..84a4c6b06967
--- /dev/null
+++ b/tools/build/options/WITHOUT_WERROR
@@ -0,0 +1,4 @@
+.\" $FreeBSD$
+Set this to not treat compiler warnings as errors.
+Useful as a temporary workaround when working on fixing compiler warnings.
+When set, warnings are still printed in the build log but do not fail the build.
diff --git a/usr.bin/drill/Makefile b/usr.bin/drill/Makefile
index 8cf0e682e36f..096699c7602f 100644
--- a/usr.bin/drill/Makefile
+++ b/usr.bin/drill/Makefile
@@ -9,7 +9,7 @@ PROG=	drill
 SRCS=	drill.c drill_util.c error.c root.c work.c \
 	chasetrace.c dnssec.c securetrace.c
 CFLAGS+= -I${LDNSDIR}
-NO_WERROR= true
+MK_WERROR=	no
 MAN=	drill.1
 
 LIBADD=	ldns crypto
diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile
index e1b9d4fd68a2..e826ac2d6dbf 100644
--- a/usr.bin/kdump/Makefile
+++ b/usr.bin/kdump/Makefile
@@ -17,6 +17,4 @@ LIBADD+=	cap_pwd
 CFLAGS+=-DWITH_CASPER
 .endif
 
-#NO_WERROR?=	YES
-
 .include <bsd.prog.mk>
diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile
index b29befdf9c37..e6b83a5591fe 100644
--- a/usr.bin/truss/Makefile
+++ b/usr.bin/truss/Makefile
@@ -1,6 +1,5 @@
 # $FreeBSD$
 
-#NO_WERROR=
 PROG=	truss
 SRCS=	main.c setup.c syscalls.c
 
diff --git a/usr.sbin/unbound/Makefile.inc b/usr.sbin/unbound/Makefile.inc
index cdb1faf5a14f..7cdeaa592d2a 100644
--- a/usr.sbin/unbound/Makefile.inc
+++ b/usr.sbin/unbound/Makefile.inc
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-NO_WERROR=	true
+MK_WERROR=	no
 NO_WTHREAD_SAFETY= true
 PACKAGE=	unbound
 


More information about the dev-commits-src-all mailing list