Messages in this thread | | | From | "Rustad, Mark D" <> | Subject | Re: [PATCH] sched: Remove nested extern | Date | Mon, 22 Sep 2014 21:50:44 +0000 |
| |
On Sep 22, 2014, at 2:21 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Mon, Sep 22, 2014 at 08:59:32PM +0000, Rustad, Mark D wrote: >> Because I have found that enabling many warnings helps identify problems >> in code and it has been my standard practice since about 1999 to do so. >> The compiler warnings are really just another form of static analysis, >> and I use it routinely on every compile. Here is how routinely: I have >> W=1 in my environment, W=12 is just too painful. I would change that >> default to W=12 if it wasn't insane to do so. > > Many warnings are just plain insane and stupid. They're not helping > anybody. There's a very good reason many are disabled. I'm sure you can > find some entertaining discussions on the topic if you search the LKML > archives.
That is what I used to think. -Wshadow for example. What's the problem? It is perfectly valid C. Well, I recently sent a patch that changed some function parameters that used the name jiffies, which of course shadowed the well-known global. If a macro were ever called in those functions whose expansion ever tried to access jiffies, well it wouldn't do what was expected. Not a bug now, but a trap for the future. I only found that because I either resolved or silenced enough warnings to see something interesting.
Over the years I think I have resolved real bugs revealed by probably nearly every one of the additional warning messages. They do have value, but that value is typically lost if the norm is a flood of messages. Apple would not have had their SSL problem if they had had -Wunreachable-code enabled and noticed the message.
-- Mark Rustad, Networking Division, Intel Corporation
[unhandled content-type:application/pgp-signature] | |