summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2013-04-19 19:45:00 +0000
committered <ed@FreeBSD.org>2013-04-19 19:45:00 +0000
commit120125784a1ca698c656c6ef5e21e219df994f64 (patch)
tree1891dfdc2dd1f99e115fc2d96089a475729f0e87
parente342f91158ed3a8e688d9b01fd14d57ad91ea8b0 (diff)
downloadFreeBSD-src-120125784a1ca698c656c6ef5e21e219df994f64.zip
FreeBSD-src-120125784a1ca698c656c6ef5e21e219df994f64.tar.gz
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@
-rw-r--r--bin/expr/Makefile2
-rw-r--r--lib/csu/Makefile.inc2
-rw-r--r--sbin/gbde/Makefile1
-rw-r--r--sbin/geom/class/Makefile.inc2
-rw-r--r--sbin/hastctl/Makefile1
-rw-r--r--sbin/hastd/Makefile1
-rw-r--r--sbin/md5/Makefile1
-rw-r--r--share/mk/bsd.sys.mk4
-rw-r--r--usr.bin/ar/Makefile2
-rw-r--r--usr.bin/bc/Makefile2
-rw-r--r--usr.bin/bzip2recover/Makefile2
-rw-r--r--usr.bin/find/Makefile2
-rw-r--r--usr.bin/indent/Makefile3
-rw-r--r--usr.bin/m4/Makefile4
-rw-r--r--usr.bin/mklocale/Makefile2
-rw-r--r--usr.sbin/auditdistd/Makefile1
-rw-r--r--usr.sbin/bluetooth/bthidd/Makefile2
-rw-r--r--usr.sbin/bsnmpd/modules/Makefile.inc2
-rw-r--r--usr.sbin/config/Makefile2
-rw-r--r--usr.sbin/fifolog/lib/Makefile2
-rw-r--r--usr.sbin/jail/Makefile2
21 files changed, 40 insertions, 2 deletions
diff --git a/bin/expr/Makefile b/bin/expr/Makefile
index 544853e..b86cf66 100644
--- a/bin/expr/Makefile
+++ b/bin/expr/Makefile
@@ -4,4 +4,6 @@ PROG= expr
SRCS= expr.y
YFLAGS=
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
.include <bsd.prog.mk>
diff --git a/lib/csu/Makefile.inc b/lib/csu/Makefile.inc
index 11ddc66..95d5c5e 100644
--- a/lib/csu/Makefile.inc
+++ b/lib/csu/Makefile.inc
@@ -4,4 +4,6 @@ SSP_CFLAGS=
SED_FIX_NOTE = -i "" -e '/\.note\.tag/s/progbits/note/'
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
.include "../Makefile.inc"
diff --git a/sbin/gbde/Makefile b/sbin/gbde/Makefile
index 3975eb6..019ee18 100644
--- a/sbin/gbde/Makefile
+++ b/sbin/gbde/Makefile
@@ -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 \
diff --git a/sbin/geom/class/Makefile.inc b/sbin/geom/class/Makefile.inc
index 6f0141e..06b733f 100644
--- a/sbin/geom/class/Makefile.inc
+++ b/sbin/geom/class/Makefile.inc
@@ -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"
diff --git a/sbin/hastctl/Makefile b/sbin/hastctl/Makefile
index e7cd9cb..2be817e 100644
--- a/sbin/hastctl/Makefile
+++ b/sbin/hastctl/Makefile
@@ -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
diff --git a/sbin/hastd/Makefile b/sbin/hastd/Makefile
index 2a4a9ce..43c7a52 100644
--- a/sbin/hastd/Makefile
+++ b/sbin/hastd/Makefile
@@ -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
diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile
index c3c5a9f..eabf129 100644
--- a/sbin/md5/Makefile
+++ b/sbin/md5/Makefile
@@ -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}
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 1d8b49d..72dfa61 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -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
diff --git a/usr.bin/ar/Makefile b/usr.bin/ar/Makefile
index fa25072..03d9814 100644
--- a/usr.bin/ar/Makefile
+++ b/usr.bin/ar/Makefile
@@ -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"
diff --git a/usr.bin/bc/Makefile b/usr.bin/bc/Makefile
index 55f465d..39d54e0 100644
--- a/usr.bin/bc/Makefile
+++ b/usr.bin/bc/Makefile
@@ -8,6 +8,8 @@ CFLAGS+= -I. -I${.CURDIR}
DPADD= ${LIBEDIT} ${LIBTERMCAP}
LDADD= -ledit -ltermcap
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
FILES+= bc.library
FILESDIR=${SHAREDIR}/misc
diff --git a/usr.bin/bzip2recover/Makefile b/usr.bin/bzip2recover/Makefile
index 7f61946..affe91b 100644
--- a/usr.bin/bzip2recover/Makefile
+++ b/usr.bin/bzip2recover/Makefile
@@ -6,4 +6,6 @@ BZ2DIR= ${.CURDIR}/../../contrib/bzip2
PROG= bzip2recover
NO_MAN=
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
.include <bsd.prog.mk>
diff --git a/usr.bin/find/Makefile b/usr.bin/find/Makefile
index 0c7bb70..cd10f12 100644
--- a/usr.bin/find/Makefile
+++ b/usr.bin/find/Makefile
@@ -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>
diff --git a/usr.bin/indent/Makefile b/usr.bin/indent/Makefile
index 8d9ff94..dcd7e39 100644
--- a/usr.bin/indent/Makefile
+++ b/usr.bin/indent/Makefile
@@ -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>
diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile
index 1f1ec5e..f0e22f8 100644
--- a/usr.bin/m4/Makefile
+++ b/usr.bin/m4/Makefile
@@ -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
diff --git a/usr.bin/mklocale/Makefile b/usr.bin/mklocale/Makefile
index e75fe99..83850c4 100644
--- a/usr.bin/mklocale/Makefile
+++ b/usr.bin/mklocale/Makefile
@@ -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>
diff --git a/usr.sbin/auditdistd/Makefile b/usr.sbin/auditdistd/Makefile
index 468290b..ee18bca 100644
--- a/usr.sbin/auditdistd/Makefile
+++ b/usr.sbin/auditdistd/Makefile
@@ -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
diff --git a/usr.sbin/bluetooth/bthidd/Makefile b/usr.sbin/bluetooth/bthidd/Makefile
index dd0754d..fe6ef33 100644
--- a/usr.sbin/bluetooth/bthidd/Makefile
+++ b/usr.sbin/bluetooth/bthidd/Makefile
@@ -13,4 +13,6 @@ DEBUG_FLAGS= -g
DPADD= ${LIBBLUETOOTH} ${LIBUSBHID}
LDADD= -lbluetooth -lusbhid
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/bsnmpd/modules/Makefile.inc b/usr.sbin/bsnmpd/modules/Makefile.inc
index b5dad56..357b441 100644
--- a/usr.sbin/bsnmpd/modules/Makefile.inc
+++ b/usr.sbin/bsnmpd/modules/Makefile.inc
@@ -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"
diff --git a/usr.sbin/config/Makefile b/usr.sbin/config/Makefile
index 6faf847..6561989 100644
--- a/usr.sbin/config/Makefile
+++ b/usr.sbin/config/Makefile
@@ -11,6 +11,8 @@ kernconf.c: kernconf.tmpl
CFLAGS+= -I. -I${.CURDIR}
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
DPADD= ${LIBL} ${LIBSBUF}
LDADD= -ll -lsbuf
diff --git a/usr.sbin/fifolog/lib/Makefile b/usr.sbin/fifolog/lib/Makefile
index c10126f..fc8e6d2 100644
--- a/usr.sbin/fifolog/lib/Makefile
+++ b/usr.sbin/fifolog/lib/Makefile
@@ -8,4 +8,6 @@ SRCS+= getdate.y
CFLAGS+= -I${.CURDIR}
+NO_WMISSING_VARIABLE_DECLARATIONS=
+
.include <bsd.lib.mk>
diff --git a/usr.sbin/jail/Makefile b/usr.sbin/jail/Makefile
index 00d7ff5..fb36def 100644
--- a/usr.sbin/jail/Makefile
+++ b/usr.sbin/jail/Makefile
@@ -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}
OpenPOWER on IntegriCloud