Re: [PATCH -v4] kbuild: Add extra gcc checks

From: Arnd Bergmann
Date: Tue Mar 01 2011 - 06:35:56 EST


On Monday 28 February 2011, Borislav Petkov wrote:
> My intention was not to have multiple levels of warnings because then
> you have to go and enable the different levels and have to remember
> which level you used last, etc, etc.

I wasn't suggesting more than two, so the two would have very distinct
definitions:

W=1: Warnings that we would like to fix all over the tree, patches to
remove these are always welcome and you can build the entire kernel
with it. Once they are all fixed, we can make the warnings the default.

W=2: Warnings that we know we don't always want to fix, meant for what
you describe here -- you build a single file and decide what to
do based on common sense.

> Instead I am thinking along with the following lines:
>
> make W=1 [path/to/kernel/file.o] 2>w.log
>
> and then take a look at w.log and start fixing warnings.
>
> You can selectively ignore some of the warnings since, as you say
> yourself above, some simply make you write ugly code like enforcing
> casts just for the sake of shutting up the compiler. A great deal of the
> warnings come from includes which are hard to fix or gcc is issuing the
> warning wrong since we do sick sh*t with C in the kernel and that's OK
> :).

Yes, I understand that.

> But in all cases you have all the warnings in one single file and that's
> it. If a certain -W option is useless, we should rather remove it since
> it doesn't help anyway. The selection above is clearly not complete so
> I'd rather drop some instead of including different W=x levels.
>
> Hmm... ?

I'd have to see the output myself. My feeling is that a lot of the
-Wextra warnings are not that useful, but I don't know which ones
are included in -Wextra these days.

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