[libcxx-commits] [PATCH] D97168: [libcxx] Don't use dllimport for a static member in a template
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 23 06:57:53 PST 2021
mstorsjo updated this revision to Diff 325777.
mstorsjo retitled this revision from "[libcxx] [test] Add -Wno-dllimport-static-field-def when building tests" to "[libcxx] Don't use dllimport for a static member in a template".
mstorsjo edited the summary of this revision.
mstorsjo added a reviewer: rnk.
mstorsjo added a comment.
Added `_LIBCPP_DATA_VIS` as suggested by @rnk. A bit unsure about the naming though, as it's not data in general (which can be dllimported just fine), but static members in templates.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97168/new/
https://reviews.llvm.org/D97168
Files:
libcxx/include/__config
libcxx/include/string
Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -805,7 +805,7 @@
__compressed_pair<__rep, allocator_type> __r_;
public:
- _LIBCPP_FUNC_VIS
+ _LIBCPP_DATA_VIS
static const size_type npos = -1;
_LIBCPP_INLINE_VISIBILITY basic_string()
@@ -4404,7 +4404,7 @@
_LIBCPP_FUNC_VIS wstring to_wstring(long double __val);
template<class _CharT, class _Traits, class _Allocator>
-_LIBCPP_FUNC_VIS
+_LIBCPP_DATA_VIS
const typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::npos;
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -636,6 +636,7 @@
#define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS
#define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS
+#define _LIBCPP_DATA_VIS
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
#define _LIBCPP_HIDDEN
#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
@@ -669,6 +670,14 @@
# endif
#endif
+#ifndef _LIBCPP_DATA_VIS
+# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
+# define _LIBCPP_DATA_VIS __attribute__ ((__visibility__("default")))
+# else
+# define _LIBCPP_DATA_VIS
+# endif
+#endif
+
#ifndef _LIBCPP_TYPE_VIS
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97168.325777.patch
Type: text/x-patch
Size: 1531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210223/452d6318/attachment.bin>
More information about the libcxx-commits
mailing list