Index: docs/DesignDocs/VisibilityMacros.rst =================================================================== --- docs/DesignDocs/VisibilityMacros.rst +++ docs/DesignDocs/VisibilityMacros.rst @@ -47,18 +47,17 @@ A synonym for `_LIBCPP_INLINE_VISIBILITY` **_LIBCPP_TYPE_VIS** + Mark a type's typeinfo, vtable and members as having default visibility. + This attribute cannot be used on class templates. + +**_LIBCPP_TEMPLATE_VIS** Mark a type's typeinfo and vtable as having default visibility. - `_LIBCPP_TYPE_VIS`. This macro has no effect on the visibility of the - type's member functions. This attribute cannot be used on class templates. + This macro has no effect on the visibility of the type's member functions. **GCC Behavior**: GCC does not support Clang's `type_visibility(...)` attribute. With GCC the `visibility(...)` attribute is used and member functions are affected. -**_LIBCPP_TEMPLATE_VIS** - The same as `_LIBCPP_TYPE_VIS` except that it may be applied to class - templates. - **Windows Behavior**: DLLs do not support dllimport/export on class templates. The macro has an empty definition on this platform. Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -628,18 +628,22 @@ #ifndef _LIBCPP_TYPE_VIS # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# if __has_attribute(__type_visibility__) -# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default"))) -# else -# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) -# endif +# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) # else # define _LIBCPP_TYPE_VIS # endif #endif #ifndef _LIBCPP_TEMPLATE_VIS -# define _LIBCPP_TEMPLATE_VIS _LIBCPP_TYPE_VIS +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# if __has_attribute(__type_visibility__) +# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default"))) +# else +# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default"))) +# endif +# else +# define _LIBCPP_TEMPLATE_VIS +# endif #endif #ifndef _LIBCPP_FUNC_VIS_ONLY Index: include/__locale =================================================================== --- include/__locale +++ include/__locale @@ -92,13 +92,16 @@ const locale& operator=(const locale&) _NOEXCEPT; - template locale combine(const locale&) const; + template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + locale combine(const locale&) const; // locale operations: string name() const; bool operator==(const locale&) const; bool operator!=(const locale& __y) const {return !(*this == __y);} template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool operator()(const basic_string<_CharT, _Traits, _Allocator>&, const basic_string<_CharT, _Traits, _Allocator>&) const; Index: include/__mutex_base =================================================================== --- include/__mutex_base +++ include/__mutex_base @@ -316,20 +316,24 @@ void wait(unique_lock& __lk) _NOEXCEPT; template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS void wait(unique_lock& __lk, _Predicate __pred); template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS cv_status wait_until(unique_lock& __lk, const chrono::time_point<_Clock, _Duration>& __t); template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool wait_until(unique_lock& __lk, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred); template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS cv_status wait_for(unique_lock& __lk, const chrono::duration<_Rep, _Period>& __d); Index: include/condition_variable =================================================================== --- include/condition_variable +++ include/condition_variable @@ -133,12 +133,14 @@ void notify_all() _NOEXCEPT; template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS void wait(_Lock& __lock); template _LIBCPP_INLINE_VISIBILITY void wait(_Lock& __lock, _Predicate __pred); template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS cv_status wait_until(_Lock& __lock, const chrono::time_point<_Clock, _Duration>& __t); Index: include/future =================================================================== --- include/future +++ include/future @@ -582,6 +582,7 @@ _LIBCPP_INLINE_VISIBILITY wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const; template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS future_status wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const; @@ -1674,6 +1675,7 @@ public: promise(); template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS promise(allocator_arg_t, const _Allocator& __a); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY Index: include/mutex =================================================================== --- include/mutex +++ include/mutex @@ -248,6 +248,7 @@ bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::steady_clock::now() + __d);} template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); void unlock() _NOEXCEPT; }; @@ -291,6 +292,7 @@ bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::steady_clock::now() + __d);} template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); void unlock() _NOEXCEPT; }; Index: include/shared_mutex =================================================================== --- include/shared_mutex +++ include/shared_mutex @@ -220,6 +220,7 @@ return try_lock_until(chrono::steady_clock::now() + __rel_time); } template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time); void unlock(); @@ -235,6 +236,7 @@ return try_lock_shared_until(chrono::steady_clock::now() + __rel_time); } template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time); void unlock_shared(); Index: include/thread =================================================================== --- include/thread +++ include/thread @@ -298,9 +298,12 @@ !is_same::type, thread>::value >::type > + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp&& __f, _Args&&... __args); #else // _LIBCPP_HAS_NO_VARIADICS - template explicit thread(_Fp __f); + template + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS + explicit thread(_Fp __f); #endif ~thread();