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
This commit is contained in:
Kyle Evans 2020-09-18 17:17:46 +00:00
parent f9cc8410e1
commit fe815331bb
36 changed files with 62 additions and 22 deletions

View File

@ -2226,12 +2226,9 @@ _crunchide= usr.sbin/crunch/crunchide
_bootstrap_tools_links+=crunchide _bootstrap_tools_links+=crunchide
.endif .endif
# r285986 crunchen: use STRIPBIN rather than STRIP # 1300115: Higher WARNS fixes
# 1100113: Support MK_AUTO_OBJ .if ${BOOTSTRAPPING} < 1202502 || \
# 1200006: META_MODE fixes (${BOOTSTRAPPING} > 1300000 && ${BOOTSTRAPPING} < 1300115)
.if ${BOOTSTRAPPING} < 1100078 || \
(${MK_AUTO_OBJ} == "yes" && ${BOOTSTRAPPING} < 1100114) || \
(${MK_META_MODE} == "yes" && ${BOOTSTRAPPING} < 1200006)
_crunchgen= usr.sbin/crunch/crunchgen _crunchgen= usr.sbin/crunch/crunchgen
.else .else
_bootstrap_tools_links+=crunchgen _bootstrap_tools_links+=crunchgen

View File

@ -4,7 +4,6 @@
.include <src.opts.mk> .include <src.opts.mk>
BINDIR?= /bin BINDIR?= /bin
WARNS?= 6
.if ${MK_DYNAMICROOT} == "no" .if ${MK_DYNAMICROOT} == "no"
NO_SHARED?= YES NO_SHARED?= YES

View File

@ -6,6 +6,8 @@ SHLIB_MAJOR= 5
REGEXDIR= ${SRCTOP}/contrib/libgnuregex REGEXDIR= ${SRCTOP}/contrib/libgnuregex
.PATH: ${REGEXDIR} .PATH: ${REGEXDIR}
WARNS?= 1
SRCS= gnuregex.c SRCS= gnuregex.c
INCSGROUPS= INCS WRINCS PXINCS INCSGROUPS= INCS WRINCS PXINCS
INCS= regex.h.patched INCS= regex.h.patched

View File

@ -18,6 +18,8 @@ CFLAGS+=-I${SRCTOP}/contrib/diff/lib
CFLAGS+=-DHAVE_CONFIG_H CFLAGS+=-DHAVE_CONFIG_H
CFLAGS+=-DDEFAULT_DIFF_PROGRAM=\"/usr/bin/diff\" CFLAGS+=-DDEFAULT_DIFF_PROGRAM=\"/usr/bin/diff\"
WARNS?= 0
.for f in diff3.c .for f in diff3.c
${f}: ${DIFFSRC}/${f} ${.CURDIR}/${f}.diff ${f}: ${DIFFSRC}/${f} ${.CURDIR}/${f}.diff
patch -s -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f} patch -s -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f}

View File

@ -2,6 +2,8 @@
.include <src.opts.mk> .include <src.opts.mk>
WARNS?= 0
VERSION= "6.1.1 [FreeBSD]" VERSION= "6.1.1 [FreeBSD]"
VENDOR= marcel VENDOR= marcel

View File

@ -14,6 +14,8 @@ SRCS= closeout.c dfa.c error.c exclude.c grep.c grepmat.c hard-locale.c \
xstrtoumax.c xstrtoumax.c
CLEANFILES+= gnugrep.1 CLEANFILES+= gnugrep.1
WARNS?= 0
CFLAGS+=-I${.CURDIR} -I${SYSROOT:U${DESTDIR}}/usr/include/gnu -DHAVE_CONFIG_H CFLAGS+=-I${.CURDIR} -I${SYSROOT:U${DESTDIR}}/usr/include/gnu -DHAVE_CONFIG_H
.if ${MK_BSD_GREP} != "yes" .if ${MK_BSD_GREP} != "yes"

View File

@ -1,5 +1,3 @@
# $FreeBSD$ # $FreeBSD$
# Default version for system libs (override in <lib>/Makefile if necessary) # Default version for system libs (override in <lib>/Makefile if necessary)
SHLIB_MAJOR?= 5 SHLIB_MAJOR?= 5
WARNS?= 6

View File

@ -9,3 +9,5 @@ DEBUG_FILES_CFLAGS= -gline-tables-only
.else .else
DEBUG_FILES_CFLAGS= -g1 DEBUG_FILES_CFLAGS= -g1
.endif .endif
WARNS?= 0

View File

@ -3,6 +3,8 @@
PACKAGE= tests PACKAGE= tests
WARNS?= 3
_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
ATF_TESTS_SH+= functional_test ATF_TESTS_SH+= functional_test

View File

@ -3,6 +3,7 @@
.include <bsd.own.mk> .include <bsd.own.mk>
BINDIR?= ${TESTSDIR} BINDIR?= ${TESTSDIR}
WARNS?= 3
# SKIP_LEFTASSOC -> these testcases fail on FreeBSD. # SKIP_LEFTASSOC -> these testcases fail on FreeBSD.
IMPLEMENTATION?= -DREGEX_SPENCER -DSKIP_LEFTASSOC IMPLEMENTATION?= -DREGEX_SPENCER -DSKIP_LEFTASSOC

View File

@ -11,6 +11,4 @@ CFLAGS+=-DWITH_CASPER
.endif .endif
LIBADD+= nv LIBADD+= nv
WARNS?= 3
.include <bsd.test.mk> .include <bsd.test.mk>

View File

@ -11,6 +11,4 @@ CFLAGS+=-DWITH_CASPER
.endif .endif
LIBADD+= nv LIBADD+= nv
WARNS?= 3
.include <bsd.test.mk> .include <bsd.test.mk>

View File

@ -11,6 +11,4 @@ CFLAGS+=-DWITH_CASPER
.endif .endif
LIBADD+= nv LIBADD+= nv
WARNS?= 3
.include <bsd.test.mk> .include <bsd.test.mk>

View File

@ -11,8 +11,6 @@ CFLAGS+=-DWITH_CASPER
.endif .endif
LIBADD+= nv LIBADD+= nv
WARNS?= 3
TEST_METADATA.sysctl_test+= required_user="root" TEST_METADATA.sysctl_test+= required_user="root"
.include <bsd.test.mk> .include <bsd.test.mk>

View File

@ -2,6 +2,8 @@
PACKAGE= tests PACKAGE= tests
WARNS?= 3
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread
# TODO: t_name (missing pthread_getname_np support in FreeBSD) # TODO: t_name (missing pthread_getname_np support in FreeBSD)

View File

@ -2,6 +2,8 @@
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread/dlopen TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread/dlopen
WARNS?= 2
.include <bsd.own.mk> .include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/lib/libthr/dlopen TESTSDIR= ${TESTSBASE}/lib/libthr/dlopen

View File

@ -1,6 +1,7 @@
# $FreeBSD$ # $FreeBSD$
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread/dlopen/dso TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libpthread/dlopen/dso
WARNS?= 3
SHLIB= h_pthread_dlopen SHLIB= h_pthread_dlopen
SHLIB_MAJOR= 1 SHLIB_MAJOR= 1

View File

@ -4,6 +4,8 @@
PACKAGE= tests PACKAGE= tests
WARNS?= 1
LIBXOSRC= ${SRCTOP}/contrib/libxo LIBXOSRC= ${SRCTOP}/contrib/libxo
# Override the default suffix transformation rules for .c/.o -> .out # Override the default suffix transformation rules for .c/.o -> .out

View File

@ -1 +1,3 @@
# $FreeBSD$ # $FreeBSD$
WARNS?= 0

View File

@ -23,6 +23,8 @@ INTERNALLIB= # Don't install this library
SRCS= exec.c getusershell.c login_class.c popen.c rcmdsh.c \ SRCS= exec.c getusershell.c login_class.c popen.c rcmdsh.c \
sysctl.c system.c sysctl.c system.c
WARNS?= 3
CFLAGS+= -DRESCUE CFLAGS+= -DRESCUE
# Flags copied from src/lib/libc and src/lib/libutil # Flags copied from src/lib/libc and src/lib/libutil
# libc/db/Makefile.inc # libc/db/Makefile.inc

View File

@ -4,7 +4,6 @@
.include <src.opts.mk> .include <src.opts.mk>
BINDIR?= /sbin BINDIR?= /sbin
WARNS?= 6
.if ${MK_DYNAMICROOT} == "no" .if ${MK_DYNAMICROOT} == "no"
NO_SHARED?= YES NO_SHARED?= YES

View File

@ -18,3 +18,5 @@ CFLAGS+= -DB_ENDIAN
CFLAGS+= -DNDEBUG CFLAGS+= -DNDEBUG
.PATH: ${LCRYPTO_SRC}/engines .PATH: ${LCRYPTO_SRC}/engines
WARNS?= 0

View File

@ -28,6 +28,14 @@ CFLAGS+= -std=${CSTD}
CXXFLAGS+= -std=${CXXSTD} CXXFLAGS+= -std=${CXXSTD}
.endif .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 # -pedantic is problematic because it also imposes namespace restrictions
#CFLAGS+= -pedantic #CFLAGS+= -pedantic
.if defined(WARNS) .if defined(WARNS)

View File

@ -40,6 +40,8 @@ __postrcconf_${var}:= ${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno
CFCOMMONFLAG?= -fno-common CFCOMMONFLAG?= -fno-common
CFLAGS+= ${CFCOMMONFLAG} CFLAGS+= ${CFCOMMONFLAG}
DEFAULTWARNS= 6
# tempting, but bsd.compiler.mk causes problems this early # tempting, but bsd.compiler.mk causes problems this early
# probably need to remove dependence on bsd.own.mk # probably need to remove dependence on bsd.own.mk
#.include "src.opts.mk" #.include "src.opts.mk"

View File

@ -7,6 +7,8 @@ MAN=
BINDIR= ${TESTSBASE}/sys/cddl/zfs/bin BINDIR= ${TESTSBASE}/sys/cddl/zfs/bin
SCRIPTSDIR= ${TESTSBASE}/sys/cddl/zfs/bin SCRIPTSDIR= ${TESTSBASE}/sys/cddl/zfs/bin
WARNS?= 0
SCRIPTS+= bsddisks.ksh SCRIPTS+= bsddisks.ksh
SCRIPTS+= dircmp.ksh SCRIPTS+= dircmp.ksh
SCRIPTS+= dumpadm.ksh SCRIPTS+= dumpadm.ksh

View File

@ -0,0 +1,3 @@
# $FreeBSD$
WARNS?= 0

View File

@ -4,6 +4,8 @@
PACKAGE= tests PACKAGE= tests
WARNS?= 3
TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T}
ATF_TESTS_C= pbkdf2_test ATF_TESTS_C= pbkdf2_test

View File

@ -1,6 +1,7 @@
# $FreeBSD$ # $FreeBSD$
PACKAGE= tests PACKAGE= tests
WARNS?= 1
TESTSDIR= ${TESTSBASE}/sys/net/routing TESTSDIR= ${TESTSBASE}/sys/net/routing

View File

@ -49,3 +49,10 @@ if [ -e "$OBJTOP"/cddl/lib/libzfs/.depend.libzfs_changelist.o ] && \
echo "Removing old ZFS tree" echo "Removing old ZFS tree"
rm -rf "$OBJTOP"/cddl "$OBJTOP"/obj-lib32/cddl rm -rf "$OBJTOP"/cddl "$OBJTOP"/obj-lib32/cddl
fi 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

View File

@ -2,5 +2,3 @@
# $FreeBSD$ # $FreeBSD$
BINDIR?= /usr/bin BINDIR?= /usr/bin
WARNS?= 6

View File

@ -10,3 +10,4 @@ CFLAGS+= -DHAVE_CONFIG_H=1
CFLAGS+= -I${_spath} -I${_spath}/src CFLAGS+= -I${_spath} -I${_spath}/src
LIBADD+= osmcomp ibmad ibumad LIBADD+= osmcomp ibmad ibumad
WARNS?= 0

View File

@ -7,3 +7,4 @@ BINDIR?= /usr/bin
CFLAGS+= -I${_spath} CFLAGS+= -I${_spath}
LIBADD+= ibverbs mlx4 mlx5 cxgb4 pthread LIBADD+= ibverbs mlx4 mlx5 cxgb4 pthread
WARNS?= 2

View File

@ -6,3 +6,5 @@ _spath=${SRCTOP}/contrib/ofed/librdmacm
BINDIR?= /usr/bin BINDIR?= /usr/bin
CFLAGS+= -I${SRCTOP}/contrib/ofed CFLAGS+= -I${SRCTOP}/contrib/ofed
LIBADD+= ibverbs rdmacm mlx4 mlx5 cxgb4 pthread LIBADD+= ibverbs rdmacm mlx4 mlx5 cxgb4 pthread
WARNS?= 0

View File

@ -2,6 +2,8 @@
PACKAGE= tests PACKAGE= tests
WARNS?= 3
_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive _LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
ATF_TESTS_SH+= functional_test ATF_TESTS_SH+= functional_test

View File

@ -2,5 +2,3 @@
# $FreeBSD$ # $FreeBSD$
BINDIR?= /usr/sbin BINDIR?= /usr/sbin
WARNS?= 6

View File

@ -2,6 +2,8 @@
BINDIR?= /usr/sbin BINDIR?= /usr/sbin
WARNS?= 0
WPA_DISTDIR?= ${SRCTOP}/contrib/wpa/ WPA_DISTDIR?= ${SRCTOP}/contrib/wpa/
WPA_SUPPLICANT_DISTDIR?=${WPA_DISTDIR}/wpa_supplicant WPA_SUPPLICANT_DISTDIR?=${WPA_DISTDIR}/wpa_supplicant
HOSTAPD_DISTDIR?= ${WPA_DISTDIR}/hostapd HOSTAPD_DISTDIR?= ${WPA_DISTDIR}/hostapd