Add more -W options to gcc.

This commit is contained in:
Denis Vlasenko 2008-05-15 21:44:46 +00:00
parent 6b06cb80be
commit e251337a4d

View File

@ -21,27 +21,16 @@ CPPFLAGS += \
CFLAGS += $(call cc-option,-Wall -Wshadow -Wwrite-strings,) CFLAGS += $(call cc-option,-Wall -Wshadow -Wwrite-strings,)
CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,) CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,)
CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,) CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,)
# If you want to add "-Wmissing-prototypes -Wmissing-declarations" above CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
# (or anything else for that matter) make sure that it is still possible # If you want to add more -Wsomething above, make sure that it is
# to build bbox without warnings. Current offender: find.c:alloc_action(). # still possible to build bbox without warnings.
# Looks more like gcc bug: gcc will warn on it with or without prototype.
# But still, warning-free compile is a must, or else we will drown
# in warnings pretty soon.
ifeq ($(CONFIG_WERROR),y) ifeq ($(CONFIG_WERROR),y)
CFLAGS += $(call cc-option,-Werror,) CFLAGS += $(call cc-option,-Werror,)
else
# for development, warn a little bit about unused results..
CPPFLAGS += -D_FORTIFY_SOURCE=2
endif endif
# gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action() # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action()
CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition) CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition)
# gcc emits bogus "no prev proto" warning on find.c:alloc_action()
ifneq ($(CONFIG_WERROR),y)
CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
endif
CFLAGS += $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,) CFLAGS += $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,)
# -fno-guess-branch-probability: prohibit pseudo-random guessing # -fno-guess-branch-probability: prohibit pseudo-random guessing
# of branch probabilities (hopefully makes bloatcheck more stable): # of branch probabilities (hopefully makes bloatcheck more stable):