From 2fa809d9eabddd820af54059faa8362dd50b51de Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:31 +0000 Subject: Vendor import of libc++ trunk r301441: https://llvm.org/svn/llvm-project/libcxx/trunk@301441 --- CMakeLists.txt | 20 +++-- include/atomic | 33 +++++--- include/math.h | 89 ++++++++++++++++++++-- include/mutex | 2 +- .../atomics/diagnose_invalid_memory_order.fail.cpp | 4 + .../support.dynamic/new_faligned_allocation.sh.cpp | 6 +- .../conversions.string/ctor_move.pass.cpp | 3 + test/libcxx/modules/cinttypes_exports.sh.cpp | 4 + test/libcxx/modules/clocale_exports.sh.cpp | 4 + test/libcxx/modules/cstdint_exports.sh.cpp | 4 + test/libcxx/modules/inttypes_h_exports.sh.cpp | 4 + .../futures/futures.promise/set_exception.pass.cpp | 3 + .../set_exception_at_thread_exit.pass.cpp | 4 +- .../thread.mutex/thread_safety_lock_guard.pass.cpp | 4 + .../thread_safety_lock_unlock.pass.cpp | 4 + .../thread_safety_missing_unlock.fail.cpp | 4 + .../thread_safety_requires_capability.pass.cpp | 4 + .../except.nested/assign.pass.cpp | 3 + .../except.nested/ctor_copy.pass.cpp | 3 + .../except.nested/ctor_default.pass.cpp | 3 + .../except.nested/rethrow_if_nested.pass.cpp | 5 +- .../except.nested/rethrow_nested.pass.cpp | 3 + .../except.nested/throw_with_nested.pass.cpp | 3 + .../propagation/current_exception.pass.cpp | 3 + .../propagation/exception_ptr.pass.cpp | 3 + .../propagation/make_exception_ptr.pass.cpp | 3 + .../propagation/rethrow_exception.pass.cpp | 3 + test/std/numerics/c.math/cmath.pass.cpp | 33 ++++++++ .../basic.string/string.cons/T_size_size.pass.cpp | 1 - .../any/any.class/any.modifiers/emplace.pass.cpp | 26 ++++--- .../optional.object.assign/emplace.pass.cpp | 4 +- .../emplace_initializer_list.pass.cpp | 18 +++-- utils/libcxx/test/config.py | 6 +- 33 files changed, 262 insertions(+), 54 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3bd533396b6..ef1726b78d9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,21 +120,19 @@ if (LIBCXX_CXX_ABI STREQUAL "default") ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include NO_DEFAULT_PATH ) - if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND - IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") + if (LIBCXX_TARGETING_MSVC) + # FIXME: Figure out how to configure the ABI library on Windows. + set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") + elseif ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND + IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_INTREE 1) + elseif (APPLE) + set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") + set(LIBCXX_CXX_ABI_SYSTEM 1) else() - if (LIBCXX_TARGETING_MSVC) - # FIXME: Figure out how to configure the ABI library on Windows. - set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") - elseif(APPLE) - set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") - set(LIBCXX_CXX_ABI_SYSTEM 1) - else() - set(LIBCXX_CXX_ABI_LIBNAME "default") - endif() + set(LIBCXX_CXX_ABI_LIBNAME "default") endif() else() set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}") diff --git a/include/atomic b/include/atomic index a17bdce1cc6f..f55e28ff5e92 100644 --- a/include/atomic +++ b/include/atomic @@ -861,16 +861,29 @@ kill_dependency(_Tp __y) _NOEXCEPT return __y; } -#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE -#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE -#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE -#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE -#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE -#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE -#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE -#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE -#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE -#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) +# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE +#else +# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#endif // general atomic diff --git a/include/math.h b/include/math.h index 79ebf2f119d7..8c30ba85d22c 100644 --- a/include/math.h +++ b/include/math.h @@ -307,6 +307,7 @@ long double truncl(long double x); extern "C++" { #include +#include // signbit @@ -324,22 +325,50 @@ __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x < 0; } + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) _NOEXCEPT +{ return false; } + #elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return ::signbit(static_cast::type>(__lcpp_x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x < 0; } + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) _NOEXCEPT +{ return false; } + #endif // signbit // fpclassify @@ -358,22 +387,34 @@ __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, int>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + #elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, bool>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return ::fpclassify(static_cast::type>(__lcpp_x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + #endif // fpclassify // isfinite @@ -392,12 +433,22 @@ __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type isfinite(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isfinite(_A1) _NOEXCEPT +{ return true; } + #endif // isfinite // isinf @@ -416,12 +467,22 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type isinf(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isinf(_A1) _NOEXCEPT +{ return false; } + #endif // isinf // isnan @@ -440,12 +501,18 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnan(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnan(_A1) _NOEXCEPT +{ return false; } + #endif // isnan // isnormal @@ -464,12 +531,18 @@ __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnormal(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnormal(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x != 0; } + #endif // isnormal // isgreater diff --git a/include/mutex b/include/mutex index e92baa51ae75..0b25614e8ead 100644 --- a/include/mutex +++ b/include/mutex @@ -685,7 +685,7 @@ inline _LIBCPP_INLINE_VISIBILITY void call_once(once_flag& __flag, const _Callable& __func) { - if (__flag.__state_ != ~0ul) + if (__libcpp_acquire_load(&__flag.__state_) != ~0ul) { __call_once_param __p(__func); __call_once(__flag.__state_, &__p, &__call_once_proxy); diff --git a/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp b/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp index d8bb363d86b0..51a1f2307ac6 100644 --- a/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp +++ b/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails because diagnose_if doesn't emit all of the diagnostics +// when -fdelayed-template-parsing is enabled, like it is on Windows. +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: verify-support, diagnose-if-support // UNSUPPORTED: libcpp-has-no-threads diff --git a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp index 04b40009cda9..8c17aabd640a 100644 --- a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp +++ b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp @@ -10,6 +10,10 @@ // test libc++'s implementation of align_val_t, and the relevent new/delete // overloads in all dialects when -faligned-allocation is present. +// Libc++ defers to the underlying MSVC library to provide the new/delete +// definitions, which does not yet provide aligned allocation +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: -faligned-allocation // RUN: %build -faligned-allocation @@ -74,4 +78,4 @@ int main() { assert(typeid(std::align_val_t).name() == std::string("St11align_val_t")); } #endif -} \ No newline at end of file +} diff --git a/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp index 9ba422fc0c9e..18cc0ca97166 100644 --- a/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp +++ b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// 'do_bytes' throws a std::range_error unexpectedly +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: c++98, c++03 // diff --git a/test/libcxx/modules/cinttypes_exports.sh.cpp b/test/libcxx/modules/cinttypes_exports.sh.cpp index 99d20ec65027..ce39ceea44d9 100644 --- a/test/libcxx/modules/cinttypes_exports.sh.cpp +++ b/test/libcxx/modules/cinttypes_exports.sh.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that re-exports diff --git a/test/libcxx/modules/clocale_exports.sh.cpp b/test/libcxx/modules/clocale_exports.sh.cpp index 69b1a9bd6624..aacddd2d857e 100644 --- a/test/libcxx/modules/clocale_exports.sh.cpp +++ b/test/libcxx/modules/clocale_exports.sh.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // UNSUPPORTED: c++98, c++03 diff --git a/test/libcxx/modules/cstdint_exports.sh.cpp b/test/libcxx/modules/cstdint_exports.sh.cpp index 8ecc1da28f1a..3d3cbe338174 100644 --- a/test/libcxx/modules/cstdint_exports.sh.cpp +++ b/test/libcxx/modules/cstdint_exports.sh.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that re-exports diff --git a/test/libcxx/modules/inttypes_h_exports.sh.cpp b/test/libcxx/modules/inttypes_h_exports.sh.cpp index d1598d7eab3f..5354c8fef338 100644 --- a/test/libcxx/modules/inttypes_h_exports.sh.cpp +++ b/test/libcxx/modules/inttypes_h_exports.sh.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that intypes.h re-exports stdint.h diff --git a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp index bf567a30243a..12c0a3d5ef41 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp @@ -8,6 +8,9 @@ //===----------------------------------------------------------------------===// // +// This test depends on std::exception_ptr which has not yet been implemented. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03 diff --git a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp index 1cb61d9af297..713f4716c764 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp @@ -6,7 +6,9 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// + +// This test depends on std::exception_ptr which has not yet been implemented. +// XFAIL: LIBCXX-WINDOWS-FIXME // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp index bff682ec4e00..6024d9978433 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp index 3898d08d8378..3ada120cb9dc 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp index 941e9ff8f678..cf3e63847905 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp index 1a5685e8deb8..e0681048d308 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/std/language.support/support.exception/except.nested/assign.pass.cpp b/test/std/language.support/support.exception/except.nested/assign.pass.cpp index 6338c8aaa26e..ec5575d072ce 100644 --- a/test/std/language.support/support.exception/except.nested/assign.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/assign.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; diff --git a/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp b/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp index 4cbdbb2ec892..92134c993af3 100644 --- a/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; diff --git a/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp b/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp index 18ca9968ff56..8f8503b254d3 100644 --- a/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; diff --git a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp index 68cd85038b28..fe9cd6042ba8 100644 --- a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // @@ -43,7 +46,7 @@ class C { public: virtual ~C() {} - C * operator&() const { assert(false); } // should not be called + C * operator&() const { assert(false); return nullptr; } // should not be called }; class D : private std::nested_exception {}; diff --git a/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp index d511a72f9f57..73d02da39333 100644 --- a/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // diff --git a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp index 6a9f25cd0855..6353afcb239b 100644 --- a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // diff --git a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp index 661f789fefd7..2046997774a8 100644 --- a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp +++ b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // diff --git a/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp b/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp index 3aa8dcf55bbc..9621a7360364 100644 --- a/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp +++ b/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // typedef unspecified exception_ptr; diff --git a/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp b/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp index 36feda7304bc..4980c656b2b5 100644 --- a/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp +++ b/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // diff --git a/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp b/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp index 565166cbdf76..7d27eee6689a 100644 --- a/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp +++ b/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // diff --git a/test/std/numerics/c.math/cmath.pass.cpp b/test/std/numerics/c.math/cmath.pass.cpp index 7161bd37e3e2..b5f586492bde 100644 --- a/test/std/numerics/c.math/cmath.pass.cpp +++ b/test/std/numerics/c.math/cmath.pass.cpp @@ -10,6 +10,7 @@ // #include +#include #include #include @@ -551,6 +552,13 @@ void test_signbit() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::signbit(-1.0) == true); + assert(std::signbit(0u) == false); + assert(std::signbit(std::numeric_limits::max()) == false); + assert(std::signbit(0) == false); + assert(std::signbit(1) == false); + assert(std::signbit(-1) == true); + assert(std::signbit(std::numeric_limits::max()) == false); + assert(std::signbit(std::numeric_limits::min()) == true); } void test_fpclassify() @@ -564,6 +572,11 @@ void test_fpclassify() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::fpclassify(-1.0) == FP_NORMAL); + assert(std::fpclassify(0) == FP_ZERO); + assert(std::fpclassify(1) == FP_NORMAL); + assert(std::fpclassify(-1) == FP_NORMAL); + assert(std::fpclassify(std::numeric_limits::max()) == FP_NORMAL); + assert(std::fpclassify(std::numeric_limits::min()) == FP_NORMAL); } void test_isfinite() @@ -577,6 +590,11 @@ void test_isfinite() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isfinite(-1.0) == true); + assert(std::isfinite(0) == true); + assert(std::isfinite(1) == true); + assert(std::isfinite(-1) == true); + assert(std::isfinite(std::numeric_limits::max()) == true); + assert(std::isfinite(std::numeric_limits::min()) == true); } void test_isnormal() @@ -590,6 +608,11 @@ void test_isnormal() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnormal(-1.0) == true); + assert(std::isnormal(0) == false); + assert(std::isnormal(1) == true); + assert(std::isnormal(-1) == true); + assert(std::isnormal(std::numeric_limits::max()) == true); + assert(std::isnormal(std::numeric_limits::min()) == true); } void test_isgreater() @@ -651,6 +674,11 @@ void test_isinf() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isinf(-1.0) == false); + assert(std::isinf(0) == false); + assert(std::isinf(1) == false); + assert(std::isinf(-1) == false); + assert(std::isinf(std::numeric_limits::max()) == false); + assert(std::isinf(std::numeric_limits::min()) == false); } void test_isless() @@ -731,6 +759,11 @@ void test_isnan() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnan(-1.0) == false); + assert(std::isnan(0) == false); + assert(std::isnan(1) == false); + assert(std::isnan(-1) == false); + assert(std::isnan(std::numeric_limits::max()) == false); + assert(std::isnan(std::numeric_limits::min()) == false); } void test_isunordered() diff --git a/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp index 312e4d27fef1..c8d14a1d0ddf 100644 --- a/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp +++ b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp @@ -63,7 +63,6 @@ void test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) { typedef typename S::traits_type T; - typedef typename S::allocator_type A; if (pos <= sv.size()) { S s2(sv, pos, n, a); diff --git a/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp index 75dfb0a2e704..7ed6121e5301 100644 --- a/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp +++ b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp @@ -44,7 +44,7 @@ void test_emplace_type() { auto &v = a.emplace(); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -60,7 +60,7 @@ void test_emplace_type() { auto &v = a.emplace(101); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -76,7 +76,7 @@ void test_emplace_type() { auto &v = a.emplace(-1, 42, -1); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -97,7 +97,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace(); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch(a); @@ -107,7 +107,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace(-1, 42, -1); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch(a); @@ -118,7 +118,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace({-1, 42, -1}); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch>(a); @@ -129,7 +129,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace({-1, 42, -1}, x); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch, int&>(a); @@ -159,7 +159,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace(101); + auto &v = a.emplace(101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -169,7 +170,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace({1, 2, 3}, 101); + auto &v = a.emplace({1, 2, 3}, 101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -180,7 +182,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace(101); + auto &v = a.emplace(101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -190,7 +193,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace({1, 2, 3}, 101); + auto &v = a.emplace({1, 2, 3}, 101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp index 0696c11526d5..e7f59f1a94ca 100644 --- a/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp @@ -254,7 +254,9 @@ int main() { assert(static_cast(opt) == true); assert(Y::dtor_called == false); - opt.emplace(1); + auto &v = opt.emplace(1); + static_assert( std::is_same_v, "" ); + assert(false); } catch (int i) { diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp index 1c3c69a70303..f6959c7e9cfd 100644 --- a/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp @@ -11,7 +11,7 @@ // // template -// void optional::emplace(initializer_list il, Args&&... args); +// T& optional::emplace(initializer_list il, Args&&... args); #include #include @@ -76,21 +76,27 @@ int main() X x; optional opt(x); assert(X::dtor_called == false); - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); assert(X::dtor_called == true); assert(*opt == X({1, 2})); + assert(&v == &*opt); } { optional> opt; - opt.emplace({1, 2, 3}, std::allocator()); + auto &v = opt.emplace({1, 2, 3}, std::allocator()); + static_assert( std::is_same_v&, decltype(v)>, "" ); assert(static_cast(opt) == true); assert(*opt == std::vector({1, 2, 3})); + assert(&v == &*opt); } { optional opt; - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); assert(*opt == Y({1, 2})); + assert(&v == &*opt); } #ifndef TEST_HAS_NO_EXCEPTIONS { @@ -100,7 +106,9 @@ int main() { assert(static_cast(opt) == true); assert(Z::dtor_called == false); - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); + assert(false); } catch (int i) { diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py index bd99e8ddd978..f839a3a0985e 100644 --- a/utils/libcxx/test/config.py +++ b/utils/libcxx/test/config.py @@ -311,10 +311,10 @@ class Configuration(object): # NOTE: We do not test for the -verify flag directly because # -verify will always exit with non-zero on an empty file. self.use_clang_verify = self.cxx.isVerifySupported() - if self.use_clang_verify: - self.config.available_features.add('verify-support') self.lit_config.note( "inferred use_clang_verify as: %r" % self.use_clang_verify) + if self.use_clang_verify: + self.config.available_features.add('verify-support') def configure_use_thread_safety(self): '''If set, run clang with -verify on failing tests.''' @@ -418,7 +418,7 @@ class Configuration(object): # initial Windows failures until they can be properly diagnosed # and fixed. This allows easier detection of new test failures # and regressions. Note: New failures should not be suppressed - # using this feature. + # using this feature. (Also see llvm.org/PR32730) self.config.available_features.add('LIBCXX-WINDOWS-FIXME') # Attempt to detect the glibc version by querying for __GLIBC__ -- cgit v1.2.3