3d3d6b847420 ("kbuild: LLVMLinux: Adapt warnings for compilation with clang")
Hi,
the commit in $Subject breaks the purpose of the W= build to see additional warnings.
With it, currently I get all that stuff disabled with gcc:
$ make V=1 W=1 fs/direct-io.o
...
gcc -Wp,-MD,... -Wno-sign-compare -Wno-missing-field-initializers -Wno-unused-value -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-uninitialized ...
which is clearly wrong. If I'm building with W=1, I *explicitly* *want* those additional warnings enabled, not disabled.
Please fix this to have effect only for clang but not for the rest of the universe.
Thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Quoted 2 lines · Borislav Petkov
Please fix this to have effect only for clang but not for the rest of the universe.
i'd suggest reverting it instead, there're probably some stale entries in there already (e.g., -fcatch-undefined-behavior).
Ok, let's wrap this case with
ifeq ($(COMPILER),clang)
...
endif
And we'll update the stale entries.
Patch to follow after some testing.
Signature · 5 lines
Dipl.-Ing. Jan-Simon Möller [email protected] Am Montag, 16. Juni 2014, 17:29:25 schrieb PaX Team:
Quoted 6 lines · Borislav Petkov
Quoted 2 lines
Please fix this to have effect only for clang but not for the rest of the universe.
i'd suggest reverting it instead, there're probably some stale entries in there already (e.g., -fcatch-undefined-behavior).
Hi,
Quoted 9 lines · Jan-Simon Möller
Ok, let's wrap this case with
ifeq ($(COMPILER),clang)
...
endifAnd we'll update the stale entries.
Patch to follow after some testing.
any progress with the testing or should we simply revert?
Thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--PATCH 1/1 kbuild, LLVMLinux: only use warnings when using clang
From: Behan Webster <[email protected]>
Only consider clang warnings in Kbuild when using the clang compiler.
--- scripts/Makefile.extrawarn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/Makefile.extrawarn +2 -1
@@ -26,7 +26,7 @@ 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 +ifeq ($(COMPILER),clang) warning-1 += $(call cc-disable-warning, initializer-overrides) warning-1 += $(call cc-disable-warning, unused-value) warning-1 += $(call cc-disable-warning, format)
@@ -35,6 +35,7 @@ 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) +endif warning-2 := -Waggregate-return warning-2 += -Wcast-align
Signature · 1 line
1.9.1
Re: [PATCH] kbuild, LLVMLinux: only use warnings when using clang
Quoted 23 lines · On Mon, Jun 30, 2014 at 05:42:26PM -0700, [email protected] wrote:
From: Behan Webster <[email protected]>
Only consider clang warnings in
Kbuildwhen using the clang compiler.Signed-off-by Behan Webster <[email protected]>--- scripts/Makefile.extrawarn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)scripts/Makefile.extrawarn +1
-1@@ -26,7 +26,7 @@ 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 +ifeq ($(COMPILER),clang) warning-1 += $(call cc-disable-warning, initializer-overrides) warning-1 += $(call cc-disable-warning, unused-value) warning-1 += $(call cc-disable-warning, format)
scripts/Makefile.extrawarn warning-1 += $(call cc-disable-warning, sign-compare) · line 38
Quoted 4 lines
scripts/Makefile.extrawarn +1
-0@@ -35,6 +35,7 @@ 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) +endif
Ok, just to make sure I understand that whole use case correctly:
The disabling of those warnings is really intended for the case where people build the kernel with "W=1" on the make cmdline *and* clang?
Thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Re: [PATCH] kbuild, LLVMLinux: only use warnings when using clang
Quoted 31 lines · Borislav Petkov
Quoted 23 lines · On Mon, Jun 30, 2014 at 05:42:26PM -0700, [email protected] wrote:
From: Behan Webster <[email protected]>
Only consider clang warnings in
Kbuildwhen using the clang compiler.Signed-off-by Behan Webster <[email protected]>--- scripts/Makefile.extrawarn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)scripts/Makefile.extrawarn +1
-1@@ -26,7 +26,7 @@ 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 +ifeq ($(COMPILER),clang) warning-1 += $(call cc-disable-warning, initializer-overrides) warning-1 += $(call cc-disable-warning, unused-value) warning-1 += $(call cc-disable-warning, format)scripts/Makefile.extrawarn warning-1 += $(call cc-disable-warning, sign-compare) · line 38
Quoted 4 lines
scripts/Makefile.extrawarn +1
-0@@ -35,6 +35,7 @@ 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) +endifOk, just to make sure I understand that whole use case correctly:
Quoted 2 lines
The disabling of those warnings is really intended for the case where people build the kernel with "W=1" on the make cmdline *and* clang?
Behan, Jan-Simon,
can you explain why are those -Wno-... options needed in the W=1 case? The whole point of the W= option is to enable noisy warnings, so I don't quite get why you want to silence these.
Thanks,
Michal
Re: [PATCH] kbuild, LLVMLinux: only use warnings when using clang
Quoted 31 lines · Michal Marek
Quoted 30 lines · Borislav Petkov
Quoted 23 lines · On Mon, Jun 30, 2014 at 05:42:26PM -0700, [email protected] wrote:
From: Behan Webster <[email protected]>
Only consider clang warnings in
Kbuildwhen using the clang compiler.Signed-off-by Behan Webster <[email protected]>--- scripts/Makefile.extrawarn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)scripts/Makefile.extrawarn +1
-1@@ -26,7 +26,7 @@ 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 +ifeq ($(COMPILER),clang) warning-1 += $(call cc-disable-warning, initializer-overrides) warning-1 += $(call cc-disable-warning, unused-value) warning-1 += $(call cc-disable-warning, format)scripts/Makefile.extrawarn warning-1 += $(call cc-disable-warning, sign-compare) · line 38
Quoted 4 lines
scripts/Makefile.extrawarn +1
-0@@ -35,6 +35,7 @@ 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) +endifOk, just to make sure I understand that whole use case correctly:
Quoted 7 lines
Quoted 2 lines
The disabling of those warnings is really intended for the case where people build the kernel with "W=1" on the make cmdline *and* clang?
Behan, Jan-Simon,
can you explain why are those -Wno-... options needed in the W=1 case? The whole point of the W= option is to enable noisy warnings, so I don't quite get why you want to silence these.
Sorry for the delay.
That code is indeed not what was intended. It's more that these warnings should normally be disabled, and when W is set they should not be disabled.
Just putting the final touches on a patch which addresses this situation.
Behan
Signature · 2 lines
Behan Webster [email protected]
PATCH v2 1/1 kbuild, LLVMLinux: Supress warnings unless W=1-3
In reply to Michal MarekFrom: Behan Webster <[email protected]>
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.
--- Makefile | 1 + scripts/Makefile.extrawarn | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-)
Makefile +1 -0
@@ -668,6 +668,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.
scripts/Makefile.extrawarn +12 -10
@@ -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
@@ -55,6 +45,18 @@ warning-3 += -Wswitch-default warning-3 += $(call cc-option, -Wpacked-bitfield-compat) warning-3 += $(call cc-option, -Wvla) +ifeq ($(COMPILER),clang) +ifndef $(W) +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 + 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)))
Signature · 1 line
1.9.1
Re: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
Dne 31.7.2014 06:16, [email protected] napsal(a):
Quoted 35 lines
From: Behan Webster <[email protected]>
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 <[email protected]>Signed-off-by Jan-Simon Möller <[email protected]>Signed-off-by Mark Charlebois <[email protected]>--- Makefile | 1 + scripts/Makefile.extrawarn | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-)Makefile +1
-0@@ -668,6 +668,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.scripts/Makefile.extrawarn +0
-0@@ -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)
scripts/Makefile.extrawarn warning-1 += $(call cc-option, -Wmissing-include-dirs) · line 38
Quoted 10 lines
scripts/Makefile.extrawarn +0
-10-# 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) -
OK.
Quoted 9 lines
scripts/Makefile.extrawarn +2
-0warning-2 := -Waggregate-return warning-2 += -Wcast-align warning-2 += -Wdisabled-optimization@@ -55,6 +45,18 @@ warning-3 += -Wswitch-default warning-3 += $(call cc-option, -Wpacked-bitfield-compat) warning-3 += $(call cc-option, -Wvla) +ifeq ($(COMPILER),clang) +ifndef $(W)
scripts/Makefile.extrawarn warning-3 += -Wswitch-default · line 59
Quoted 10 lines
scripts/Makefile.extrawarn +10
-0+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 +
Please remove this part, it has no effect. I assume that if it works for you, these warning are not as annoying so they do not need to be disabled?
Thanks,
Michal
Re: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
Quoted 56 lines · Michal Marek
Dne 31.7.2014 06:16, [email protected] napsal(a):
Quoted 35 lines
From: Behan Webster <[email protected]>
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 <[email protected]>Signed-off-by Jan-Simon Möller <[email protected]>Signed-off-by Mark Charlebois <[email protected]>--- Makefile | 1 + scripts/Makefile.extrawarn | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-)Makefile +1
-0@@ -668,6 +668,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.scripts/Makefile.extrawarn +0
-0@@ -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)scripts/Makefile.extrawarn warning-1 += $(call cc-option, -Wmissing-include-dirs) · line 38
Quoted 10 lines
scripts/Makefile.extrawarn +0
-10-# 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) -OK.
Quoted 7 lines
scripts/Makefile.extrawarn +0
-0warning-2 := -Waggregate-return warning-2 += -Wcast-align warning-2 += -Wdisabled-optimization@@ -55,6 +45,18 @@ warning-3 += -Wswitch-default warning-3 += $(call cc-option, -Wpacked-bitfield-compat) warning-3 += $(call cc-option, -Wvla)
Quoted 14 lines
scripts/Makefile.extrawarn warning-3 += -Wswitch-default · line 59
Quoted 12 lines
scripts/Makefile.extrawarn +12
-0+ifeq ($(COMPILER),clang) +ifndef $(W) +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 +Please remove this part, it has no effect. I assume that if it works for you, these warning are not as annoying so they do not need to be disabled?
Actually they are annoying, that's why they're disabled normally. Most of them complain about practices which are relatively common in kernel code.
clang warns about a lot more things than gcc does. It means that code which compiles cleanly in gcc often doesn't with clang. This cuts out the warnings which are unlikely to to be fixed in kernel code anytime soon, but which are probably worth exposing when W=1 is used.
This part of the patch explicitly deals with complaints from some in the kernel community that clang is too noisy with kernel code.
This part of the patch needs to be somewhere. This seemed the best place.
Behan
Signature · 2 lines
Behan Webster [email protected]
Re: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
Dne 31.7.2014 18:12, Behan Webster napsal(a):
Quoted 29 lines · Michal Marek
Quoted 11 lines
Dne 31.7.2014 06:16, [email protected] napsal(a):
Quoted 10 lines
scripts/Makefile.extrawarn +6
-0@@ -55,6 +45,18 @@ warning-3 += -Wswitch-default warning-3 += $(call cc-option, -Wpacked-bitfield-compat) warning-3 += $(call cc-option, -Wvla) +ifeq ($(COMPILER),clang) +ifndef $(W) +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)Quoted 8 lines
scripts/Makefile.extrawarn warning-3 += -Wswitch-default · line 59
Quoted 5 lines
scripts/Makefile.extrawarn +5
-0+KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) +KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) +endif +endif +Please remove this part, it has no effect. I assume that if it works for you, these warning are not as annoying so they do not need to be disabled?
Actually they are annoying, that's why they're disabled normally. Most of them complain about practices which are relatively common in kernel code.
clang warns about a lot more things than gcc does. It means that code which compiles cleanly in gcc often doesn't with clang. This cuts out the warnings which are unlikely to to be fixed in kernel code anytime soon, but which are probably worth exposing when W=1 is used.
Quoted 4 lines
This part of the patch explicitly deals with complaints from some in the kernel community that clang is too noisy with kernel code.
This part of the patch needs to be somewhere. This seemed the best place.
You placed it inside a branch that is only evaluated when W= is given.
Michal
Re: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
Quoted 30 lines · Michal Marek
Dne 31.7.2014 18:12, Behan Webster napsal(a):
Quoted 29 lines · Michal Marek
Quoted 11 lines
Dne 31.7.2014 06:16, [email protected] napsal(a):
Quoted 10 lines
scripts/Makefile.extrawarn +6
-0@@ -55,6 +45,18 @@ warning-3 += -Wswitch-default warning-3 += $(call cc-option, -Wpacked-bitfield-compat) warning-3 += $(call cc-option, -Wvla) +ifeq ($(COMPILER),clang) +ifndef $(W) +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)Quoted 8 lines
scripts/Makefile.extrawarn warning-3 += -Wswitch-default · line 59
Quoted 5 lines
scripts/Makefile.extrawarn +5
-0+KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) +KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) +endif +endif +Please remove this part, it has no effect. I assume that if it works for you, these warning are not as annoying so they do not need to be disabled?
Actually they are annoying, that's why they're disabled normally. Most of them complain about practices which are relatively common in kernel code.
clang warns about a lot more things than gcc does. It means that code which compiles cleanly in gcc often doesn't with clang. This cuts out the warnings which are unlikely to to be fixed in kernel code anytime soon, but which are probably worth exposing when W=1 is used.
Quoted 5 lines
Quoted 4 lines
This part of the patch explicitly deals with complaints from some in the kernel community that clang is too noisy with kernel code.
This part of the patch needs to be somewhere. This seemed the best place.
You placed it inside a branch that is only evaluated when W= is given.
Hmm. You're right. Will fix.
Behan
Signature · 2 lines
Behan Webster [email protected]
PATCH v3 1/1 kbuild, LLVMLinux: Supress warnings unless W=1-3
In reply to Michal MarekFrom: Behan Webster <[email protected]>
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.
--- Makefile | 1 + scripts/Makefile.extrawarn | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-)
Makefile +1 -0
@@ -668,6 +668,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.
scripts/Makefile.extrawarn +12 -10
@@ -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,16 @@ 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 +
Signature · 1 line
1.9.1
Re: [PATCH v3] kbuild, LLVMLinux: Supress warnings unless W=1-3
Quoted 10 lines · On 2014-08-01 06:08, [email protected] wrote:
From: Behan Webster <[email protected]>
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 <[email protected]>Signed-off-by Jan-Simon Möller <[email protected]>Signed-off-by Mark Charlebois <[email protected]>
Quoted 4 lines
--- Makefile | 1 + scripts/Makefile.extrawarn | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-)
OK, this looks better, I applied the patch to kbuild.git#kbuild.
Quoted 1 line
+KBUILD_CFLAGS += $(call cc-disable-warning, unknown-warning-option)
Do we have -W... options in the Makefiles that clang does not understand and that are added unconditionally?
Thanks,
Michal