3 # This file contains common settings used for building FreeBSD
6 # Enable various levels of compiler warning checks. These may be
7 # overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.
9 # for GCC: http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143
11 # Universally disable -Werror until src/ is in better shape for GCC 4.2
14 .if !defined(NO_WARNS) && ${CC} != "icc"
17 CFLAGS += -traditional
18 . elif ${CSTD} == "c89" || ${CSTD} == "c90"
19 CFLAGS += -std=iso9899:1990
20 . elif ${CSTD} == "c94" || ${CSTD} == "c95"
21 CFLAGS += -std=iso9899:199409
22 . elif ${CSTD} == "c99"
23 CFLAGS += -std=iso9899:1999
25 CFLAGS += -std=${CSTD}
27 # -pedantic is problematic because it also imposes namespace restrictions
32 CWARNFLAGS += -Wsystem-headers
33 . if !defined(NO_WERROR)
38 CWARNFLAGS += -Wall -Wno-format-y2k
41 CWARNFLAGS += -W -Wno-unused-parameter -Wstrict-prototypes\
42 -Wmissing-prototypes -Wpointer-arith
45 CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
46 -Wshadow -Wcast-align -Wunused-parameter
50 CWARNFLAGS += -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
52 . if ${WARNS} >= 2 && ${WARNS} <= 4
53 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
54 # XXX always get it right.
55 CWARNFLAGS += -Wno-uninitialized
57 . if !defined(WITH_GCC3)
58 CWARNFLAGS += -Wno-pointer-sign
62 . if defined(FORMAT_AUDIT)
67 #CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
68 CWARNFLAGS += -Wformat=2 -Wno-format-extra-args
69 . if !defined(NO_WERROR)
76 .if defined(IGNORE_PRAGMA)
77 CWARNFLAGS += -Wno-unknown-pragmas
80 # Allow user-specified additional warning flags
81 CFLAGS += ${CWARNFLAGS}