This is the mail archive of the
gcc-patches@gcc.gnu.org
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: <6c33472e0905142348y142c319br6d5ca874ec0456e7@mail.gmail.com> <4A0E7EC6.9020003@users.sourceforge.net> <6c33472e0905160244yce8c322mde6ecf5285b4c761@mail.gmail.com> <6dc9ffc80905160817k20bf638bof0cbe91ea4959c65@mail.gmail.com> <84fc9c000905171321v6d3ac773ga8e468284c5a7105@mail.gmail.com> <6c33472e0905171352v542267d4m7953b13a17e83bf8@mail.gmail.com> <de8d50360905171354n6db713b8ue50aa2764f123595@mail.gmail.com>
- Reply-to: tromey at redhat dot com
>>>>> "Andrew" == Andrew Pinski <pinskia@gmail.com> 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.
Tom