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 .if
!defined
(NO_WARNS
) && ${CC} != "icc"
14 CFLAGS
+= -traditional
15 . elif
${CSTD} == "c89" ||
${CSTD} == "c90"
16 CFLAGS
+= -std
=iso9899
:1990
17 . elif
${CSTD} == "c94" ||
${CSTD} == "c95"
18 CFLAGS
+= -std
=iso9899
:199409
19 . elif
${CSTD} == "c99"
20 CFLAGS
+= -std
=iso9899
:1999
22 CFLAGS
+= -std
=${CSTD}
24 # -pedantic is problematic because it also imposes namespace restrictions
29 CWARNFLAGS
+= -Wsystem-headers
30 . if
!defined
(NO_WERROR
)
35 CWARNFLAGS
+= -Wall
-Wno-format-y2k
38 CWARNFLAGS
+= -W
-Wno-unused-parameter
-Wstrict-prototypes\
39 -Wmissing-prototypes
-Wpointer-arith
42 CWARNFLAGS
+= -Wreturn-type
-Wcast-qual
-Wwrite-strings
-Wswitch\
43 -Wshadow
-Wcast-align
-Wunused-parameter
47 CWARNFLAGS
+= -Wchar-subscripts
-Winline
-Wnested-externs
-Wredundant-decls
49 . if
${WARNS} >= 2 && ${WARNS} <= 4
50 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
51 # XXX always get it right.
52 CWARNFLAGS
+= -Wno-uninitialized
54 . if
!defined
(WITH_GCC3
)
55 CWARNFLAGS
+= -Wno-pointer-sign
59 . if defined
(FORMAT_AUDIT
)
64 #CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
65 CWARNFLAGS
+= -Wformat
=2 -Wno-format-extra-args
66 . if
!defined
(NO_WERROR
)
73 .if defined
(IGNORE_PRAGMA
)
74 CWARNFLAGS
+= -Wno-unknown-pragmas
77 .if
${MK_SSP} != "no" && ${CC} != "icc" && ${MACHINE_ARCH} != "ia64" && \
78 ${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "mips"
79 # Don't use -Wstack-protector as it breaks world with -Werror.
80 SSP_CFLAGS ?
= -fstack-protector
81 CFLAGS
+= ${SSP_CFLAGS}
84 # Allow user-specified additional warning flags
85 CFLAGS
+= ${CWARNFLAGS}