diff --git a/bin/ed/Makefile b/bin/ed/Makefile index 61859c7..347ec27 100644 --- a/bin/ed/Makefile +++ b/bin/ed/Makefile @@ -6,6 +6,7 @@ SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 +WARNS?= 2 .if exists(${.CURDIR}/../../secure) && !defined(NO_CRYPT) DISTRIBUTION=crypto diff --git a/etc/defaults/make.conf b/etc/defaults/make.conf index f75ba20..45f2417 100644 --- a/etc/defaults/make.conf +++ b/etc/defaults/make.conf @@ -69,9 +69,6 @@ BDECFLAGS= -W -Wall -ansi -pedantic -Wbad-function-cast -Wcast-align \ -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings # -# WARNS_WERROR causes -Werror to be added when WARNS is in effect. -#WARNS_WERROR= yes -# # To compile just the kernel with special optimizations, you should use # this instead of CFLAGS (which is not applicable to kernel builds anyway). # There is very little to gain by using higher optimization levels, and doing diff --git a/gnu/usr.bin/binutils217/Makefile.inc0 b/gnu/usr.bin/binutils217/Makefile.inc0 index 7ef8753..22e127e 100644 --- a/gnu/usr.bin/binutils217/Makefile.inc0 +++ b/gnu/usr.bin/binutils217/Makefile.inc0 @@ -19,7 +19,6 @@ RELTOP:= .. RELSRC= ${RELTOP}/../../../contrib/binutils-2.17 SRCDIR= ${.CURDIR}/${RELSRC} -CFLAGS+= -D_GNU_SOURCE CFLAGS+= -I. .if exists(${.CURDIR}/${BINUTIL_ARCH}) CFLAGS+= -I${.CURDIR}/${BINUTIL_ARCH} diff --git a/lib/libm/Makefile b/lib/libm/Makefile index 2124be8..d967603 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -2,7 +2,7 @@ LIB= m SHLIB_MAJOR= 3 -WARNS?= 6 +WARNS?= 2 # Don't MD fragment must be included before MI fragment. ARCHDIR?= ${MACHINE_ARCH} diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile index b38bbd7..bc7b3cd 100644 --- a/lib/libutil/Makefile +++ b/lib/libutil/Makefile @@ -13,7 +13,7 @@ SRCS= login.c login_tty.c logout.c logwtmp.c pty.c \ realhostname.c fparseln.c stub.c pidfile.c trimdomain.c \ dehumanize_number.c humanize_number.c pw_scan.c pw_util.c INCS= libutil.h login_cap.h -WARNS?= 3 +WARNS?= 2 MAN+= login.3 login_auth.3 login_tty.3 logout.3 logwtmp.3 pty.3 \ login_cap.3 login_class.3 login_times.3 login_ok.3 \ diff --git a/sbin/ccdconfig/Makefile b/sbin/ccdconfig/Makefile index ae0b302..a878a81 100644 --- a/sbin/ccdconfig/Makefile +++ b/sbin/ccdconfig/Makefile @@ -9,5 +9,6 @@ LDADD+= -lkvm DPADD+= ${LIBKVM} BINGRP= kmem BINMODE= 2555 +WARNS?= 4 .include diff --git a/sbin/dhclient/Makefile b/sbin/dhclient/Makefile index 4d7f82c..c88735b 100644 --- a/sbin/dhclient/Makefile +++ b/sbin/dhclient/Makefile @@ -40,7 +40,7 @@ SRCS= dhclient.c clparse.c dispatch.c bpf.c options.c \ PROG= dhclient MAN= dhclient.8 dhclient.conf.5 dhclient.leases.5 dhclient-script.8 -WARNS?= 3 +WARNS?= 0 beforeinstall: ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ diff --git a/sbin/disklabel64/crc32.c b/sbin/disklabel64/crc32.c index cc7641a..f86b499 100644 --- a/sbin/disklabel64/crc32.c +++ b/sbin/disklabel64/crc32.c @@ -31,6 +31,8 @@ #include +uint32_t crc32(const void *, size_t); + static uint32_t crc32_tab[] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, @@ -91,4 +93,3 @@ crc32(const void *buf, size_t size) return crc ^ ~0U; } - diff --git a/sbin/ipfw/Makefile b/sbin/ipfw/Makefile index d2a9335..0611230 100644 --- a/sbin/ipfw/Makefile +++ b/sbin/ipfw/Makefile @@ -4,6 +4,6 @@ PROG= ipfw MAN= ipfw.8 SRCS= ipfw2.c -WARNS?= 2 +WARNS?= 1 .include diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile index 0c7c3e7..5affcc6 100644 --- a/sbin/md5/Makefile +++ b/sbin/md5/Makefile @@ -12,7 +12,7 @@ MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ md5.1 sha256.1 -WFORMAT?= 1 +WARNS?= 0 DPADD= ${LIBMD} LDADD= -lmd diff --git a/sbin/route/Makefile b/sbin/route/Makefile index 3a8cbf0..aff6bb2 100644 --- a/sbin/route/Makefile +++ b/sbin/route/Makefile @@ -8,6 +8,7 @@ SRCS= route.c show.c keywords.h keywords.c CFLAGS+=-I. -DNS CFLAGS+=-DINET6 CLEANFILES+=keywords.h keywords.c _keywords.tmp +WARNS?= 3 keywords.h: echo -e "extern struct keytab {\n\tconst char\t*kt_cp;\n\tint\t\t kt_i;\n} keywords[];\n\n" > ${.TARGET} diff --git a/sbin/routed/rtquery/Makefile b/sbin/routed/rtquery/Makefile index 37ea63f..dd4bd91 100644 --- a/sbin/routed/rtquery/Makefile +++ b/sbin/routed/rtquery/Makefile @@ -6,5 +6,6 @@ PROG= rtquery MAN= rtquery.8 LDADD+= -lmd DPADD+= ${LIBMD} +WARNS?= 4 .include diff --git a/secure/lib/libtelnet/Makefile b/secure/lib/libtelnet/Makefile index 93d1720..972eec4 100644 --- a/secure/lib/libtelnet/Makefile +++ b/secure/lib/libtelnet/Makefile @@ -11,7 +11,7 @@ SRCS= genget.c getent.c misc.c encrypt.c auth.c \ CFLAGS+= -DENCRYPTION -DAUTHENTICATION -DSRA \ -I${TELNETDIR} -I${TELNETDIR}/libtelnet -WARNS?= 2 +WARNS?= 0 INCS= ${TELNETDIR}/arpa/telnet.h INCSDIR= ${INCLUDEDIR}/arpa diff --git a/secure/libexec/telnetd/Makefile b/secure/libexec/telnetd/Makefile index 05d800e..a29f8de 100644 --- a/secure/libexec/telnetd/Makefile +++ b/secure/libexec/telnetd/Makefile @@ -14,7 +14,7 @@ CFLAGS+= -DLINEMODE -DUSE_TERMIO -DDIAGNOSTICS -DOLD_ENVIRON \ -DENV_HACK -DAUTHENTICATION -DENCRYPTION \ -I${TELNETDIR} -DINET6 -WARNS?= 2 +WARNS?= 0 WFORMAT?= 0 DPADD= ${LIBUTIL} ${LIBTERMCAP} ${LIBTELNET} ${LIBCRYPTO} \ diff --git a/secure/usr.bin/telnet/Makefile b/secure/usr.bin/telnet/Makefile index aed3509..71c0c80 100644 --- a/secure/usr.bin/telnet/Makefile +++ b/secure/usr.bin/telnet/Makefile @@ -10,7 +10,7 @@ CFLAGS+= -DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK -DOPIE \ -DENCRYPTION -DAUTHENTICATION -DIPSEC -DINET6 \ -I${TELNETDIR} -I${TELNETDIR}/libtelnet/ -WARNS?= 2 +WARNS?= 0 DPADD= ${LIBTERMCAP} ${LIBTELNET} \ ${LIBCRYPTO} ${LIBCRYPT} ${LIBIPSEC} ${LIBPAM} diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5 index 3bdc97e..fcb4520 100644 --- a/share/man/man5/make.conf.5 +++ b/share/man/man5/make.conf.5 @@ -261,12 +261,6 @@ The documentation .Ar supfile to use when doing a .Dq Li "make update" . -.It Va WARNS_WERROR -Causes -.Fl Werror -to be added to -.Va CFLAGS -when WARNS is in effect. .It Va WITH_GCPIO .Pq Vt bool Set this to use diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 6bf9e1f..36f4b1b 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -8,29 +8,44 @@ # overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS. .if !defined(NO_WARNS) -. if defined(WARNS) -# XXX Delete -Wuninitialized by default for now -- the compiler doesn't -# XXX always get it right. -. if ${WARNS} <= 4 -CFLAGS += -Wno-uninitialized -. endif -. if defined(WARNS_WERROR) && !defined(NO_WERROR) -CFLAGS += -Werror +. if defined(CSTD) +. if ${CSTD} == "k&r" +CFLAGS += -traditional +. elif ${CSTD} == "c89" || ${CSTD} == "c90" +CFLAGS += -std=iso9899:1990 +. elif ${CSTD} == "c94" || ${CSTD} == "c95" +CFLAGS += -std=iso9899:199409 +. elif ${CSTD} == "c99" +CFLAGS += -std=iso9899:1999 +. else +CFLAGS += -std=${CSTD} . endif +. endif +. if defined(WARNS) . if ${WARNS} >= 1 -CFLAGS += -Wunknown-pragmas -Wsystem-headers -.endif +CWARNFLAGS += -Wsystem-headers +. if !defined(NO_WERROR) && ${CCVER} == "gcc41" && ${MACHINE_ARCH} == "i386" +CWARNFLAGS += -Werror +. endif +. endif . if ${WARNS} >= 2 -CFLAGS += -Wall +CWARNFLAGS += -Wall -Wno-format-y2k . endif . if ${WARNS} >= 3 -CFLAGS += -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith +CWARNFLAGS += -W -Wno-unused-parameter -Wstrict-prototypes\ + -Wmissing-prototypes -Wpointer-arith . endif . if ${WARNS} >= 4 -CFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align +CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\ + -Wshadow -Wcast-align -Wunused-parameter . endif . if ${WARNS} >= 6 -CFLAGS += -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls +CWARNFLAGS += -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls +. endif +. if ${WARNS} >= 2 && ${WARNS} <= 4 +# XXX Delete -Wuninitialized by default for now -- the compiler doesn't +# XXX always get it right. +CWARNFLAGS += -Wno-uninitialized . endif . endif @@ -39,17 +54,13 @@ WFORMAT = 1 . endif . if defined(WFORMAT) . if ${WFORMAT} > 0 -CFLAGS += -Wno-format-extra-args -. if defined(WARNS_WERROR) && !defined(NO_WERROR) -CFLAGS += -Werror +CWARNFLAGS += -Wformat=2 -Wno-format-extra-args +. if !defined(NO_WERROR) && ${CCVER} == "gcc41" +CWARNFLAGS += -Werror . endif . endif . endif .endif -.if defined(WARNS_NO_UNUSED_PARAMETERS) -CFLAGS+= -Wno-unused-parameters -.endif - # Allow user-specified additional warning flags CFLAGS += ${CWARNFLAGS} diff --git a/sys/libkern/crc32.c b/sys/libkern/crc32.c index 9d5df6e..4b72d82 100644 --- a/sys/libkern/crc32.c +++ b/sys/libkern/crc32.c @@ -56,6 +56,7 @@ #endif uint32_t crc32(const void *buf, size_t size); +uint32_t crc32_ext(const void *buf, size_t size, uint32_t ocrc); uint32_t crc32_tab[] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, diff --git a/usr.bin/find/Makefile b/usr.bin/find/Makefile index defb89e..ad59094 100644 --- a/usr.bin/find/Makefile +++ b/usr.bin/find/Makefile @@ -7,5 +7,6 @@ SRCS= find.c function.c ls.c main.c misc.c operator.c option.c \ getdate.y CFLAGS+=-DHAVE_SYS_TIMEB_H -I${.CURDIR} YFLAGS= +WARNS?= 4 .include diff --git a/usr.bin/fstat/Makefile b/usr.bin/fstat/Makefile index 54dc667..38a09c2 100644 --- a/usr.bin/fstat/Makefile +++ b/usr.bin/fstat/Makefile @@ -9,5 +9,6 @@ DPADD= ${LIBKVM} LDADD= -lkvm BINGRP= kmem BINMODE=2555 +WARNS?= 0 .include diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile index 2b5732e..4f8ac57 100644 --- a/usr.bin/make/Makefile +++ b/usr.bin/make/Makefile @@ -10,7 +10,6 @@ SRCS= arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c \ lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c \ util.c var.c -WARNS_WERROR= YES NOSHARED?= YES CFLAGS+=-DMAKE_VERSION=\"5200408120\" diff --git a/usr.bin/mkstr/Makefile b/usr.bin/mkstr/Makefile index 6e07cdf..bc46146 100644 --- a/usr.bin/mkstr/Makefile +++ b/usr.bin/mkstr/Makefile @@ -2,5 +2,6 @@ # $DragonFly: src/usr.bin/mkstr/Makefile,v 1.3 2007/08/27 16:50:56 pavalos Exp $ PROG= mkstr +WARNS?= 2 .include diff --git a/usr.bin/truncate/Makefile b/usr.bin/truncate/Makefile index f788061..79c0a52 100644 --- a/usr.bin/truncate/Makefile +++ b/usr.bin/truncate/Makefile @@ -2,5 +2,6 @@ # $DragonFly: src/usr.bin/truncate/Makefile,v 1.4 2007/08/27 16:51:00 pavalos Exp $ PROG= truncate +WARNS?= 4 .include diff --git a/usr.sbin/keyserv/Makefile b/usr.sbin/keyserv/Makefile index d7c7b70..bcc4450 100644 --- a/usr.sbin/keyserv/Makefile +++ b/usr.sbin/keyserv/Makefile @@ -3,7 +3,7 @@ PROG= keyserv SRCS= keyserv.c setkey.c keyserv_uid.c crypt_svc.c crypt_server.c crypt.h -WARNS?= 6 +WARNS?= 1 MAN= keyserv.8 diff --git a/usr.sbin/pciconf/Makefile b/usr.sbin/pciconf/Makefile index 4bb625f..3fd26dc 100644 --- a/usr.sbin/pciconf/Makefile +++ b/usr.sbin/pciconf/Makefile @@ -5,6 +5,6 @@ PROG= pciconf MAN= pciconf.8 CFLAGS+= -I${.CURDIR}/../../sys -WARNS?= 6 +WARNS?= 4 .include diff --git a/usr.sbin/pfctl/pfctl_altq.c b/usr.sbin/pfctl/pfctl_altq.c index 4587ebf..08b3e49 100644 --- a/usr.sbin/pfctl/pfctl_altq.c +++ b/usr.sbin/pfctl/pfctl_altq.c @@ -1042,7 +1042,9 @@ print_fairq_opts(const struct pf_altq *a, const struct node_queue_opt *qopts) /* * admission control using generalized service curve */ +#ifndef INFINITY #define INFINITY HUGE_VAL /* positive infinity defined in */ +#endif /* add a new service curve to a generalized service curve */ static void diff --git a/usr.sbin/pflogd/Makefile b/usr.sbin/pflogd/Makefile index 45c178a..1b61b00 100644 --- a/usr.sbin/pflogd/Makefile +++ b/usr.sbin/pflogd/Makefile @@ -7,6 +7,6 @@ DPAPP+= ${LIBPCAP} ${LIBUTIL} PROG= pflogd SRCS= pflogd.c privsep.c privsep_fdpass.c MAN= pflogd.8 -WARNS?= 6 +WARNS?= 4 .include diff --git a/usr.sbin/pstat/Makefile b/usr.sbin/pstat/Makefile index 5eb2a45..f6fc0c2 100644 --- a/usr.sbin/pstat/Makefile +++ b/usr.sbin/pstat/Makefile @@ -12,6 +12,6 @@ LDADD= -lkcore -lkinfo -lkvm MAN= pstat.8 LINKS= ${BINDIR}/pstat ${BINDIR}/swapinfo MLINKS= pstat.8 swapinfo.8 -WARNS?= 6 +WARNS?= 0 .include