[PATCH] D26950: [libc++abi] Add _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 21 17:32:33 PST 2016


smeenai created this revision.
smeenai added reviewers: EricWF, mclow.lists.
smeenai added a subscriber: cfe-commits.

It's useful to be able to disable visibility annotations entirely; for
example, if we're building libc++abi static to include in another library,
and we don't want any libc++abi functions getting exported out of that
library. This is a generalization of _LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT.


https://reviews.llvm.org/D26950

Files:
  include/__cxxabi_config.h


Index: include/__cxxabi_config.h
===================================================================
--- include/__cxxabi_config.h
+++ include/__cxxabi_config.h
@@ -22,7 +22,7 @@
 #endif
 
 #if defined(_WIN32)
- #if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+ #if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
   #define _LIBCXXABI_HIDDEN
   #define _LIBCXXABI_DATA_VIS
   #define _LIBCXXABI_FUNC_VIS
@@ -39,13 +39,20 @@
   #define _LIBCXXABI_TYPE_VIS __declspec(dllimport)
  #endif
 #else
- #define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden")))
- #define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default")))
- #define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default")))
- #if __has_attribute(__type_visibility__)
-  #define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default")))
+ #if !defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
+  #define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden")))
+  #define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default")))
+  #define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default")))
+  #if __has_attribute(__type_visibility__)
+   #define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default")))
+  #else
+   #define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default")))
+  #endif
  #else
-  #define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default")))
+  #define _LIBCXXABI_HIDDEN
+  #define _LIBCXXABI_DATA_VIS
+  #define _LIBCXXABI_FUNC_VIS
+  #define _LIBCXXABI_TYPE_VIS
  #endif
 #endif
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26950.78809.patch
Type: text/x-patch
Size: 1555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161122/01efbfa8/attachment-0001.bin>


More information about the cfe-commits mailing list