Skip to contentSkip to conversation

kbuild: implement several W= levels

RFC PATCH Superseded Sam Ravnborg 10 participants 42 messages Apr 21, 2011 – May 2, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 kbuild: implement several W= levels

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - usefull warning options
W=2 - noisy but semi usefull warnign options W=3 - almost pure noise options

I do not feel strongly about the distinction between group 2 and 3. But we should consider what we add in group 1.

Sample run on my box (x86, 32bit allyesconfig build)
CC kernel/bounds.s
kernel/bounds.c:14: warning: no previous prototype for ‘foo’
GEN include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
In file included from include/linux/sched.h:73,

                 from arch/x86/kernel/asm-offsets.c:9:

include/linux/signal.h: In function ‘sigorsets’:
include/linux/signal.h:121: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ include/linux/signal.h: In function ‘sigandsets’:
include/linux/signal.h:124: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ include/linux/signal.h: In function ‘signandsets’:
include/linux/signal.h:127: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ include/linux/signal.h: In function ‘signotset’:
include/linux/signal.h:151: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ arch/x86/kernel/asm-offsets.c: At top level:
arch/x86/kernel/asm-offsets.c:30: warning: no previous prototype for ‘common’

the patch is only an RFC - and is not made on top of an upstream kernel with no additiona stuff applied.

Sam

Makefile +1 -1
index b967b96..f0e138b 100644
@@ -103,7 +103,7 @@ ifeq ("$(origin O)", "command line")
 endif
 
 ifeq ("$(origin W)", "command line")
-  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
+  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
 endif
 
 # That's our default target when none is given on the command line
scripts/Makefile.build +37 -25

68 lines not on this page · raw message

#1 lore raw
Quoted 7 lines · Sam Ravnborg

Building a kernel with "make W=1" produce far too much noise to be usefull.
Divide the warning options in three groups:
W=1 - usefull warning options
W=2 - noisy but semi usefull warnign options
W=3 - almost pure noise options
+warning-1 := -Wextra

[]

Quoted 1 line

+warning-2 += -Waggregate-return

This is a different form for this first warning-2 declaration than the first warning-1 declaration.

Maybe this should be := instead?

Maybe there's a way to do something akin to

warning_type(level, option)

So these become

warning_type(1, extra)
warning_type(2, aggregate-return)

etc.

#2 lore raw
Quoted 8 lines · Joe Perches
Quoted 7 lines · Sam Ravnborg

Building a kernel with "make W=1" produce far too much noise to be usefull.
Divide the warning options in three groups:
W=1 - usefull warning options
W=2 - noisy but semi usefull warnign options
W=3 - almost pure noise options
+warning-1 := -Wextra

Quoted 6 lines

[]

Quoted 1 line

+warning-2 += -Waggregate-return

This is a different form for this first warning-2 declaration than the first warning-1 declaration.

Maybe this should be := instead?

yeap...for the first warning-3 assignment too...
maybe something like this:
warning-1:=
warning-2:=
warning-3:=
right after 'ifeq' could help, so that you can alter/test the warnings' levels more easily(without having to change between := and += for the first warning of each warning level).

Signature · 2 lines
Stratos Psomadakis
<[email protected]>
#3 lore raw
In reply to Sam Ravnborg
Quoted 123 lines · Sam Ravnborg

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - usefull warning options
W=2 - noisy but semi usefull warnign options
W=3 - almost pure noise options

I do not feel strongly about the distinction between group 2 and 3. But we should consider what we add in group 1.

Sample run on my box (x86, 32bit allyesconfig build)
CC kernel/bounds.s
kernel/bounds.c:14: warning: no previous prototype for ‘foo’
GEN include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
In file included from include/linux/sched.h:73,

                 from arch/x86/kernel/asm-offsets.c:9:

include/linux/signal.h: In function ‘sigorsets’:
include/linux/signal.h:121: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ include/linux/signal.h: In function ‘sigandsets’:
include/linux/signal.h:124: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ include/linux/signal.h: In function ‘signandsets’:
include/linux/signal.h:127: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ include/linux/signal.h: In function ‘signotset’:
include/linux/signal.h:151: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ arch/x86/kernel/asm-offsets.c: At top level:
arch/x86/kernel/asm-offsets.c:30: warning: no previous prototype for ‘common’

the patch is only an RFC - and is not made on top of an upstream kernel with no additiona stuff applied.

Sam

Makefile +1 -1
index b967b96..f0e138b 100644
@@ -103,7 +103,7 @@ ifeq ("$(origin O)", "command line")
 endif
 
 ifeq ("$(origin W)", "command line")
-  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
+  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
 endif
 
 # That's our default target when none is given on the command line
scripts/Makefile.build +37 -26
index d5f925a..b65f820 100644
@@ -56,31 +56,43 @@ endif
 # $(call cc-option... ) handles gcc -W.. options which
 # are not supported by all versions of the compiler
 ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
-KBUILD_EXTRA_WARNINGS := -Wextra
-KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter
-KBUILD_EXTRA_WARNINGS += -Waggregate-return
-KBUILD_EXTRA_WARNINGS += -Wbad-function-cast
-KBUILD_EXTRA_WARNINGS += -Wcast-qual
-KBUILD_EXTRA_WARNINGS += -Wcast-align
-KBUILD_EXTRA_WARNINGS += -Wconversion
-KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization
-KBUILD_EXTRA_WARNINGS += -Wlogical-op
-KBUILD_EXTRA_WARNINGS += -Wmissing-declarations
-KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute
-KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,)
-KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes
-KBUILD_EXTRA_WARNINGS += -Wnested-externs
-KBUILD_EXTRA_WARNINGS += -Wold-style-definition
-KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,)
-KBUILD_EXTRA_WARNINGS += -Wpacked
-KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat
-KBUILD_EXTRA_WARNINGS += -Wpadded
-KBUILD_EXTRA_WARNINGS += -Wpointer-arith
-KBUILD_EXTRA_WARNINGS += -Wredundant-decls
-KBUILD_EXTRA_WARNINGS += -Wshadow
-KBUILD_EXTRA_WARNINGS += -Wswitch-default
-KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
-KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
+warning-1 := -Wextra
+warning-1 += -Wunused -Wno-unused-parameter
+warning-2 += -Waggregate-return
+warning-2 += -Wbad-function-cast
+warning-2 += -Wcast-qual
+warning-2 += -Wcast-align
+warning-3 += -Wconversion
+warning-2 += -Wdisabled-optimization
+warning-2 += -Wlogical-op
+warning-1 += -Wmissing-declarations
+warning-1 += -Wmissing-format-attribute
+warning-1 += $(call cc-option, -Wmissing-include-dirs,)
+warning-1 += -Wmissing-prototypes
+warning-1 += -Wnested-externs
+warning-2 += -Wold-style-definition
+warning-2 += $(call cc-option, -Woverlength-strings,)
+warning-3 += -Wpacked
+warning-3 += -Wpacked-bitfield-compat
+warning-3 += -Wpadded
+warning-3 += -Wpointer-arith
+warning-2 += -Wredundant-decls
+warning-2 += -Wshadow
+warning-3 += -Wswitch-default
+warning-3 += $(call cc-option, -Wvla,)
+ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),1)
+        KBUILD_CFLAGS += $(warning-1)
+else
+        ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),2)
+                KBUILD_CFLAGS += $(warning-1) $(warning-2)
+        else
+                ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),3)
+                        KBUILD_CFLAGS += $(warning-1) $(warning-2) $(warning-3)
+                else
+                        $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
+                endif
+        endif
+endif
 endif
 
 include scripts/Makefile.lib
--
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Just started looking at the patch.
I tested it and -Wnested-externs is causing a *lot* of noise, because of the nested extern ‘_NSIG_WORDS_is_unsupported_size’ in include/linux/signal.h, which gets included a lot.
So, unless that changes, I think that it shouldn't be enabled for W=1.

Signature · 2 lines
Stratos Psomadakis
<[email protected]>
#4 lore raw
Quoted 5 lines

Just started looking at the patch.
I tested it and -Wnested-externs is causing a *lot* of noise, because of the nested extern ‘_NSIG_WORDS_is_unsupported_size’ in include/linux/signal.h, which gets included a lot.
So, unless that changes, I think that it shouldn't be enabled for W=1.

It is just the same issue that pops up for each file. It is easy to fix.

The ones that does not belong in W=1 is those that are triggered by many different places in the kernel.

If they are triggered in a few .h files they look noisy, but it is easy to fix.

Sam

#5 lore raw

RFC PATCH v2 1/1 kbuild: implement several W= levels

In reply to Sam Ravnborg

From 7f1edfc13eadc1cf8c80d72ff850a121bf472e00 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Fri, 22 Apr 2011 08:22:25 +0200
Subject: [PATCH] kbuild: implement several W= levels

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

When building init/ on my box the levels produces:

W=1 - 46 warnings
W=2 - 863 warnings
W=3 - 6496 warnings

Many warnings occur from .h files so fixing one file may have a nice effect on the total number of warnings.

With these changes I am actually tempted to try W=1 now and then. Previously there were just too much noise.

Cc Borislav Petkov <[email protected]>
Cc Dave Jones <[email protected]>

---
This is based on top of -linus to make it easy to test. But I included fixes for older gcc as posted in a separate patch.

Changes since v1:
- updated help text
- updated grouping, less warnings in W=1
- reimplment selection of warnings for the individual levels
- added a comment describing the individual levels

Sam

 Makefile               |    4 +-
 scripts/Makefile.build |   69 +++++++++++++++++++++++++++++------------------
 2 files changed, 44 insertions(+), 29 deletions(-)
Makefile +2 -2
index b967b96..37a6062 100644
@@ -103,7 +103,7 @@ ifeq ("$(origin O)", "command line")
 endif
 
 ifeq ("$(origin W)", "command line")
-  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
+  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
 endif
 
 # That's our default target when none is given on the command line
@@ -1267,7 +1267,7 @@ help:
 	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
 	@echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
 	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
-	@echo  '  make W=1   [targets] Enable extra gcc checks'
+	@echo  '  make W=n   [targets] Enable extra gcc checks, n=1,2,3'
 	@echo  ''
 	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
 	@echo  'For further info see the ./README file'
scripts/Makefile.build +42 -27

78 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#6 lore raw
In reply to Sam Ravnborg
Quoted 31 lines · Sam Ravnborg

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - usefull warning options
W=2 - noisy but semi usefull warnign options W=3 - almost pure noise options

I do not feel strongly about the distinction between group 2 and 3. But we should consider what we add in group 1.

Sample run on my box (x86, 32bit allyesconfig build)
CC kernel/bounds.s
kernel/bounds.c:14: warning: no previous prototype for ‘foo’
GEN include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
In file included from include/linux/sched.h:73,

                 from arch/x86/kernel/asm-offsets.c:9:

include/linux/signal.h: In function ‘sigorsets’:
include/linux/signal.h:121: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ include/linux/signal.h: In function ‘sigandsets’:
include/linux/signal.h:124: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ include/linux/signal.h: In function ‘signandsets’:
include/linux/signal.h:127: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ include/linux/signal.h: In function ‘signotset’:
include/linux/signal.h:151: warning: nested extern declaration of ‘_NSIG_WORDS_is_unsupported_size’ arch/x86/kernel/asm-offsets.c: At top level:
arch/x86/kernel/asm-offsets.c:30: warning: no previous prototype for ‘common’

Quoted 2 lines

the patch is only an RFC - and is not made on top of an upstream kernel with no additiona stuff applied.

Thanks for doing this, a couple of suggestions below.

Quoted 41 lines

Sam

Makefile +1 -1
index b967b96..f0e138b 100644
@@ -103,7 +103,7 @@ ifeq ("$(origin O)", "command line")
 endif
 
 ifeq ("$(origin W)", "command line")
-  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
+  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
 endif
 
 # That's our default target when none is given on the command line
scripts/Makefile.build +0 -17
index d5f925a..b65f820 100644
@@ -56,31 +56,43 @@ endif
 # $(call cc-option... ) handles gcc -W.. options which
 # are not supported by all versions of the compiler
 ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
-KBUILD_EXTRA_WARNINGS := -Wextra
-KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter
-KBUILD_EXTRA_WARNINGS += -Waggregate-return
-KBUILD_EXTRA_WARNINGS += -Wbad-function-cast
-KBUILD_EXTRA_WARNINGS += -Wcast-qual
-KBUILD_EXTRA_WARNINGS += -Wcast-align
-KBUILD_EXTRA_WARNINGS += -Wconversion
-KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization
-KBUILD_EXTRA_WARNINGS += -Wlogical-op
-KBUILD_EXTRA_WARNINGS += -Wmissing-declarations
-KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute
-KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,)
-KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes
-KBUILD_EXTRA_WARNINGS += -Wnested-externs
-KBUILD_EXTRA_WARNINGS += -Wold-style-definition
-KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,)
-KBUILD_EXTRA_WARNINGS += -Wpacked

scripts/Makefile.build endif · line 60

Quoted 10 lines
scripts/Makefile.build +2 -8
-KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat
-KBUILD_EXTRA_WARNINGS += -Wpadded
-KBUILD_EXTRA_WARNINGS += -Wpointer-arith
-KBUILD_EXTRA_WARNINGS += -Wredundant-decls
-KBUILD_EXTRA_WARNINGS += -Wshadow
-KBUILD_EXTRA_WARNINGS += -Wswitch-default
-KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
-KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
+warning-1 := -Wextra
+warning-1 += -Wunused -Wno-unused-parameter

Ok, I went and enabled each switch separately to look at output and recheck whether each one makes sense. The following is all IMHO:

The first two W=1 warnings should be merged into one to denote that we're actually tweaking -Wextra behavior (otherwise there's too much output from unused parameters in headers):

warning-1 := -Wextra -Wunused -Wno-unused-parameter

scripts/Makefile.build endif · line 61

Quoted 1 line
scripts/Makefile.build +1 -0
+warning-2 += -Waggregate-return

warning-2 := -Waggregate-return

since this is a first-time assignment to warning-2

otherwise I get

$ make W=2 drivers/edac/amd64_edac.o
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
scripts/Makefile.build:87: *** Recursive variable `KBUILD_CFLAGS' references itself (eventually).  Stop.
make: *** [prepare0] Error 2

scripts/Makefile.build endif · line 62

Quoted 1 line
scripts/Makefile.build +1 -0
+warning-2 += -Wbad-function-cast

I'd move this one to W=3 since it is almost useless for kernel code. mm is one good example where we cast unsigned longs to the pagetable types back and forth.

scripts/Makefile.build endif · line 63

Quoted 1 line
scripts/Makefile.build +1 -0
+warning-2 += -Wcast-qual

maybe also W=3 due to too noisy with *get_user* calls in headers.

scripts/Makefile.build endif · line 64

Quoted 1 line
scripts/Makefile.build +1 -0
+warning-2 += -Wcast-align

this one doesn't trigger anything on x86, maybe on other arches?

scripts/Makefile.build endif · line 65

Quoted 1 line
scripts/Makefile.build +1 -0
+warning-3 += -Wconversion

also first assignment so

warning-3 := -Wconversion

scripts/Makefile.build endif · line 66

Quoted 1 line
scripts/Makefile.build +1 -0
+warning-2 += -Wdisabled-optimization

this one doesn't trigger anything here either

scripts/Makefile.build endif · line 71

Quoted 5 lines
scripts/Makefile.build +5 -0
+warning-2 += -Wlogical-op
+warning-1 += -Wmissing-declarations
+warning-1 += -Wmissing-format-attribute
+warning-1 += $(call cc-option, -Wmissing-include-dirs,)
+warning-1 += -Wmissing-prototypes

this one is in the top-level Makefile in HOSTCFLAGS so no need for it here.

scripts/Makefile.build endif · line 72

Quoted 1 line
scripts/Makefile.build +1 -0
+warning-1 += -Wnested-externs

I don't think this one makes too much sense since we use the trick it warns for to artificially cause a build error. Maybe downgrade it to W=2 or W=3.

scripts/Makefile.build endif · line 73

Quoted 1 line
scripts/Makefile.build +1 -0
+warning-2 += -Wold-style-definition

this one actually finds bugs :), maybe W=1.

scripts/Makefile.build endif · line 74

Quoted 1 line
scripts/Makefile.build +1 -0
+warning-2 += $(call cc-option, -Woverlength-strings,)

triggers in tracepoints declarations:

include/trace/events/kmem.h:11: warning: string length ‘1643’ is greater than the length ‘509’ ISO C90 compilers are required to support

I'm not sure we want it at all since the warning message is useless.

scripts/Makefile.build endif · line 76

Quoted 2 lines
scripts/Makefile.build +2 -0
+warning-3 += -Wpacked
+warning-3 += -Wpacked-bitfield-compat

gcc docs says this one is enabled by default:
http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Warning-Options.html

scripts/Makefile.build endif · line 79

Quoted 3 lines
scripts/Makefile.build +3 -0
+warning-3 += -Wpadded
+warning-3 += -Wpointer-arith
+warning-2 += -Wredundant-decls

this might help clean up a bunch of headers

scripts/Makefile.build endif · line 82

Quoted 3 lines
scripts/Makefile.build +3 -0
+warning-2 += -Wshadow
+warning-3 += -Wswitch-default
+warning-3 += $(call cc-option, -Wvla,)

oh yeah, maybe sort the warning-{1,2,3} assignments alphanumerically :)

scripts/Makefile.build endif · line 92

Quoted 10 lines
scripts/Makefile.build +10 -0
+ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),1)
+        KBUILD_CFLAGS += $(warning-1)
+else
+        ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),2)
+                KBUILD_CFLAGS += $(warning-1) $(warning-2)
+        else
+                ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),3)
+                        KBUILD_CFLAGS += $(warning-1) $(warning-2) $(warning-3)
+                else
+                        $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)

Also, I think it'll make more sense to enable a warning level exclusively instead of inclusively, so that W=1 gives you only the most important and sane warnings, W=2 the more noisy ones which are a disjunct set from the W=1 ones etc.

Thanks.

Signature · 2 lines
Regards/Gruss,
    Boris.
#7 lore raw

Hi Borislav.

Quoted 4 lines
Quoted 2 lines

the patch is only an RFC - and is not made on top of an upstream kernel with no additiona stuff applied.

Thanks for doing this, a couple of suggestions below.

...

You already spend more time analysing this than it took me to write the patch.
Can I persuade you to implement the various W= levels based on your analysis and send to Michal for merging? You can use my v2 PATCH as inspiration.

Please take authorship on the patch as the main work is to decide what warnings belongs to which level.

[Snipped - lots of good comments]

Sam

#8 lore raw

Hi Sam,

Quoted 14 lines · Sam Ravnborg

Hi Borislav.

Quoted 4 lines
Quoted 2 lines

the patch is only an RFC - and is not made on top of an upstream kernel with no additiona stuff applied.

Thanks for doing this, a couple of suggestions below.

...

You already spend more time analysing this than it took me to write the patch.
Can I persuade you to implement the various W= levels based on your analysis and send to Michal for merging? You can use my v2 PATCH as inspiration.

Quoted 4 lines

Please take authorship on the patch as the main work is to decide what warnings belongs to which level.

[Snipped - lots of good comments]

thanks but according to Documentation/SubmittingPatches, the _initial_ author is the author of the patch. Besides, I just had the talk with Ingo the other day on how to acknowledge multuple authors so I'm not making the same mistake again :).

But seriously, let me add my comments to your patch while they're fresh in my head and let's see what we come up with in our combined and perfectly orchestrated effort :).

Thanks.

Signature · 2 lines
Regards/Gruss,
    Boris.
#9 lore raw

PATCH v3 1/1 kbuild: implement several W= levels

Quoted 3 lines · Borislav Petkov

But seriously, let me add my comments to your patch while they're fresh in my head and let's see what we come up with in our combined and perfectly orchestrated effort :).

Ok, this is starting to look like another kernelnewbies.org task:

make W=x 2>>w.log

and stare at compiler output in the other xterm:

tail -f w.log

and the bugs are just waiting there to be fixed! :)

Below is v3, please take a look.

--
From: Sam Ravnborg <[email protected]>
Date: Fri, 22 Apr 2011 08:22:25 +0200
Subject: [PATCH] kbuild: implement several W= levels

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

When building init/ on my box the levels produces:

W=1 - 46 warnings
W=2 - 863 warnings
W=3 - 6496 warnings

Many warnings occur from .h files so fixing one file may have a nice effect on the total number of warnings.

With these changes I am actually tempted to try W=1 now and then. Previously there were just too much noise.

Borislav:

- make the W= levels exclusive
- drop -Wmissing-prototypes since it is being added to the toplevel Makefile
- move very noisy and making little sense for the kernel warnings to W=3
- drop -Woverlength-strings due to useless warning message
- copy explanatory text for the different warning levels to 'make help'

---
 Makefile               |    8 ++++-
 scripts/Makefile.build |   64 +++++++++++++++++++++++++++--------------------
 2 files changed, 43 insertions(+), 29 deletions(-)
Makefile +6 -2
index b967b96..17ce5d5 100644
@@ -103,7 +103,7 @@ ifeq ("$(origin O)", "command line")
 endif
 
 ifeq ("$(origin W)", "command line")
-  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
+  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
 endif
 
 # That's our default target when none is given on the command line
@@ -1267,7 +1267,11 @@ help:
 	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
 	@echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
 	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
-	@echo  '  make W=1   [targets] Enable extra gcc checks'
+	@echo  '  make W=n   [targets] Enable extra gcc checks, n=1,2,3 where'
+	@echo  '		1: warnings which may be relevant and do not occur too often'
+	@echo  '		2: warnings which occur quite often but may still be relevant'
+	@echo  '		3: more obscure warnings, can most likely be ignored'
+
 	@echo  ''
 	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
 	@echo  'For further info see the ./README file'
scripts/Makefile.build +37 -27

73 lines not on this page · raw message

Signature · 6 lines
1.7.5.rc1.16.g9db1


-- 
Regards/Gruss,
    Boris.
#10 lore raw
Quoted 3 lines

Borislav:

- drop -Wmissing-prototypes since it is being added to the toplevel Makefile

This is actually bogus..
We only add this to HOSTCFLAGS - which is used to build programs that run on your build host. These options do not propagate to gcc used to build the kernel modules.

The rest looks good.

Sam

#11 lore raw

PATCH 1/1 kbuild: implement several W= levels

From: Sam Ravnborg <[email protected]>

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

When building init/ on my box the levels produces:

W=1 - 46 warnings
W=2 - 863 warnings
W=3 - 6496 warnings

Many warnings occur from .h files so fixing one file may have a nice effect on the total number of warnings.

With these changes I am actually tempted to try W=1 now and then. Previously there were just too much noise.

Borislav:

- make the W= levels exclusive
- move very noisy and making little sense for the kernel warnings to W=3
- drop -Woverlength-strings due to useless warning message
- copy explanatory text for the different warning levels to 'make help'

---
 Makefile               |    8 ++++-
 scripts/Makefile.build |   65 ++++++++++++++++++++++++++++--------------------
 2 files changed, 44 insertions(+), 29 deletions(-)
Makefile +6 -2
index b967b96..17ce5d5 100644
@@ -103,7 +103,7 @@ ifeq ("$(origin O)", "command line")
 endif
 
 ifeq ("$(origin W)", "command line")
-  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
+  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
 endif
 
 # That's our default target when none is given on the command line
@@ -1267,7 +1267,11 @@ help:
 	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
 	@echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
 	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
-	@echo  '  make W=1   [targets] Enable extra gcc checks'
+	@echo  '  make W=n   [targets] Enable extra gcc checks, n=1,2,3 where'
+	@echo  '		1: warnings which may be relevant and do not occur too often'
+	@echo  '		2: warnings which occur quite often but may still be relevant'
+	@echo  '		3: more obscure warnings, can most likely be ignored'
+
 	@echo  ''
 	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
 	@echo  'For further info see the ./README file'
scripts/Makefile.build +38 -27

74 lines not on this page · raw message

Signature · 1 line
1.7.5.rc1.16.g9db1
#12 lore raw
Quoted 11 lines · Borislav Petkov

From: Sam Ravnborg <[email protected]>

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

Quoted 5 lines

When building init/ on my box the levels produces:

W=1 - 46 warnings
W=2 - 863 warnings
W=3 - 6496 warnings

I guess these numbers are not valid after your changes? Not that the exact numbers are important, but maybe the distribution change? Otherwise the patch looks good, thanks a lot to both of you!

Michal

Quoted 127 lines

Many warnings occur from .h files so fixing one file may have a nice effect on the total number of warnings.

With these changes I am actually tempted to try W=1 now and then. Previously there were just too much noise.

Borislav:

- make the W= levels exclusive
- move very noisy and making little sense for the kernel warnings to W=3
- drop -Woverlength-strings due to useless warning message
- copy explanatory text for the different warning levels to 'make help'

---
 Makefile               |    8 ++++-
 scripts/Makefile.build |   65 ++++++++++++++++++++++++++++--------------------
 2 files changed, 44 insertions(+), 29 deletions(-)
Makefile +6 -2
index b967b96..17ce5d5 100644
@@ -103,7 +103,7 @@ ifeq ("$(origin O)", "command line")
 endif
 
 ifeq ("$(origin W)", "command line")
-  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
+  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
 endif
 
 # That's our default target when none is given on the command line
@@ -1267,7 +1267,11 @@ help:
 	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
 	@echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
 	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
-	@echo  '  make W=1   [targets] Enable extra gcc checks'
+	@echo  '  make W=n   [targets] Enable extra gcc checks, n=1,2,3 where'
+	@echo  '		1: warnings which may be relevant and do not occur too often'
+	@echo  '		2: warnings which occur quite often but may still be relevant'
+	@echo  '		3: more obscure warnings, can most likely be ignored'
+
 	@echo  ''
 	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
 	@echo  'For further info see the ./README file'
scripts/Makefile.build +38 -27
index d5f925a..ffb383c 100644
@@ -51,36 +51,47 @@ ifeq ($(KBUILD_NOPEDANTIC),)
 endif
 
 #
-# make W=1 settings
+# make W=... settings
 #
-# $(call cc-option... ) handles gcc -W.. options which
+# W=1 - warnings that may be relevant and does not occur too often
+# W=2 - warnings that occur quite often but may still be relevant
+# W=3 - the more obscure warnings, can most likely be ignored
+#
+# $(call cc-option, -W...) handles gcc -W.. options which
 # are not supported by all versions of the compiler
 ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
-KBUILD_EXTRA_WARNINGS := -Wextra
-KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter
-KBUILD_EXTRA_WARNINGS += -Waggregate-return
-KBUILD_EXTRA_WARNINGS += -Wbad-function-cast
-KBUILD_EXTRA_WARNINGS += -Wcast-qual
-KBUILD_EXTRA_WARNINGS += -Wcast-align
-KBUILD_EXTRA_WARNINGS += -Wconversion
-KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization
-KBUILD_EXTRA_WARNINGS += -Wlogical-op
-KBUILD_EXTRA_WARNINGS += -Wmissing-declarations
-KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute
-KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,)
-KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes
-KBUILD_EXTRA_WARNINGS += -Wnested-externs
-KBUILD_EXTRA_WARNINGS += -Wold-style-definition
-KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,)
-KBUILD_EXTRA_WARNINGS += -Wpacked
-KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat
-KBUILD_EXTRA_WARNINGS += -Wpadded
-KBUILD_EXTRA_WARNINGS += -Wpointer-arith
-KBUILD_EXTRA_WARNINGS += -Wredundant-decls
-KBUILD_EXTRA_WARNINGS += -Wshadow
-KBUILD_EXTRA_WARNINGS += -Wswitch-default
-KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
-KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
+warning-1 := -Wextra -Wunused -Wno-unused-parameter
+warning-1 += -Wmissing-declarations
+warning-1 += -Wmissing-format-attribute
+warning-1 += -Wmissing-prototypes
+warning-1 += -Wold-style-definition
+warning-1 += $(call cc-option, -Wmissing-include-dirs)
+
+warning-2 := -Waggregate-return
+warning-2 += -Wcast-align
+warning-2 += -Wdisabled-optimization
+warning-2 += -Wnested-externs
+warning-2 += -Wshadow
+warning-2 += $(call cc-option, -Wlogical-op)
+
+warning-3 := -Wbad-function-cast
+warning-3 += -Wcast-qual
+warning-3 += -Wconversion
+warning-3 += -Wpacked
+warning-3 += -Wpadded
+warning-3 += -Wpointer-arith
+warning-3 += -Wredundant-decls
+warning-3 += -Wswitch-default
+warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
+warning-3 += $(call cc-option, -Wvla)
+
+warning := $(warning-$(KBUILD_ENABLE_EXTRA_GCC_CHECKS))
+
+ifeq ("$(warning)","")
+        $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
+endif
+
+KBUILD_CFLAGS += $(warning)
 endif
 
 include scripts/Makefile.lib
#13 lore raw
Quoted 12 lines · Michal Marek
Quoted 11 lines · Borislav Petkov

From: Sam Ravnborg <[email protected]>

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

Quoted 8 lines
Quoted 5 lines

When building init/ on my box the levels produces:

W=1 - 46 warnings
W=2 - 863 warnings
W=3 - 6496 warnings

I guess these numbers are not valid after your changes? Not that the exact numbers are important, but maybe the distribution change?

I think so too that those numbers don't mean a lot. Instead, this feature makes more sense IMHO if you use it on a single file:

make W=1 <file.c> 2>before.log

<make your changes>

make W=1 <file.c> 2>after.log

diff -uprN before.log after.log

and you let the compiler tell you which warnings you've introduced. Then you do the same game with W=2 and W=3.

Nice, huh. :)

Signature · 2 lines
Regards/Gruss,
    Boris.
#14 lore raw
Quoted 15 lines · Borislav Petkov
Quoted 14 lines · Michal Marek
Quoted 13 lines · Borislav Petkov

From: Sam Ravnborg <[email protected]>

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

When building init/ on my box the levels produces:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

W=1 - 46 warnings
W=2 - 863 warnings
W=3 - 6496 warnings

I guess these numbers are not valid after your changes? Not that the exact numbers are important, but maybe the distribution change?

I think so too that those numbers don't mean a lot.

The numbers _only_ tell you that the amoun of warnings on W=1 is down to a manageable number and they increase be the higher level.

Will you cook up a more correct changelog and resubmit?

Sam

#15 lore raw
In reply to Borislav Petkov
Quoted 20 lines · Borislav Petkov

From: Sam Ravnborg <[email protected]>

Building a kernel with "make W=1" produce far too much noise to be usefull.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

When building init/ on my box the levels produces:

W=1 - 46 warnings
W=2 - 863 warnings
W=3 - 6496 warnings

Many warnings occur from .h files so fixing one file may have a nice effect on the total number of warnings.

Quoted 6 lines

With these changes I am actually tempted to try W=1 now and then. Previously there were just too much noise.

Borislav:

- make the W= levels exclusive

I do not see the point in this really. This is not what most people would expect.
When you ask for more you get more - not something else.

We see it with verbose levels where -vv give more output than -v etc.

Anyway - the important thing is to keep the relevant warnings at W=1 level. Which is independendt of this change.
So consider the input and decide - I do not want to make a fuzz about it.

Sam

#16 lore raw
Quoted 10 lines · Sam Ravnborg
Quoted 1 line

- make the W= levels exclusive

I do not see the point in this really. This is not what most people would expect.
When you ask for more you get more - not something else.

We see it with verbose levels where -vv give more output than -v etc.

Anyway - the important thing is to keep the relevant warnings at W=1 level. Which is independendt of this change.
So consider the input and decide - I do not want to make a fuzz about it.

I know, -vv.. increases verbosity is probably part of old unix tradition or common sense but it doesn't make much sense in this case, IMHO. When I use this, I want to see what the most relevant warnings are, maybe have a crack at them to fix them, and _then_ look at the less important ones (for an arbitrary definition of important warnings).

If we do this inclusive, then W=2 dumps the, let's call it, level 1 _plus_ the new level 2 warnings, polluting the output with something I've already seen, but only partially. And then I start to think, did I see this one already, didn't I, which was it? By the time you enable W=3, the output becomes pretty useless. For example, W=3 generates 190+ MB logfile here only with level 3 warnings. Now imagine all 3 levels combined.

Dividing the output by level of importance doesn't have this problem and is much more workable, IMHO.

But this is just my use case, it could be that I'm completely alone on this one. I'd love to hear what other people think.

FWIW, we might even make this behavior configurable by having

make W=1o

meaning level 1 warnings only or whatever sick idea we come up with eventually.

;-)

Thanks.

Signature · 2 lines
Regards/Gruss,
Boris.
#17 lore raw

PATCH 1/1 kbuild: implement several W= levels

From: Sam Ravnborg <[email protected]>

Building a kernel with "make W=1" produces far too much noise to be useful.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

When building the whole kernel, those levels produce:

W=1 - 4859 warnings
W=2 - 1394 warnings
W=3 - 86666 warnings

respectively. Warnings have been counted with Geert's script at

http://www.kernel.org/pub/linux/kernel/people/geert/linux-log/linux-log-summary.pl

Many warnings occur from .h files so fixing one file may have a nice effect on the total number of warnings.

With these changes I am actually tempted to try W=1 now and then. Previously there was just too much noise.

Borislav:

- make the W= levels exclusive
- move very noisy and making little sense for the kernel warnings to W=3
- drop -Woverlength-strings due to useless warning message
- copy explanatory text for the different warning levels to 'make help'
- recount warnings per level

---
 Makefile               |    8 ++++-
 scripts/Makefile.build |   65 ++++++++++++++++++++++++++++--------------------
 2 files changed, 44 insertions(+), 29 deletions(-)
Makefile +6 -2
index 5a7a2e4..b2a6808 100644
@@ -103,7 +103,7 @@ ifeq ("$(origin O)", "command line")
 endif
 
 ifeq ("$(origin W)", "command line")
-  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
+  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
 endif
 
 # That's our default target when none is given on the command line
@@ -1267,7 +1267,11 @@ help:
 	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
 	@echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
 	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
-	@echo  '  make W=1   [targets] Enable extra gcc checks'
+	@echo  '  make W=n   [targets] Enable extra gcc checks, n=1,2,3 where'
+	@echo  '		1: warnings which may be relevant and do not occur too often'
+	@echo  '		2: warnings which occur quite often but may still be relevant'
+	@echo  '		3: more obscure warnings, can most likely be ignored'
+
 	@echo  ''
 	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
 	@echo  'For further info see the ./README file'
scripts/Makefile.build +38 -27

74 lines not on this page · raw message

Signature · 1 line
1.7.5.rc1.16.g9db1
#18 lore raw
Quoted 1 line · Borislav Petkov

From: Sam Ravnborg <[email protected]>

[]

scripts/Makefile.build ifeq ($(KBUILD_NOPEDANTIC),) · line 68

Quoted 2 lines
scripts/Makefile.build +2 -0
+warning-1 += -Wold-style-definition
+warning-1 += $(call cc-option, -Wmissing-include-dirs)

Only thing I would suggest is a comment describing why some entries use $(call cc-option, -Wfoo) and others don't.

Something akin to:

# Use call cc-option when the minimum supported gcc version does not

# support a specific option but a later gcc version does.
#19 lore raw
Quoted 9 lines · Joe Perches
Quoted 1 line · Borislav Petkov

From: Sam Ravnborg <[email protected]>

[]

scripts/Makefile.build ifeq ($(KBUILD_NOPEDANTIC),) · line 68

Quoted 2 lines
scripts/Makefile.build +2 -0
+warning-1 += -Wold-style-definition
+warning-1 += $(call cc-option, -Wmissing-include-dirs)

Only thing I would suggest is a comment describing why some entries use $(call cc-option, -Wfoo) and others don't.

Quoted 4 lines

Something akin to:

# Use call cc-option when the minimum supported gcc version does not

# support a specific option but a later gcc version does.

From the patch:
+# $(call cc-option, -W...) handles gcc -W.. options which

 # are not supported by all versions of the compiler

So it is already included.

Sam

#20 lore raw
In reply to Borislav Petkov
Quoted 35 lines · Borislav Petkov

From: Sam Ravnborg <[email protected]>

Building a kernel with "make W=1" produces far too much noise to be useful.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

When building the whole kernel, those levels produce:

W=1 - 4859 warnings
W=2 - 1394 warnings
W=3 - 86666 warnings

respectively. Warnings have been counted with Geert's script at

http://www.kernel.org/pub/linux/kernel/people/geert/linux-log/linux-log-summary.pl

Many warnings occur from .h files so fixing one file may have a nice effect on the total number of warnings.

With these changes I am actually tempted to try W=1 now and then. Previously there was just too much noise.

Borislav:

- make the W= levels exclusive
- move very noisy and making little sense for the kernel warnings to W=3
- drop -Woverlength-strings due to useless warning message
- copy explanatory text for the different warning levels to 'make help'
- recount warnings per level

Quoted 5 lines

---

Looks good. Michal - please apply.

Sam

#21 lore raw
In reply to Borislav Petkov
Quoted 35 lines · Borislav Petkov

From: Sam Ravnborg <[email protected]>

Building a kernel with "make W=1" produces far too much noise to be useful.

Divide the warning options in three groups:

W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored

When building the whole kernel, those levels produce:

W=1 - 4859 warnings
W=2 - 1394 warnings
W=3 - 86666 warnings

respectively. Warnings have been counted with Geert's script at

http://www.kernel.org/pub/linux/kernel/people/geert/linux-log/linux-log-summary.pl

Many warnings occur from .h files so fixing one file may have a nice effect on the total number of warnings.

With these changes I am actually tempted to try W=1 now and then. Previously there was just too much noise.

Borislav:

- make the W= levels exclusive
- move very noisy and making little sense for the kernel warnings to W=3
- drop -Woverlength-strings due to useless warning message
- copy explanatory text for the different warning levels to 'make help'
- recount warnings per level

Quoted 4 lines

Applied to kbuild-2.6.git#kbuild, thanks!

Michal

#22 lore raw
In reply to Borislav Petkov
Quoted 7 lines · Borislav Petkov

If we do this inclusive, then W=2 dumps the, let's call it, level 1 _plus_ the new level 2 warnings, polluting the output with something I've already seen, but only partially. And then I start to think, did I see this one already, didn't I, which was it? By the time you enable W=3, the output becomes pretty useless. For example, W=3 generates 190+ MB logfile here only with level 3 warnings. Now imagine all 3 levels combined.

If each level is averaging 10x the previous level, then all 3 levels will only be 11% bigger, or 211MB.

You *really* want to get *all* the warnings - quite often, you'll be looking at a set of 15 or 20 level-3 warnings. And if you had the Level-2's in there as well, you'd immediately realize that the single level-2 was the real root-cause of all the cascating warnings.

Also, having it as a "volume control" means I don't have to go reading the Makefile to figure out which number I need to specify for which message - I can just say W=3 and *know* the flavor I want will be in there somewhere. Let's face it, if there's over 10 or 15 warnings involved, grep or your editor's "locate next" will do a better job of finding it than you ever can...

#23 lore raw
Quoted 10 lines · On 28.4.2011 02:25, [email protected] wrote:
Quoted 7 lines · Borislav Petkov

If we do this inclusive, then W=2 dumps the, let's call it, level 1 _plus_ the new level 2 warnings, polluting the output with something I've already seen, but only partially. And then I start to think, did I see this one already, didn't I, which was it? By the time you enable W=3, the output becomes pretty useless. For example, W=3 generates 190+ MB logfile here only with level 3 warnings. Now imagine all 3 levels combined.

Quoted 7 lines

If each level is averaging 10x the previous level, then all 3 levels will only be 11% bigger, or 211MB.

You *really* want to get *all* the warnings - quite often, you'll be looking at a set of 15 or 20 level-3 warnings. And if you had the Level-2's in there as well, you'd immediately realize that the single level-2 was the real root-cause of all the cascating warnings.

How about W=12 for level 1 and 2 warnings and W=123 for all levels?

Michal

#24 lore raw
Quoted 14 lines · Michal Marek
Quoted 13 lines · On 28.4.2011 02:25, [email protected] wrote:
Quoted 7 lines · Borislav Petkov

If we do this inclusive, then W=2 dumps the, let's call it, level 1 _plus_ the new level 2 warnings, polluting the output with something I've already seen, but only partially. And then I start to think, did I see this one already, didn't I, which was it? By the time you enable W=3, the output becomes pretty useless. For example, W=3 generates 190+ MB logfile here only with level 3 warnings. Now imagine all 3 levels combined.

If each level is averaging 10x the previous level, then all 3 levels will only be 11% bigger, or 211MB.

Quoted 6 lines
Quoted 4 lines

You *really* want to get *all* the warnings - quite often, you'll be looking at a set of 15 or 20 level-3 warnings. And if you had the Level-2's in there as well, you'd immediately realize that the single level-2 was the real root-cause of all the cascating warnings.

How about W=12 for level 1 and 2 warnings and W=123 for all levels?

I'd be OK with that, or a 'W=all', or whatever, as long as it's doable.

#25 lore raw

PATCH 1/1 kbuild: Allow to combine multiple W= levels

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

---
 scripts/Makefile.build |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.build +6 -2
index 9c0c481..28cef2a 100644
@@ -60,6 +60,8 @@ endif
 # $(call cc-option, -W...) handles gcc -W.. options which
 # are not supported by all versions of the compiler
 ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
+warning-  := $(empty)
+
 warning-1 := -Wextra -Wunused -Wno-unused-parameter
 warning-1 += -Wmissing-declarations
 warning-1 += -Wmissing-format-attribute
@@ -85,9 +87,11 @@ warning-3 += -Wswitch-default
 warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
 warning-3 += $(call cc-option, -Wvla)
 
-warning := $(warning-$(KBUILD_ENABLE_EXTRA_GCC_CHECKS))
+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)))
 
-ifeq ("$(warning)","")
+ifeq ("$(strip $(warning))","")
         $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
 endif
 
Signature · 1 line
1.7.4.1
author Acked-by on v1 1/1
#26 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

Quoted 3 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

I was considering W=all - but that gives less flexibility, which is what has been requested.

Sam

#27 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

In reply to Michal Marek

Hi,

Quoted 23 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

---
 scripts/Makefile.build |    8 ++++++--

 1 files changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.build +0 -0
index 9c0c481..28cef2a 100644
@@ -60,6 +60,8 @@ endif
  # $(call cc-option, -W...) handles gcc -W.. options which
  # are not supported by all versions of the compiler

 ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS

scripts/Makefile.build +2 -0
+warning-  := $(empty)
+

 warning-1 := -Wextra -Wunused -Wno-unused-parameter warning-1 += -Wmissing-declarations warning-1 += -Wmissing-format-attribute

scripts/Makefile.build warning-3 += -Wswitch-default · line 93

Quoted 8 lines
scripts/Makefile.build +3 -1
@@ -85,9 +87,11 @@ warning-3 += -Wswitch-default
  warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
  warning-3 += $(call cc-option, -Wvla)
 
-warning := $(warning-$(KBUILD_ENABLE_EXTRA_GCC_CHECKS))
+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)))
 

I do not really like that, it would mean that W=123, W=321, W=231 and W=132 would lead to the same result. What about a comma separated string, ala:

LEVELS=1,2,3,4

comma:= ,
empty:=
space:= $(empty) $(empty)

warning-1:= a
warning-2:= b
warning-3:= c
warning-4:= d

all:

        echo $(foreach level, $(subst ${comma},${space},${LEVELS},

${warning}), ${warning-${level}})

It has the advantage to scale up without adding new code.

- Arnaud

Quoted 13 lines
scripts/Makefile.build +1 -1
-ifeq ("$(warning)","")
+ifeq ("$(strip $(warning))","")
         $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)

 endif

--
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#28 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

Quoted 3 lines · Arnaud Lacombe

I do not really like that, it would mean that W=123, W=321, W=231 and W=132 would lead to the same result. What about a comma separated string, ala:

OK, I'll bite - if W=321 should behaved differently than 123, exactly *how* should it be different?

Reviewed-by on v1 1/1
#29 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

In reply to Michal Marek
Quoted 6 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

---

OK, that addresses my concerns, feel free to stick a

on it...

#30 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

In reply to Michal Marek
Quoted 25 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

---
 scripts/Makefile.build |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.build +2 -0
index 9c0c481..28cef2a 100644
@@ -60,6 +60,8 @@ endif
 # $(call cc-option, -W...) handles gcc -W.. options which
 # are not supported by all versions of the compiler
 ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
+warning-  := $(empty)
+
 warning-1 := -Wextra -Wunused -Wno-unused-parameter
 warning-1 += -Wmissing-declarations
 warning-1 += -Wmissing-format-attribute
@@ -85,9 +87,11 @@ warning-3 += -Wswitch-default
 warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
 warning-3 += $(call cc-option, -Wvla)

scripts/Makefile.build warning-3 += -Wswitch-default · line 96

Quoted 10 lines
scripts/Makefile.build +4 -2
 
-warning := $(warning-$(KBUILD_ENABLE_EXTRA_GCC_CHECKS))
+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)))
 
-ifeq ("$(warning)","")
+ifeq ("$(strip $(warning))","")
         $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
 endif

Pushed to kbuild-2.6.git#kbuild with the following make help update:

Makefile +1 -1
index 4527dc2..d342502 100644
@@ -1290,7 +1290,7 @@ help:
 	@echo  '		1: warnings which may be relevant and do not occur too often'
 	@echo  '		2: warnings which occur quite often but may still be relevant'
 	@echo  '		3: more obscure warnings, can most likely be ignored'
-
+	@echo  '		Multiple levels can be combined with W=12 or W=123'
 	@echo  ''
 	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
 	@echo  'For further info see the ./README file'

Michal

#31 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

Hi Michal,

Quoted 32 lines · Michal Marek
Quoted 31 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

---
 scripts/Makefile.build |    8 ++++++--

 1 files changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.build +0 -0
index 9c0c481..28cef2a 100644
@@ -60,6 +60,8 @@ endif
  # $(call cc-option, -W...) handles gcc -W.. options which
  # are not supported by all versions of the compiler

 ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS

scripts/Makefile.build +2 -0
+warning-  := $(empty)
+

 warning-1 := -Wextra -Wunused -Wno-unused-parameter warning-1 += -Wmissing-declarations warning-1 += -Wmissing-format-attribute

scripts/Makefile.build +3 -1
@@ -85,9 +87,11 @@ warning-3 += -Wswitch-default
  warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
  warning-3 += $(call cc-option, -Wvla)
 
-warning := $(warning-$(KBUILD_ENABLE_EXTRA_GCC_CHECKS))
+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)))
 
Quoted 7 lines
Quoted 4 lines
scripts/Makefile.build +1 -1
-ifeq ("$(warning)","")
+ifeq ("$(strip $(warning))","")
          $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)

 endif

Pushed to kbuild-2.6.git#kbuild with the following make help update:

you did not comment on the point I raised.

Thanks,
- Arnaud

Quoted 20 lines
Makefile +0 -0
index 4527dc2..d342502 100644
@@ -1290,7 +1290,7 @@ help:

       @echo  '                1: warnings which may be relevant and do not occur too often' @echo  '                2: warnings which occur quite often but may still be relevant' @echo  '                3: more obscure warnings, can most likely be ignored' -
+       @echo  '                Multiple levels can be combined with W=12 or W=123' @echo  ''
       @echo  'Execute "make" or "make all" to build all targets marked with [*] ' @echo  'For further info see the ./README file'

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#32 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

Quoted 35 lines · Arnaud Lacombe

Hi Michal,

Quoted 32 lines · Michal Marek
Quoted 31 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

---
  scripts/Makefile.build |    8 ++++++--
  1 files changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.build +5 -1
index 9c0c481..28cef2a 100644
@@ -60,6 +60,8 @@ endif
  # $(call cc-option, -W...) handles gcc -W.. options which
  # are not supported by all versions of the compiler
  ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
+warning-  := $(empty)
+
  warning-1 := -Wextra -Wunused -Wno-unused-parameter
  warning-1 += -Wmissing-declarations
  warning-1 += -Wmissing-format-attribute
@@ -85,9 +87,11 @@ warning-3 += -Wswitch-default
  warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
  warning-3 += $(call cc-option, -Wvla)
 
-warning := $(warning-$(KBUILD_ENABLE_EXTRA_GCC_CHECKS))
+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)))
 
Quoted 8 lines
Quoted 7 lines

scripts/Makefile.build warning-3 += -Wswitch-default · line 96

Quoted 4 lines
scripts/Makefile.build +1 -1
-ifeq ("$(warning)","")
+ifeq ("$(strip $(warning))","")
          $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
  endif

Pushed to kbuild-2.6.git#kbuild with the following make help update:

you did not comment on the point I raised.

Valdis did. Why is it a problem that W=123 can be interchanged with W=321?

Michal

#33 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

Hi,

Quoted 49 lines · Michal Marek
Quoted 48 lines · Arnaud Lacombe

Hi Michal,

Quoted 44 lines · Michal Marek
Quoted 37 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level>  does not include warnings from the previous level.

---
 scripts/Makefile.build |    8 ++++++--

 1 files changed, 6 insertions(+), 2 deletions(-)
scripts/Makefile.build +0 -0
index 9c0c481..28cef2a 100644
@@ -60,6 +60,8 @@ endif
  # $(call cc-option, -W...) handles gcc -W.. options which
  # are not supported by all versions of the compiler

 ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS

scripts/Makefile.build +2 -0
+warning-  := $(empty)
+

 warning-1 := -Wextra -Wunused -Wno-unused-parameter warning-1 += -Wmissing-declarations warning-1 += -Wmissing-format-attribute

scripts/Makefile.build +4 -2
@@ -85,9 +87,11 @@ warning-3 += -Wswitch-default
  warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
  warning-3 += $(call cc-option, -Wvla)
 
-warning := $(warning-$(KBUILD_ENABLE_EXTRA_GCC_CHECKS))
+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)))
 
-ifeq ("$(warning)","")
+ifeq ("$(strip $(warning))","")
Quoted 2 lines

         $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) endif

Pushed to kbuild-2.6.git#kbuild with the following make help update:

Quoted 4 lines
Quoted 1 line

you did not comment on the point I raised.

Valdis did. Why is it a problem that W=123 can be interchanged with W=321?

Because 321 != 123 and 321 > 123. As I am a dumb human being, I would expect 321 to have a different meaning than 123, but also 321 to be more verbose than 123. Said otherwise, humans tends to naturally interpret 321 and 123 as number rather than concatenation of character.

- Arnaud

Quoted 2 lines

Michal

#34 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

In reply to Michal Marek
Quoted 4 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

This interface is not friendly, at least not as normal as we often see. W=x+1 is supposed to include warnings of W=x.

Please refine the interface.

Thanks.

#35 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

Quoted 10 lines · Américo Wang
Quoted 4 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

This interface is not friendly, at least not as normal as we often see. W=x+1 is supposed to include warnings of W=x.

Please refine the interface.

Until we see that several people have had benefit if W=... we should leave it as is now.

Then when people really start to use if we can refine it.

IMO it is much more important to find the right sub-set
of warnings to keep on W=1 level than how we see additional warnings.

There may well be warnings where we say that the benefit of it is zero - or it is plain wrong in the kernel.
Lets try to focus on this.

Sam

#36 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

Hi,

Quoted 15 lines · Sam Ravnborg
Quoted 10 lines · Américo Wang
Quoted 4 lines · Michal Marek

Add support for make W=12, make W=123 and so on, to enable warnings from multiple W= levels. Normally, make W=<level> does not include warnings from the previous level.

This interface is not friendly, at least not as normal as we often see. W=x+1 is supposed to include warnings of W=x.

Please refine the interface.

Until we see that several people have had benefit if W=... we should leave it as is now.

Quoted 9 lines

Then when people really start to use if we can refine it.

IMO it is much more important to find the right sub-set
of warnings to keep on W=1 level than how we see additional warnings.

There may well be warnings where we say that the benefit of it is zero - or it is plain wrong in the kernel.
Lets try to focus on this.

Because you are not even sure of what you submitted is good for the kernel ?

I think this has been done completely wrong, first all the extra warnings got in (without a detailed impact implied by each one), then it was decided to be split in several level (which I proposed on Feb 20th, but was originally rejected by Borislav Petkov), then, well, some may need to be removed because they are not good for Linux. I would rather have provided the framework first, clean, natural interface, then added new warnings gradually when we were sure had a positive impact on the kernel, with the associated patch fixing them. Right now, +80k warnings will be just impossible to fix.

Now, the drawback of your comment is that when it will be time to change the interface, some will object because it will have been started to be used by third party scripts, and as authors of third party script, it is a PITA to have to check the kernel version to know if I should W=1,2,3, or W=123 or if W=3 includes W=1 ...

my 0.2c,

- Arnaud

#37 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

I'm really getting tired of this!

Quoted 2 lines

Because you are not even sure of what you submitted is good for the kernel ?

No, because we need to get a feeling of what makes sense for all these options first. I'd rather do the learning-by-doing thing here and implement what makes sense than braindead frameworks.

Quoted 2 lines

I think this has been done completely wrong, first all the extra warnings got in (without a detailed impact implied by each one),

WTF? http://marc.info/?l=linux-kbuild&m=130346037604547&w=2

No one else did check those and said, ACK/NACK so we went in with this initial splitting first.

Quoted 2 lines

then it was decided to be split in several level (which I proposed on Feb 20th, but was originally rejected by Borislav Petkov),

Of course, because it made no sense at the time. Sam added it later with his proposal patch.

Quoted 2 lines

then, well, some may need to be removed because they are not good for Linux.

have you even tried all those options and come up with concrete suggestions on which options should go in and which shouldn't, and for what reasons? I don't think so. So until you do, I don't care what you have to say.

[snip a bunch of bullshit]

Quoted 5 lines

Now, the drawback of your comment is that when it will be time to change the interface, some will object because it will have been started to be used by third party scripts, and as authors of third party script, it is a PITA to have to check the kernel version to know if I should W=1,2,3, or W=123 or if W=3 includes W=1 ...

This is exactly why we're trying to get a feeling of this by _running_ it and _then_ _bitching_ about it. And this is for DEVELOPERS only - if they've introduced it in their scripts, then they should be able to fix any changes very easily.

#38 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

Hi,

Quoted 3 lines · On Mon, May 2, 2011 at 2:03 PM, <[email protected]> wrote:

This is exactly why we're trying to get a feeling of this by _running_ it and _then_ _bitching_ about it.

This is just what I did, might you consider it bullshit or not. I really do _dislike_ Michal's interface. I proposed a solution, Americo did too. I guess that unless a patch is submitted, this will go nowhere.

Quoted 3 lines

And this is for DEVELOPERS only - if
they've introduced it in their scripts, then they should be able to fix any changes very easily.

This argument is worthless. As soon as it gets in mainline, everybody will be free to use it, newbs, QA, packager, ...

- Arnaud

#39 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

Quoted 2 lines

I proposed a solution, Americo did too. I guess that unless a patch is submitted, this will go nowhere.

Exactly, if you feel something is wrong with this interface and you think you have a better idea, make a patch, test it and send it out.

This is how solutions are proposed properly on lkml. :)

#40 lore raw

Re: [PATCH] kbuild: Allow to combine multiple W= levels

In reply to Arnaud Lacombe
Quoted 10 lines · Arnaud Lacombe

Hi,

Quoted 3 lines · On Mon, May 2, 2011 at 2:03 PM, <[email protected]> wrote:

This is exactly why we're trying to get a feeling of this by _running_ it and _then_ _bitching_ about it.

This is just what I did, might you consider it bullshit or not. I really do _dislike_ Michal's interface. I proposed a solution, Americo did too. I guess that unless a patch is submitted, this will go nowhere.

Yes, feel free to submit a patch that does things better. Nothing is set in stone yet, the code isn't even merged into Linus' tree, let alone part of some official release.

Michal

#41 lore raw
In reply to Borislav Petkov
Quoted 7 lines · Borislav Petkov
Quoted 3 lines · Borislav Petkov

But seriously, let me add my comments to your patch while they're fresh in my head and let's see what we come up with in our combined and perfectly orchestrated effort :).

Ok, this is starting to look like another kernelnewbies.org task:

Quoted 7 lines

make W=x 2>>w.log

and stare at compiler output in the other xterm:

tail -f w.log

and the bugs are just waiting there to be fixed! :)

You can use http://www.kernel.org/pub/linux/kernel/people/geert/linux-log/linux-log-summary.pl
to get a summary, sorted by number of occurrences. So you see which
ones to fix first ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds