[cfe-dev] [RFC] __attribute__((internal_linkage))

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Fri Oct 16 11:07:15 PDT 2015


On Thu, Oct 15, 2015 at 6:55 PM, Eric Fiselier <eric at efcs.ca> wrote:
>
> 1. What would happen if the user attempts to take the address of a
> function marked
> `__attribute__((internal_linkage))`? Wouldn't this case required external
> linkage?
> For libc++ it's sufficient if it causes a compile error because users
> aren't allowed
> to take the address of functions in the standard library.
>

Addresses of such functions would just compare not equal across TUs. I
think that's pretty reasonable, and probably conformant. There are many
ways that STL functions can be called indirectly (std::function's vtable),
so I don't think we want to try to forbid that.


> 2. It would be great if we could apply the attribute to a namespace, that
> in turn applies it to
>    all of the symbols within. Would this be possible?
>

The Clang attribute machinery *appears* to support attributes on namespace,
but there doesn't seem to be a single test for it in the test suite. I
don't think we can do that yet. Anyway, this feels like a separate feature
request to me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151016/1896f177/attachment.html>


More information about the cfe-dev mailing list