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: [PATCH preprocessor, diagnostics] PR preprocessor/53229 - Fix diagnostics location when pasting tokens


On 05/21/2012 10:07 AM, Dodji Seketeli wrote:
Jason Merrill<jason@redhat.com> writes:
When do we not want to set invocation_location if we're beginning to
expand a macro?

If M itself involves expanding another macro M', we are supposed to call the (internal function) cpp_get_token_1 that does not set set_invocation_location. So that the only expansion point recorded is the one for M, not the one for M'.

But if we're already in a macro expansion (if context->c.macro is set) cpp_get_token_1 doesn't set invocation_location even if set_invocation_location is true. So we should only get the expansion point for M even if set_invocation_location is always true.


Now, looking at how surprising this is turning out to be, I am thinking
that cpp_get_token should, like cpp_get_token_with_location just set
pfile->set_invocation_location, just like cpp_get_token_with_location.

Would you agree?

Yes, except that I would go farther and do away with the flag entirely.


Jason


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