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
- From: Tom Tromey <tromey at redhat dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>, Richard Guenther <richard dot guenther at gmail dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, Simon Martin <simartin at users dot sourceforge dot net>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Mark Mitchell <mark at codesourcery dot com>, Jason Merrill <jason at redhat dot com>, Nathan Sidwell <nathan at codesourcery dot com>, Vladimir Makarov <vmakarov at redhat dot com>
- Date: Mon, 18 May 2009 11:42:49 -0600
- Subject: Re: [C/C++/IRA] PR 16302 gcc fails to warn about some common logic errors
- References: <email@example.com> <4A0E7EC6.firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com>
- Reply-to: tromey at redhat dot com
>>>>> "Andrew" == Andrew Pinski <firstname.lastname@example.org> writes:
Andrew> Is there a way to tell if !x happens because of a macro, if
Andrew> there is then we should not warn about it. This is the
Andrew> current issue with this warning (and most likely others too)
Andrew> is that they don't take into account macros.
In today's gcc, you detect a token coming from a macro expansion by
noticing when the token's location differs from the extra location
returned by cpp_get_token_with_location. Currently the lexer discards
this information, though.
FWIW I have a mostly-finished patch that adds macro expansion
information to the line table. I'm slowly working on finishing it.
If someone wants it sooner, I can send it.