Add the Clang specific -Wmissing-variable-declarations to WARNS=6.

This compiler flag enforces that that people either mark variables
static or use an external declarations for the variable, similar to how
-Wmissing-prototypes works for functions.

Due to the fact that Yacc/Lex generate code that cannot trivially be
changed to not warn because of this (lots of yy* variables), add a
NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this
specific compiler warning.

Announced on:	toolchain@
This commit is contained in:
Ed Schouten 2013-04-19 19:45:00 +00:00
parent c0794a841d
commit 7e659f9491
21 changed files with 40 additions and 2 deletions

View File

@ -4,4 +4,6 @@ PROG= expr
SRCS= expr.y
YFLAGS=
NO_WMISSING_VARIABLE_DECLARATIONS=
.include <bsd.prog.mk>

View File

@ -4,4 +4,6 @@ SSP_CFLAGS=
SED_FIX_NOTE = -i "" -e '/\.note\.tag/s/progbits/note/'
NO_WMISSING_VARIABLE_DECLARATIONS=
.include "../Makefile.inc"

View File

@ -10,6 +10,7 @@ SRCS+= g_bde_lock.c
# rijndael-fst.c does evil casting things which can results in warnings,
# the test-vectors check out however, so it works right.
NO_WCAST_ALIGN=
NO_WMISSING_VARIABLE_DECLARATIONS=
CFLAGS+= -I${.CURDIR}/../../sys
.PATH: ${.CURDIR}/../../sys/geom/bde \

View File

@ -6,6 +6,8 @@ LINKS= ${BINDIR}/geom ${BINDIR}/g${GEOM_CLASS}
MAN= g${GEOM_CLASS}.8
SRCS+= geom_${GEOM_CLASS}.c subr.c
NO_WMISSING_VARIABLE_DECLARATIONS=
CFLAGS+= -I${.CURDIR}/../..
.include "../Makefile.inc"

View File

@ -21,6 +21,7 @@ MAN= hastctl.8
NO_WFORMAT=
NO_WCAST_ALIGN=
NO_WMISSING_VARIABLE_DECLARATIONS=
CFLAGS+=-I${.CURDIR}/../hastd
CFLAGS+=-DHAVE_CAPSICUM
CFLAGS+=-DINET

View File

@ -21,6 +21,7 @@ MAN= hastd.8 hast.conf.5
NO_WFORMAT=
NO_WCAST_ALIGN=
NO_WMISSING_VARIABLE_DECLARATIONS=
CFLAGS+=-I${.CURDIR}
CFLAGS+=-DHAVE_CAPSICUM
CFLAGS+=-DPROTO_TCP_DEFAULT_PORT=8457

View File

@ -13,6 +13,7 @@ MLINKS= md5.1 rmd160.1 \
md5.1 sha256.1 \
md5.1 sha512.1
NO_WMISSING_VARIABLE_DECLARATIONS=
WFORMAT?= 1
DPADD= ${LIBMD}

View File

@ -54,6 +54,10 @@ CWARNFLAGS+= -Wcast-align
.if ${WARNS} >= 6
CWARNFLAGS+= -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls\
-Wold-style-definition
.if ${COMPILER_TYPE} == "clang" && !defined(EARLY_BUILD) && \
!defined(NO_WMISSING_VARIABLE_DECLARATIONS)
CWARNFLAGS+= -Wmissing-variable-declarations
.endif
.endif # WARNS >= 6
.if ${WARNS} >= 2 && ${WARNS} <= 4
# XXX Delete -Wuninitialized by default for now -- the compiler doesn't

View File

@ -8,6 +8,8 @@ SRCS= ar.c acplex.l acpyacc.y read.c util.c write.c y.tab.h
DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBZ}
LDADD= -larchive -lelf -lz
NO_WMISSING_VARIABLE_DECLARATIONS=
CFLAGS+=-I. -I${.CURDIR}
.if ${MK_SHARED_TOOLCHAIN} == "no"

View File

@ -8,6 +8,8 @@ CFLAGS+= -I. -I${.CURDIR}
DPADD= ${LIBEDIT} ${LIBTERMCAP}
LDADD= -ledit -ltermcap
NO_WMISSING_VARIABLE_DECLARATIONS=
FILES+= bc.library
FILESDIR=${SHAREDIR}/misc

View File

@ -6,4 +6,6 @@ BZ2DIR= ${.CURDIR}/../../contrib/bzip2
PROG= bzip2recover
NO_MAN=
NO_WMISSING_VARIABLE_DECLARATIONS=
.include <bsd.prog.mk>

View File

@ -6,4 +6,6 @@ SRCS= find.c function.c ls.c main.c misc.c operator.c option.c \
getdate.y
YFLAGS=
NO_WMISSING_VARIABLE_DECLARATIONS=
.include <bsd.prog.mk>

View File

@ -1,6 +1,9 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $FreeBSD$
PROG= indent
SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c
NO_WMISSING_VARIABLE_DECLARATIONS=
.include <bsd.prog.mk>

View File

@ -8,8 +8,8 @@ PROG= m4
CFLAGS+=-DEXTENDED -I${.CURDIR} -I${.CURDIR}/lib
DPADD= ${LIBY} ${LIBL} ${LIBM}
LDADD= -ly -ll -lm
# clang needs 1 while with gcc we can use 2
#WARNS= 1
NO_WMISSING_VARIABLE_DECLARATIONS=
SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l
.PATH: ${.CURDIR}/lib

View File

@ -5,4 +5,6 @@ PROG= mklocale
SRCS= yacc.y lex.l y.tab.h
CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../../lib/libc/locale
NO_WMISSING_VARIABLE_DECLARATIONS=
.include <bsd.prog.mk>

View File

@ -10,6 +10,7 @@ OPENBSMDIR=${.CURDIR}/../../contrib/openbsm
CFLAGS+=-I${OPENBSMDIR} -I${OPENBSMDIR}/bin/auditdistd
NO_WFORMAT=
NO_WMISSING_VARIABLE_DECLARATIONS=
PROG= auditdistd
SRCS= auditdistd.c

View File

@ -13,4 +13,6 @@ DEBUG_FLAGS= -g
DPADD= ${LIBBLUETOOTH} ${LIBUSBHID}
LDADD= -lbluetooth -lusbhid
NO_WMISSING_VARIABLE_DECLARATIONS=
.include <bsd.prog.mk>

View File

@ -6,4 +6,6 @@ MANFILTER= sed -e 's%@MODPATH@%${LIBDIR}/%g' \
-e 's%@DEFPATH@%${DEFSDIR}/%g' \
-e 's%@MIBSPATH@%${BMIBSDIR}/%g'
NO_WMISSING_VARIABLE_DECLARATIONS=
.include "../Makefile.inc"

View File

@ -11,6 +11,8 @@ kernconf.c: kernconf.tmpl
CFLAGS+= -I. -I${.CURDIR}
NO_WMISSING_VARIABLE_DECLARATIONS=
DPADD= ${LIBL} ${LIBSBUF}
LDADD= -ll -lsbuf

View File

@ -8,4 +8,6 @@ SRCS+= getdate.y
CFLAGS+= -I${.CURDIR}
NO_WMISSING_VARIABLE_DECLARATIONS=
.include <bsd.lib.mk>

View File

@ -9,6 +9,8 @@ SRCS= jail.c command.c config.c state.c jailp.h jaillex.l jailparse.y y.tab.h
DPADD= ${LIBJAIL} ${LIBKVM} ${LIBUTIL} ${LIBL}
LDADD= -ljail -lkvm -lutil -ll
NO_WMISSING_VARIABLE_DECLARATIONS=
YFLAGS+=-v
CFLAGS+=-I. -I${.CURDIR}