[cfe-commits] r123192 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/blocksignature.c test/CodeGen/const-init.c test/CodeGen/darwin-string-literals.c test/CodeGen/func-in-block.c test/CodeGen/predefined-expr.c test/CodeGen/string-literal-short-wstring.c test/CodeGen/string-literal.c test/CodeGenCXX/predefined-expr.cpp test/CodeGenObjC/predefined-expr.m

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Fri Jan 14 15:03:10 PST 2011

> Are you not already merging them during linking?

Since declarations cannot have it, combining a declaration and a 
definition is easy (keep the definition).

> What happens when I have
> two weak/linkonce definitions?  More generally, is this attribute a guarantee
> that nobody *ever* cares about address significance, or just that the current
> module doesn't?

That nobody ever cares about the address of *this* definition. I haven't 
finished implementing all the cases about multiple definitions, but what 
I think should happen is

* When linking together two definitions ideally it should be an error 
for both to have different unnamed_addr, but see next item.

* Const merge should be allowed to merge a unnamed_addr constant with 
one without unnamed_addr if the resulting one does not have 
unnamed_addr. Because of this, the liker would not be able to tell a 
confused FE from constmerge doing its job and we have to allow linking 
two definitions with different unnamed_addr. Naturally the resulting 
definition should not have the attribute.

> Also, I wish this had been discussed on the ML even slightly before being
> committed.

I am mostly following Sabre's proposal in PR8927 and have emailed the 
list for questions (like allowing it on declarations).

> John.


More information about the cfe-commits mailing list