This is the mail archive of the
mailing list for the GCC project.
Re: [C/C++/IRA] PR 16302 gcc fails to warn about some common logic errors
2009/5/19 Mark Mitchell <email@example.com>:
> 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?)
-Wlogical-op has never been part of -Wextra in any released GCC.
I moved -Wlogical-op into -Wextra in GCC 4.5 after I modified it to
not warn about cases that are typical of macro expansions, and after
it found some bugs in GCC itself. Obviously, given the current
situation, I missed some cases that cannot be resolved without knowing
for sure that the code comes from a macro expansion.
On the other hand, I wonder if some of the warnings are just some bug
in the logic, like the one for "if (foo & 0 && x)" that I fixed
already. Those could (and should) be fixed.