diff --git a/libcxx/.clang-format b/libcxx/.clang-format --- a/libcxx/.clang-format +++ b/libcxx/.clang-format @@ -28,7 +28,6 @@ '_LIBCPP_TEMPLATE_DATA_VIS', '_LIBCPP_EXPORTED_FROM_ABI', '_LIBCPP_OVERRIDABLE_FUNC_VIS', - '_LIBCPP_ENUM_VIS', '_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS', '_LIBCPP_INTERNAL_LINKAGE', '_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION', diff --git a/libcxx/docs/DesignDocs/VisibilityMacros.rst b/libcxx/docs/DesignDocs/VisibilityMacros.rst --- a/libcxx/docs/DesignDocs/VisibilityMacros.rst +++ b/libcxx/docs/DesignDocs/VisibilityMacros.rst @@ -72,19 +72,6 @@ **Windows Behavior**: DLLs do not support dllimport/export on class templates. The macro has an empty definition on this platform. - -**_LIBCPP_ENUM_VIS** - Mark the typeinfo of an enum as having default visibility. This attribute - should be applied to all enum declarations. - - **Windows Behavior**: DLLs do not support importing or exporting enumeration - typeinfo. The macro has an empty definition on this platform. - - **GCC Behavior**: GCC un-hides the typeinfo for enumerations by default, even - if `-fvisibility=hidden` is specified. Additionally applying a visibility - attribute to an enum class results in a warning. The macro has an empty - definition with GCC. - **_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS** Mark the member functions, typeinfo, and vtable of the type named in an extern template declaration as being exported by the libc++ library. diff --git a/libcxx/include/__charconv/chars_format.h b/libcxx/include/__charconv/chars_format.h --- a/libcxx/include/__charconv/chars_format.h +++ b/libcxx/include/__charconv/chars_format.h @@ -21,7 +21,7 @@ #if _LIBCPP_STD_VER >= 17 -enum class _LIBCPP_ENUM_VIS chars_format { scientific = 0x1, fixed = 0x2, hex = 0x4, general = fixed | scientific }; +enum class chars_format { scientific = 0x1, fixed = 0x2, hex = 0x4, general = fixed | scientific }; inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator~(chars_format __x) { return chars_format(~std::__to_underlying(__x)); diff --git a/libcxx/include/__compare/ordering.h b/libcxx/include/__compare/ordering.h --- a/libcxx/include/__compare/ordering.h +++ b/libcxx/include/__compare/ordering.h @@ -22,13 +22,13 @@ #if _LIBCPP_STD_VER >= 20 // exposition only -enum class _LIBCPP_ENUM_VIS _OrdResult : signed char { +enum class _OrdResult : signed char { __less = -1, __equiv = 0, __greater = 1 }; -enum class _LIBCPP_ENUM_VIS _NCmpResult : signed char { +enum class _NCmpResult : signed char { __unordered = -127 }; diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -543,7 +543,6 @@ # define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS # define _LIBCPP_TEMPLATE_VIS # define _LIBCPP_TEMPLATE_DATA_VIS -# define _LIBCPP_ENUM_VIS # else @@ -571,20 +570,16 @@ # define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS # endif -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# if __has_attribute(__type_visibility__) -# define _LIBCPP_TEMPLATE_VIS __attribute__((__type_visibility__("default"))) -# else -# define _LIBCPP_TEMPLATE_VIS __attribute__((__visibility__("default"))) -# endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && !__has_attribute(__type_visibility__) +# define _LIBCPP_TEMPLATE_VIS __attribute__((__visibility__("default"))) # else # define _LIBCPP_TEMPLATE_VIS # endif # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) -# define _LIBCPP_ENUM_VIS __attribute__((__type_visibility__("default"))) +# define _LIBCPP_TYPE_VISIBILITY_DEFAULT __attribute__((__type_visibility__("default"))) # else -# define _LIBCPP_ENUM_VIS +# define _LIBCPP_TYPE_VISIBILITY_DEFAULT # endif # endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) @@ -658,7 +653,8 @@ // Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect. // clang-format off -# define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE { +# define _LIBCPP_BEGIN_NAMESPACE_STD namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT _LIBCPP_HIDDEN std { \ + inline namespace _LIBCPP_ABI_NAMESPACE { # define _LIBCPP_END_NAMESPACE_STD }} # define _VSTD std @@ -711,7 +707,7 @@ // clang-format on # else // _LIBCPP_CXX03_LANG -# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x +# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class x # define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) # endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__filesystem/copy_options.h b/libcxx/include/__filesystem/copy_options.h --- a/libcxx/include/__filesystem/copy_options.h +++ b/libcxx/include/__filesystem/copy_options.h @@ -23,7 +23,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH -enum class _LIBCPP_ENUM_VIS copy_options : unsigned short { +enum class copy_options : unsigned short { none = 0, skip_existing = 1, overwrite_existing = 2, diff --git a/libcxx/include/__filesystem/directory_options.h b/libcxx/include/__filesystem/directory_options.h --- a/libcxx/include/__filesystem/directory_options.h +++ b/libcxx/include/__filesystem/directory_options.h @@ -23,7 +23,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH -enum class _LIBCPP_ENUM_VIS directory_options : unsigned char { +enum class directory_options : unsigned char { none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 diff --git a/libcxx/include/__filesystem/file_type.h b/libcxx/include/__filesystem/file_type.h --- a/libcxx/include/__filesystem/file_type.h +++ b/libcxx/include/__filesystem/file_type.h @@ -23,7 +23,7 @@ // On Windows, the library never identifies files as block, character, fifo // or socket. -enum class _LIBCPP_ENUM_VIS file_type : signed char { +enum class file_type : signed char { none = 0, not_found = -1, regular = 1, diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h --- a/libcxx/include/__filesystem/path.h +++ b/libcxx/include/__filesystem/path.h @@ -464,7 +464,7 @@ typedef basic_string string_type; typedef basic_string_view __string_view; - enum _LIBCPP_ENUM_VIS format : unsigned char { + enum format : unsigned char { auto_format, native_format, generic_format diff --git a/libcxx/include/__filesystem/perm_options.h b/libcxx/include/__filesystem/perm_options.h --- a/libcxx/include/__filesystem/perm_options.h +++ b/libcxx/include/__filesystem/perm_options.h @@ -23,7 +23,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH -enum class _LIBCPP_ENUM_VIS perm_options : unsigned char { +enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, diff --git a/libcxx/include/__filesystem/perms.h b/libcxx/include/__filesystem/perms.h --- a/libcxx/include/__filesystem/perms.h +++ b/libcxx/include/__filesystem/perms.h @@ -27,7 +27,7 @@ // file, and the executable bit is always returned as set. When setting // permissions, as long as the write bit is set for either owner, group or // others, the readonly flag is cleared. -enum class _LIBCPP_ENUM_VIS perms : unsigned { +enum class perms : unsigned { none = 0, owner_read = 0400, diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h --- a/libcxx/include/__format/format_arg.h +++ b/libcxx/include/__format/format_arg.h @@ -54,7 +54,7 @@ /// handle to satisfy the user observable behaviour. The internal function /// __visit_format_arg doesn't do this wrapping. So in the format functions /// this function is used to avoid unneeded overhead. -enum class _LIBCPP_ENUM_VIS __arg_t : uint8_t { +enum class __arg_t : uint8_t { __none, __boolean, __char_type, diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h --- a/libcxx/include/__format/formatter_output.h +++ b/libcxx/include/__format/formatter_output.h @@ -491,7 +491,7 @@ return static_cast>(__value); } -enum class _LIBCPP_ENUM_VIS __escape_quotation_mark { __apostrophe, __double_quote }; +enum class __escape_quotation_mark { __apostrophe, __double_quote }; // [format.string.escaped]/2 template diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h --- a/libcxx/include/__format/parser_std_format_spec.h +++ b/libcxx/include/__format/parser_std_format_spec.h @@ -160,7 +160,7 @@ inline constexpr __fields __fields_fill_align_width{}; # endif -enum class _LIBCPP_ENUM_VIS __alignment : uint8_t { +enum class __alignment : uint8_t { /// No alignment is set in the format string. __default, __left, @@ -169,7 +169,7 @@ __zero_padding }; -enum class _LIBCPP_ENUM_VIS __sign : uint8_t { +enum class __sign : uint8_t { /// No sign is set in the format string. /// /// The sign isn't allowed for certain format-types. By using this value @@ -181,7 +181,7 @@ __space }; -enum class _LIBCPP_ENUM_VIS __type : uint8_t { +enum class __type : uint8_t { __default, __string, __binary_lower_case, diff --git a/libcxx/include/__fwd/subrange.h b/libcxx/include/__fwd/subrange.h --- a/libcxx/include/__fwd/subrange.h +++ b/libcxx/include/__fwd/subrange.h @@ -23,7 +23,7 @@ namespace ranges { -enum class _LIBCPP_ENUM_VIS subrange_kind : bool { unsized, sized }; +enum class subrange_kind : bool { unsized, sized }; template _Sent, subrange_kind _Kind> requires(_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent, _Iter>) diff --git a/libcxx/include/new b/libcxx/include/new --- a/libcxx/include/new +++ b/libcxx/include/new @@ -185,7 +185,7 @@ #if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && \ !defined(_LIBCPP_ABI_VCRUNTIME) #ifndef _LIBCPP_CXX03_LANG -enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; +enum class align_val_t : size_t { }; #else enum align_val_t { __zero = 0, __max = (size_t)-1 }; #endif