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: preserve parameter attributes during C++ decl smashing


Dave Korn wrote:
> Jason Merrill wrote:
>> This seems like a reasonable change, but it doesn't cover a
>> redeclaration that is not a definition which adds attributes, i.e.
>>
>> void f(int i);
>> void f(int i __attribute ((foo)));
>> void f(int i) { ... }
>>
>> I think in this situation the "foo" attribute will get silently dropped
>> on the floor.  Better to always merge the attributes, I think.

I agree.

>   Is that correct for "__attribute__ ((weak))"?  Or should the version without
> the attribute be taken as a strong declaration?

If we emit a definition of "f", I don't think we should emit it as weak.
 AFAIK, it only makes sense for a symbol to be weak when we are emitted
a reference to it, not a definition of it.  But, that's not really a
question about merging attributes; the same question applies to:

   __attribute__((weak)) void f(int i) { ... }

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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