Deleted Added
full compact
bsd.sys.mk (232322) bsd.sys.mk (232473)
1# $FreeBSD: head/share/mk/bsd.sys.mk 232322 2012-02-29 22:58:51Z dim $
1# $FreeBSD: head/share/mk/bsd.sys.mk 232473 2012-03-03 18:58:15Z dim $
2#
3# This file contains common settings used for building FreeBSD
4# sources.
5
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.
8
9# for GCC: http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143

--- 13 unchanged lines hidden (view full) ---

23CFLAGS += -std=${CSTD}
24.endif
25.if !defined(NO_WARNS)
26# -pedantic is problematic because it also imposes namespace restrictions
27#CFLAGS += -pedantic
28. if defined(WARNS)
29. if ${WARNS} >= 1
30CWARNFLAGS += -Wsystem-headers
2#
3# This file contains common settings used for building FreeBSD
4# sources.
5
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.
8
9# for GCC: http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143

--- 13 unchanged lines hidden (view full) ---

23CFLAGS += -std=${CSTD}
24.endif
25.if !defined(NO_WARNS)
26# -pedantic is problematic because it also imposes namespace restrictions
27#CFLAGS += -pedantic
28. if defined(WARNS)
29. if ${WARNS} >= 1
30CWARNFLAGS += -Wsystem-headers
31. if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang))
31. if !defined(NO_WERROR) && ((${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no")) || !defined(NO_WERROR.clang))
32CWARNFLAGS += -Werror
33. endif
34. endif
35. if ${WARNS} >= 2
36CWARNFLAGS += -Wall -Wno-format-y2k
37. endif
38. if ${WARNS} >= 3
39CWARNFLAGS += -W -Wno-unused-parameter -Wstrict-prototypes\
40 -Wmissing-prototypes -Wpointer-arith
41. endif
42. if ${WARNS} >= 4
43CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
44 -Wshadow -Wunused-parameter
32CWARNFLAGS += -Werror
33. endif
34. endif
35. if ${WARNS} >= 2
36CWARNFLAGS += -Wall -Wno-format-y2k
37. endif
38. if ${WARNS} >= 3
39CWARNFLAGS += -W -Wno-unused-parameter -Wstrict-prototypes\
40 -Wmissing-prototypes -Wpointer-arith
41. endif
42. if ${WARNS} >= 4
43CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
44 -Wshadow -Wunused-parameter
45. if !defined(NO_WCAST_ALIGN) && ((${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") || !defined(NO_WCAST_ALIGN.clang))
45. if !defined(NO_WCAST_ALIGN) && ((${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no")) || !defined(NO_WCAST_ALIGN.clang))
46CWARNFLAGS += -Wcast-align
47. endif
48. endif
49# BDECFLAGS
50. if ${WARNS} >= 6
51CWARNFLAGS += -Wchar-subscripts -Winline -Wnested-externs\
52 -Wredundant-decls -Wold-style-definition
53. endif
54. if ${WARNS} >= 2 && ${WARNS} <= 4
55# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
56# XXX always get it right.
57CWARNFLAGS += -Wno-uninitialized
58. endif
59CWARNFLAGS += -Wno-pointer-sign
60# Clang has more warnings enabled by default, and when using -Wall, so if WARNS
61# is set to low values, these have to be disabled explicitly.
46CWARNFLAGS += -Wcast-align
47. endif
48. endif
49# BDECFLAGS
50. if ${WARNS} >= 6
51CWARNFLAGS += -Wchar-subscripts -Winline -Wnested-externs\
52 -Wredundant-decls -Wold-style-definition
53. endif
54. if ${WARNS} >= 2 && ${WARNS} <= 4
55# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
56# XXX always get it right.
57CWARNFLAGS += -Wno-uninitialized
58. endif
59CWARNFLAGS += -Wno-pointer-sign
60# Clang has more warnings enabled by default, and when using -Wall, so if WARNS
61# is set to low values, these have to be disabled explicitly.
62. if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
62. if ${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no")
63. if ${WARNS} <= 3
64CWARNFLAGS += -Wno-tautological-compare -Wno-unused-value\
65 -Wno-parentheses-equality -Wno-unused-function\
66 -Wno-conversion
67. endif
68. if ${WARNS} <= 2
69CWARNFLAGS += -Wno-switch-enum -Wno-empty-body
70. endif

--- 8 unchanged lines hidden (view full) ---

79
80. if defined(FORMAT_AUDIT)
81WFORMAT = 1
82. endif
83. if defined(WFORMAT)
84. if ${WFORMAT} > 0
85#CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
86CWARNFLAGS += -Wformat=2 -Wno-format-extra-args
63. if ${WARNS} <= 3
64CWARNFLAGS += -Wno-tautological-compare -Wno-unused-value\
65 -Wno-parentheses-equality -Wno-unused-function\
66 -Wno-conversion
67. endif
68. if ${WARNS} <= 2
69CWARNFLAGS += -Wno-switch-enum -Wno-empty-body
70. endif

--- 8 unchanged lines hidden (view full) ---

79
80. if defined(FORMAT_AUDIT)
81WFORMAT = 1
82. endif
83. if defined(WFORMAT)
84. if ${WFORMAT} > 0
85#CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args
86CWARNFLAGS += -Wformat=2 -Wno-format-extra-args
87. if !defined(NO_WERROR) && ((${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") || !defined(NO_WERROR.clang))
87. if !defined(NO_WERROR) && ((${CC:T:Mclang} != "clang" && (!defined(MK_CLANG_IS_CC) || ${MK_CLANG_IS_CC} == "no")) || !defined(NO_WERROR.clang))
88CWARNFLAGS += -Werror
89. endif
90. endif
91. endif
88CWARNFLAGS += -Werror
89. endif
90. endif
91. endif
92. if defined(NO_WFORMAT) || ((${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && defined(NO_WFORMAT.clang))
92. if defined(NO_WFORMAT) || ((${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no")) && defined(NO_WFORMAT.clang))
93CWARNFLAGS += -Wno-format
94. endif
95.endif
96
97.if defined(IGNORE_PRAGMA)
98CWARNFLAGS += -Wno-unknown-pragmas
99.endif
100
93CWARNFLAGS += -Wno-format
94. endif
95.endif
96
97.if defined(IGNORE_PRAGMA)
98CWARNFLAGS += -Wno-unknown-pragmas
99.endif
100
101.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
101.if ${CC:T:Mclang} == "clang" || (defined(MK_CLANG_IS_CC) && ${MK_CLANG_IS_CC} != "no")
102CLANG_NO_IAS = -no-integrated-as
103CLANG_OPT_SMALL = -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \
104 -mllvm -enable-load-pre=false
105.endif
106
107.if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \
108 ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
109# Don't use -Wstack-protector as it breaks world with -Werror.
110SSP_CFLAGS ?= -fstack-protector
111CFLAGS += ${SSP_CFLAGS}
112.endif
113
114# Allow user-specified additional warning flags
115CFLAGS += ${CWARNFLAGS}
102CLANG_NO_IAS = -no-integrated-as
103CLANG_OPT_SMALL = -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \
104 -mllvm -enable-load-pre=false
105.endif
106
107.if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \
108 ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
109# Don't use -Wstack-protector as it breaks world with -Werror.
110SSP_CFLAGS ?= -fstack-protector
111CFLAGS += ${SSP_CFLAGS}
112.endif
113
114# Allow user-specified additional warning flags
115CFLAGS += ${CWARNFLAGS}