[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64N.0612191311590.24901@attu4.cs.washington.edu>
Date: Tue, 19 Dec 2006 13:24:24 -0800 (PST)
From: David Rientjes <rientjes@...washington.edu>
To: Jan Engelhardt <jengelh@...ux01.gwdg.de>
cc: Bob Copeland <me@...copeland.com>, Dave Jones <davej@...hat.com>,
"Robert P. J. Day" <rpjday@...dspring.com>,
Linux kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: my handy-dandy, "coding style" script
On Tue, 19 Dec 2006, Jan Engelhardt wrote:
> > I don't know if anyone cares about them anymore, since I think gcc
> > grew some smarts in the area recently, but there are a lot of lines of
> > code matching "static int.*= *0;" and equivalents in the driver tree.
>
> I'd really like to see the C compiler being enhanced to detect
> "stupid casts", i.e. those, which when removed, do not change (a) the outcome
> (b) the compiler warnings/error output.
>
If your desire is for the compiler warnings output to be unchanged, I'm
not sure how you'd enhance the compiler from detecting these casts. All
of the casts that have been removed in these cleanup patches do not change
the assembly when using gcc; they simply reduce the amount of visual noise
in the source code.
This is also true in terms of global static variables being initialized to
0 (or NULL). While it is indeed unnecessary by the standard, it simply
moves the initialization from one segment of the assembly to the other,
regardless of how many different functions it is referenced in. gcc does
not emit movl $0, var for these cases.
It _would_ be helpful to add a macro such as:
#define SILENCE_GCC(x) = x
to eliminate warnings such that:
auto int a SILENCE_GCC(a);
fill_a(&a);
if (a)
...
would not produce a "may be used uninitialized" warning.
David
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists