[patch] [libcxx] _LIBCPP_WEAK

G M gmisocpp at gmail.com
Thu Sep 26 05:49:06 PDT 2013


Hi Nico

On Thu, Sep 26, 2013 at 8:39 PM, Nico Rieck <nico.rieck at gmail.com> wrote:

> _LIBCPP_NEW_DELETE_VIS expands to _LIBCPP_FUNC_VIS_ONLY when using libc++
> (which in turn expands to nothing on Windows). When building libc++ as
> shared library it expands to _LIBCPP_FUNC_VIS (which in turn expands to
> dllexport). The new/delete operators are special cases that must not be
> decorated with dllimport so that they can be replaced with a local
> non-imported definition.
>
> -Nico
>

Would you mind clarifying that for me, please.

First: I take it from what you say my patch *as it stands* is correct?

Second:
When you say "LIBCPP_NEW_DELETE_VIS expands to _LIBCPP_FUNC_VIS_ONLY when
using libc++ (which in turn expands to nothing on Windows)."

Do you mean "LIBCPP_NEW_DELETE_VIS expands to _LIBCPP_FUNC_VIS_ONLY when
using libc++ [as a static library]" or in some other context?

Third:
Are you saying we can't decorate the definition with _LIBCPP_NEW_DELETE_VIS
or is that ok? just not to apply _LIBCPP_FUNC_VIS here. Or must it be
nothing at all (other than _LIBCPP_WEAK) which is as I am tempted to read
your words.

It isn't decorated right now and my expectation is that the right attribute
(or none) will be taken from the prototype so it will do the right thing.
But I'm not clear if _LIBCPP_NEW_DELETE_VIS is ok to put on the
definition as there may be some interest to do that for documentation
reasons but obviously not if doing that would change the meaning. We don't
decorate definitions generally currently, but there maybe a call to
consider doing that.

By the way, I really think we should rename some of these macros. I find
them too passive. _LIBCPP_FUNC_VIS etc. just feels like it's saying "I have
a visibility" but without saying what it is, I prefer DLL_PUBLIC or
something along with DLL_LOCAL. Anyone from a windows background will
likely totally not get the current names. If I'm correct, even non windows
people aren't immediately clear about what the gcc based names do. They
themselves feel the same:
http://gcc.gnu.org/wiki/Visibility

Anyone agree?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130927/39f76bcb/attachment.html>


More information about the cfe-commits mailing list