On 05/21/2012 10:07 AM, Dodji Seketeli wrote:
Jason Merrill<ja...@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

Reply via email to