Skip to content

Commit 758504b

Browse files
committed
[libc++] Simplify the visibility attributes
Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D128007
1 parent 4512dda commit 758504b

File tree

1 file changed

+14
-66
lines changed

1 file changed

+14
-66
lines changed

libcxx/include/__config

Lines changed: 14 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -527,42 +527,31 @@ typedef __char32_t char32_t;
527527
# define _LIBCPP_TEMPLATE_DATA_VIS
528528
# define _LIBCPP_ENUM_VIS
529529

530-
# endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
530+
# else
531531

532-
# ifndef _LIBCPP_HIDDEN
533532
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
534-
# define _LIBCPP_HIDDEN __attribute__((__visibility__("hidden")))
533+
# define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis)))
535534
# else
536-
# define _LIBCPP_HIDDEN
535+
# define _LIBCPP_VISIBILITY(vis)
537536
# endif
538-
# endif
539537

540-
# ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
538+
# define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden")
539+
# define _LIBCPP_FUNC_VIS _LIBCPP_VISIBILITY("default")
540+
# define _LIBCPP_TYPE_VIS _LIBCPP_VISIBILITY("default")
541+
# define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default")
542+
# define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default")
543+
# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")
544+
# define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBILITY("default")
545+
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default")
546+
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
547+
541548
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
542549
// The inline should be removed once PR32114 is resolved
543550
# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
544551
# else
545552
# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
546553
# endif
547-
# endif
548-
549-
# ifndef _LIBCPP_FUNC_VIS
550-
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
551-
# define _LIBCPP_FUNC_VIS __attribute__((__visibility__("default")))
552-
# else
553-
# define _LIBCPP_FUNC_VIS
554-
# endif
555-
# endif
556554

557-
# ifndef _LIBCPP_TYPE_VIS
558-
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
559-
# define _LIBCPP_TYPE_VIS __attribute__((__visibility__("default")))
560-
# else
561-
# define _LIBCPP_TYPE_VIS
562-
# endif
563-
# endif
564-
565-
# ifndef _LIBCPP_TEMPLATE_VIS
566555
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
567556
# if __has_attribute(__type_visibility__)
568557
# define _LIBCPP_TEMPLATE_VIS __attribute__((__type_visibility__("default")))
@@ -572,55 +561,14 @@ typedef __char32_t char32_t;
572561
# else
573562
# define _LIBCPP_TEMPLATE_VIS
574563
# endif
575-
# endif
576564

577-
# ifndef _LIBCPP_TEMPLATE_DATA_VIS
578-
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
579-
# define _LIBCPP_TEMPLATE_DATA_VIS __attribute__((__visibility__("default")))
580-
# else
581-
# define _LIBCPP_TEMPLATE_DATA_VIS
582-
# endif
583-
# endif
584-
585-
# ifndef _LIBCPP_EXPORTED_FROM_ABI
586-
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
587-
# define _LIBCPP_EXPORTED_FROM_ABI __attribute__((__visibility__("default")))
588-
# else
589-
# define _LIBCPP_EXPORTED_FROM_ABI
590-
# endif
591-
# endif
592-
593-
# ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
594-
# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
595-
# endif
596-
597-
# ifndef _LIBCPP_EXCEPTION_ABI
598-
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
599-
# define _LIBCPP_EXCEPTION_ABI __attribute__((__visibility__("default")))
600-
# else
601-
# define _LIBCPP_EXCEPTION_ABI
602-
# endif
603-
# endif
604-
605-
# ifndef _LIBCPP_ENUM_VIS
606565
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
607566
# define _LIBCPP_ENUM_VIS __attribute__((__type_visibility__("default")))
608567
# else
609568
# define _LIBCPP_ENUM_VIS
610569
# endif
611-
# endif
612570

613-
# ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
614-
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
615-
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__((__visibility__("default")))
616-
# else
617-
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
618-
# endif
619-
# endif
620-
621-
# ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
622-
# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
623-
# endif
571+
# endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
624572

625573
# if __has_attribute(internal_linkage)
626574
# define _LIBCPP_INTERNAL_LINKAGE __attribute__((internal_linkage))

0 commit comments

Comments
 (0)