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 3/7] Emit macro expansion related diagnostics


Jason Merrill <jason@redhat.com> writes:

> On 09/20/2011 03:23 AM, Dodji Seketeli wrote:
>> Jason Merrill<jason@redhat.com>  writes:
>
>>> Certainly all the calls to tokens_buff_add_token pass src->src_loc for
>>> the second.  So why don't we look up the second location in the macro
>>> definition when we need it rather than store a copy in the map?
>>
>> Because when you have the first location, looking up the second is not
>> easy.
>
> In linemap_macro_map_loc_to_def_point you get the token number and
> then use that to index into MACRO_MAP_LOCATIONS.  Can't you use the
> same token number to index into macro->exp.tokens instead?

No, because a macro argument can be made of several tokens.  So after
the first macro parameter of the replacement-list has been replaced by
the tokens of the argument, there is a shift between the indexes of the
tokens resulting from the replacement, and the original tokens of the
macro replacement list.

-- 
		Dodji


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