From: Daniel Schwierzeck Date: Thu, 25 Jan 2018 18:21:24 +0100 Subject: [U-Boot] [PATCH 1/4] Kbuild: support W=[N, ]err for passing '-Werror' to the compiler In-Reply-To: <20180125172127.17825-1-daniel.schwierzeck@gmail.com> References: <20180125172127.17825-1-daniel.schwierzeck@gmail.com> Message-ID: <20180125172127.17825-2-daniel.schwierzeck@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Extend the Kbuild's W=N option with an optional 'err' value. This will pass -Werror to the compiler to treat all warnings as errors. This is useful to enforce a zero-warnings policy. The 'err' value can also be combined with the numerical values like this: make W=1 make W=err make W=1,err Signed-off-by: Daniel Schwierzeck --- scripts/Makefile.extrawarn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 1d3a570594..d8d93b7fe1 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -48,9 +48,12 @@ warning-3 += -Wswitch-default warning-3 += $(call cc-option, -Wpacked-bitfield-compat) warning-3 += $(call cc-option, -Wvla) +warning-err := -Werror + 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))) +warning += $(warning-$(findstring err, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) ifeq ("$(strip $(warning))","") $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) -- 2.16.1