From: Behan Webster Date: Fri, 1 Aug 2014 04:08:25 +0000 (-0700) Subject: kbuild, LLVMLinux: Supress warnings unless W=1-3 X-Git-Tag: v4.14-rc1~7004^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=26ea6bb1fef06c686be771903ecab0518af5c2de;p=platform%2Fkernel%2Flinux-rpi.git kbuild, LLVMLinux: Supress warnings unless W=1-3 clang has more warnings enabled by default. Turn them off unless W is set. This patch fixes a logic bug where warnings in clang were disabled when W was set. Signed-off-by: Behan Webster Signed-off-by: Jan-Simon Möller Signed-off-by: Mark Charlebois Cc: bp@alien8.de Signed-off-by: Michal Marek --- diff --git a/Makefile b/Makefile index 2fd21a5..4aef4f8 100644 --- a/Makefile +++ b/Makefile @@ -663,6 +663,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) else # This warning generated too much noise in a regular build. diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 6564350..f734033 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -26,16 +26,6 @@ warning-1 += $(call cc-option, -Wmissing-include-dirs) warning-1 += $(call cc-option, -Wunused-but-set-variable) warning-1 += $(call cc-disable-warning, missing-field-initializers) -# Clang -warning-1 += $(call cc-disable-warning, initializer-overrides) -warning-1 += $(call cc-disable-warning, unused-value) -warning-1 += $(call cc-disable-warning, format) -warning-1 += $(call cc-disable-warning, unknown-warning-option) -warning-1 += $(call cc-disable-warning, sign-compare) -warning-1 += $(call cc-disable-warning, format-zero-length) -warning-1 += $(call cc-disable-warning, uninitialized) -warning-1 += $(call cc-option, -fcatch-undefined-behavior) - warning-2 := -Waggregate-return warning-2 += -Wcast-align warning-2 += -Wdisabled-optimization @@ -64,4 +54,15 @@ ifeq ("$(strip $(warning))","") endif KBUILD_CFLAGS += $(warning) +else + +ifeq ($(COMPILER),clang) +KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) +KBUILD_CFLAGS += $(call cc-disable-warning, format) +KBUILD_CFLAGS += $(call cc-disable-warning, unknown-warning-option) +KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) +KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) +KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) +endif endif