1# $FreeBSD$ 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.if !defined(NO_WARNS) 10. if defined(WARNS) 11. if ${WARNS} > 0 12. if !defined(NO_WERROR) 13CFLAGS += -Werror 14. endif 15. endif 16. if ${WARNS} > 1 17CFLAGS += -Wall 18. endif 19. if ${WARNS} > 2 20CFLAGS += -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 21. endif 22. if ${WARNS} > 3 23CFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align 24. endif 25. if ${WARNS} > 1 26# XXX Delete -Wuninitialized by default for now -- the compiler doesn't 27# XXX always get it right. 28CFLAGS += -Wno-uninitialized 29. endif 30. endif 31 32. if defined(FORMAT_AUDIT) 33WFORMAT = 1 34. endif 35. if defined(WFORMAT) 36. if ${WFORMAT} > 0 37CFLAGS += -Wnon-const-format -Wno-format-extra-args 38. if !defined(NO_WERROR) 39CFLAGS += -Werror 40. endif 41. endif 42. endif 43.endif 44 45# Allow user-specified additional warning flags 46CFLAGS += ${CWARNFLAGS} 47