This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]