Restrict -Werror to gcc41.
[dragonfly.git] / share / mk / bsd.sys.mk
CommitLineData
984263bc 1# $FreeBSD: src/share/mk/bsd.sys.mk,v 1.3.2.5 2002/07/03 16:59:14 des Exp $
05d75b5d 2# $DragonFly: src/share/mk/bsd.sys.mk,v 1.12 2008/11/14 15:04:42 swildner Exp $
984263bc 3#
114580ac 4# This file contains common settings used for building DragonFly
984263bc
MD
5# sources.
6
7# Enable various levels of compiler warning checks. These may be
8# overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS.
9
10.if !defined(NO_WARNS)
6dd73847
PA
11. if defined(CSTD)
12. if ${CSTD} == "k&r"
13CFLAGS += -traditional
14. elif ${CSTD} == "c89" || ${CSTD} == "c90"
15CFLAGS += -std=iso9899:1990
16. elif ${CSTD} == "c94" || ${CSTD} == "c95"
17CFLAGS += -std=iso9899:199409
18. elif ${CSTD} == "c99"
19CFLAGS += -std=iso9899:1999
20. else
21CFLAGS += -std=${CSTD}
984263bc 22. endif
6dd73847
PA
23. endif
24. if defined(WARNS)
38842275 25. if ${WARNS} >= 1
6dd73847 26CWARNFLAGS += -Wsystem-headers
5623ae32 27. if !defined(NO_WERROR) && ${CCVER} == "gcc41"
dcdd01ca
SW
28CWARNFLAGS += -Werror
29. endif
6dd73847 30. endif
38842275 31. if ${WARNS} >= 2
6dd73847 32CWARNFLAGS += -Wall
c8960d50 33. endif
38842275 34. if ${WARNS} >= 3
6dd73847
PA
35CWARNFLAGS += -W -Wno-unused-parameter -Wstrict-prototypes\
36 -Wmissing-prototypes -Wpointer-arith
c8960d50 37. endif
38842275 38. if ${WARNS} >= 4
6dd73847
PA
39CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\
40 -Wshadow -Wcast-align -Wunused-parameter
c8960d50 41. endif
38842275 42. if ${WARNS} >= 6
6dd73847
PA
43CWARNFLAGS += -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
44. endif
45. if ${WARNS} >= 2 && ${WARNS} <= 4
46# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
47# XXX always get it right.
48CWARNFLAGS += -Wno-uninitialized
984263bc
MD
49. endif
50. endif
51
52. if defined(FORMAT_AUDIT)
53WFORMAT = 1
54. endif
55. if defined(WFORMAT)
56. if ${WFORMAT} > 0
6dd73847 57CWARNFLAGS += -Wformat=2 -Wno-format-extra-args
5623ae32 58. if !defined(NO_WERROR) && ${CCVER} == "gcc41"
dcdd01ca
SW
59CWARNFLAGS += -Werror
60. endif
984263bc
MD
61. endif
62. endif
63.endif
64
65# Allow user-specified additional warning flags
66CFLAGS += ${CWARNFLAGS}