[PATCH] D35388: [libc++] Give extern templates default visibility on gcc

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 12 10:29:58 PST 2021


smeenai updated this revision to Diff 316161.
smeenai added a comment.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D35388/new/

https://reviews.llvm.org/D35388

Files:
  libcxx/docs/DesignDocs/VisibilityMacros.rst
  libcxx/include/__config


Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -715,7 +715,7 @@
 #endif
 
 #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
-#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
+#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
 #    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
 #  else
 #    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
Index: libcxx/docs/DesignDocs/VisibilityMacros.rst
===================================================================
--- libcxx/docs/DesignDocs/VisibilityMacros.rst
+++ libcxx/docs/DesignDocs/VisibilityMacros.rst
@@ -131,12 +131,6 @@
   specified on the primary template and to export the member functions produced
   by the explicit instantiation in the dylib.
 
-  **GCC Behavior**: GCC ignores visibility attributes applied the type in
-  extern template declarations and applying an attribute results in a warning.
-  However since `_LIBCPP_TEMPLATE_VIS` is the same as
-  `__attribute__((visibility("default"))` the visibility is already correct.
-  The macro has an empty definition with GCC.
-
   **Windows Behavior**: `extern template` and `dllexport` are fundamentally
   incompatible *on a class template* on Windows; the former suppresses
   instantiation, while the latter forces it. Specifying both on the same


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35388.316161.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210112/ac288052/attachment.bin>


More information about the cfe-commits mailing list