[C/C++/IRA] PR 16302 gcc fails to warn about some common logic errors

Mark Mitchell mark@codesourcery.com
Tue May 19 14:44:00 GMT 2009


Manuel López-Ibáñez wrote:

> Mark, Joseph. Would a patch to move Wlogical-op out of Wextra be approved?

I don't have a strong feeling about this.

Warnings like this are going to generate false positives, period.  You
either adjust your codebase so as not to trigger the warning (whether by
changing the code or by inserting #pragmas that disable the warnings at
particular locations), or you disable the warning.  There's no perfect
default setting; some people want 100 false positives for 1 true
positive, whereas other people want the ratio to be much smaller.

I do not think, though, that we should be making changes like based
solely on our experience developing GCC itself.  The admirable desire to
"eat our own dogfood" shouldn't morph into "making GCC the perfect
compiler for compiling GCC".

Are there parts of -Wlogical-op that have been part of -Wextra for a
long time and could stay in without this new bit?  That would avoid
people wondering where their warnings have gone.  (I'm a little confused
because the 4.3 documentation that I have doesn't document -Wlogical-op
as being part of -Wextra; maybe that documentation was wrong, or maybe
we only relatively recently moved -Wlogical-op into -Wextra?)

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list