Commit a6de553d authored by Michal Marek's avatar Michal Marek

kbuild: Allow to combine multiple W= levels

Add support for make W=12, make W=123 and so on, to enable warnings from
multiple W= levels. Normally, make W=<level> does not include warnings
from the previous level.
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-By: default avatarValdis Kletnieks <valdis.kletnieks@vt.edu>
parent af0e5d56
...@@ -1290,7 +1290,7 @@ help: ...@@ -1290,7 +1290,7 @@ help:
@echo ' 1: warnings which may be relevant and do not occur too often' @echo ' 1: warnings which may be relevant and do not occur too often'
@echo ' 2: warnings which occur quite often but may still be relevant' @echo ' 2: warnings which occur quite often but may still be relevant'
@echo ' 3: more obscure warnings, can most likely be ignored' @echo ' 3: more obscure warnings, can most likely be ignored'
@echo ' Multiple levels can be combined with W=12 or W=123'
@echo '' @echo ''
@echo 'Execute "make" or "make all" to build all targets marked with [*] ' @echo 'Execute "make" or "make all" to build all targets marked with [*] '
@echo 'For further info see the ./README file' @echo 'For further info see the ./README file'
......
...@@ -60,6 +60,8 @@ endif ...@@ -60,6 +60,8 @@ endif
# $(call cc-option, -W...) handles gcc -W.. options which # $(call cc-option, -W...) handles gcc -W.. options which
# are not supported by all versions of the compiler # are not supported by all versions of the compiler
ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
warning- := $(empty)
warning-1 := -Wextra -Wunused -Wno-unused-parameter warning-1 := -Wextra -Wunused -Wno-unused-parameter
warning-1 += -Wmissing-declarations warning-1 += -Wmissing-declarations
warning-1 += -Wmissing-format-attribute warning-1 += -Wmissing-format-attribute
...@@ -86,9 +88,11 @@ warning-3 += -Wswitch-default ...@@ -86,9 +88,11 @@ warning-3 += -Wswitch-default
warning-3 += $(call cc-option, -Wpacked-bitfield-compat) warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
warning-3 += $(call cc-option, -Wvla) warning-3 += $(call cc-option, -Wvla)
warning := $(warning-$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)) warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
ifeq ("$(warning)","") ifeq ("$(strip $(warning))","")
$(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
endif endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment