[libcxx-commits] [libcxx] 758504b - [libc++] Simplify the visibility attributes
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 22 16:30:53 PDT 2022
Author: Nikolas Klauser
Date: 2022-06-23T01:30:32+02:00
New Revision: 758504b8ab64cff98a862a4f4e022ab4e069f3f1
URL: https://github.com/llvm/llvm-project/commit/758504b8ab64cff98a862a4f4e022ab4e069f3f1
DIFF: https://github.com/llvm/llvm-project/commit/758504b8ab64cff98a862a4f4e022ab4e069f3f1.diff
LOG: [libc++] Simplify the visibility attributes
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D128007
Added:
Modified:
libcxx/include/__config
Removed:
################################################################################
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 6f02a3a97596..11f934c0edf3 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -527,42 +527,31 @@ typedef __char32_t char32_t;
# define _LIBCPP_TEMPLATE_DATA_VIS
# define _LIBCPP_ENUM_VIS
-# endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
+# else
-# ifndef _LIBCPP_HIDDEN
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
-# define _LIBCPP_HIDDEN __attribute__((__visibility__("hidden")))
+# define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis)))
# else
-# define _LIBCPP_HIDDEN
+# define _LIBCPP_VISIBILITY(vis)
# endif
-# endif
-# ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+# define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden")
+# define _LIBCPP_FUNC_VIS _LIBCPP_VISIBILITY("default")
+# define _LIBCPP_TYPE_VIS _LIBCPP_VISIBILITY("default")
+# define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default")
+# define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default")
+# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")
+# define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBILITY("default")
+# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default")
+# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
+
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
// The inline should be removed once PR32114 is resolved
# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
# else
# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
# endif
-# endif
-
-# ifndef _LIBCPP_FUNC_VIS
-# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
-# define _LIBCPP_FUNC_VIS __attribute__((__visibility__("default")))
-# else
-# define _LIBCPP_FUNC_VIS
-# endif
-# endif
-# ifndef _LIBCPP_TYPE_VIS
-# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
-# define _LIBCPP_TYPE_VIS __attribute__((__visibility__("default")))
-# else
-# define _LIBCPP_TYPE_VIS
-# endif
-# endif
-
-# ifndef _LIBCPP_TEMPLATE_VIS
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
# if __has_attribute(__type_visibility__)
# define _LIBCPP_TEMPLATE_VIS __attribute__((__type_visibility__("default")))
@@ -572,55 +561,14 @@ typedef __char32_t char32_t;
# else
# define _LIBCPP_TEMPLATE_VIS
# endif
-# endif
-# ifndef _LIBCPP_TEMPLATE_DATA_VIS
-# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
-# define _LIBCPP_TEMPLATE_DATA_VIS __attribute__((__visibility__("default")))
-# else
-# define _LIBCPP_TEMPLATE_DATA_VIS
-# endif
-# endif
-
-# ifndef _LIBCPP_EXPORTED_FROM_ABI
-# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
-# define _LIBCPP_EXPORTED_FROM_ABI __attribute__((__visibility__("default")))
-# else
-# define _LIBCPP_EXPORTED_FROM_ABI
-# endif
-# endif
-
-# ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
-# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
-# endif
-
-# ifndef _LIBCPP_EXCEPTION_ABI
-# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
-# define _LIBCPP_EXCEPTION_ABI __attribute__((__visibility__("default")))
-# else
-# define _LIBCPP_EXCEPTION_ABI
-# endif
-# endif
-
-# ifndef _LIBCPP_ENUM_VIS
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
# define _LIBCPP_ENUM_VIS __attribute__((__type_visibility__("default")))
# else
# define _LIBCPP_ENUM_VIS
# endif
-# endif
-# ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
-# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
-# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__((__visibility__("default")))
-# else
-# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
-# endif
-# endif
-
-# ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
-# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
-# endif
+# endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
# if __has_attribute(internal_linkage)
# define _LIBCPP_INTERNAL_LINKAGE __attribute__((internal_linkage))
More information about the libcxx-commits
mailing list