<div dir="ltr"><div class="gmail_extra">Sorry the namespace question was a bit of a distraction. I was curious because I want to add a `__libcpp_internal` namespace that I can put implementation details into without having to worry about them being visible. However I don't want that to infect this discussion.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Evgenii thanks for all the work. I noticed that your tests rule out applying the new attribute to a class declaration. However libc++ currently applies the the visibility attributes to classes. I've always assumed that this simply propagated the visibility to each member function but please let me know if I'm wrong. I think this attribute needs to work the same way.</div><div class="gmail_extra"><br></div><div class="gmail_extra">/Eric</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 20, 2015 at 3:01 PM, Evgenii Stepanov <span dir="ltr"><<a href="mailto:eugeni.stepanov@gmail.com" target="_blank">eugeni.stepanov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've put together an implementation of this attribute:<br>
<a href="http://reviews.llvm.org/D13925" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13925</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, Oct 20, 2015 at 5:57 PM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com">aaron@aaronballman.com</a>> wrote:<br>
> On Tue, Oct 20, 2015 at 8:52 PM, Evgenii Stepanov<br>
> <<a href="mailto:eugeni.stepanov@gmail.com">eugeni.stepanov@gmail.com</a>> wrote:<br>
>> Do we really want to apply the attribute to the entire namespace? We'd<br>
>> need to skip at least extern template methods (like<br>
>> char_traits<char>).<br>
><br>
> Eric was asking for it specifically, so I am assuming that was<br>
> something he might want to do. I would certainly be curious what the<br>
> semantics would be for it.<br>
><br>
> I mostly would like to avoid replacing one solution that clutters<br>
> libc++ with another one that clutters equally, if we can avoid it.<br>
><br>
> ~Aaron<br>
><br>
>><br>
>><br>
>> On Tue, Oct 20, 2015 at 5:28 PM, Aaron Ballman <<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a>> wrote:<br>
>>> On Fri, Oct 16, 2015 at 2:07 PM, Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:<br>
>>>> On Thu, Oct 15, 2015 at 6:55 PM, Eric Fiselier <<a href="mailto:eric@efcs.ca">eric@efcs.ca</a>> wrote:<br>
>>>>><br>
>>>>> 1. What would happen if the user attempts to take the address of a<br>
>>>>> function marked<br>
>>>>> `__attribute__((internal_linkage))`? Wouldn't this case required external<br>
>>>>> linkage?<br>
>>>>> For libc++ it's sufficient if it causes a compile error because users<br>
>>>>> aren't allowed<br>
>>>>> to take the address of functions in the standard library.<br>
>>>><br>
>>>><br>
>>>> Addresses of such functions would just compare not equal across TUs. I think<br>
>>>> that's pretty reasonable, and probably conformant. There are many ways that<br>
>>>> STL functions can be called indirectly (std::function's vtable), so I don't<br>
>>>> think we want to try to forbid that.<br>
>>>><br>
>>>>><br>
>>>>> 2. It would be great if we could apply the attribute to a namespace, that<br>
>>>>> in turn applies it to<br>
>>>>>    all of the symbols within. Would this be possible?<br>
>>>><br>
>>>><br>
>>>> The Clang attribute machinery *appears* to support attributes on namespace,<br>
>>>> but there doesn't seem to be a single test for it in the test suite. I don't<br>
>>>> think we can do that yet. Anyway, this feels like a separate feature request<br>
>>>> to me.<br>
>>><br>
>>> C++ attributes are supported on namespaces, but I'm not certain about<br>
>>> GNU attributes on them. I'm not aware of any GNU attributes that<br>
>>> appertain to a namespace, so I'm not surprised about a lack of test<br>
>>> coverage.<br>
>>><br>
>>> As for the feature itself, I think it's possibly a related feature<br>
>>> instead of a separate one, but I don't feel strongly. Given the use<br>
>>> case is "let's remove a bunch of not-really-working" libc++ code, I<br>
>>> can see the namespace being the better approach for those needs, with<br>
>>> a declaration attribute that happens to be the underlying<br>
>>> implementation of the namespace attribute.<br>
>>><br>
>>> ~Aaron<br>
</div></div></blockquote></div><br></div></div>