aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-09-18 17:17:46 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-09-18 17:17:46 +0000
commitfe815331bb40604ba31312acf7e4619674631777 (patch)
treec81780275dd6e888c4f23a7ee44cd37f687bc5f8
parentf9cc8410e16ab0870c218b7a9541464ef10a8d34 (diff)
downloadsrc-fe815331bb40604ba31312acf7e4619674631777.tar.gz
src-fe815331bb40604ba31312acf7e4619674631777.zip
build: provide a default WARNS for all in-tree builds
The current default is provided in various Makefile.inc in some top-level directories and covers a good portion of the tree, but doesn't cover parts of the build a little deeper (e.g. libcasper). Provide a default in src.sys.mk and set WARNS to it in bsd.sys.mk if that variable is defined. This lets us relatively cleanly provide a default WARNS no matter where you're building in the src tree without breaking things outside of the tree. Crunchgen has been updated as a bootstrap tool to work on this change because it needs r365605 at a minimum to succeed. The cleanup necessary to successfully walk over this change on WITHOUT_CLEAN builds has been added. There is a supplemental project to this to list all of the warnings that are encountered when the environment has WARNS=6 NO_WERROR=yes: https://warns.kevans.dev -- this project will hopefully eventually go away in favor of CI doing a much better job than it. Reviewed by: emaste, brooks, ngie (all earlier version) Reviewed by: emaste, arichardson (depend-cleanup.sh change) Differential Revision: https://reviews.freebsd.org/D26455
Notes
Notes: svn path=/head/; revision=365887
-rw-r--r--Makefile.inc19
-rw-r--r--bin/Makefile.inc1
-rw-r--r--gnu/lib/libregex/Makefile2
-rw-r--r--gnu/usr.bin/diff3/Makefile2
-rw-r--r--gnu/usr.bin/gdb/Makefile.inc2
-rw-r--r--gnu/usr.bin/grep/Makefile2
-rw-r--r--lib/Makefile.inc2
-rw-r--r--lib/clang/Makefile.inc2
-rw-r--r--lib/libarchive/tests/Makefile2
-rw-r--r--lib/libc/tests/regex/Makefile.inc1
-rw-r--r--lib/libcasper/services/cap_dns/tests/Makefile2
-rw-r--r--lib/libcasper/services/cap_grp/tests/Makefile2
-rw-r--r--lib/libcasper/services/cap_pwd/tests/Makefile2
-rw-r--r--lib/libcasper/services/cap_sysctl/tests/Makefile2
-rw-r--r--lib/libthr/tests/Makefile2
-rw-r--r--lib/libthr/tests/dlopen/Makefile2
-rw-r--r--lib/libthr/tests/dlopen/dso/Makefile1
-rw-r--r--lib/libxo/tests/Makefile2
-rw-r--r--lib/ofed/Makefile.inc2
-rw-r--r--rescue/librescue/Makefile2
-rw-r--r--sbin/Makefile.inc1
-rw-r--r--secure/lib/libcrypto/engines/Makefile.inc2
-rw-r--r--share/mk/bsd.sys.mk8
-rw-r--r--share/mk/src.sys.mk2
-rw-r--r--tests/sys/cddl/zfs/bin/Makefile2
-rw-r--r--tests/sys/cddl/zfs/tests/Makefile.inc3
-rw-r--r--tests/sys/geom/class/eli/Makefile2
-rw-r--r--tests/sys/net/routing/Makefile1
-rwxr-xr-xtools/build/depend-cleanup.sh7
-rw-r--r--usr.bin/Makefile.inc2
-rw-r--r--usr.bin/ofed/infiniband-diags/Makefile.inc1
-rw-r--r--usr.bin/ofed/libibverbs/Makefile.inc1
-rw-r--r--usr.bin/ofed/librdmacm/Makefile.inc2
-rw-r--r--usr.bin/tar/tests/Makefile2
-rw-r--r--usr.sbin/Makefile.inc2
-rw-r--r--usr.sbin/wpa/Makefile.inc2
36 files changed, 62 insertions, 22 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 46cecc5a9d1f..b7a1c0476d77 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -2226,12 +2226,9 @@ _crunchide= usr.sbin/crunch/crunchide
_bootstrap_tools_links+=crunchide
.endif
-# r285986 crunchen: use STRIPBIN rather than STRIP
-# 1100113: Support MK_AUTO_OBJ
-# 1200006: META_MODE fixes
-.if ${BOOTSTRAPPING} < 1100078 || \
- (${MK_AUTO_OBJ} == "yes" && ${BOOTSTRAPPING} < 1100114) || \
- (${MK_META_MODE} == "yes" && ${BOOTSTRAPPING} < 1200006)
+# 1300115: Higher WARNS fixes
+.if ${BOOTSTRAPPING} < 1202502 || \
+ (${BOOTSTRAPPING} > 1300000 && ${BOOTSTRAPPING} < 1300115)
_crunchgen= usr.sbin/crunch/crunchgen
.else
_bootstrap_tools_links+=crunchgen
diff --git a/bin/Makefile.inc b/bin/Makefile.inc
index 86141a1387f9..637d54f2a4ac 100644
--- a/bin/Makefile.inc
+++ b/bin/Makefile.inc
@@ -4,7 +4,6 @@
.include <src.opts.mk>
BINDIR?= /bin
-WARNS?= 6
.if ${MK_DYNAMICROOT} == "no"
NO_SHARED?= YES
diff --git a/gnu/lib/libregex/Makefile b/gnu/lib/libregex/Makefile
index b775b74d75ae..c18243a81065 100644
--- a/gnu/lib/libregex/Makefile
+++ b/gnu/lib/libregex/Makefile
@@ -6,6 +6,8 @@ SHLIB_MAJOR= 5
REGEXDIR= ${SRCTOP}/contrib/libgnuregex
.PATH: ${REGEXDIR}
+WARNS?= 1
+
SRCS= gnuregex.c
INCSGROUPS= INCS WRINCS PXINCS
INCS= regex.h.patched
diff --git a/gnu/usr.bin/diff3/Makefile b/gnu/usr.bin/diff3/Makefile
index 7e72487bed00..6549b7157ef6 100644
--- a/gnu/usr.bin/diff3/Makefile
+++ b/gnu/usr.bin/diff3/Makefile
@@ -18,6 +18,8 @@ CFLAGS+=-I${SRCTOP}/contrib/diff/lib
CFLAGS+=-DHAVE_CONFIG_H
CFLAGS+=-DDEFAULT_DIFF_PROGRAM=\"/usr/bin/diff\"
+WARNS?= 0
+
.for f in diff3.c
${f}: ${DIFFSRC}/${f} ${.CURDIR}/${f}.diff
patch -s -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f}
diff --git a/gnu/usr.bin/gdb/Makefile.inc b/gnu/usr.bin/gdb/Makefile.inc
index 30d677726a00..a668a487d218 100644
--- a/gnu/usr.bin/gdb/Makefile.inc
+++ b/gnu/usr.bin/gdb/Makefile.inc
@@ -2,6 +2,8 @@
.include <src.opts.mk>
+WARNS?= 0
+
VERSION= "6.1.1 [FreeBSD]"
VENDOR= marcel
diff --git a/gnu/usr.bin/grep/Makefile b/gnu/usr.bin/grep/Makefile
index b24b1ea292e0..98c8cec401f0 100644
--- a/gnu/usr.bin/grep/Makefile
+++ b/gnu/usr.bin/grep/Makefile
@@ -14,6 +14,8 @@ SRCS= closeout.c dfa.c error.c exclude.c grep.c grepmat.c hard-locale.c \
xstrtoumax.c
CLEANFILES+= gnugrep.1
+WARNS?= 0
+
CFLAGS+=-I${.CURDIR} -I${SYSROOT:U${DESTDIR}}/usr/include/gnu -DHAVE_CONFIG_H
.if ${MK_BSD_GREP} != "yes"
diff --git a/lib/Makefile.inc b/lib/Makefile.inc
index d77e2dbd15d5..e9cf750939ce 100644
--- a/lib/Makefile.inc
+++ b/lib/Makefile.inc
@@ -1,5 +1,3 @@
# $FreeBSD$
# Default version for system libs (override in <lib>/Makefile if necessary)
SHLIB_MAJOR?= 5
-
-WARNS?= 6
diff --git a/lib/clang/Makefile.inc b/lib/clang/Makefile.inc
index 3d49ea44c991..6500e91eaac1 100644
--- a/lib/clang/Makefile.inc
+++ b/lib/clang/Makefile.inc
@@ -9,3 +9,5 @@ DEBUG_FILES_CFLAGS= -gline-tables-only
.else
DEBUG_FILES_CFLAGS= -g1
.endif
+
+WARNS?= 0
diff --git a/lib/libarchive/tests/Makefile b/lib/libarchive/tests/Makefile
index 8467123d159e..ba662adcc070 100644
--- a/lib/libarchive/tests/Makefile
+++ b/lib/libarchive/tests/Makefile
@@ -3,6 +3,8 @@
PACKAGE= tests
+WARNS?= 3
+
_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
ATF_TESTS_SH+= functional_test
diff --git a/lib/libc/tests/regex/Makefile.inc b/lib/libc/tests/regex/Makefile.inc
index 00aa7c0e212b..9e0584bd73e3 100644
--- a/lib/libc/tests/regex/Makefile.inc
+++ b/lib/libc/tests/regex/Makefile.inc
@@ -3,6 +3,7 @@
.include <bsd.own.mk>
BINDIR?= ${TESTSDIR}
+WARNS?= 3
# SKIP_LEFTASSOC -> these testcases fail on FreeBSD.
IMPLEMENTATION?= -DREGEX_SPENCER -DSKIP_LEFTASSOC
diff --git a/lib/libcasper/services/cap_dns/tests/Makefile b/lib/libcasper/services/cap_dns/tests/Makefile
index 55c163bbdb40..f79e872049d1 100644
--- a/lib/libcasper/services/cap_dns/tests/Makefile
+++ b/lib/libcasper/services/cap_dns/tests/Makefile
@@ -11,6 +11,4 @@ CFLAGS+=-DWITH_CASPER
.endif
LIBADD+= nv
-WARNS?= 3
-
.include <bsd.test.mk>
diff --git a/lib/libcasper/services/cap_grp/tests/Makefile b/lib/libcasper/services/cap_grp/tests/Makefile
index ff2f2f18e25c..d24cba093e67 100644
--- a/lib/libcasper/services/cap_grp/tests/Makefile
+++ b/lib/libcasper/services/cap_grp/tests/Makefile
@@ -11,6 +11,4 @@ CFLAGS+=-DWITH_CASPER
.endif
LIBADD+= nv
-WARNS?= 3
-
.include <bsd.test.mk>
diff --git a/lib/libcasper/services/cap_pwd/tests/Makefile b/lib/libcasper/services/cap_pwd/tests/Makefile
index d010cc45efdd..515fe383b971 100644
--- a/lib/libcasper/services/cap_pwd/tests/Makefile
+++ b/lib/libcasper/services/cap_pwd/tests/Makefile
@@ -11,6 +11,4 @@ CFLAGS+=-DWITH_CASPER
.endif
LIBADD+= nv
-WARNS?= 3
-
.include <bsd.test.mk>
diff --git a/lib/libcasper/services/cap_sysctl/tests/Makefile b/lib/libcasper/services/cap_sysctl/tests/Makefile
index 46aa5424323d..d0d9f9bd7a0d 100644
--- a/lib/libcasper/services/cap_sysctl/tests/Makefile
+++ b/lib/libcasper/services/cap_sysctl/tests/Makefile
@@ -11,8 +11,6 @@ CFLAGS+=-DWITH_CASPER
.endif
LIBADD+= nv
-WARNS?= 3
-
TEST_METADATA.sysctl_test+= required_user="root"
.include <bsd.test.mk>
diff --git a/lib/libthr/tests/Makefile b/lib/libthr/tests/Makefile
index f899f4735093..9330297bc579 100644
--- a/lib/libthr/tests/Makefile
+++ b/lib/libthr/tests/Makefile
@@ -2,6 +2,8 @@
PACKAGE= tests
+WARNS?= 3
+
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread
# TODO: t_name (missing pthread_getname_np support in FreeBSD)
diff --git a/lib/libthr/tests/dlopen/Makefile b/lib/libthr/tests/dlopen/Makefile
index bea70ec7cbd5..05f1cb7e6790 100644
--- a/lib/libthr/tests/dlopen/Makefile
+++ b/lib/libthr/tests/dlopen/Makefile
@@ -2,6 +2,8 @@
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread/dlopen
+WARNS?= 2
+
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/lib/libthr/dlopen
diff --git a/lib/libthr/tests/dlopen/dso/Makefile b/lib/libthr/tests/dlopen/dso/Makefile
index b9a90310bf2b..dfd926586c90 100644
--- a/lib/libthr/tests/dlopen/dso/Makefile
+++ b/lib/libthr/tests/dlopen/dso/Makefile
@@ -1,6 +1,7 @@
# $FreeBSD$
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread/dlopen/dso
+WARNS?= 3
SHLIB= h_pthread_dlopen
SHLIB_MAJOR= 1
diff --git a/lib/libxo/tests/Makefile b/lib/libxo/tests/Makefile
index 5d42e0d9c34e..2d834ac502f1 100644
--- a/lib/libxo/tests/Makefile
+++ b/lib/libxo/tests/Makefile
@@ -4,6 +4,8 @@
PACKAGE= tests
+WARNS?= 1
+
LIBXOSRC= ${SRCTOP}/contrib/libxo
# Override the default suffix transformation rules for .c/.o -> .out
diff --git a/lib/ofed/Makefile.inc b/lib/ofed/Makefile.inc
index e8c0da7a1d7e..a73f0e488b1f 100644
--- a/lib/ofed/Makefile.inc
+++ b/lib/ofed/Makefile.inc
@@ -1 +1,3 @@
# $FreeBSD$
+
+WARNS?= 0
diff --git a/rescue/librescue/Makefile b/rescue/librescue/Makefile
index e7147d8e67ce..2116219dc746 100644
--- a/rescue/librescue/Makefile
+++ b/rescue/librescue/Makefile
@@ -23,6 +23,8 @@ INTERNALLIB= # Don't install this library
SRCS= exec.c getusershell.c login_class.c popen.c rcmdsh.c \
sysctl.c system.c
+WARNS?= 3
+
CFLAGS+= -DRESCUE
# Flags copied from src/lib/libc and src/lib/libutil
# libc/db/Makefile.inc
diff --git a/sbin/Makefile.inc b/sbin/Makefile.inc
index 896c64c82c13..401e2a8e3491 100644
--- a/sbin/Makefile.inc
+++ b/sbin/Makefile.inc
@@ -4,7 +4,6 @@
.include <src.opts.mk>
BINDIR?= /sbin
-WARNS?= 6
.if ${MK_DYNAMICROOT} == "no"
NO_SHARED?= YES
diff --git a/secure/lib/libcrypto/engines/Makefile.inc b/secure/lib/libcrypto/engines/Makefile.inc
index 1d368ae5d650..88ef355f5568 100644
--- a/secure/lib/libcrypto/engines/Makefile.inc
+++ b/secure/lib/libcrypto/engines/Makefile.inc
@@ -18,3 +18,5 @@ CFLAGS+= -DB_ENDIAN
CFLAGS+= -DNDEBUG
.PATH: ${LCRYPTO_SRC}/engines
+
+WARNS?= 0
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 7702ddfe15a7..c5bb6e4068de 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -28,6 +28,14 @@ CFLAGS+= -std=${CSTD}
CXXFLAGS+= -std=${CXXSTD}
.endif
+# This gives the Makefile we're evaluating at the top-level a chance to set
+# WARNS. If it doesn't do so, we may freely pull a DEFAULTWARNS if it's set
+# and use that. This allows us to default WARNS to 6 for src builds without
+# needing to set the default in various Makefile.inc.
+.if !defined(WARNS) && defined(DEFAULTWARNS)
+WARNS= ${DEFAULTWARNS}
+.endif
+
# -pedantic is problematic because it also imposes namespace restrictions
#CFLAGS+= -pedantic
.if defined(WARNS)
diff --git a/share/mk/src.sys.mk b/share/mk/src.sys.mk
index 61c51f200d35..2a6bfadee009 100644
--- a/share/mk/src.sys.mk
+++ b/share/mk/src.sys.mk
@@ -40,6 +40,8 @@ __postrcconf_${var}:= ${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno
CFCOMMONFLAG?= -fno-common
CFLAGS+= ${CFCOMMONFLAG}
+DEFAULTWARNS= 6
+
# tempting, but bsd.compiler.mk causes problems this early
# probably need to remove dependence on bsd.own.mk
#.include "src.opts.mk"
diff --git a/tests/sys/cddl/zfs/bin/Makefile b/tests/sys/cddl/zfs/bin/Makefile
index 21fff8e2ea51..165082e91747 100644
--- a/tests/sys/cddl/zfs/bin/Makefile
+++ b/tests/sys/cddl/zfs/bin/Makefile
@@ -7,6 +7,8 @@ MAN=
BINDIR= ${TESTSBASE}/sys/cddl/zfs/bin
SCRIPTSDIR= ${TESTSBASE}/sys/cddl/zfs/bin
+WARNS?= 0
+
SCRIPTS+= bsddisks.ksh
SCRIPTS+= dircmp.ksh
SCRIPTS+= dumpadm.ksh
diff --git a/tests/sys/cddl/zfs/tests/Makefile.inc b/tests/sys/cddl/zfs/tests/Makefile.inc
new file mode 100644
index 000000000000..a73f0e488b1f
--- /dev/null
+++ b/tests/sys/cddl/zfs/tests/Makefile.inc
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+WARNS?= 0
diff --git a/tests/sys/geom/class/eli/Makefile b/tests/sys/geom/class/eli/Makefile
index 8e4f2f4eb839..c7f1342f45ae 100644
--- a/tests/sys/geom/class/eli/Makefile
+++ b/tests/sys/geom/class/eli/Makefile
@@ -4,6 +4,8 @@
PACKAGE= tests
+WARNS?= 3
+
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
ATF_TESTS_C= pbkdf2_test
diff --git a/tests/sys/net/routing/Makefile b/tests/sys/net/routing/Makefile
index f0fe536fe747..d32ba9af54a1 100644
--- a/tests/sys/net/routing/Makefile
+++ b/tests/sys/net/routing/Makefile
@@ -1,6 +1,7 @@
# $FreeBSD$
PACKAGE= tests
+WARNS?= 1
TESTSDIR= ${TESTSBASE}/sys/net/routing
diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
index 0134a1cae5a6..8b249ccf55fa 100755
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -49,3 +49,10 @@ if [ -e "$OBJTOP"/cddl/lib/libzfs/.depend.libzfs_changelist.o ] && \
echo "Removing old ZFS tree"
rm -rf "$OBJTOP"/cddl "$OBJTOP"/obj-lib32/cddl
fi
+
+# 20200916 WARNS bumped, need bootstrapped crunchgen stubs
+if [ -e "$OBJTOP"/rescue/rescue/rescue.c ] && \
+ ! grep -q 'crunched_stub_t' "$OBJTOP"/rescue/rescue/rescue.c; then
+ echo "Removing old rescue(8) tree"
+ rm -rf "$OBJTOP"/rescue/rescue
+fi
diff --git a/usr.bin/Makefile.inc b/usr.bin/Makefile.inc
index 534349f25155..e4edaf4e08e1 100644
--- a/usr.bin/Makefile.inc
+++ b/usr.bin/Makefile.inc
@@ -2,5 +2,3 @@
# $FreeBSD$
BINDIR?= /usr/bin
-
-WARNS?= 6
diff --git a/usr.bin/ofed/infiniband-diags/Makefile.inc b/usr.bin/ofed/infiniband-diags/Makefile.inc
index 76bf879f6096..c3ba3a255c55 100644
--- a/usr.bin/ofed/infiniband-diags/Makefile.inc
+++ b/usr.bin/ofed/infiniband-diags/Makefile.inc
@@ -10,3 +10,4 @@ CFLAGS+= -DHAVE_CONFIG_H=1
CFLAGS+= -I${_spath} -I${_spath}/src
LIBADD+= osmcomp ibmad ibumad
+WARNS?= 0
diff --git a/usr.bin/ofed/libibverbs/Makefile.inc b/usr.bin/ofed/libibverbs/Makefile.inc
index 9ed20e6a94b0..0f60546d9820 100644
--- a/usr.bin/ofed/libibverbs/Makefile.inc
+++ b/usr.bin/ofed/libibverbs/Makefile.inc
@@ -7,3 +7,4 @@ BINDIR?= /usr/bin
CFLAGS+= -I${_spath}
LIBADD+= ibverbs mlx4 mlx5 cxgb4 pthread
+WARNS?= 2
diff --git a/usr.bin/ofed/librdmacm/Makefile.inc b/usr.bin/ofed/librdmacm/Makefile.inc
index d407c8ff9681..05d4f33c9ab5 100644
--- a/usr.bin/ofed/librdmacm/Makefile.inc
+++ b/usr.bin/ofed/librdmacm/Makefile.inc
@@ -6,3 +6,5 @@ _spath=${SRCTOP}/contrib/ofed/librdmacm
BINDIR?= /usr/bin
CFLAGS+= -I${SRCTOP}/contrib/ofed
LIBADD+= ibverbs rdmacm mlx4 mlx5 cxgb4 pthread
+
+WARNS?= 0
diff --git a/usr.bin/tar/tests/Makefile b/usr.bin/tar/tests/Makefile
index f537274021c5..d9ebfc2072ce 100644
--- a/usr.bin/tar/tests/Makefile
+++ b/usr.bin/tar/tests/Makefile
@@ -2,6 +2,8 @@
PACKAGE= tests
+WARNS?= 3
+
_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
ATF_TESTS_SH+= functional_test
diff --git a/usr.sbin/Makefile.inc b/usr.sbin/Makefile.inc
index bd13613e1d93..4347591cf563 100644
--- a/usr.sbin/Makefile.inc
+++ b/usr.sbin/Makefile.inc
@@ -2,5 +2,3 @@
# $FreeBSD$
BINDIR?= /usr/sbin
-
-WARNS?= 6
diff --git a/usr.sbin/wpa/Makefile.inc b/usr.sbin/wpa/Makefile.inc
index c2e216c4b6c4..0a69ca08166b 100644
--- a/usr.sbin/wpa/Makefile.inc
+++ b/usr.sbin/wpa/Makefile.inc
@@ -2,6 +2,8 @@
BINDIR?= /usr/sbin
+WARNS?= 0
+
WPA_DISTDIR?= ${SRCTOP}/contrib/wpa/
WPA_SUPPLICANT_DISTDIR?=${WPA_DISTDIR}/wpa_supplicant
HOSTAPD_DISTDIR?= ${WPA_DISTDIR}/hostapd