* 3d3d6b847420 ("kbuild: LLVMLinux: Adapt warnings for compilation with clang")
@ 2014-06-16 13:07 Borislav Petkov
2014-06-16 15:29 ` PaX Team
0 siblings, 1 reply; 15+ messages in thread
From: Borislav Petkov @ 2014-06-16 13:07 UTC (permalink / raw)
To: Jan-Simon Möller
Cc: Behan Webster, Mark Charlebois, PaX Team, Michal Marek,
linux-kbuild, lkml
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.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: 3d3d6b847420 ("kbuild: LLVMLinux: Adapt warnings for compilation with clang")
2014-06-16 13:07 3d3d6b847420 ("kbuild: LLVMLinux: Adapt warnings for compilation with clang") Borislav Petkov
@ 2014-06-16 15:29 ` PaX Team
2014-06-16 15:48 ` Jan-Simon Möller
0 siblings, 1 reply; 15+ messages in thread
From: PaX Team @ 2014-06-16 15:29 UTC (permalink / raw)
To: Jan-Simon Möller, Borislav Petkov
Cc: Behan Webster, Mark Charlebois, Michal Marek, linux-kbuild, lkml
On 16 Jun 2014 at 15:07, Borislav Petkov wrote:
> 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).
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: 3d3d6b847420 ("kbuild: LLVMLinux: Adapt warnings for compilation with clang")
2014-06-16 15:29 ` PaX Team
@ 2014-06-16 15:48 ` Jan-Simon Möller
2014-06-29 20:13 ` Borislav Petkov
0 siblings, 1 reply; 15+ messages in thread
From: Jan-Simon Möller @ 2014-06-16 15:48 UTC (permalink / raw)
To: pageexec
Cc: Borislav Petkov, Behan Webster, Mark Charlebois, Michal Marek,
linux-kbuild, lkml
Ok, let's wrap this case with
ifeq ($(COMPILER),clang)
...
endif
And we'll update the stale entries.
Patch to follow after some testing.
--
Dipl.-Ing.
Jan-Simon Möller
jansimon.moeller@gmx.de
Am Montag, 16. Juni 2014, 17:29:25 schrieb PaX Team:
> On 16 Jun 2014 at 15:07, Borislav Petkov wrote:
> > 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).
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: 3d3d6b847420 ("kbuild: LLVMLinux: Adapt warnings for compilation with clang")
2014-06-16 15:48 ` Jan-Simon Möller
@ 2014-06-29 20:13 ` Borislav Petkov
2014-07-01 0:42 ` [PATCH] kbuild, LLVMLinux: only use warnings when using clang behanw
0 siblings, 1 reply; 15+ messages in thread
From: Borislav Petkov @ 2014-06-29 20:13 UTC (permalink / raw)
To: Jan-Simon Möller
Cc: pageexec, Behan Webster, Mark Charlebois, Michal Marek,
linux-kbuild, lkml
Hi,
On Mon, Jun 16, 2014 at 05:48:01PM +0200, Jan-Simon Möller wrote:
> Ok, let's wrap this case with
>
> ifeq ($(COMPILER),clang)
> ...
> endif
>
> And we'll update the stale entries.
>
> Patch to follow after some testing.
any progress with the testing or should we simply revert?
Thanks.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] kbuild, LLVMLinux: only use warnings when using clang
2014-06-29 20:13 ` Borislav Petkov
@ 2014-07-01 0:42 ` behanw
2014-07-01 10:12 ` Borislav Petkov
0 siblings, 1 reply; 15+ messages in thread
From: behanw @ 2014-07-01 0:42 UTC (permalink / raw)
To: mmarek, bp
Cc: linux-kbuild, linux-kernel, dl9pf, pageexec, mcharleb, Behan Webster
From: Behan Webster <behanw@converseincode.com>
Only consider clang warnings in Kbuild when using the clang compiler.
Signed-off-by: Behan Webster <behanw@converseincode.com>
---
| 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 6564350..e350127 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -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
--
1.9.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] kbuild, LLVMLinux: only use warnings when using clang
2014-07-01 0:42 ` [PATCH] kbuild, LLVMLinux: only use warnings when using clang behanw
@ 2014-07-01 10:12 ` Borislav Petkov
2014-07-30 13:04 ` Michal Marek
0 siblings, 1 reply; 15+ messages in thread
From: Borislav Petkov @ 2014-07-01 10:12 UTC (permalink / raw)
To: behanw; +Cc: mmarek, linux-kbuild, linux-kernel, dl9pf, pageexec, mcharleb
On Mon, Jun 30, 2014 at 05:42:26PM -0700, behanw@converseincode.com wrote:
> From: Behan Webster <behanw@converseincode.com>
>
> Only consider clang warnings in Kbuild when using the clang compiler.
>
> Signed-off-by: Behan Webster <behanw@converseincode.com>
> ---
> scripts/Makefile.extrawarn | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 6564350..e350127 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -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
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.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] kbuild, LLVMLinux: only use warnings when using clang
2014-07-01 10:12 ` Borislav Petkov
@ 2014-07-30 13:04 ` Michal Marek
2014-07-30 21:39 ` Behan Webster
2014-07-31 4:16 ` [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3 behanw
0 siblings, 2 replies; 15+ messages in thread
From: Michal Marek @ 2014-07-30 13:04 UTC (permalink / raw)
To: behanw, dl9pf
Cc: Borislav Petkov, linux-kbuild, linux-kernel, pageexec, mcharleb
On 2014-07-01 12:12, Borislav Petkov wrote:
> On Mon, Jun 30, 2014 at 05:42:26PM -0700, behanw@converseincode.com wrote:
>> From: Behan Webster <behanw@converseincode.com>
>>
>> Only consider clang warnings in Kbuild when using the clang compiler.
>>
>> Signed-off-by: Behan Webster <behanw@converseincode.com>
>> ---
>> scripts/Makefile.extrawarn | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
>> index 6564350..e350127 100644
>> --- a/scripts/Makefile.extrawarn
>> +++ b/scripts/Makefile.extrawarn
>> @@ -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
>
> 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?
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] kbuild, LLVMLinux: only use warnings when using clang
2014-07-30 13:04 ` Michal Marek
@ 2014-07-30 21:39 ` Behan Webster
2014-07-31 4:16 ` [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3 behanw
1 sibling, 0 replies; 15+ messages in thread
From: Behan Webster @ 2014-07-30 21:39 UTC (permalink / raw)
To: Michal Marek, dl9pf
Cc: Borislav Petkov, linux-kbuild, linux-kernel, pageexec, mcharleb
On 07/30/14 06:04, Michal Marek wrote:
> On 2014-07-01 12:12, Borislav Petkov wrote:
>> On Mon, Jun 30, 2014 at 05:42:26PM -0700, behanw@converseincode.com wrote:
>>> From: Behan Webster <behanw@converseincode.com>
>>>
>>> Only consider clang warnings in Kbuild when using the clang compiler.
>>>
>>> Signed-off-by: Behan Webster <behanw@converseincode.com>
>>> ---
>>> scripts/Makefile.extrawarn | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
>>> index 6564350..e350127 100644
>>> --- a/scripts/Makefile.extrawarn
>>> +++ b/scripts/Makefile.extrawarn
>>> @@ -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
>> 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?
> 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
--
Behan Webster
behanw@converseincode.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
2014-07-30 13:04 ` Michal Marek
2014-07-30 21:39 ` Behan Webster
@ 2014-07-31 4:16 ` behanw
2014-07-31 8:18 ` Michal Marek
1 sibling, 1 reply; 15+ messages in thread
From: behanw @ 2014-07-31 4:16 UTC (permalink / raw)
To: mmarek
Cc: linux-kbuild, linux-kernel, dwmw2, Behan Webster,
Jan-Simon Möller, Mark Charlebois, bp
From: Behan Webster <behanw@converseincode.com>
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 <behanw@converseincode.com>
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Cc: mmarek@suse.cz
Cc: bp@alien8.de
---
Makefile | 1 +
| 22 ++++++++++++----------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index f6a7794..f343e17 100644
--- a/Makefile
+++ b/Makefile
@@ -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.
--git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 6564350..b5b0751 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
@@ -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)))
--
1.9.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
2014-07-31 4:16 ` [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3 behanw
@ 2014-07-31 8:18 ` Michal Marek
2014-07-31 16:12 ` Behan Webster
0 siblings, 1 reply; 15+ messages in thread
From: Michal Marek @ 2014-07-31 8:18 UTC (permalink / raw)
To: behanw
Cc: linux-kbuild, linux-kernel, dwmw2, Jan-Simon Möller,
Mark Charlebois, bp
Dne 31.7.2014 06:16, behanw@converseincode.com napsal(a):
> From: Behan Webster <behanw@converseincode.com>
>
> 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 <behanw@converseincode.com>
> Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
> Signed-off-by: Mark Charlebois <charlebm@gmail.com>
> Cc: mmarek@suse.cz
> Cc: bp@alien8.de
> ---
> Makefile | 1 +
> scripts/Makefile.extrawarn | 22 ++++++++++++----------
> 2 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index f6a7794..f343e17 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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.
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 6564350..b5b0751 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)
> -
OK.
> 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
> +
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
2014-07-31 8:18 ` Michal Marek
@ 2014-07-31 16:12 ` Behan Webster
2014-07-31 20:46 ` Michal Marek
0 siblings, 1 reply; 15+ messages in thread
From: Behan Webster @ 2014-07-31 16:12 UTC (permalink / raw)
To: Michal Marek
Cc: linux-kbuild, linux-kernel, dwmw2, Jan-Simon Möller,
Mark Charlebois, bp
On 07/31/14 01:18, Michal Marek wrote:
> Dne 31.7.2014 06:16, behanw@converseincode.com napsal(a):
>> From: Behan Webster <behanw@converseincode.com>
>>
>> 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 <behanw@converseincode.com>
>> Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
>> Signed-off-by: Mark Charlebois <charlebm@gmail.com>
>> Cc: mmarek@suse.cz
>> Cc: bp@alien8.de
>> ---
>> Makefile | 1 +
>> scripts/Makefile.extrawarn | 22 ++++++++++++----------
>> 2 files changed, 13 insertions(+), 10 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index f6a7794..f343e17 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -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.
>> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
>> index 6564350..b5b0751 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)
>> -
> OK.
>
>
>> 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
>> +
> 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
--
Behan Webster
behanw@converseincode.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
2014-07-31 16:12 ` Behan Webster
@ 2014-07-31 20:46 ` Michal Marek
2014-08-01 4:07 ` Behan Webster
2014-08-01 4:08 ` [PATCH v3] " behanw
0 siblings, 2 replies; 15+ messages in thread
From: Michal Marek @ 2014-07-31 20:46 UTC (permalink / raw)
To: Behan Webster
Cc: linux-kbuild, linux-kernel, dwmw2, Jan-Simon Möller,
Mark Charlebois, bp
Dne 31.7.2014 18:12, Behan Webster napsal(a):
> On 07/31/14 01:18, Michal Marek wrote:
>> Dne 31.7.2014 06:16, behanw@converseincode.com napsal(a):
>>> @@ -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
>>> +
>> 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.
You placed it inside a branch that is only evaluated when W= is given.
Michal
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3
2014-07-31 20:46 ` Michal Marek
@ 2014-08-01 4:07 ` Behan Webster
2014-08-01 4:08 ` [PATCH v3] " behanw
1 sibling, 0 replies; 15+ messages in thread
From: Behan Webster @ 2014-08-01 4:07 UTC (permalink / raw)
To: Michal Marek
Cc: linux-kbuild, linux-kernel, dwmw2, Jan-Simon Möller,
Mark Charlebois, bp
On 07/31/14 13:46, Michal Marek wrote:
> Dne 31.7.2014 18:12, Behan Webster napsal(a):
>> On 07/31/14 01:18, Michal Marek wrote:
>>> Dne 31.7.2014 06:16, behanw@converseincode.com napsal(a):
>>>> @@ -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
>>>> +
>>> 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.
> You placed it inside a branch that is only evaluated when W= is given.
Hmm. You're right. Will fix.
Behan
--
Behan Webster
behanw@converseincode.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3] kbuild, LLVMLinux: Supress warnings unless W=1-3
2014-07-31 20:46 ` Michal Marek
2014-08-01 4:07 ` Behan Webster
@ 2014-08-01 4:08 ` behanw
2014-08-05 13:42 ` Michal Marek
1 sibling, 1 reply; 15+ messages in thread
From: behanw @ 2014-08-01 4:08 UTC (permalink / raw)
To: mmarek
Cc: linux-kbuild, linux-kernel, dwmw2, Behan Webster,
Jan-Simon Möller, Mark Charlebois, bp
From: Behan Webster <behanw@converseincode.com>
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 <behanw@converseincode.com>
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Cc: mmarek@suse.cz
Cc: bp@alien8.de
---
Makefile | 1 +
| 22 ++++++++++++----------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index f6a7794..f343e17 100644
--- a/Makefile
+++ b/Makefile
@@ -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.
--git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 6564350..4315d34 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,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
+
--
1.9.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3] kbuild, LLVMLinux: Supress warnings unless W=1-3
2014-08-01 4:08 ` [PATCH v3] " behanw
@ 2014-08-05 13:42 ` Michal Marek
0 siblings, 0 replies; 15+ messages in thread
From: Michal Marek @ 2014-08-05 13:42 UTC (permalink / raw)
To: behanw
Cc: linux-kbuild, linux-kernel, dwmw2, Jan-Simon Möller,
Mark Charlebois, bp
On 2014-08-01 06:08, behanw@converseincode.com wrote:
> From: Behan Webster <behanw@converseincode.com>
>
> 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 <behanw@converseincode.com>
> Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
> Signed-off-by: Mark Charlebois <charlebm@gmail.com>
> Cc: mmarek@suse.cz
> Cc: bp@alien8.de
> ---
> 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.
> +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
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2014-08-05 13:42 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16 13:07 3d3d6b847420 ("kbuild: LLVMLinux: Adapt warnings for compilation with clang") Borislav Petkov
2014-06-16 15:29 ` PaX Team
2014-06-16 15:48 ` Jan-Simon Möller
2014-06-29 20:13 ` Borislav Petkov
2014-07-01 0:42 ` [PATCH] kbuild, LLVMLinux: only use warnings when using clang behanw
2014-07-01 10:12 ` Borislav Petkov
2014-07-30 13:04 ` Michal Marek
2014-07-30 21:39 ` Behan Webster
2014-07-31 4:16 ` [PATCH v2] kbuild, LLVMLinux: Supress warnings unless W=1-3 behanw
2014-07-31 8:18 ` Michal Marek
2014-07-31 16:12 ` Behan Webster
2014-07-31 20:46 ` Michal Marek
2014-08-01 4:07 ` Behan Webster
2014-08-01 4:08 ` [PATCH v3] " behanw
2014-08-05 13:42 ` Michal Marek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).