diff options
| author | 2019-06-17 22:28:47 +0000 | |
|---|---|---|
| committer | 2019-06-17 22:28:47 +0000 | |
| commit | 308ed93135e1e5919c16767bd98e8835e42e613b (patch) | |
| tree | 96ea3d17c9198fdc432e974c60f2ce769bf38ec4 /lib/libcxx/include | |
| parent | Import libunwind 8.0.0. (diff) | |
| download | wireguard-openbsd-308ed93135e1e5919c16767bd98e8835e42e613b.tar.xz wireguard-openbsd-308ed93135e1e5919c16767bd98e8835e42e613b.zip | |
Merge libc++, libc++abi and libunwind version 8.0.0.
Ports build by naddy@
Tested by visa on octeon
Tested by kettenis on macppc and sparc64
Diffstat (limited to 'lib/libcxx/include')
| -rw-r--r-- | lib/libcxx/include/__config | 283 | ||||
| -rw-r--r-- | lib/libcxx/include/__locale | 16 | ||||
| -rw-r--r-- | lib/libcxx/include/experimental/dynarray | 305 |
3 files changed, 183 insertions, 421 deletions
diff --git a/lib/libcxx/include/__config b/lib/libcxx/include/__config index d6942af125d..5295b77d4cf 100644 --- a/lib/libcxx/include/__config +++ b/lib/libcxx/include/__config @@ -33,14 +33,10 @@ # define _GNUC_VER_NEW 0 #endif -#define _LIBCPP_VERSION 7000 +#define _LIBCPP_VERSION 8000 #ifndef _LIBCPP_ABI_VERSION -# ifdef __Fuchsia__ -# define _LIBCPP_ABI_VERSION 2 -# else -# define _LIBCPP_ABI_VERSION 1 -# endif +# define _LIBCPP_ABI_VERSION 1 #endif #ifndef _LIBCPP_STD_VER @@ -99,6 +95,8 @@ // Use the smallest possible integer type to represent the index of the variant. // Previously libc++ used "unsigned int" exclusivly. # define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION +// Unstable attempt to provide a more optimized std::function +# define _LIBCPP_ABI_OPTIMIZED_FUNCTION #elif _LIBCPP_ABI_VERSION == 1 # if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inline methods into the dylib to support @@ -123,7 +121,9 @@ #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) -#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) +#ifndef _LIBCPP_ABI_NAMESPACE +# define _LIBCPP_ABI_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) +#endif #if __cplusplus < 201103L #define _LIBCPP_CXX03_LANG @@ -362,6 +362,18 @@ # endif // __linux__ #endif +#ifndef _LIBCPP_CXX03_LANG +# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) +#elif defined(_LIBCPP_COMPILER_CLANG) +# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) +#else +// This definition is potentially buggy, but it's only taken with GCC in C++03, +// which we barely support anyway. See llvm.org/PR39713 +# define _LIBCPP_ALIGNOF(_Tp) __alignof(_Tp) +#endif + +#define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) + #if defined(_LIBCPP_COMPILER_CLANG) // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for @@ -376,7 +388,7 @@ # define _ALIGNAS_TYPE(x) alignas(x) # define _ALIGNAS(x) alignas(x) #else -# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) +# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) # define _ALIGNAS(x) __attribute__((__aligned__(x))) #endif @@ -476,16 +488,6 @@ typedef __char32_t char32_t; #define _LIBCPP_IS_LITERAL(T) __is_literal(T) #endif -// Inline namespaces are available in Clang regardless of C++ dialect. -#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { -#define _LIBCPP_END_NAMESPACE_STD } } -#define _VSTD std::_LIBCPP_NAMESPACE - -namespace std { - inline namespace _LIBCPP_NAMESPACE { - } -} - #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer) #define _LIBCPP_HAS_NO_ASAN #endif @@ -505,10 +507,15 @@ namespace std { #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +// No apple compilers support ""d and ""y at this time. +#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__) +#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS +#endif + #elif defined(_LIBCPP_COMPILER_GCC) #define _ALIGNAS(x) __attribute__((__aligned__(x))) -#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) +#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) #define _LIBCPP_NORETURN __attribute__((noreturn)) @@ -575,15 +582,6 @@ namespace std { #endif // __GXX_EXPERIMENTAL_CXX0X__ -#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE { -#define _LIBCPP_END_NAMESPACE_STD } } -#define _VSTD std::_LIBCPP_NAMESPACE - -namespace std { - inline namespace _LIBCPP_NAMESPACE { - } -} - #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__) #define _LIBCPP_HAS_NO_ASAN #endif @@ -619,13 +617,6 @@ namespace std { #define _ALIGNAS_TYPE(x) alignas(x) #define _LIBCPP_HAS_NO_VARIADICS -#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { -#define _LIBCPP_END_NAMESPACE_STD } -#define _VSTD std - -namespace std { -} - #define _LIBCPP_WEAK #define _LIBCPP_HAS_NO_ASAN @@ -637,7 +628,7 @@ namespace std { #elif defined(_LIBCPP_COMPILER_IBM) #define _ALIGNAS(x) __attribute__((__aligned__(x))) -#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) +#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) #define _ATTRIBUTE(x) __attribute__((x)) #define _LIBCPP_NORETURN __attribute__((noreturn)) @@ -653,15 +644,6 @@ namespace std { #define __MULTILOCALE_API #endif -#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { -#define _LIBCPP_END_NAMESPACE_STD } } -#define _VSTD std::_LIBCPP_NAMESPACE - -namespace std { - inline namespace _LIBCPP_NAMESPACE { - } -} - #define _LIBCPP_HAS_NO_ASAN #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) @@ -670,20 +652,6 @@ namespace std { #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] -#if _LIBCPP_STD_VER >= 17 -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { -#else -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { -#endif - -#define _LIBCPP_END_NAMESPACE_FILESYSTEM \ - _LIBCPP_END_NAMESPACE_STD } } - -#define _VSTD_FS _VSTD::__fs::filesystem - - #if defined(_LIBCPP_OBJECT_FORMAT_COFF) #ifdef _DLL @@ -697,33 +665,29 @@ namespace std { # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS # define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_EXPORTED_FROM_ABI #elif defined(_LIBCPP_BUILDING_LIBRARY) # define _LIBCPP_DLL_VIS __declspec(dllexport) # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport) #else # define _LIBCPP_DLL_VIS __declspec(dllimport) # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS # define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport) #endif #define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS #define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS -#define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS #define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS #define _LIBCPP_HIDDEN #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS #define _LIBCPP_TEMPLATE_VIS #define _LIBCPP_ENUM_VIS -#if defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline -#else -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__)) -#endif - #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) #ifndef _LIBCPP_HIDDEN @@ -771,8 +735,12 @@ namespace std { # endif #endif -#ifndef _LIBCPP_EXTERN_VIS -#define _LIBCPP_EXTERN_VIS +#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 @@ -813,6 +781,15 @@ namespace std { # define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE #endif +#if __has_attribute(exclude_from_explicit_instantiation) +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__ ((__exclude_from_explicit_instantiation__)) +#else + // Try to approximate the effect of exclude_from_explicit_instantiation + // (which is that entities are not assumed to be provided by explicit + // template instantitations in the dylib) by always inlining those entities. +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE +#endif + #ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU # ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT # define _LIBCPP_HIDE_FROM_ABI_PER_TU 0 @@ -825,21 +802,42 @@ namespace std { # if _LIBCPP_HIDE_FROM_ABI_PER_TU # define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE # else -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_ALWAYS_INLINE +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION # endif #endif -// Just so we can migrate to _LIBCPP_HIDE_FROM_ABI gradually. -#define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI - -#ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) +#ifdef _LIBCPP_BUILDING_LIBRARY +# if _LIBCPP_ABI_VERSION > 1 +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI # else -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__)) +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 # endif +#else +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI +#endif + +// Just so we can migrate to the new macros gradually. +#define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI + +// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect. +#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE { +#define _LIBCPP_END_NAMESPACE_STD } } +#define _VSTD std::_LIBCPP_ABI_NAMESPACE +_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 17 +#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { +#else +#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { #endif +#define _LIBCPP_END_NAMESPACE_FILESYSTEM \ + _LIBCPP_END_NAMESPACE_STD } } + +#define _VSTD_FS _VSTD::__fs::filesystem + #ifndef _LIBCPP_PREFERRED_OVERLOAD # if __has_attribute(__enable_if__) # define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, ""))) @@ -1000,7 +998,14 @@ template <unsigned> struct __static_assert_check {}; // If we are getting operator new from the MSVC CRT, then allocation overloads // for align_val_t were added in 19.12, aka VS 2017 version 15.3. #if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912 -#define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +#elif defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) +# define _LIBCPP_DEFER_NEW_TO_VCRUNTIME +# if !defined(__cpp_aligned_new) + // We're defering to Microsoft's STL to provide aligned new et al. We don't + // have it unless the language feature test macro is defined. +# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +# endif #endif #if defined(__APPLE__) @@ -1008,16 +1013,11 @@ template <unsigned> struct __static_assert_check {}; defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) # define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ # endif -# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 -# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION -# endif -# endif #endif // defined(__APPLE__) #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \ - !defined(_LIBCPP_BUILDING_LIBRARY) && \ - (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) + (defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \ + (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)) # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION #endif @@ -1029,18 +1029,46 @@ template <unsigned> struct __static_assert_check {}; #define _LIBCPP_WCTYPE_IS_MASK #endif -#if _LIBCPP_STD_VER > 11 -# define _LIBCPP_DEPRECATED [[deprecated]] +#if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) +#define _LIBCPP_NO_HAS_CHAR8_T +#endif + +// Deprecation macros. +// Deprecations warnings are only enabled when _LIBCPP_ENABLE_DEPRECATION_WARNINGS is defined. +#if defined(_LIBCPP_ENABLE_DEPRECATION_WARNINGS) +# if __has_attribute(deprecated) +# define _LIBCPP_DEPRECATED __attribute__ ((deprecated)) +# elif _LIBCPP_STD_VER > 11 +# define _LIBCPP_DEPRECATED [[deprecated]] +# else +# define _LIBCPP_DEPRECATED +# endif #else # define _LIBCPP_DEPRECATED #endif +#if !defined(_LIBCPP_CXX03_LANG) +# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED +#else +# define _LIBCPP_DEPRECATED_IN_CXX11 +#endif + +#if _LIBCPP_STD_VER >= 14 +# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED +#else +# define _LIBCPP_DEPRECATED_IN_CXX14 +#endif + +#if _LIBCPP_STD_VER >= 17 +# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED +#else +# define _LIBCPP_DEPRECATED_IN_CXX17 +#endif + #if _LIBCPP_STD_VER <= 11 # define _LIBCPP_EXPLICIT_AFTER_CXX11 -# define _LIBCPP_DEPRECATED_AFTER_CXX11 #else # define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit -# define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] #endif #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) @@ -1061,8 +1089,30 @@ template <unsigned> struct __static_assert_check {}; # define _LIBCPP_CONSTEXPR_AFTER_CXX17 #endif -#if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) -# define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]] +// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other +// NODISCARD macros to the correct attribute. +#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC) +# define _LIBCPP_NODISCARD_ATTRIBUTE [[nodiscard]] +#elif defined(_LIBCPP_COMPILER_CLANG) && !defined(_LIBCPP_CXX03_LANG) +# define _LIBCPP_NODISCARD_ATTRIBUTE [[clang::warn_unused_result]] +#else +// We can't use GCC's [[gnu::warn_unused_result]] and +// __attribute__((warn_unused_result)), because GCC does not silence them via +// (void) cast. +# define _LIBCPP_NODISCARD_ATTRIBUTE +#endif + +// _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not +// specified as such as an extension. +#if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT) +# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD_ATTRIBUTE +#else +# define _LIBCPP_NODISCARD_EXT +#endif + +#if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && \ + (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD)) +# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD_ATTRIBUTE #else # define _LIBCPP_NODISCARD_AFTER_CXX17 #endif @@ -1119,6 +1169,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( defined(__Fuchsia__) || \ defined(__NetBSD__) || \ defined(__linux__) || \ + defined(__GNU__) || \ defined(__APPLE__) || \ defined(__CloudABI__) || \ defined(__sun__) || \ @@ -1226,8 +1277,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( # define _LIBCPP_DIAGNOSE_ERROR(...) #endif -#if __has_attribute(fallthough) || _GNUC_VER >= 700 // Use a function like macro to imply that it must be followed by a semicolon +#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) +# define _LIBCPP_FALLTHROUGH() [[fallthrough]] +#elif __has_cpp_attribute(clang::fallthrough) +# define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]] +#elif __has_attribute(fallthough) || _GNUC_VER >= 700 # define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) #else # define _LIBCPP_FALLTHROUGH() ((void)0) @@ -1281,9 +1336,15 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) -# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) -# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable)) -# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable)) +# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \ + __attribute__((availability(macosx,strict,introduced=10.14))) \ + __attribute__((availability(ios,strict,introduced=12.0))) \ + __attribute__((availability(tvos,strict,introduced=12.0))) \ + __attribute__((availability(watchos,strict,introduced=5.0))) +# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \ + _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS +# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \ + _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ __attribute__((availability(macosx,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ @@ -1307,8 +1368,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( __attribute__((availability(ios,strict,introduced=7.0))) #else # define _LIBCPP_AVAILABILITY_SHARED_MUTEX +# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS -# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE @@ -1320,26 +1381,30 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( // Define availability that depends on _LIBCPP_NO_EXCEPTIONS. #ifdef _LIBCPP_NO_EXCEPTIONS -# define _LIBCPP_AVAILABILITY_DYNARRAY # define _LIBCPP_AVAILABILITY_FUTURE # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST +# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS +# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS #else -# define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH -# define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR -# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST \ - _LIBCPP_AVAILABILITY_BAD_ANY_CAST -#endif - -// Availability of stream API in the dylib got dropped and re-added. The -// extern template should effectively be available at: -// availability(macosx,introduced=10.9) -// availability(ios,introduced=7.0) -#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) && \ +# define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR +# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST +# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS +# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS +#endif + +// The stream API was dropped and re-added in the dylib shipped on macOS +// and iOS. We can only assume the dylib to provide these definitions for +// macosx >= 10.9 and ios >= 7.0. Otherwise, the definitions are available +// from the headers, but not from the dylib. Explicit instantiation +// declarations for streams exist conditionally to this; if we provide +// an explicit instantiation declaration and we try to deploy to a dylib +// that does not provide those symbols, we'll get a load-time error. +#if !defined(_LIBCPP_BUILDING_LIBRARY) && \ ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000)) -#define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE +# define _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB #endif #if defined(_LIBCPP_COMPILER_IBM) @@ -1382,6 +1447,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( # endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) #endif // _LIBCPP_NO_AUTO_LINK +#define _LIBCPP_UNUSED_VAR(x) ((void)(x)) + #endif // __cplusplus #endif // _LIBCPP_CONFIG diff --git a/lib/libcxx/include/__locale b/lib/libcxx/include/__locale index 79063e08c85..af5e5d02e83 100644 --- a/lib/libcxx/include/__locale +++ b/lib/libcxx/include/__locale @@ -1255,13 +1255,13 @@ struct __narrow_to_utf8<8> }; template <> -struct __narrow_to_utf8<16> +struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16> : public codecvt<char16_t, char, mbstate_t> { _LIBCPP_INLINE_VISIBILITY __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} - ~__narrow_to_utf8(); + _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8(); template <class _OutputIterator, class _CharT> _LIBCPP_INLINE_VISIBILITY @@ -1289,13 +1289,13 @@ struct __narrow_to_utf8<16> }; template <> -struct __narrow_to_utf8<32> +struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<32> : public codecvt<char32_t, char, mbstate_t> { _LIBCPP_INLINE_VISIBILITY __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} - ~__narrow_to_utf8(); + _LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8(); template <class _OutputIterator, class _CharT> _LIBCPP_INLINE_VISIBILITY @@ -1345,13 +1345,13 @@ struct __widen_from_utf8<8> }; template <> -struct __widen_from_utf8<16> +struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16> : public codecvt<char16_t, char, mbstate_t> { _LIBCPP_INLINE_VISIBILITY __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} - ~__widen_from_utf8(); + _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8(); template <class _OutputIterator> _LIBCPP_INLINE_VISIBILITY @@ -1379,13 +1379,13 @@ struct __widen_from_utf8<16> }; template <> -struct __widen_from_utf8<32> +struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32> : public codecvt<char32_t, char, mbstate_t> { _LIBCPP_INLINE_VISIBILITY __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} - ~__widen_from_utf8(); + _LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8(); template <class _OutputIterator> _LIBCPP_INLINE_VISIBILITY diff --git a/lib/libcxx/include/experimental/dynarray b/lib/libcxx/include/experimental/dynarray deleted file mode 100644 index a60c87c3f97..00000000000 --- a/lib/libcxx/include/experimental/dynarray +++ /dev/null @@ -1,305 +0,0 @@ -// -*- C++ -*- -//===-------------------------- dynarray ----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_DYNARRAY -#define _LIBCPP_DYNARRAY - -/* - dynarray synopsis - -namespace std { namespace experimental { - -template< typename T > -class dynarray -{ - // types: - typedef T value_type; - typedef T& reference; - typedef const T& const_reference; - typedef T* pointer; - typedef const T* const_pointer; - typedef implementation-defined iterator; - typedef implementation-defined const_iterator; - typedef reverse_iterator<iterator> reverse_iterator; - typedef reverse_iterator<const_iterator> const_reverse_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - -public: - // construct/copy/destroy: - explicit dynarray(size_type c); - dynarray(size_type c, const T& v); - dynarray(const dynarray& d); - dynarray(initializer_list<T>); - - template <class Alloc> - dynarray(allocator_arg_t, const Alloc& a, size_type c, const Alloc& alloc); - template <class Alloc> - dynarray(allocator_arg_t, const Alloc& a, size_type c, const T& v, const Alloc& alloc); - template <class Alloc> - dynarray(allocator_arg_t, const Alloc& a, const dynarray& d, const Alloc& alloc); - template <class Alloc> - dynarray(allocator_arg_t, const Alloc& a, initializer_list<T>, const Alloc& alloc); - dynarray& operator=(const dynarray&) = delete; - ~dynarray(); - - // iterators: - iterator begin() noexcept; - const_iterator begin() const noexcept; - const_iterator cbegin() const noexcept; - iterator end() noexcept; - const_iterator end() const noexcept; - const_iterator cend() const noexcept; - - reverse_iterator rbegin() noexcept; - const_reverse_iterator rbegin() const noexcept; - const_reverse_iterator crbegin() const noexcept; - reverse_iterator rend() noexcept; - const_reverse_iterator rend() const noexcept; - const_reverse_iterator crend() const noexcept; - - // capacity: - size_type size() const noexcept; - size_type max_size() const noexcept; - bool empty() const noexcept; - - // element access: - reference operator[](size_type n); - const_reference operator[](size_type n) const; - - reference front(); - const_reference front() const; - reference back(); - const_reference back() const; - - const_reference at(size_type n) const; - reference at(size_type n); - - // data access: - T* data() noexcept; - const T* data() const noexcept; - - // mutating member functions: - void fill(const T& v); -}; - -}} // std::experimental - -*/ -#include <__config> -#if _LIBCPP_STD_VER > 11 - -#include <__functional_base> -#include <iterator> -#include <stdexcept> -#include <initializer_list> -#include <new> -#include <algorithm> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -namespace std { namespace experimental { inline namespace __array_extensions_v1 { - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_DYNARRAY dynarray -{ -public: - // types: - typedef dynarray __self; - typedef _Tp value_type; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef value_type* iterator; - typedef const value_type* const_iterator; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - -private: - size_t __size_; - value_type * __base_; - _LIBCPP_INLINE_VISIBILITY dynarray () noexcept : __size_(0), __base_(nullptr) {} - - static inline _LIBCPP_INLINE_VISIBILITY - value_type* __allocate(size_t __count) { - if (numeric_limits<size_t>::max() / sizeof (value_type) <= __count) - __throw_bad_array_length(); - - return static_cast<value_type *>( - _VSTD::__libcpp_allocate(sizeof(value_type) * __count, __alignof(value_type))); - } - - static inline _LIBCPP_INLINE_VISIBILITY - void __deallocate_value(value_type* __ptr ) noexcept { - _VSTD::__libcpp_deallocate(static_cast<void *>(__ptr), __alignof(value_type)); - } - -public: - - _LIBCPP_INLINE_VISIBILITY - explicit dynarray(size_type __c); - _LIBCPP_INLINE_VISIBILITY - dynarray(size_type __c, const value_type& __v); - _LIBCPP_INLINE_VISIBILITY - dynarray(const dynarray& __d); - _LIBCPP_INLINE_VISIBILITY - dynarray(initializer_list<value_type>); - -// We're not implementing these right now. -// Updated with the resolution of LWG issue #2255 -// template <typename _Alloc> -// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c); -// template <typename _Alloc> -// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c, const value_type& __v); -// template <typename _Alloc> -// dynarray(allocator_arg_t, const _Alloc& __alloc, const dynarray& __d); -// template <typename _Alloc> -// dynarray(allocator_arg_t, const _Alloc& __alloc, initializer_list<value_type>); - - dynarray& operator=(const dynarray&) = delete; - _LIBCPP_INLINE_VISIBILITY - ~dynarray(); - - // iterators: - inline _LIBCPP_INLINE_VISIBILITY iterator begin() noexcept { return iterator(data()); } - inline _LIBCPP_INLINE_VISIBILITY const_iterator begin() const noexcept { return const_iterator(data()); } - inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); } - inline _LIBCPP_INLINE_VISIBILITY iterator end() noexcept { return iterator(data() + __size_); } - inline _LIBCPP_INLINE_VISIBILITY const_iterator end() const noexcept { return const_iterator(data() + __size_); } - inline _LIBCPP_INLINE_VISIBILITY const_iterator cend() const noexcept { return const_iterator(data() + __size_); } - - inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } - inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } - inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } - inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() noexcept { return reverse_iterator(begin()); } - inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } - inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } - - // capacity: - inline _LIBCPP_INLINE_VISIBILITY size_type size() const noexcept { return __size_; } - inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; } - inline _LIBCPP_INLINE_VISIBILITY bool empty() const noexcept { return __size_ == 0; } - - // element access: - inline _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) { return data()[__n]; } - inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; } - - inline _LIBCPP_INLINE_VISIBILITY reference front() { return data()[0]; } - inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; } - inline _LIBCPP_INLINE_VISIBILITY reference back() { return data()[__size_-1]; } - inline _LIBCPP_INLINE_VISIBILITY const_reference back() const { return data()[__size_-1]; } - - inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const; - inline _LIBCPP_INLINE_VISIBILITY reference at(size_type __n); - - // data access: - inline _LIBCPP_INLINE_VISIBILITY _Tp* data() noexcept { return __base_; } - inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; } - - // mutating member functions: - inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); } -}; - -template <class _Tp> -inline -dynarray<_Tp>::dynarray(size_type __c) : dynarray () -{ - __base_ = __allocate (__c); - value_type *__data = data (); - for ( __size_ = 0; __size_ < __c; ++__size_, ++__data ) - ::new (__data) value_type; -} - -template <class _Tp> -inline -dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray () -{ - __base_ = __allocate (__c); - value_type *__data = data (); - for ( __size_ = 0; __size_ < __c; ++__size_, ++__data ) - ::new (__data) value_type (__v); -} - -template <class _Tp> -inline -dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray () -{ - size_t sz = __il.size(); - __base_ = __allocate (sz); - value_type *__data = data (); - auto src = __il.begin(); - for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src ) - ::new (__data) value_type (*src); -} - -template <class _Tp> -inline -dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray () -{ - size_t sz = __d.size(); - __base_ = __allocate (sz); - value_type *__data = data (); - auto src = __d.begin(); - for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src ) - ::new (__data) value_type (*src); -} - -template <class _Tp> -inline -dynarray<_Tp>::~dynarray() -{ - value_type *__data = data () + __size_; - for ( size_t i = 0; i < __size_; ++i ) - (--__data)->value_type::~value_type(); - __deallocate_value( __base_ ); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename dynarray<_Tp>::reference -dynarray<_Tp>::at(size_type __n) -{ - if (__n >= __size_) - __throw_out_of_range("dynarray::at"); - - return data()[__n]; -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -typename dynarray<_Tp>::const_reference -dynarray<_Tp>::at(size_type __n) const -{ - if (__n >= __size_) - __throw_out_of_range("dynarray::at"); - - return data()[__n]; -} - -}}} - - -_LIBCPP_BEGIN_NAMESPACE_STD -template <class _Tp, class _Alloc> -struct _LIBCPP_TEMPLATE_VIS uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {}; -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // if _LIBCPP_STD_VER > 11 -#endif // _LIBCPP_DYNARRAY |
