Vendor import of libc++ trunk r291476:
https://llvm.org/svn/llvm-project/libcxx/trunk@291476
This commit is contained in:
parent
b806704804
commit
665511c88f
@ -116,7 +116,12 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
|
||||
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
|
||||
set(LIBCXX_CXX_ABI_INTREE 1)
|
||||
else()
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "default")
|
||||
if (WIN32 AND NOT MINGW)
|
||||
# FIXME: Figure out how to configure the ABI library on Windows.
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "none")
|
||||
else()
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "default")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}")
|
||||
@ -169,6 +174,9 @@ option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread AP
|
||||
option(LIBCXX_HAS_EXTERNAL_THREAD_API
|
||||
"Build libc++ with an externalized threading API.
|
||||
This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF)
|
||||
option(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY
|
||||
"Build libc++ with an externalized threading library.
|
||||
This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON" OFF)
|
||||
|
||||
# Misc options ----------------------------------------------------------------
|
||||
# FIXME: Turn -pedantic back ON. It is currently off because it warns
|
||||
@ -230,12 +238,24 @@ if(NOT LIBCXX_ENABLE_THREADS)
|
||||
message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to ON"
|
||||
" when LIBCXX_ENABLE_THREADS is also set to ON.")
|
||||
endif()
|
||||
if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
|
||||
message(FATAL_ERROR "LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY can only be set "
|
||||
"to ON when LIBCXX_ENABLE_THREADS is also set to ON.")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API)
|
||||
message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
|
||||
"and LIBCXX_HAS_PTHREAD_API cannot be both"
|
||||
"set to ON at the same time.")
|
||||
if (LIBCXX_HAS_EXTERNAL_THREAD_API)
|
||||
if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
|
||||
message(FATAL_ERROR "The options LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY and "
|
||||
"LIBCXX_HAS_EXTERNAL_THREAD_API cannot both be ON at "
|
||||
"the same time")
|
||||
endif()
|
||||
if (LIBCXX_HAS_PTHREAD_API)
|
||||
message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
|
||||
"and LIBCXX_HAS_PTHREAD_API cannot be both"
|
||||
"set to ON at the same time.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
|
||||
@ -441,7 +461,7 @@ if (NOT LIBCXX_ENABLE_RTTI)
|
||||
endif()
|
||||
|
||||
# Threading flags =============================================================
|
||||
if (LIBCXX_HAS_EXTERNAL_THREAD_API AND LIBCXX_ENABLE_SHARED)
|
||||
if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXX_ENABLE_SHARED)
|
||||
# Need to allow unresolved symbols if this is to work with shared library builds
|
||||
if (APPLE)
|
||||
add_link_flags("-undefined dynamic_lookup")
|
||||
@ -520,6 +540,7 @@ config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THRE
|
||||
|
||||
config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL)
|
||||
config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
|
||||
|
||||
# By default libc++ on Windows expects to use a shared library, which requires
|
||||
|
@ -80,6 +80,10 @@ N: Andrew Morrow
|
||||
E: andrew.c.morrow@gmail.com
|
||||
D: Minor patches and Linux fixes.
|
||||
|
||||
N: Michael Park
|
||||
E: mpark@apache.org
|
||||
D: Implementation of <variant>.
|
||||
|
||||
N: Arvid Picciani
|
||||
E: aep at exys dot org
|
||||
D: Minor patches and musl port.
|
||||
|
70
docs/DesignDocs/ThreadingSupportAPI.rst
Normal file
70
docs/DesignDocs/ThreadingSupportAPI.rst
Normal file
@ -0,0 +1,70 @@
|
||||
=====================
|
||||
Threading Support API
|
||||
=====================
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
Libc++ supports using multiple different threading models and configurations
|
||||
to implement the threading parts of libc++, including ``<thread>`` and ``<mutex>``.
|
||||
These different models provide entirely different interfaces from each
|
||||
other. To address this libc++ wraps the underlying threading API in a new and
|
||||
consistent API, which it uses internally to implement threading primitives.
|
||||
|
||||
The ``<__threading_support>`` header is where libc++ defines its internal
|
||||
threading interface. It contains forward declarations of the internal threading
|
||||
interface as well as definitions for the interface.
|
||||
|
||||
External Threading API and the ``<__external_threading>`` header
|
||||
================================================================
|
||||
|
||||
In order to support vendors with custom threading API's libc++ allows the
|
||||
entire internal threading interface to be provided by an external,
|
||||
vendor provided, header.
|
||||
|
||||
When ``_LIBCPP_HAS_THREAD_API_EXTERNAL`` is defined the ``<__threading_support>``
|
||||
header simply forwards to the ``<__external_threading>`` header (which must exist).
|
||||
It is expected that the ``<__external_threading>`` header provide the exact
|
||||
interface normally provided by ``<__threading_support>``.
|
||||
|
||||
External Threading Library
|
||||
==========================
|
||||
|
||||
Normally ``<__threading_support>`` provides inline definitions to each internal
|
||||
threading API function it declares. However libc++ also supports using an
|
||||
external library to provide the definitions.
|
||||
|
||||
When ``_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL`` libc++ does not provide inline
|
||||
definitions for the internal API, instead assuming the definitions will be
|
||||
provided by an external library.
|
||||
|
||||
Threading Configuration Macros
|
||||
==============================
|
||||
|
||||
**_LIBCPP_HAS_NO_THREADS**
|
||||
This macro is defined when libc++ is built without threading support. It
|
||||
should not be manually defined by the user.
|
||||
|
||||
**_LIBCPP_HAS_THREAD_API_EXTERNAL**
|
||||
This macro is defined when libc++ should use the ``<__external_threading>``
|
||||
header to provide the internal threading API. This macro overrides
|
||||
``_LIBCPP_HAS_THREAD_API_PTHREAD``.
|
||||
|
||||
**_LIBCPP_HAS_THREAD_API_PTHREAD**
|
||||
This macro is defined when libc++ should use POSIX threads to implement the
|
||||
internal threading API.
|
||||
|
||||
**_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL**
|
||||
This macro is defined when libc++ expects the definitions of the internal
|
||||
threading API to be provided by an external library. When defined
|
||||
``<__threading_support>`` will only provide the forward declarations and
|
||||
typedefs for the internal threading API.
|
||||
|
||||
**_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL**
|
||||
This macro is used to build an external threading library using the
|
||||
``<__threading_support>``. Specifically it exposes the threading API
|
||||
definitions in ``<__threading_support>`` as non-inline definitions meant to
|
||||
be compiled into a library.
|
@ -49,7 +49,7 @@ Visibility Macros
|
||||
attribute. With GCC the `visibility(...)` attribute is used and member
|
||||
functions are affected.
|
||||
|
||||
**_LIBCPP_TEMPLATE_ONLY**
|
||||
**_LIBCPP_TEMPLATE_VIS**
|
||||
The same as `_LIBCPP_TYPE_VIS` except that it may be applied to class
|
||||
templates.
|
||||
|
||||
|
@ -131,7 +131,7 @@ Design Documents
|
||||
DesignDocs/CapturingConfigInfo
|
||||
DesignDocs/ABIVersioning
|
||||
DesignDocs/VisibilityMacros
|
||||
|
||||
DesignDocs/ThreadingSupportAPI
|
||||
|
||||
* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
|
||||
* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
|
||||
|
@ -40,11 +40,8 @@ class __bit_reference
|
||||
__storage_pointer __seg_;
|
||||
__storage_type __mask_;
|
||||
|
||||
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
|
||||
friend typename _Cp::__self;
|
||||
#else
|
||||
friend class _Cp::__self;
|
||||
#endif
|
||||
|
||||
friend class __bit_const_reference<_Cp>;
|
||||
friend class __bit_iterator<_Cp, false>;
|
||||
public:
|
||||
@ -130,11 +127,7 @@ class __bit_const_reference
|
||||
__storage_pointer __seg_;
|
||||
__storage_type __mask_;
|
||||
|
||||
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
|
||||
friend typename _Cp::__self;
|
||||
#else
|
||||
friend class _Cp::__self;
|
||||
#endif
|
||||
friend class __bit_iterator<_Cp, true>;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1221,11 +1214,8 @@ private:
|
||||
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
|
||||
: __seg_(__s), __ctz_(__ctz) {}
|
||||
|
||||
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
|
||||
friend typename _Cp::__self;
|
||||
#else
|
||||
friend class _Cp::__self;
|
||||
#endif
|
||||
|
||||
friend class __bit_reference<_Cp>;
|
||||
friend class __bit_const_reference<_Cp>;
|
||||
friend class __bit_iterator<_Cp, true>;
|
||||
|
@ -101,6 +101,25 @@
|
||||
#define __is_identifier(__x) 1
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define _LIBCPP_COMPILER_CLANG
|
||||
#elif defined(__GNUC__)
|
||||
#define _LIBCPP_COMPILER_GCC
|
||||
#elif defined(_MSC_VER)
|
||||
#define _LIBCPP_COMPILER_MSVC
|
||||
#elif defined(__IBMCPP__)
|
||||
#define _LIBCPP_COMPILER_IBM
|
||||
#endif
|
||||
|
||||
// FIXME: ABI detection should be done via compiler builtin macros. This
|
||||
// is just a placeholder until Clang implements such macros. For now assume
|
||||
// that Windows compilers pretending to be MSVC++ target the microsoft ABI.
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# define _LIBCPP_ABI_MICROSOFT
|
||||
#else
|
||||
# define _LIBCPP_ABI_ITANIUM
|
||||
#endif
|
||||
|
||||
// Need to detect which libc we're using if we're on Linux.
|
||||
#if defined(__linux__)
|
||||
#include <features.h>
|
||||
@ -164,16 +183,7 @@
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# define _LIBCPP_SHORT_WCHAR 1
|
||||
// Compiler intrinsics (MSVC)
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
# define _LIBCPP_HAS_IS_BASE_OF
|
||||
# endif
|
||||
# if defined(_MSC_VER) && !defined(__clang__)
|
||||
# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
|
||||
# define _LIBCPP_TOSTRING2(x) #x
|
||||
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
|
||||
# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
|
||||
# endif
|
||||
|
||||
// If mingw not explicitly detected, assume using MS C runtime only.
|
||||
# ifndef __MINGW32__
|
||||
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
|
||||
@ -230,7 +240,7 @@
|
||||
#define _LIBCPP_NO_CFI
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#if defined(_LIBCPP_COMPILER_CLANG)
|
||||
|
||||
// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
|
||||
// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
|
||||
@ -275,10 +285,6 @@ typedef __char32_t char32_t;
|
||||
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_deleted_functions))
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#endif // !(__has_feature(cxx_deleted_functions))
|
||||
|
||||
#if !(__has_feature(cxx_lambdas))
|
||||
#define _LIBCPP_HAS_NO_LAMBDAS
|
||||
#endif
|
||||
@ -390,7 +396,7 @@ namespace std {
|
||||
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
|
||||
#endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
#elif defined(_LIBCPP_COMPILER_GCC)
|
||||
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||
@ -431,7 +437,6 @@ namespace std {
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
@ -448,7 +453,6 @@ namespace std {
|
||||
|
||||
#if _GNUC_VER < 404
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
@ -475,15 +479,23 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
#define _LIBCPP_HAS_NO_ASAN
|
||||
#endif
|
||||
|
||||
#elif defined(_LIBCPP_MSVC)
|
||||
#elif defined(_LIBCPP_COMPILER_MSVC)
|
||||
|
||||
#define _LIBCPP_TOSTRING2(x) #x
|
||||
#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
|
||||
#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
|
||||
|
||||
#if _MSC_VER < 1900
|
||||
#error "MSVC versions prior to Visual Studio 2015 are not supported"
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_IS_BASE_OF
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
|
||||
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||
#if _MSC_VER <= 1800
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#endif
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_NOEXCEPT
|
||||
#define __alignof__ __alignof
|
||||
#define _LIBCPP_NORETURN __declspec(noreturn)
|
||||
@ -500,7 +512,7 @@ namespace std {
|
||||
|
||||
#define _LIBCPP_HAS_NO_ASAN
|
||||
|
||||
#elif defined(__IBMCPP__)
|
||||
#elif defined(_LIBCPP_COMPILER_IBM)
|
||||
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||
@ -530,7 +542,7 @@ namespace std {
|
||||
|
||||
#define _LIBCPP_HAS_NO_ASAN
|
||||
|
||||
#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
|
||||
#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
|
||||
|
||||
#if defined(__ELF__)
|
||||
#define _LIBCPP_OBJECT_FORMAT_ELF 1
|
||||
@ -566,7 +578,7 @@ namespace std {
|
||||
#define _LIBCPP_FUNC_VIS_ONLY
|
||||
#define _LIBCPP_ENUM_VIS
|
||||
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
# define _LIBCPP_INLINE_VISIBILITY __forceinline
|
||||
# define _LIBCPP_ALWAYS_INLINE __forceinline
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline
|
||||
@ -739,7 +751,7 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define _LIBCPP_DEFAULT = default;
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
#define _LIBCPP_EQUAL_DELETE
|
||||
#else
|
||||
#define _LIBCPP_EQUAL_DELETE = delete
|
||||
@ -892,8 +904,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
|
||||
// Thread API
|
||||
#if !defined(_LIBCPP_HAS_NO_THREADS) && \
|
||||
!defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
|
||||
!defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
!defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
# if defined(__FreeBSD__) || \
|
||||
defined(__Fuchsia__) || \
|
||||
defined(__NetBSD__) || \
|
||||
@ -901,7 +912,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
defined(__APPLE__) || \
|
||||
defined(__CloudABI__) || \
|
||||
defined(__sun__)
|
||||
# define _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
# define _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
# elif defined(_LIBCPP_WIN32API)
|
||||
# define _LIBCPP_HAS_THREAD_API_WIN32
|
||||
# else
|
||||
# error "No thread API"
|
||||
# endif // _LIBCPP_HAS_THREAD_API
|
||||
|
@ -21,6 +21,7 @@
|
||||
#cmakedefine _LIBCPP_HAS_MUSL_LIBC
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
|
||||
#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
|
||||
|
||||
#endif // _LIBCPP_CONFIG_SITE
|
||||
|
@ -122,7 +122,7 @@ struct _LIBCPP_TYPE_VIS __i_node
|
||||
__i_node* __next_;
|
||||
__c_node* __c_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__i_node(const __i_node&) = delete;
|
||||
__i_node& operator=(const __i_node&) = delete;
|
||||
#else
|
||||
@ -145,7 +145,7 @@ struct _LIBCPP_TYPE_VIS __c_node
|
||||
__i_node** end_;
|
||||
__i_node** cap_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__c_node(const __c_node&) = delete;
|
||||
__c_node& operator=(const __c_node&) = delete;
|
||||
#else
|
||||
@ -232,7 +232,7 @@ class _LIBCPP_TYPE_VIS __libcpp_db
|
||||
|
||||
__libcpp_db();
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__libcpp_db(const __libcpp_db&) = delete;
|
||||
__libcpp_db& operator=(const __libcpp_db&) = delete;
|
||||
#else
|
||||
|
@ -552,23 +552,10 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
return cref(__t.get());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp> void ref(const _Tp&&) = delete;
|
||||
template <class _Tp> void cref(const _Tp&&) = delete;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&&);// = delete;
|
||||
template <class _Tp> void cref(const _Tp&&);// = delete;
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _Tp1, class _Tp2 = void>
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include <__undef_min_max>
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
@ -1321,7 +1320,7 @@ private:
|
||||
void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
void __deallocate(__next_pointer __np) _NOEXCEPT;
|
||||
void __deallocate_node(__next_pointer __np) _NOEXCEPT;
|
||||
__next_pointer __detach() _NOEXCEPT;
|
||||
|
||||
template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
|
||||
@ -1454,7 +1453,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
|
||||
"Predicate must be copy-constructible.");
|
||||
static_assert((is_copy_constructible<hasher>::value),
|
||||
"Hasher must be copy-constructible.");
|
||||
__deallocate(__p1_.first().__next_);
|
||||
__deallocate_node(__p1_.first().__next_);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__erase_c(this);
|
||||
#endif
|
||||
@ -1492,7 +1491,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u)
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__next_pointer __np)
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
|
||||
_NOEXCEPT
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
@ -1599,11 +1598,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__deallocate(__cache);
|
||||
__deallocate_node(__cache);
|
||||
throw;
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__deallocate(__cache);
|
||||
__deallocate_node(__cache);
|
||||
}
|
||||
const_iterator __i = __u.begin();
|
||||
while (__u.size() != 0)
|
||||
@ -1661,11 +1660,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__deallocate(__cache);
|
||||
__deallocate_node(__cache);
|
||||
throw;
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__deallocate(__cache);
|
||||
__deallocate_node(__cache);
|
||||
}
|
||||
for (; __first != __last; ++__first)
|
||||
__insert_unique(*__first);
|
||||
@ -1701,11 +1700,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__deallocate(__cache);
|
||||
__deallocate_node(__cache);
|
||||
throw;
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__deallocate(__cache);
|
||||
__deallocate_node(__cache);
|
||||
}
|
||||
for (; __first != __last; ++__first)
|
||||
__insert_multi(_NodeTypes::__get_value(*__first));
|
||||
@ -1765,7 +1764,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT
|
||||
{
|
||||
if (size() > 0)
|
||||
{
|
||||
__deallocate(__p1_.first().__next_);
|
||||
__deallocate_node(__p1_.first().__next_);
|
||||
__p1_.first().__next_ = nullptr;
|
||||
size_type __bc = bucket_count();
|
||||
for (size_type __i = 0; __i < __bc; ++__i)
|
||||
|
@ -15,8 +15,6 @@
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@ -64,7 +62,7 @@ public:
|
||||
if (__p == (pointer)&buf_)
|
||||
__allocated_ = false;
|
||||
else
|
||||
_VSTD::__deallocate(__p);
|
||||
_VSTD::__libcpp_deallocate(__p);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
|
@ -17,39 +17,24 @@
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#ifndef __libcpp_has_include
|
||||
#ifndef __has_include
|
||||
#define __libcpp_has_include(x) 0
|
||||
#else
|
||||
#define __libcpp_has_include(x) __has_include(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) && \
|
||||
!__libcpp_has_include(<__external_threading>)
|
||||
// If the <__external_threading> header is absent, build libc++ against a
|
||||
// pthread-oriented thread api but leave out its implementation. This setup
|
||||
// allows building+testing of an externally-threaded library variant (on any
|
||||
// platform that supports pthreads). Here, an 'externally-threaded' library
|
||||
// variant is one where the implementation of the libc++ thread api is provided
|
||||
// as a separate library.
|
||||
#define _LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) && \
|
||||
__libcpp_has_include(<__external_threading>)
|
||||
#include <__external_threading>
|
||||
#else
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
|
||||
defined(_LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD)
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
# include <__external_threading>
|
||||
#elif !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||
#include <assert.h>
|
||||
#include <Windows.h>
|
||||
#include <process.h>
|
||||
#include <fibersapi.h>
|
||||
|
||||
#include <chrono>
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)
|
||||
#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS
|
||||
#else
|
||||
#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -57,8 +42,7 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
|
||||
defined(_LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD)
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
// Mutex
|
||||
typedef pthread_mutex_t __libcpp_mutex_t;
|
||||
#define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
@ -81,6 +65,33 @@ typedef pthread_t __libcpp_thread_t;
|
||||
|
||||
// Thrad Local Storage
|
||||
typedef pthread_key_t __libcpp_tls_key;
|
||||
|
||||
#define _LIBCPP_TLS_DESTRUCTOR_CC
|
||||
#else
|
||||
// Mutex
|
||||
typedef SRWLOCK __libcpp_mutex_t;
|
||||
#define _LIBCPP_MUTEX_INITIALIZER SRWLOCK_INIT
|
||||
|
||||
typedef CRITICAL_SECTION __libcpp_recursive_mutex_t;
|
||||
|
||||
// Condition Variable
|
||||
typedef CONDITION_VARIABLE __libcpp_condvar_t;
|
||||
#define _LIBCPP_CONDVAR_INITIALIZER CONDITION_VARIABLE_INIT
|
||||
|
||||
// Execute Once
|
||||
typedef INIT_ONCE __libcpp_exec_once_flag;
|
||||
#define _LIBCPP_EXEC_ONCE_INITIALIZER INIT_ONCE_STATIC_INIT
|
||||
|
||||
// Thread ID
|
||||
typedef DWORD __libcpp_thread_id;
|
||||
|
||||
// Thread
|
||||
typedef HANDLE __libcpp_thread_t;
|
||||
|
||||
// Thread Local Storage
|
||||
typedef DWORD __libcpp_tls_key;
|
||||
|
||||
#define _LIBCPP_TLS_DESTRUCTOR_CC WINAPI
|
||||
#endif
|
||||
|
||||
// Mutex
|
||||
@ -167,7 +178,8 @@ void __libcpp_thread_yield();
|
||||
|
||||
// Thread local storage
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *));
|
||||
int __libcpp_tls_create(__libcpp_tls_key* __key,
|
||||
void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*));
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
void *__libcpp_tls_get(__libcpp_tls_key __key);
|
||||
@ -175,8 +187,10 @@ void *__libcpp_tls_get(__libcpp_tls_key __key);
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
|
||||
defined(_LIBCPP_BUILDING_THREAD_API_EXTERNAL_PTHREAD)
|
||||
#if !defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
|
||||
int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
@ -342,12 +356,230 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
|
||||
return pthread_setspecific(__key, __p);
|
||||
}
|
||||
|
||||
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||
|
||||
// Mutex
|
||||
int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
InitializeCriticalSection(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
EnterCriticalSection(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
TryEnterCriticalSection(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
LeaveCriticalSection(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
static_cast<void>(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
AcquireSRWLockExclusive(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
TryAcquireSRWLockExclusive(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
ReleaseSRWLockExclusive(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
|
||||
{
|
||||
static_cast<void>(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Condition Variable
|
||||
int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
|
||||
{
|
||||
WakeConditionVariable(__cv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
|
||||
{
|
||||
WakeAllConditionVariable(__cv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
|
||||
{
|
||||
SleepConditionVariableSRW(__cv, __m, INFINITE, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
|
||||
timespec *__ts)
|
||||
{
|
||||
using namespace _VSTD::chrono;
|
||||
|
||||
auto duration = seconds(__ts->tv_sec) + nanoseconds(__ts->tv_nsec);
|
||||
auto abstime =
|
||||
system_clock::time_point(duration_cast<system_clock::duration>(duration));
|
||||
auto timeout_ms = duration_cast<milliseconds>(abstime - system_clock::now());
|
||||
|
||||
if (!SleepConditionVariableSRW(__cv, __m,
|
||||
timeout_ms.count() > 0 ? timeout_ms.count()
|
||||
: 0,
|
||||
0))
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
|
||||
{
|
||||
static_cast<void>(__cv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute Once
|
||||
static inline _LIBCPP_ALWAYS_INLINE BOOL CALLBACK
|
||||
__libcpp_init_once_execute_once_thunk(PINIT_ONCE __init_once, PVOID __parameter,
|
||||
PVOID *__context)
|
||||
{
|
||||
static_cast<void>(__init_once);
|
||||
static_cast<void>(__context);
|
||||
|
||||
void (*init_routine)(void) = reinterpret_cast<void (*)(void)>(__parameter);
|
||||
init_routine();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int __libcpp_execute_once(__libcpp_exec_once_flag *__flag,
|
||||
void (*__init_routine)(void))
|
||||
{
|
||||
if (!InitOnceExecuteOnce(__flag, __libcpp_init_once_execute_once_thunk,
|
||||
reinterpret_cast<void *>(__init_routine), NULL))
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Thread ID
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id __lhs,
|
||||
__libcpp_thread_id __rhs)
|
||||
{
|
||||
return __lhs == __rhs;
|
||||
}
|
||||
|
||||
bool __libcpp_thread_id_less(__libcpp_thread_id __lhs, __libcpp_thread_id __rhs)
|
||||
{
|
||||
return __lhs < __rhs;
|
||||
}
|
||||
|
||||
// Thread
|
||||
struct __libcpp_beginthreadex_thunk_data
|
||||
{
|
||||
void *(*__func)(void *);
|
||||
void *__arg;
|
||||
};
|
||||
|
||||
static inline _LIBCPP_ALWAYS_INLINE unsigned int WINAPI
|
||||
__libcpp_beginthreadex_thunk(void *__data)
|
||||
{
|
||||
__libcpp_beginthreadex_thunk_data data =
|
||||
*reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data);
|
||||
delete reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data);
|
||||
return reinterpret_cast<unsigned int>(data.__func(data.__arg));
|
||||
}
|
||||
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg)
|
||||
{
|
||||
auto *data = new __libcpp_beginthreadex_thunk_data;
|
||||
data->__func = __func;
|
||||
data->__arg = __arg;
|
||||
|
||||
*__t = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0,
|
||||
__libcpp_beginthreadex_thunk,
|
||||
data, 0, NULL));
|
||||
if (*__t)
|
||||
return 0;
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_current_id()
|
||||
{
|
||||
return GetCurrentThreadId();
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
|
||||
{
|
||||
return GetThreadId(*__t);
|
||||
}
|
||||
|
||||
int __libcpp_thread_join(__libcpp_thread_t *__t)
|
||||
{
|
||||
if (WaitForSingleObjectEx(*__t, INFINITE, FALSE) == WAIT_FAILED)
|
||||
return GetLastError();
|
||||
if (!CloseHandle(*__t))
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_thread_detach(__libcpp_thread_t *__t)
|
||||
{
|
||||
if (!CloseHandle(*__t))
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __libcpp_thread_yield()
|
||||
{
|
||||
SwitchToThread();
|
||||
}
|
||||
|
||||
// Thread Local Storage
|
||||
int __libcpp_tls_create(__libcpp_tls_key* __key,
|
||||
void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))
|
||||
{
|
||||
*__key = FlsAlloc(__at_exit);
|
||||
if (*__key == FLS_OUT_OF_INDEXES)
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *__libcpp_tls_get(__libcpp_tls_key __key)
|
||||
{
|
||||
return FlsGetValue(__key);
|
||||
}
|
||||
|
||||
int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
|
||||
{
|
||||
if (!FlsSetValue(__key, __p))
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
|
||||
#endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_THREAD_API_EXTERNAL || !__libcpp_has_include(<__external_threading>)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_THREADS
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_THREADING_SUPPORT
|
||||
|
@ -3100,28 +3100,28 @@ template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator __sample(_PopulationIterator __first,
|
||||
_PopulationIterator __last, _SampleIterator __out,
|
||||
_PopulationIterator __last, _SampleIterator __output,
|
||||
_Distance __n,
|
||||
_UniformRandomNumberGenerator & __g,
|
||||
input_iterator_tag) {
|
||||
|
||||
_Distance __k = 0;
|
||||
for (; __first != __last && __k < __n; ++__first, (void)++__k)
|
||||
__out[__k] = *__first;
|
||||
__output[__k] = *__first;
|
||||
_Distance __sz = __k;
|
||||
for (; __first != __last; ++__first, (void)++__k) {
|
||||
_Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
|
||||
if (__r < __sz)
|
||||
__out[__r] = *__first;
|
||||
__output[__r] = *__first;
|
||||
}
|
||||
return __out + _VSTD::min(__n, __k);
|
||||
return __output + _VSTD::min(__n, __k);
|
||||
}
|
||||
|
||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator __sample(_PopulationIterator __first,
|
||||
_PopulationIterator __last, _SampleIterator __out,
|
||||
_PopulationIterator __last, _SampleIterator __output,
|
||||
_Distance __n,
|
||||
_UniformRandomNumberGenerator& __g,
|
||||
forward_iterator_tag) {
|
||||
@ -3130,18 +3130,18 @@ _SampleIterator __sample(_PopulationIterator __first,
|
||||
_Distance __r =
|
||||
_VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
|
||||
if (__r < __n) {
|
||||
*__out++ = *__first;
|
||||
*__output++ = *__first;
|
||||
--__n;
|
||||
}
|
||||
}
|
||||
return __out;
|
||||
return __output;
|
||||
}
|
||||
|
||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator __sample(_PopulationIterator __first,
|
||||
_PopulationIterator __last, _SampleIterator __out,
|
||||
_PopulationIterator __last, _SampleIterator __output,
|
||||
_Distance __n, _UniformRandomNumberGenerator& __g) {
|
||||
typedef typename iterator_traits<_PopulationIterator>::iterator_category
|
||||
_PopCategory;
|
||||
@ -3153,7 +3153,7 @@ _SampleIterator __sample(_PopulationIterator __first,
|
||||
typedef typename common_type<_Distance, _Difference>::type _CommonType;
|
||||
_LIBCPP_ASSERT(__n >= 0, "N must be a positive number.");
|
||||
return _VSTD::__sample(
|
||||
__first, __last, __out, _CommonType(__n),
|
||||
__first, __last, __output, _CommonType(__n),
|
||||
__g, _PopCategory());
|
||||
}
|
||||
|
||||
@ -3162,9 +3162,9 @@ template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator sample(_PopulationIterator __first,
|
||||
_PopulationIterator __last, _SampleIterator __out,
|
||||
_PopulationIterator __last, _SampleIterator __output,
|
||||
_Distance __n, _UniformRandomNumberGenerator&& __g) {
|
||||
return _VSTD::__sample(__first, __last, __out, __n, __g);
|
||||
return _VSTD::__sample(__first, __last, __output, __n, __g);
|
||||
}
|
||||
#endif // _LIBCPP_STD_VER > 14
|
||||
|
||||
|
@ -943,16 +943,16 @@ struct __atomic_base // false
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__atomic_base(const __atomic_base&) = delete;
|
||||
__atomic_base& operator=(const __atomic_base&) = delete;
|
||||
__atomic_base& operator=(const __atomic_base&) volatile = delete;
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#else
|
||||
private:
|
||||
__atomic_base(const __atomic_base&);
|
||||
__atomic_base& operator=(const __atomic_base&);
|
||||
__atomic_base& operator=(const __atomic_base&) volatile;
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(__cpp_lib_atomic_is_always_lock_free)
|
||||
@ -1699,16 +1699,16 @@ typedef struct atomic_flag
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
atomic_flag(const atomic_flag&) = delete;
|
||||
atomic_flag& operator=(const atomic_flag&) = delete;
|
||||
atomic_flag& operator=(const atomic_flag&) volatile = delete;
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#else
|
||||
private:
|
||||
atomic_flag(const atomic_flag&);
|
||||
atomic_flag& operator=(const atomic_flag&);
|
||||
atomic_flag& operator=(const atomic_flag&) volatile;
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#endif
|
||||
} atomic_flag;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -60,9 +60,9 @@ template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator sample(_PopulationIterator __first, _PopulationIterator __last,
|
||||
_SampleIterator __out, _Distance __n,
|
||||
_SampleIterator __output, _Distance __n,
|
||||
_UniformRandomNumberGenerator &&__g) {
|
||||
return _VSTD::__sample(__first, __last, __out, __n, __g);
|
||||
return _VSTD::__sample(__first, __last, __output, __n, __g);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
@ -11,9 +11,6 @@
|
||||
#ifndef _LIBCPP_DYNARRAY
|
||||
#define _LIBCPP_DYNARRAY
|
||||
|
||||
#include <__config>
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
/*
|
||||
dynarray synopsis
|
||||
|
||||
@ -96,6 +93,8 @@ public:
|
||||
}} // std::experimental
|
||||
|
||||
*/
|
||||
#include <__config>
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
#include <__functional_base>
|
||||
#include <iterator>
|
||||
@ -104,8 +103,6 @@ public:
|
||||
#include <new>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@ -143,9 +140,9 @@ private:
|
||||
return static_cast<value_type *> (_VSTD::__allocate (sizeof(value_type) * count));
|
||||
}
|
||||
|
||||
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
|
||||
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate_value( value_type* __ptr ) noexcept
|
||||
{
|
||||
_VSTD::__deallocate (static_cast<void *> (__ptr));
|
||||
_VSTD::__libcpp_deallocate (static_cast<void *> (__ptr));
|
||||
}
|
||||
|
||||
public:
|
||||
@ -265,7 +262,7 @@ dynarray<_Tp>::~dynarray()
|
||||
value_type *__data = data () + __size_;
|
||||
for ( size_t i = 0; i < __size_; ++i )
|
||||
(--__data)->value_type::~value_type();
|
||||
__deallocate ( __base_ );
|
||||
__deallocate_value( __base_ );
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
|
@ -75,19 +75,19 @@ public:
|
||||
typedef void reference;
|
||||
|
||||
ostream_joiner(ostream_type& __os, _Delim&& __d)
|
||||
: __out(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {}
|
||||
: __output(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {}
|
||||
|
||||
ostream_joiner(ostream_type& __os, const _Delim& __d)
|
||||
: __out(_VSTD::addressof(__os)), __delim(__d), __first(true) {}
|
||||
: __output(_VSTD::addressof(__os)), __delim(__d), __first(true) {}
|
||||
|
||||
|
||||
template<typename _Tp>
|
||||
ostream_joiner& operator=(const _Tp& __v)
|
||||
{
|
||||
if (!__first)
|
||||
*__out << __delim;
|
||||
*__output << __delim;
|
||||
__first = false;
|
||||
*__out << __v;
|
||||
*__output << __v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ public:
|
||||
ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
|
||||
|
||||
private:
|
||||
ostream_type* __out;
|
||||
ostream_type* __output;
|
||||
_Delim __delim;
|
||||
bool __first;
|
||||
};
|
||||
|
@ -205,14 +205,9 @@ protected:
|
||||
basic_ios<char_type, traits_type>::swap(__rhs);
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
basic_istream (const basic_istream& __rhs) = delete;
|
||||
basic_istream& operator=(const basic_istream& __rhs) = delete;
|
||||
#else
|
||||
basic_istream (const basic_istream& __rhs); // not defined
|
||||
basic_istream& operator=(const basic_istream& __rhs); // not defined
|
||||
#endif
|
||||
#endif
|
||||
public:
|
||||
|
||||
|
@ -644,7 +644,6 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
|
||||
#endif
|
||||
|
||||
#include <__undef_min_max>
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -1772,7 +1771,7 @@ public:
|
||||
return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
|
||||
{_VSTD::__deallocate((void*)__p);}
|
||||
{_VSTD::__libcpp_deallocate((void*)__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
|
||||
{return size_type(~0) / sizeof(_Tp);}
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
@ -1868,7 +1867,7 @@ public:
|
||||
return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
|
||||
{_VSTD::__deallocate((void*)__p);}
|
||||
{_VSTD::__libcpp_deallocate((void*)__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
|
||||
{return size_type(~0) / sizeof(_Tp);}
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
@ -3345,12 +3344,13 @@ struct __scalar_hash<_Tp, 4>
|
||||
}
|
||||
};
|
||||
|
||||
struct _PairT {
|
||||
size_t first;
|
||||
size_t second;
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
|
||||
struct _PairT {
|
||||
size_t first;
|
||||
size_t second;
|
||||
};
|
||||
typedef __scalar_hash<_PairT> _HashT;
|
||||
const _PairT __p = {__lhs, __rhs};
|
||||
return _HashT()(__p);
|
||||
|
@ -485,7 +485,6 @@ module std [system] {
|
||||
module __tree { header "__tree" export * }
|
||||
module __tuple { header "__tuple" export * }
|
||||
module __undef_min_max { header "__undef_min_max" export * }
|
||||
module __undef___deallocate { header "__undef___deallocate" export * }
|
||||
|
||||
module experimental {
|
||||
requires cplusplus11
|
||||
|
@ -92,8 +92,6 @@ void operator delete[](void* ptr, void*) noexcept;
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@ -217,7 +215,7 @@ inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void __deallocate(void *__ptr) {
|
||||
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void *__ptr) {
|
||||
#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
||||
::operator delete(__ptr);
|
||||
#else
|
||||
|
@ -179,7 +179,7 @@ protected:
|
||||
void swap(basic_ostream& __rhs)
|
||||
{ basic_ios<char_type, traits_type>::swap(__rhs); }
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
basic_ostream (const basic_ostream& __rhs) = delete;
|
||||
basic_ostream& operator=(const basic_ostream& __rhs) = delete;
|
||||
#else
|
||||
|
@ -5262,15 +5262,15 @@ public:
|
||||
// format:
|
||||
template <class _OutputIter>
|
||||
_OutputIter
|
||||
format(_OutputIter __out, const char_type* __fmt_first,
|
||||
format(_OutputIter __output, const char_type* __fmt_first,
|
||||
const char_type* __fmt_last,
|
||||
regex_constants::match_flag_type __flags = regex_constants::format_default) const;
|
||||
template <class _OutputIter, class _ST, class _SA>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIter
|
||||
format(_OutputIter __out, const basic_string<char_type, _ST, _SA>& __fmt,
|
||||
format(_OutputIter __output, const basic_string<char_type, _ST, _SA>& __fmt,
|
||||
regex_constants::match_flag_type __flags = regex_constants::format_default) const
|
||||
{return format(__out, __fmt.data(), __fmt.data() + __fmt.size(), __flags);}
|
||||
{return format(__output, __fmt.data(), __fmt.data() + __fmt.size(), __flags);}
|
||||
template <class _ST, class _SA>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<char_type, _ST, _SA>
|
||||
@ -5382,7 +5382,7 @@ match_results<_BidirectionalIterator, _Allocator>::__init(unsigned __s,
|
||||
template <class _BidirectionalIterator, class _Allocator>
|
||||
template <class _OutputIter>
|
||||
_OutputIter
|
||||
match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __out,
|
||||
match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output,
|
||||
const char_type* __fmt_first, const char_type* __fmt_last,
|
||||
regex_constants::match_flag_type __flags) const
|
||||
{
|
||||
@ -5391,27 +5391,27 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __out,
|
||||
for (; __fmt_first != __fmt_last; ++__fmt_first)
|
||||
{
|
||||
if (*__fmt_first == '&')
|
||||
__out = _VSTD::copy(__matches_[0].first, __matches_[0].second,
|
||||
__out);
|
||||
__output = _VSTD::copy(__matches_[0].first, __matches_[0].second,
|
||||
__output);
|
||||
else if (*__fmt_first == '\\' && __fmt_first + 1 != __fmt_last)
|
||||
{
|
||||
++__fmt_first;
|
||||
if ('0' <= *__fmt_first && *__fmt_first <= '9')
|
||||
{
|
||||
size_t __i = *__fmt_first - '0';
|
||||
__out = _VSTD::copy((*this)[__i].first,
|
||||
(*this)[__i].second, __out);
|
||||
__output = _VSTD::copy((*this)[__i].first,
|
||||
(*this)[__i].second, __output);
|
||||
}
|
||||
else
|
||||
{
|
||||
*__out = *__fmt_first;
|
||||
++__out;
|
||||
*__output = *__fmt_first;
|
||||
++__output;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*__out = *__fmt_first;
|
||||
++__out;
|
||||
*__output = *__fmt_first;
|
||||
++__output;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5424,21 +5424,21 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __out,
|
||||
switch (__fmt_first[1])
|
||||
{
|
||||
case '$':
|
||||
*__out = *++__fmt_first;
|
||||
++__out;
|
||||
*__output = *++__fmt_first;
|
||||
++__output;
|
||||
break;
|
||||
case '&':
|
||||
++__fmt_first;
|
||||
__out = _VSTD::copy(__matches_[0].first, __matches_[0].second,
|
||||
__out);
|
||||
__output = _VSTD::copy(__matches_[0].first, __matches_[0].second,
|
||||
__output);
|
||||
break;
|
||||
case '`':
|
||||
++__fmt_first;
|
||||
__out = _VSTD::copy(__prefix_.first, __prefix_.second, __out);
|
||||
__output = _VSTD::copy(__prefix_.first, __prefix_.second, __output);
|
||||
break;
|
||||
case '\'':
|
||||
++__fmt_first;
|
||||
__out = _VSTD::copy(__suffix_.first, __suffix_.second, __out);
|
||||
__output = _VSTD::copy(__suffix_.first, __suffix_.second, __output);
|
||||
break;
|
||||
default:
|
||||
if ('0' <= __fmt_first[1] && __fmt_first[1] <= '9')
|
||||
@ -5451,25 +5451,25 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __out,
|
||||
++__fmt_first;
|
||||
__i = 10 * __i + *__fmt_first - '0';
|
||||
}
|
||||
__out = _VSTD::copy((*this)[__i].first,
|
||||
(*this)[__i].second, __out);
|
||||
__output = _VSTD::copy((*this)[__i].first,
|
||||
(*this)[__i].second, __output);
|
||||
}
|
||||
else
|
||||
{
|
||||
*__out = *__fmt_first;
|
||||
++__out;
|
||||
*__output = *__fmt_first;
|
||||
++__output;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*__out = *__fmt_first;
|
||||
++__out;
|
||||
*__output = *__fmt_first;
|
||||
++__output;
|
||||
}
|
||||
}
|
||||
}
|
||||
return __out;
|
||||
return __output;
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator, class _Allocator>
|
||||
@ -6459,7 +6459,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
|
||||
template <class _OutputIterator, class _BidirectionalIterator,
|
||||
class _Traits, class _CharT>
|
||||
_OutputIterator
|
||||
regex_replace(_OutputIterator __out,
|
||||
regex_replace(_OutputIterator __output,
|
||||
_BidirectionalIterator __first, _BidirectionalIterator __last,
|
||||
const basic_regex<_CharT, _Traits>& __e, const _CharT* __fmt,
|
||||
regex_constants::match_flag_type __flags = regex_constants::match_default)
|
||||
@ -6470,7 +6470,7 @@ regex_replace(_OutputIterator __out,
|
||||
if (__i == __eof)
|
||||
{
|
||||
if (!(__flags & regex_constants::format_no_copy))
|
||||
__out = _VSTD::copy(__first, __last, __out);
|
||||
__output = _VSTD::copy(__first, __last, __output);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -6478,29 +6478,29 @@ regex_replace(_OutputIterator __out,
|
||||
for (size_t __len = char_traits<_CharT>::length(__fmt); __i != __eof; ++__i)
|
||||
{
|
||||
if (!(__flags & regex_constants::format_no_copy))
|
||||
__out = _VSTD::copy(__i->prefix().first, __i->prefix().second, __out);
|
||||
__out = __i->format(__out, __fmt, __fmt + __len, __flags);
|
||||
__output = _VSTD::copy(__i->prefix().first, __i->prefix().second, __output);
|
||||
__output = __i->format(__output, __fmt, __fmt + __len, __flags);
|
||||
__lm = __i->suffix();
|
||||
if (__flags & regex_constants::format_first_only)
|
||||
break;
|
||||
}
|
||||
if (!(__flags & regex_constants::format_no_copy))
|
||||
__out = _VSTD::copy(__lm.first, __lm.second, __out);
|
||||
__output = _VSTD::copy(__lm.first, __lm.second, __output);
|
||||
}
|
||||
return __out;
|
||||
return __output;
|
||||
}
|
||||
|
||||
template <class _OutputIterator, class _BidirectionalIterator,
|
||||
class _Traits, class _CharT, class _ST, class _SA>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
regex_replace(_OutputIterator __out,
|
||||
regex_replace(_OutputIterator __output,
|
||||
_BidirectionalIterator __first, _BidirectionalIterator __last,
|
||||
const basic_regex<_CharT, _Traits>& __e,
|
||||
const basic_string<_CharT, _ST, _SA>& __fmt,
|
||||
regex_constants::match_flag_type __flags = regex_constants::match_default)
|
||||
{
|
||||
return _VSTD::regex_replace(__out, __first, __last, __e, __fmt.c_str(), __flags);
|
||||
return _VSTD::regex_replace(__output, __first, __last, __e, __fmt.c_str(), __flags);
|
||||
}
|
||||
|
||||
template <class _Traits, class _CharT, class _ST, class _SA, class _FST,
|
||||
|
@ -156,6 +156,11 @@ namespace std {
|
||||
template <> struct hash<u32string_view>;
|
||||
template <> struct hash<wstring_view>;
|
||||
|
||||
constexpr basic_string<char> operator "" s( const char *str, size_t len ); // C++17
|
||||
constexpr basic_string<wchar_t> operator "" s( const wchar_t *str, size_t len ); // C++17
|
||||
constexpr basic_string<char16_t> operator "" s( const char16_t *str, size_t len ); // C++17
|
||||
constexpr basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++17
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
@ -749,6 +754,38 @@ hash<basic_string_view<_CharT, _Traits> >::operator()(
|
||||
return __do_string_hash(__val.data(), __val.data() + __val.size());
|
||||
}
|
||||
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
inline namespace literals
|
||||
{
|
||||
inline namespace string_view_literals
|
||||
{
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
basic_string_view<char> operator "" sv(const char *__str, size_t __len)
|
||||
{
|
||||
return basic_string_view<char> (__str, __len);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
basic_string_view<wchar_t> operator "" sv(const wchar_t *__str, size_t __len)
|
||||
{
|
||||
return basic_string_view<wchar_t> (__str, __len);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
basic_string_view<char16_t> operator "" sv(const char16_t *__str, size_t __len)
|
||||
{
|
||||
return basic_string_view<char16_t> (__str, __len);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
basic_string_view<char32_t> operator "" sv(const char32_t *__str, size_t __len)
|
||||
{
|
||||
return basic_string_view<char32_t> (__str, __len);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STRING_VIEW
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <cstdarg> // va_ macros
|
||||
// "builtins" not implemented here for Clang or GCC as they provide
|
||||
// implementations. Assuming required for elsewhere else, certainly MSVC.
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
@ -49,7 +49,7 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
|
||||
#define _Exit _exit
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
|
||||
// Bit builtin's make these assumptions when calling _BitScanForward/Reverse
|
||||
// etc. These assumptions are expected to be true for Win32/Win64 which this
|
||||
|
@ -148,7 +148,8 @@ class __thread_specific_ptr
|
||||
__thread_specific_ptr(const __thread_specific_ptr&);
|
||||
__thread_specific_ptr& operator=(const __thread_specific_ptr&);
|
||||
|
||||
static void __at_thread_exit(void*);
|
||||
static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
|
||||
|
||||
public:
|
||||
typedef _Tp* pointer;
|
||||
|
||||
@ -164,7 +165,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
void
|
||||
void _LIBCPP_TLS_DESTRUCTOR_CC
|
||||
__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
|
||||
{
|
||||
delete static_cast<pointer>(__p);
|
||||
@ -173,12 +174,10 @@ __thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
|
||||
template <class _Tp>
|
||||
__thread_specific_ptr<_Tp>::__thread_specific_ptr()
|
||||
{
|
||||
int __ec = __libcpp_tls_create(
|
||||
&__key_,
|
||||
&__thread_specific_ptr::__at_thread_exit);
|
||||
if (__ec)
|
||||
__throw_system_error(__ec,
|
||||
"__thread_specific_ptr construction failed");
|
||||
int __ec =
|
||||
__libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
|
||||
if (__ec)
|
||||
__throw_system_error(__ec, "__thread_specific_ptr construction failed");
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
|
@ -489,7 +489,7 @@ addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DELETED_FUNCTIONS)
|
||||
#if !defined(_LIBCPP_CXX03_LANG)
|
||||
template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
|
||||
#endif
|
||||
|
||||
@ -1503,7 +1503,7 @@ template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
|
||||
|
||||
// is_polymorphic
|
||||
|
||||
#if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC)
|
||||
#if __has_feature(is_polymorphic) || defined(_LIBCPP_COMPILER_MSVC)
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS is_polymorphic
|
||||
@ -1566,7 +1566,7 @@ struct __type_list
|
||||
|
||||
struct __nat
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__nat() = delete;
|
||||
__nat(const __nat&) = delete;
|
||||
__nat& operator=(const __nat&) = delete;
|
||||
|
@ -348,7 +348,6 @@ template <class T> unspecified2 end(const valarray<T>& v);
|
||||
#include <new>
|
||||
|
||||
#include <__undef_min_max>
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -3697,7 +3696,7 @@ valarray<_Tp>::resize(size_t __n, value_type __x)
|
||||
{
|
||||
while (__end_ != __begin_)
|
||||
(--__end_)->~value_type();
|
||||
_VSTD::__deallocate(__begin_);
|
||||
_VSTD::__libcpp_deallocate(__begin_);
|
||||
__begin_ = __end_ = nullptr;
|
||||
}
|
||||
if (__n)
|
||||
|
@ -275,7 +275,7 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_HAS_EXTERNAL_THREAD_API)
|
||||
if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
|
||||
file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp)
|
||||
|
||||
if (LIBCXX_ENABLE_SHARED)
|
||||
|
@ -12,6 +12,28 @@
|
||||
#include "system_error" // __throw_system_error
|
||||
#include <time.h> // clock_gettime, CLOCK_MONOTONIC and CLOCK_REALTIME
|
||||
|
||||
#if (__APPLE__)
|
||||
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
|
||||
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101200
|
||||
#define _LIBCXX_USE_CLOCK_GETTIME
|
||||
#endif
|
||||
#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
|
||||
#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 100000
|
||||
#define _LIBCXX_USE_CLOCK_GETTIME
|
||||
#endif
|
||||
#elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
|
||||
#if __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 100000
|
||||
#define _LIBCXX_USE_CLOCK_GETTIME
|
||||
#endif
|
||||
#elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__)
|
||||
#if __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 30000
|
||||
#define _LIBCXX_USE_CLOCK_GETTIME
|
||||
#endif
|
||||
#endif // __ENVIRONMENT_.*_VERSION_MIN_REQUIRED__
|
||||
#else
|
||||
#define _LIBCXX_USE_CLOCK_GETTIME
|
||||
#endif // __APPLE__
|
||||
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define VC_EXTRA_LEAN
|
||||
@ -70,16 +92,16 @@ system_clock::now() _NOEXCEPT
|
||||
static_cast<__int64>(ft.dwLowDateTime)};
|
||||
return time_point(duration_cast<duration>(d - nt_to_unix_epoch));
|
||||
#else
|
||||
#ifdef CLOCK_REALTIME
|
||||
#if defined(_LIBCXX_USE_CLOCK_GETTIME) && defined(CLOCK_REALTIME)
|
||||
struct timespec tp;
|
||||
if (0 != clock_gettime(CLOCK_REALTIME, &tp))
|
||||
__throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed");
|
||||
return time_point(seconds(tp.tv_sec) + microseconds(tp.tv_nsec / 1000));
|
||||
#else // !CLOCK_REALTIME
|
||||
#else
|
||||
timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
|
||||
#endif // CLOCK_REALTIME
|
||||
#endif // _LIBCXX_USE_CLOCK_GETTIME && CLOCK_REALTIME
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -106,6 +128,18 @@ const bool steady_clock::is_steady;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
// Darwin libc versions >= 1133 provide ns precision via CLOCK_UPTIME_RAW
|
||||
#if defined(_LIBCXX_USE_CLOCK_GETTIME) && defined(CLOCK_UPTIME_RAW)
|
||||
steady_clock::time_point
|
||||
steady_clock::now() _NOEXCEPT
|
||||
{
|
||||
struct timespec tp;
|
||||
if (0 != clock_gettime(CLOCK_UPTIME_RAW, &tp))
|
||||
__throw_system_error(errno, "clock_gettime(CLOCK_UPTIME_RAW) failed");
|
||||
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
|
||||
}
|
||||
|
||||
#else
|
||||
// mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of
|
||||
// nanoseconds since the computer booted up. MachInfo.numer and MachInfo.denom
|
||||
// are run time constants supplied by the OS. This clock has no relationship
|
||||
@ -157,6 +191,7 @@ steady_clock::now() _NOEXCEPT
|
||||
static FP fp = init_steady_clock();
|
||||
return time_point(duration(fp()));
|
||||
}
|
||||
#endif // defined(_LIBCXX_USE_CLOCK_GETTIME) && defined(CLOCK_UPTIME_RAW)
|
||||
|
||||
#elif defined(_LIBCPP_WIN32API)
|
||||
|
||||
@ -175,6 +210,13 @@ steady_clock::now() _NOEXCEPT
|
||||
|
||||
#elif defined(CLOCK_MONOTONIC)
|
||||
|
||||
// On Apple platforms only CLOCK_UPTIME_RAW or mach_absolute_time are able to
|
||||
// time functions in the nanosecond range. Thus, they are the only acceptable
|
||||
// implementations of steady_clock.
|
||||
#ifdef __APPLE__
|
||||
#error "Never use CLOCK_MONOTONIC for steady_clock::now on Apple platforms"
|
||||
#endif
|
||||
|
||||
steady_clock::time_point
|
||||
steady_clock::now() _NOEXCEPT
|
||||
{
|
||||
|
@ -12,7 +12,10 @@
|
||||
#include "exception"
|
||||
#include "new"
|
||||
|
||||
#if defined(__APPLE__) && !defined(LIBCXXRT) && \
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
#include <eh.h>
|
||||
#include <corecrt_terminate.h>
|
||||
#elif defined(__APPLE__) && !defined(LIBCXXRT) && \
|
||||
!defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
|
||||
#include <cxxabi.h>
|
||||
|
||||
@ -46,13 +49,21 @@ namespace std
|
||||
unexpected_handler
|
||||
set_unexpected(unexpected_handler func) _NOEXCEPT
|
||||
{
|
||||
return __sync_lock_test_and_set(&__unexpected_handler, func);
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return ::set_unexpected(func);
|
||||
#else
|
||||
return __sync_lock_test_and_set(&__unexpected_handler, func);
|
||||
#endif
|
||||
}
|
||||
|
||||
unexpected_handler
|
||||
get_unexpected() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return ::_get_unexpected();
|
||||
#else
|
||||
return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_NORETURN
|
||||
@ -67,13 +78,21 @@ unexpected()
|
||||
terminate_handler
|
||||
set_terminate(terminate_handler func) _NOEXCEPT
|
||||
{
|
||||
return __sync_lock_test_and_set(&__terminate_handler, func);
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return ::set_terminate(func);
|
||||
#else
|
||||
return __sync_lock_test_and_set(&__terminate_handler, func);
|
||||
#endif
|
||||
}
|
||||
|
||||
terminate_handler
|
||||
get_terminate() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return ::_get_terminate();
|
||||
#else
|
||||
return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef __EMSCRIPTEN__ // We provide this in JS
|
||||
@ -103,6 +122,7 @@ terminate() _NOEXCEPT
|
||||
#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
|
||||
|
||||
#if !defined(LIBCXXRT) && !defined(__GLIBCXX__) && !defined(__EMSCRIPTEN__)
|
||||
|
||||
bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
|
||||
|
||||
int uncaught_exceptions() _NOEXCEPT
|
||||
@ -115,7 +135,9 @@ int uncaught_exceptions() _NOEXCEPT
|
||||
# else
|
||||
return __cxa_uncaught_exception() ? 1 : 0;
|
||||
# endif
|
||||
#else // __APPLE__
|
||||
#elif defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return __uncaught_exceptions();
|
||||
#else
|
||||
# if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING("uncaught_exceptions not yet implemented")
|
||||
# else
|
||||
|
@ -34,7 +34,7 @@ class _LIBCPP_TYPE_VIS __new_delete_memory_resource_imp
|
||||
{ return __allocate(__size); }
|
||||
|
||||
virtual void do_deallocate(void * __p, size_t, size_t)
|
||||
{ __deallocate(__p); }
|
||||
{ _VSTD::__libcpp_deallocate(__p); }
|
||||
|
||||
virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT
|
||||
{ return &__other == this; }
|
||||
|
@ -31,7 +31,7 @@
|
||||
#elif defined(__sun__)
|
||||
#define _LIBCPP_ELAST ESTALE
|
||||
#elif defined(_LIBCPP_MSVCRT)
|
||||
#define _LIBCPP_ELAST _sys_nerr
|
||||
#define _LIBCPP_ELAST (_sys_nerr - 1)
|
||||
#else
|
||||
// Warn here so that the person doing the libcxx port has an easier time:
|
||||
#warning ELAST for this platform not yet implemented
|
||||
|
@ -14,32 +14,64 @@
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_STDIN
|
||||
_ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin [sizeof(istream)];
|
||||
_ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin [sizeof(__stdinbuf <char>)];
|
||||
_ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin[sizeof(istream)]
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
__asm__("?cin@__1@std@@3V?$basic_istream@DU?$char_traits@D@__1@std@@@12@A")
|
||||
#endif
|
||||
;
|
||||
_ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin[sizeof(__stdinbuf <char>)];
|
||||
static mbstate_t mb_cin;
|
||||
_ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin [sizeof(wistream)];
|
||||
_ALIGNAS_TYPE (__stdinbuf<wchar_t> ) static char __wcin [sizeof(__stdinbuf <wchar_t>)];
|
||||
_ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin[sizeof(wistream)]
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
__asm__("?wcin@__1@std@@3V?$basic_istream@_WU?$char_traits@_W@__1@std@@@12@A")
|
||||
#endif
|
||||
;
|
||||
_ALIGNAS_TYPE (__stdinbuf<wchar_t> ) static char __wcin[sizeof(__stdinbuf <wchar_t>)];
|
||||
static mbstate_t mb_wcin;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_STDOUT
|
||||
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)];
|
||||
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)]
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
__asm__("?cout@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A")
|
||||
#endif
|
||||
;
|
||||
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
|
||||
static mbstate_t mb_cout;
|
||||
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)];
|
||||
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)]
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
__asm__("?wcout@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A")
|
||||
#endif
|
||||
;
|
||||
_ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
|
||||
static mbstate_t mb_wcout;
|
||||
#endif
|
||||
|
||||
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)];
|
||||
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)]
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
__asm__("?cerr@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A")
|
||||
#endif
|
||||
;
|
||||
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
|
||||
static mbstate_t mb_cerr;
|
||||
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)];
|
||||
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)]
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
__asm__("?wcerr@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A")
|
||||
#endif
|
||||
;
|
||||
_ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)];
|
||||
static mbstate_t mb_wcerr;
|
||||
|
||||
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)];
|
||||
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)];
|
||||
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)]
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
__asm__("?clog@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A")
|
||||
#endif
|
||||
;
|
||||
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)]
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
__asm__("?wclog@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A")
|
||||
#endif
|
||||
;
|
||||
|
||||
ios_base::Init __start_std_streams;
|
||||
|
||||
|
@ -140,7 +140,7 @@ class _LIBCPP_HIDDEN locale::__imp
|
||||
: public facet
|
||||
{
|
||||
enum {N = 28};
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
// FIXME: MSVC doesn't support aligned parameters by value.
|
||||
// I can't get the __sso_allocator to work here
|
||||
// for MSVC I think for this reason.
|
||||
|
@ -117,6 +117,12 @@ sleep_for(const chrono::nanoseconds& ns)
|
||||
using namespace chrono;
|
||||
if (ns > nanoseconds::zero())
|
||||
{
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
milliseconds ms = duration_cast<milliseconds>(ns);
|
||||
if (ms.count() == 0 || ns > duration_cast<nanoseconds>(ms))
|
||||
++ms;
|
||||
Sleep(ms.count());
|
||||
#else
|
||||
seconds s = duration_cast<seconds>(ns);
|
||||
timespec ts;
|
||||
typedef decltype(ts.tv_sec) ts_sec;
|
||||
@ -134,6 +140,7 @@ sleep_for(const chrono::nanoseconds& ns)
|
||||
|
||||
while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
|
||||
;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ pythonize_bool(LIBCXXABI_ENABLE_SHARED)
|
||||
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
|
||||
pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
|
||||
pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
|
||||
pythonize_bool(LIBCXX_HAS_EXTERNAL_THREAD_API)
|
||||
pythonize_bool(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
|
||||
|
||||
# By default, for non-standalone builds, libcxx and libcxxabi share a library
|
||||
# directory.
|
||||
|
@ -25,9 +25,10 @@
|
||||
#include <vector>
|
||||
#include <initializer_list>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#if TEST_STD_VER >= 11
|
||||
#define DELETE_FUNCTION = delete
|
||||
#else
|
||||
#define DELETE_FUNCTION
|
||||
|
@ -67,7 +67,8 @@ def __init__(self, lit_config, config):
|
||||
self.cxx_library_root = None
|
||||
self.cxx_runtime_root = None
|
||||
self.abi_library_root = None
|
||||
self.env = {}
|
||||
self.link_shared = self.get_lit_bool('enable_shared', default=True)
|
||||
self.exec_env = {}
|
||||
self.use_target = False
|
||||
self.use_system_cxx_lib = False
|
||||
self.use_clang_verify = False
|
||||
@ -146,7 +147,7 @@ def print_config_info(self):
|
||||
# Print as list to prevent "set([...])" from being printed.
|
||||
self.lit_config.note('Using available_features: %s' %
|
||||
list(self.config.available_features))
|
||||
self.lit_config.note('Using environment: %r' % self.env)
|
||||
self.lit_config.note('Using environment: %r' % self.exec_env)
|
||||
|
||||
def get_test_format(self):
|
||||
return LibcxxTestFormat(
|
||||
@ -154,7 +155,7 @@ def get_test_format(self):
|
||||
self.use_clang_verify,
|
||||
self.execute_external,
|
||||
self.executor,
|
||||
exec_env=self.env)
|
||||
exec_env=self.exec_env)
|
||||
|
||||
def configure_executor(self):
|
||||
exec_str = self.get_lit_conf('executor', "None")
|
||||
@ -207,12 +208,16 @@ def configure_cxx(self):
|
||||
self.config.available_features.add('%s-%s' % (cxx_type, maj_v))
|
||||
self.config.available_features.add('%s-%s.%s' % (
|
||||
cxx_type, maj_v, min_v))
|
||||
self.cxx.compile_env = dict(os.environ)
|
||||
# 'CCACHE_CPP2' prevents ccache from stripping comments while
|
||||
# preprocessing. This is required to prevent stripping of '-verify'
|
||||
# comments.
|
||||
self.cxx.compile_env['CCACHE_CPP2'] = '1'
|
||||
|
||||
def _configure_clang_cl(self, clang_path):
|
||||
assert self.cxx_is_clang_cl
|
||||
# FIXME: don't hardcode the target
|
||||
flags = ['-fms-compatibility-version=19.00',
|
||||
'--target=i686-unknown-windows']
|
||||
flags = ['--target=i686-pc-windows']
|
||||
compile_flags = []
|
||||
link_flags = ['-fuse-ld=lld']
|
||||
if 'INCLUDE' in os.environ:
|
||||
@ -555,7 +560,7 @@ def configure_filesystem_compile_flags(self):
|
||||
if not os.path.isdir(dynamic_env):
|
||||
os.makedirs(dynamic_env)
|
||||
self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="%s"' % dynamic_env]
|
||||
self.env['LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT'] = ("%s" % dynamic_env)
|
||||
self.exec_env['LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT'] = ("%s" % dynamic_env)
|
||||
|
||||
dynamic_helper = os.path.join(self.libcxx_src_root, 'test', 'support',
|
||||
'filesystem_dynamic_test_helper.py')
|
||||
@ -577,7 +582,7 @@ def configure_link_flags(self):
|
||||
self.cxx.link_flags += ['-nodefaultlibs']
|
||||
# FIXME: Handle MSVCRT as part of the ABI library handling.
|
||||
if self.is_windows:
|
||||
self.cxx.link_flags += ['-nostdlib', '-lmsvcrtd']
|
||||
self.cxx.link_flags += ['-nostdlib']
|
||||
self.configure_link_flags_cxx_library()
|
||||
self.configure_link_flags_abi_library()
|
||||
self.configure_extra_library_flags()
|
||||
@ -602,8 +607,14 @@ def configure_link_flags_cxx_library_path(self):
|
||||
if not self.use_system_cxx_lib:
|
||||
if self.cxx_library_root:
|
||||
self.cxx.link_flags += ['-L' + self.cxx_library_root]
|
||||
if self.cxx_runtime_root and not self.is_windows:
|
||||
self.cxx.link_flags += ['-Wl,-rpath,' + self.cxx_runtime_root]
|
||||
if self.is_windows and self.link_shared:
|
||||
self.add_path(self.cxx.compile_env, self.cxx_library_root)
|
||||
if self.cxx_runtime_root:
|
||||
if not self.is_windows:
|
||||
self.cxx.link_flags += ['-Wl,-rpath,' +
|
||||
self.cxx_runtime_root]
|
||||
elif self.is_windows and self.link_shared:
|
||||
self.add_path(self.exec_env, self.cxx_runtime_root)
|
||||
|
||||
def configure_link_flags_abi_library_path(self):
|
||||
# Configure ABI library paths.
|
||||
@ -612,14 +623,15 @@ def configure_link_flags_abi_library_path(self):
|
||||
self.cxx.link_flags += ['-L' + self.abi_library_root]
|
||||
if not self.is_windows:
|
||||
self.cxx.link_flags += ['-Wl,-rpath,' + self.abi_library_root]
|
||||
else:
|
||||
self.add_path(self.exec_env, self.abi_library_root)
|
||||
|
||||
def configure_link_flags_cxx_library(self):
|
||||
libcxx_experimental = self.get_lit_bool('enable_experimental', default=False)
|
||||
if libcxx_experimental:
|
||||
self.config.available_features.add('c++experimental')
|
||||
self.cxx.link_flags += ['-lc++experimental']
|
||||
libcxx_shared = self.get_lit_bool('enable_shared', default=True)
|
||||
if libcxx_shared:
|
||||
if self.link_shared:
|
||||
self.cxx.link_flags += ['-lc++']
|
||||
else:
|
||||
cxx_library_root = self.get_lit_conf('cxx_library_root')
|
||||
@ -654,7 +666,8 @@ def configure_link_flags_abi_library(self):
|
||||
elif cxx_abi == 'libcxxrt':
|
||||
self.cxx.link_flags += ['-lcxxrt']
|
||||
elif cxx_abi == 'none' or cxx_abi == 'default':
|
||||
pass
|
||||
if self.is_windows:
|
||||
self.cxx.link_flags += ['-lmsvcrtd']
|
||||
else:
|
||||
self.lit_config.fatal(
|
||||
'C++ ABI setting %s unsupported for tests' % cxx_abi)
|
||||
@ -746,7 +759,7 @@ def add_ubsan():
|
||||
self.cxx.flags += ['-fsanitize=undefined',
|
||||
'-fno-sanitize=vptr,function,float-divide-by-zero',
|
||||
'-fno-sanitize-recover=all']
|
||||
self.env['UBSAN_OPTIONS'] = 'print_stacktrace=1'
|
||||
self.exec_env['UBSAN_OPTIONS'] = 'print_stacktrace=1'
|
||||
self.config.available_features.add('ubsan')
|
||||
|
||||
# Setup the sanitizer compile flags
|
||||
@ -754,10 +767,10 @@ def add_ubsan():
|
||||
if san == 'Address' or san == 'Address;Undefined' or san == 'Undefined;Address':
|
||||
self.cxx.flags += ['-fsanitize=address']
|
||||
if llvm_symbolizer is not None:
|
||||
self.env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer
|
||||
self.exec_env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer
|
||||
# FIXME: Turn ODR violation back on after PR28391 is resolved
|
||||
# https://llvm.org/bugs/show_bug.cgi?id=28391
|
||||
self.env['ASAN_OPTIONS'] = 'detect_odr_violation=0'
|
||||
self.exec_env['ASAN_OPTIONS'] = 'detect_odr_violation=0'
|
||||
self.config.available_features.add('asan')
|
||||
self.config.available_features.add('sanitizer-new-delete')
|
||||
self.cxx.compile_flags += ['-O1']
|
||||
@ -769,7 +782,7 @@ def add_ubsan():
|
||||
self.cxx.compile_flags += [
|
||||
'-fsanitize-memory-track-origins']
|
||||
if llvm_symbolizer is not None:
|
||||
self.env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer
|
||||
self.exec_env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer
|
||||
self.config.available_features.add('msan')
|
||||
self.config.available_features.add('sanitizer-new-delete')
|
||||
self.cxx.compile_flags += ['-O1']
|
||||
@ -855,8 +868,8 @@ def configure_substitutions(self):
|
||||
sub.append(('%link', link_str))
|
||||
sub.append(('%build', build_str))
|
||||
# Configure exec prefix substitutions.
|
||||
exec_env_str = 'env ' if len(self.env) != 0 else ''
|
||||
for k, v in self.env.items():
|
||||
exec_env_str = 'env ' if len(self.exec_env) != 0 else ''
|
||||
for k, v in self.exec_env.items():
|
||||
exec_env_str += ' %s=%s' % (k, v)
|
||||
# Configure run env substitution.
|
||||
exec_str = exec_env_str
|
||||
@ -898,4 +911,12 @@ def configure_triple(self):
|
||||
"inferred target_triple as: %r" % self.config.target_triple)
|
||||
|
||||
def configure_env(self):
|
||||
self.target_info.configure_env(self.env)
|
||||
self.target_info.configure_env(self.exec_env)
|
||||
|
||||
def add_path(self, dest_env, new_path):
|
||||
if 'PATH' not in dest_env:
|
||||
dest_env['PATH'] = new_path
|
||||
else:
|
||||
split_char = ';' if self.is_windows else ':'
|
||||
dest_env['PATH'] = '%s%s%s' % (new_path, split_char,
|
||||
dest_env['PATH'])
|
||||
|
@ -7,6 +7,7 @@
|
||||
#
|
||||
#===----------------------------------------------------------------------===##
|
||||
|
||||
import platform
|
||||
import os
|
||||
|
||||
from libcxx.test import tracing
|
||||
@ -34,6 +35,7 @@ def run(self, exe_path, cmd, local_cwd, file_deps=None, env=None):
|
||||
class LocalExecutor(Executor):
|
||||
def __init__(self):
|
||||
super(LocalExecutor, self).__init__()
|
||||
self.is_windows = platform.system() == 'Windows'
|
||||
|
||||
def run(self, exe_path, cmd=None, work_dir='.', file_deps=None, env=None):
|
||||
cmd = cmd or [exe_path]
|
||||
@ -43,9 +45,30 @@ def run(self, exe_path, cmd=None, work_dir='.', file_deps=None, env=None):
|
||||
env_cmd += ['%s=%s' % (k, v) for k, v in env.items()]
|
||||
if work_dir == '.':
|
||||
work_dir = os.getcwd()
|
||||
out, err, rc = executeCommand(env_cmd + cmd, cwd=work_dir)
|
||||
if not self.is_windows:
|
||||
out, err, rc = executeCommand(env_cmd + cmd, cwd=work_dir)
|
||||
else:
|
||||
out, err, rc = executeCommand(cmd, cwd=work_dir,
|
||||
env=self._build_windows_env(env))
|
||||
return (env_cmd + cmd, out, err, rc)
|
||||
|
||||
def _build_windows_env(self, exec_env):
|
||||
# FIXME: Finding Windows DLL's at runtime requires modifying the
|
||||
# PATH environment variables. However we don't want to print out
|
||||
# the entire PATH as part of the diagnostic for every failing test.
|
||||
# Therefore this hack builds a new executable environment that
|
||||
# merges the current environment and the supplied environment while
|
||||
# still only printing the supplied environment in diagnostics.
|
||||
if not self.is_windows or exec_env is None:
|
||||
return None
|
||||
new_env = dict(os.environ)
|
||||
for key, value in exec_env.items():
|
||||
if key == 'PATH':
|
||||
assert value.strip() != '' and "expected non-empty path"
|
||||
new_env['PATH'] = "%s;%s" % (value, os.environ['PATH'])
|
||||
else:
|
||||
new_env[key] = value
|
||||
return new_env
|
||||
|
||||
class PrefixExecutor(Executor):
|
||||
"""Prefix an executor with some other command wrapper.
|
||||
|
@ -41,11 +41,6 @@ def __init__(self, cxx, use_verify_for_fail, execute_external,
|
||||
self.execute_external = execute_external
|
||||
self.executor = executor
|
||||
self.exec_env = dict(exec_env)
|
||||
self.cxx.compile_env = dict(os.environ)
|
||||
# 'CCACHE_CPP2' prevents ccache from stripping comments while
|
||||
# preprocessing. This is required to prevent stripping of '-verify'
|
||||
# comments.
|
||||
self.cxx.compile_env['CCACHE_CPP2'] = '1'
|
||||
|
||||
@staticmethod
|
||||
def _make_custom_parsers():
|
||||
|
@ -28,7 +28,7 @@ config.has_libatomic = "@LIBCXX_HAS_ATOMIC_LIB@"
|
||||
config.use_libatomic = "@LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@"
|
||||
|
||||
config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
|
||||
config.cxx_ext_threads = "@LIBCXX_HAS_EXTERNAL_THREAD_API@"
|
||||
config.cxx_ext_threads = "@LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY@"
|
||||
|
||||
# Let the main config do the real work.
|
||||
config.loaded_site_config = True
|
||||
|
@ -132,10 +132,10 @@ int main()
|
||||
static_assert ( std::rbegin(c) != std::rend(c), "");
|
||||
static_assert ( std::cbegin(c) != std::cend(c), "");
|
||||
static_assert ( std::crbegin(c) != std::crend(c), "");
|
||||
|
||||
|
||||
static_assert ( *c.begin() == 0, "");
|
||||
static_assert ( *c.rbegin() == 4, "");
|
||||
|
||||
|
||||
static_assert ( *std::begin(c) == 0, "" );
|
||||
static_assert ( *std::cbegin(c) == 0, "" );
|
||||
static_assert ( *std::rbegin(c) == 4, "" );
|
||||
|
@ -0,0 +1,55 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <istream>
|
||||
|
||||
// template <class charT, class traits = char_traits<charT> >
|
||||
// class basic_istream;
|
||||
|
||||
// basic_istream(basic_istream const& rhs) = delete;
|
||||
// basic_istream& operator=(basic_istream const&) = delete;
|
||||
|
||||
#include <istream>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
struct test_istream
|
||||
: public std::basic_istream<char>
|
||||
{
|
||||
typedef std::basic_istream<char> base;
|
||||
|
||||
test_istream(test_istream&& s)
|
||||
: base(std::move(s)) // OK
|
||||
{
|
||||
}
|
||||
|
||||
test_istream& operator=(test_istream&& s) {
|
||||
base::operator=(std::move(s)); // OK
|
||||
return *this;
|
||||
}
|
||||
|
||||
test_istream(test_istream const& s)
|
||||
: base(s) // expected-error {{call to deleted constructor of 'std::basic_istream<char>'}}
|
||||
{
|
||||
}
|
||||
|
||||
test_istream& operator=(test_istream const& s) {
|
||||
base::operator=(s); // expected-error {{call to deleted member function 'operator='}}
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
}
|
@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <istream>
|
||||
|
||||
// template <class charT, class traits = char_traits<charT> >
|
||||
@ -17,8 +19,6 @@
|
||||
#include <istream>
|
||||
#include <cassert>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class CharT>
|
||||
struct testbuf
|
||||
: public std::basic_streambuf<CharT>
|
||||
@ -37,11 +37,8 @@ struct test_istream
|
||||
: base(std::move(s)) {}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
testbuf<char> sb;
|
||||
test_istream<char> is1(&sb);
|
||||
@ -74,5 +71,4 @@ int main()
|
||||
assert(is.precision() == 6);
|
||||
assert(is.getloc().name() == "C");
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
}
|
||||
|
@ -179,10 +179,10 @@ int main(){
|
||||
static_assert ( std::rbegin(c) != std::rend(c), "");
|
||||
static_assert ( std::cbegin(c) != std::cend(c), "");
|
||||
static_assert ( std::crbegin(c) != std::crend(c), "");
|
||||
|
||||
|
||||
static_assert ( *c.begin() == 0, "");
|
||||
static_assert ( *c.rbegin() == 4, "");
|
||||
|
||||
|
||||
static_assert ( *std::begin(c) == 0, "" );
|
||||
static_assert ( *std::cbegin(c) == 0, "" );
|
||||
static_assert ( *std::rbegin(c) == 4, "" );
|
||||
@ -191,7 +191,7 @@ int main(){
|
||||
|
||||
{
|
||||
static constexpr const int c[] = {0,1,2,3,4};
|
||||
|
||||
|
||||
static_assert ( *std::begin(c) == 0, "" );
|
||||
static_assert ( *std::cbegin(c) == 0, "" );
|
||||
static_assert ( *std::rbegin(c) == 4, "" );
|
||||
|
@ -0,0 +1,57 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
|
||||
// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
|
||||
// Note: libc++ supports string_view before C++17, but literals were introduced in C++14
|
||||
|
||||
#include <string_view>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace std::literals::string_view_literals;
|
||||
|
||||
static_assert ( std::is_same<decltype( "Hi"sv), std::string_view>::value, "" );
|
||||
static_assert ( std::is_same<decltype( u8"Hi"sv), std::string_view>::value, "" );
|
||||
static_assert ( std::is_same<decltype( L"Hi"sv), std::wstring_view>::value, "" );
|
||||
static_assert ( std::is_same<decltype( u"Hi"sv), std::u16string_view>::value, "" );
|
||||
static_assert ( std::is_same<decltype( U"Hi"sv), std::u32string_view>::value, "" );
|
||||
|
||||
std::string_view foo;
|
||||
std::wstring_view Lfoo;
|
||||
std::u16string_view ufoo;
|
||||
std::u32string_view Ufoo;
|
||||
|
||||
foo = ""sv; assert( foo.size() == 0);
|
||||
foo = u8""sv; assert( foo.size() == 0);
|
||||
Lfoo = L""sv; assert(Lfoo.size() == 0);
|
||||
ufoo = u""sv; assert(ufoo.size() == 0);
|
||||
Ufoo = U""sv; assert(Ufoo.size() == 0);
|
||||
|
||||
foo = " "sv; assert( foo.size() == 1);
|
||||
foo = u8" "sv; assert( foo.size() == 1);
|
||||
Lfoo = L" "sv; assert(Lfoo.size() == 1);
|
||||
ufoo = u" "sv; assert(ufoo.size() == 1);
|
||||
Ufoo = U" "sv; assert(Ufoo.size() == 1);
|
||||
|
||||
foo = "ABC"sv; assert( foo == "ABC"); assert( foo == std::string_view ( "ABC"));
|
||||
foo = u8"ABC"sv; assert( foo == u8"ABC"); assert( foo == std::string_view (u8"ABC"));
|
||||
Lfoo = L"ABC"sv; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring_view ( L"ABC"));
|
||||
ufoo = u"ABC"sv; assert(ufoo == u"ABC"); assert(ufoo == std::u16string_view( u"ABC"));
|
||||
Ufoo = U"ABC"sv; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string_view( U"ABC"));
|
||||
|
||||
static_assert( "ABC"sv.size() == 3, "");
|
||||
static_assert(u8"ABC"sv.size() == 3, "");
|
||||
static_assert( L"ABC"sv.size() == 3, "");
|
||||
static_assert( u"ABC"sv.size() == 3, "");
|
||||
static_assert( U"ABC"sv.size() == 3, "");
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
|
||||
// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
|
||||
|
||||
#include <string_view>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
using std::string_view;
|
||||
|
||||
string_view foo = ""sv; // should fail w/conversion operator not found
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
|
||||
// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
|
||||
// Note: libc++ supports string_view before C++17, but literals were introduced in C++14
|
||||
|
||||
#include <string_view>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace std::literals;
|
||||
|
||||
std::string_view foo = ""sv;
|
||||
assert(foo.length() == 0);
|
||||
}
|
@ -8,13 +8,14 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifdef __deallocate
|
||||
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
_LIBCPP_WARNING("macro __deallocate is incompatible with C++. #undefining __deallocate")
|
||||
#else
|
||||
#warning: macro __deallocate is incompatible with C++. #undefining __deallocate
|
||||
#endif
|
||||
#endif
|
||||
#undef __deallocate
|
||||
#endif
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
|
||||
// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
|
||||
|
||||
#include <string_view>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string_view foo = ""sv; // should fail w/conversion operator not found
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
|
||||
// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
|
||||
// Note: libc++ supports string_view before C++17, but literals were introduced in C++14
|
||||
|
||||
#include <string_view>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace std::literals::string_view_literals;
|
||||
|
||||
std::string_view foo = ""sv;
|
||||
assert(foo.length() == 0);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03, c++11
|
||||
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
|
||||
// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
|
||||
// Note: libc++ supports string_view before C++17, but literals were introduced in C++14
|
||||
|
||||
#include <string_view>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace std;
|
||||
|
||||
string_view foo = ""sv;
|
||||
assert(foo.length() == 0);
|
||||
}
|
@ -19,7 +19,9 @@
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#include "test_macros.h"
|
||||
|
||||
#if TEST_STD_VER >= 11
|
||||
#define DELETE_FUNCTION = delete
|
||||
#else
|
||||
#define DELETE_FUNCTION { assert(false); }
|
||||
|
@ -38,7 +38,7 @@ int main()
|
||||
us1 %= std::chrono::milliseconds(3);
|
||||
assert(us1.count() == 2);
|
||||
}
|
||||
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@ int main()
|
||||
us %= 3;
|
||||
assert(us.count() == 2);
|
||||
}
|
||||
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@ int main()
|
||||
ns *= 5;
|
||||
assert(ns.count() == 15);
|
||||
}
|
||||
|
||||
|
||||
#if TEST_STD_VER > 14
|
||||
static_assert(test_constexpr(), "");
|
||||
#endif
|
||||
|
@ -13,6 +13,8 @@
|
||||
// Disable the missing braces warning for this reason.
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wmissing-braces"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
#endif
|
||||
|
||||
#endif // SUPPORT_DISABLE_MISSING_BRACES_WARNING_H
|
||||
|
@ -6,5 +6,5 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#define _LIBCPP_BUILDING_THREAD_API_EXTERNAL_PTHREAD
|
||||
#define _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
|
||||
#include <__threading_support>
|
||||
|
@ -37,4 +37,11 @@
|
||||
#define _Y NASTY_MACRO
|
||||
#define _Z NASTY_MACRO
|
||||
|
||||
// Test that libc++ doesn't use names reserved by WIN32 API Macros.
|
||||
// NOTE: Obviously we can only define these on non-windows platforms.
|
||||
#ifndef _WIN32
|
||||
#define __deallocate NASTY_MACRO
|
||||
#define __out NASTY_MACRO
|
||||
#endif
|
||||
|
||||
#endif // SUPPORT_NASTY_MACROS_HPP
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#if TEST_STD_VER >= 11
|
||||
#define DELETE_FUNCTION = delete
|
||||
#else
|
||||
#define DELETE_FUNCTION
|
||||
|
@ -124,7 +124,7 @@
|
||||
<tr><td></td><td></td><td></td><td></td><td></td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0003R5">P0003R5</a></td><td>LWG</td><td>Removing Deprecated Exception Specifications from C++17</td><td>Issaquah</td><td></td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0067R5">P0067R5</a></td><td>LWG</td><td>Elementary string conversions, revision 5</td><td>Issaquah</td><td></td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0403R1">P0403R1</a></td><td>LWG</td><td>Literal suffixes for <tt>basic_string_view</tt></td><td>Issaquah</td><td></td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0403R1">P0403R1</a></td><td>LWG</td><td>Literal suffixes for <tt>basic_string_view</tt></td><td>Issaquah</td><td>Complete</td><td>4.0</td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0414R2">P0414R2</a></td><td>LWG</td><td>Merging shared_ptr changes from Library Fundamentals to C++17</td><td>Issaquah</td><td></td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0418R2">P0418R2</a></td><td>LWG</td><td>Fail or succeed: there is no atomic lattice</td><td>Issaquah</td><td></td><td></td></tr>
|
||||
<tr><td><a href="http://wg21.link/P0426R1">P0426R1</a></td><td>LWG</td><td>Constexpr for <tt>std::char_traits</tt></td><td>Issaquah</td><td></td><td></td></tr>
|
||||
|
Loading…
Reference in New Issue
Block a user