diff mbox

[2/5] kbuild: LLVMLinux: Adapt warnings for compilation with clang

Message ID 1393376923-21892-3-git-send-email-behanw@converseincode.com
State New
Headers show

Commit Message

Behan Webster Feb. 26, 2014, 1:08 a.m. UTC
From: Jan-Simon Möller <dl9pf@gmx.de>

When compiling kernel with clang, disable warnings which are too noisy, and
add the clang flag catch-undefined-behavior.

Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Signed-off-by: Mark Charlebois <mcharleb@gmail.com>
Cc: PaX Team <pageexec@freemail.hu>
---
 scripts/Makefile.build | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Behan Webster Feb. 26, 2014, 1:31 a.m. UTC | #1
On 02/25/14 17:17, Dave Jones wrote:
> On Tue, Feb 25, 2014 at 05:08:40PM -0800, behanw@converseincode.com wrote:
>   > +warning-1 += $(call cc-disable-warning, self-assign)
>
> Do you have a pointer to an example log-file from before this change ?
> I'm curious for eg, which self-assign warnings are showing up,
> because I've been fixing up the ones that Coverity found, of which
> there are only a dozen or so left iirc.
>
> Some of the others may also be interesting.
I don't have one now, but I can generate a log and send it to you. We've 
had that option set from near the beginning of the porting effort.

This are primarily off due to the amount of noise these warnings produce 
at this time (clang produces a LOT of warnings straight out of the box). 
I'd love to eventually turn some of these back on again.

Thanks,

Behan
Behan Webster Feb. 26, 2014, 2:38 a.m. UTC | #2
On 02/25/14 17:17, Dave Jones wrote:
> On Tue, Feb 25, 2014 at 05:08:40PM -0800, behanw@converseincode.com wrote:
>   
>   > When compiling kernel with clang, disable warnings which are too noisy, and
>   > add the clang flag catch-undefined-behavior.
>   >
>   > +# 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, self-assign)
>   > +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)
>
> Do you have a pointer to an example log-file from before this change ?
> I'm curious for eg, which self-assign warnings are showing up,
> because I've been fixing up the ones that Coverity found, of which
> there are only a dozen or so left iirc.
I count 22 in this particular x86 kernel build (some of which you may 
well have fixed already). Enjoy.

http://buildbot.llvm.linuxfoundation.org/self-assign-build.log.txt

Perhaps I should re-enable that warning, considering the number has 
dropped so dramatically from when I last checked over a year ago.

Thanks,

Behan
diff mbox

Patch

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index d5d859c..27c4098 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -65,12 +65,23 @@  warning-  := $(empty)
 warning-1 := -Wextra -Wunused -Wno-unused-parameter
 warning-1 += -Wmissing-declarations
 warning-1 += -Wmissing-format-attribute
-warning-1 += -Wmissing-prototypes
+warning-1 += $(call cc-option, -Wmissing-prototypes)
 warning-1 += -Wold-style-definition
 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, self-assign)
+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