Does libc++ really need both _LIBCPP_INLINE_VISIBILITY and _LIBCPP_ALWAYS_INLINE?

Hi All,

Recently there has been a lot of work done on cleaning up libc++'s visibility annotations. To continue this work I would like to figure out why libc++ has two different macros, '_LIBCPP_INLINE_VISIBILITYand_LIBCPP_ALWAYS_INLINE`, for expressing function visibility. If there is no need for both macros I would like to remove one of them entirely.

On every platform and configuration except for Clang on Windows these macros have identical definitions. The definition is __attribute__((__visibility__("hidden"), __always_inline__)). (Note: libc++ detects “Windows” using _WIN32, so this affects mingw and other enviroments)

However the macros get different definitions when using Clang on Windows.

#define _LIBCPP_INLINE_VISIBILITY attribute((always_inline))
#define _LIBCPP_ALWAYS_INLINE attribute((visibility(“hidden”), always_inline))

I’m almost certain this difference is unintentional. However before I remove one in favor of the other I would like to be sure this is the correct thing to do.

I would like to find out if:

1.Do visibility attributes have any effect on windows? If not the two definitions are already functionally identical.
2. Is there any other reason we might need two different macros on windows?

Any input would be appreciated. I want to make sure I’m on the right path before making such a large change.

/Eric

Maybe it could affect linkage? Rafael or Reid would probably know.

In any case it looks strange. And does libc++ even have Windows support?

#define _LIBCPP_INLINE_VISIBILITY __attribute__((__always_inline__))
#define _LIBCPP_ALWAYS_INLINE __attribute__((__visibility__("hidden"),
__always_inline__))

I'm almost certain this difference is unintentional. However before I remove
one in favor of the other I would like to be sure this is the correct thing
to do.

I would like to find out if:

1.Do visibility attributes have any effect on windows? If not the two
definitions are already functionally identical.

Maybe it could affect linkage? Rafael or Reid would probably know.

In any case it looks strange. And does libc++ even have Windows support?

Sorry, no idea what hidden will expand to on COFF.

Cheers,
Rafael

In any case it looks strange. And does libc++ even have Windows support?

No, but various attempts have been made to add support, including trying to support Windows dllimport/export semantics.

Sorry, no idea what hidden will expand to on COFF.

Thanks. I was already pretty sure that the visibility attribute was an oversight. Not an intended difference.