Allow disabling of unused parameter warnings. This is handy for third
[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 $
04214b4c 2# $DragonFly: src/share/mk/bsd.sys.mk,v 1.7 2005/07/08 13:05:53 joerg Exp $
984263bc
MD
3#
4# This file contains common settings used for building FreeBSD
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)
11. if defined(WARNS)
984263bc
MD
12# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
13# XXX always get it right.
cf277b96 14. if ${WARNS} <= 4
984263bc 15CFLAGS += -Wno-uninitialized
cf277b96
JS
16. endif
17. if defined(WARNS_WERROR) && !defined(NO_WERROR)
984263bc 18CFLAGS += -Werror
984263bc 19. endif
cf277b96
JS
20. if ${WARNS} > 0
21CFLAGS += -Wunknown-pragmas
22. if ${CCVER} != gcc2
23CFLAGS += -Wsystem-headers
24. endif
25.endif
984263bc 26. if ${WARNS} > 1
c8960d50
JR
27CFLAGS += -Wall
28. endif
29. if ${WARNS} > 2
30CFLAGS += -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
31. endif
32. if ${WARNS} > 3
33CFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
34. endif
35. if ${WARNS} > 5
36CFLAGS += -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
984263bc
MD
37. endif
38. endif
39
40. if defined(FORMAT_AUDIT)
41WFORMAT = 1
42. endif
43. if defined(WFORMAT)
44. if ${WFORMAT} > 0
a74a8e46
SS
45CFLAGS += -Wno-format-extra-args
46. if ${CCVER} == gcc2
47CFLAGS += -Wnon-const-format
48. endif
984263bc
MD
49. if defined(WARNS_WERROR) && !defined(NO_WERROR)
50CFLAGS += -Werror
51. endif
52. endif
53. endif
54.endif
55
04214b4c
JS
56.if defined(WARNS_NO_UNUSED_PARAMETERS)
57CFLAGS+= -Wno-unused-parameters
58.endif
59
984263bc
MD
60# Allow user-specified additional warning flags
61CFLAGS += ${CWARNFLAGS}