more on duplicate decls
Kenneth Zadeck
zadeck@naturalbridge.com
Wed Jul 13 12:43:00 GMT 2005
Mark Mitchell wrote:
> Kenneth Zadeck wrote:
>
>> The kludge to handle them is documented in cp/name-lookup.c around
>> line 670
>
> Ugh.
>
> IMO, the right thing here is that there should be only one
> FUNCTION_DECL for a given function, ever, period. Default arguments
> are not part of "the function" in C++; they are an aspect of
> particular declarations of the function. The problem we're having is
> that we associate them with the FUNCTION_DECL, rather than with the
> bindings (mappings from names to FUNCTION_DECLs).
>
> Unfortunately, fixing that properly is a rather large change.
>
>> It seems like a better way is to build a table of merges that need to
>> be done and find some place after the c++ front end is finished but
>> before the cgraph gets built and do one scan of the code and replace
>> all of the offending decls.
>
> After the C++ front end is done, it would be OK to canoanicalize all
> FUNCTION_DECLs with a single UID into one. A stupid way of doing that
> would be to just walk the entire translation unit, and whenever you
> find a reference to a non-canonical copy of the FUNCTION_DECL,
> re-point it at the right one.
>
> The C++ front end always operates in unit-at-a-time mode, so, yes, you
> could do this when the C++ front end is finished.
Are you saying that if I wait til the front end is finished that I do
not have to worry about the default args problem you mention above?
Should I fix it this simple way or should I let a c++ front end person
fix it as the decls are created?
kenny
More information about the Gcc
mailing list