Jason Merrill <ja...@redhat.com> writes:

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

The problem is that cpp_get_token_1 can be called when we are at the
beginning of a macro expansion (inside enter_macro_expansion, called
from cpp_get_token_1), *before* context->c.macro is set.  This happens
e.g, when we call funlike_invocation_p to know if the current macro is
function-like or not.

In that case, if we don't have the pfile->set_invocation_location flag,
we'll record the expansion point of M', if M' is an argument of the
function-like macro M.

-- 
                Dodji

Reply via email to