diff options
Diffstat (limited to 'libcxx/test')
3 files changed, 25 insertions, 4 deletions
diff --git a/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp b/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp index 7a4090b9c25..7a8d4c1f4a6 100644 --- a/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp +++ b/libcxx/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp @@ -89,6 +89,7 @@ int main() CHECK_ALWAYS_LOCK_FREE(float); CHECK_ALWAYS_LOCK_FREE(double); CHECK_ALWAYS_LOCK_FREE(long double); +#if __has_attribute(vector_size) && defined(_LIBCPP_VERSION) CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(1 * sizeof(int))))); CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(2 * sizeof(int))))); CHECK_ALWAYS_LOCK_FREE(int __attribute__((vector_size(4 * sizeof(int))))); @@ -104,6 +105,7 @@ int main() CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(4 * sizeof(double))))); CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(16 * sizeof(double))))); CHECK_ALWAYS_LOCK_FREE(double __attribute__((vector_size(32 * sizeof(double))))); +#endif // __has_attribute(vector_size) && defined(_LIBCPP_VERSION) CHECK_ALWAYS_LOCK_FREE(struct Empty {}); CHECK_ALWAYS_LOCK_FREE(struct OneInt { int i; }); CHECK_ALWAYS_LOCK_FREE(struct IntArr2 { int i[2]; }); diff --git a/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp index 7601ff9d147..f33b4157721 100644 --- a/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp @@ -305,15 +305,17 @@ void constructor_tests() using RetT = decltype(std::not_fn(value)); static_assert(std::is_move_constructible<RetT>::value, ""); static_assert(std::is_copy_constructible<RetT>::value, ""); - static_assert(std::is_move_assignable<RetT>::value, ""); - static_assert(std::is_copy_assignable<RetT>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_move_assignable<RetT>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_copy_assignable<RetT>::value, ""); auto ret = std::not_fn(value); assert(ret() == false); auto ret2 = std::not_fn(value2); assert(ret2() == true); +#if defined(_LIBCPP_VERSION) ret = ret2; assert(ret() == true); assert(ret2() == true); +#endif // _LIBCPP_VERSION } { using T = MoveAssignableWrapper; @@ -322,14 +324,16 @@ void constructor_tests() using RetT = decltype(std::not_fn(std::move(value))); static_assert(std::is_move_constructible<RetT>::value, ""); static_assert(!std::is_copy_constructible<RetT>::value, ""); - static_assert(std::is_move_assignable<RetT>::value, ""); + LIBCPP_STATIC_ASSERT(std::is_move_assignable<RetT>::value, ""); static_assert(!std::is_copy_assignable<RetT>::value, ""); auto ret = std::not_fn(std::move(value)); assert(ret() == false); auto ret2 = std::not_fn(std::move(value2)); assert(ret2() == true); +#if defined(_LIBCPP_VERSION) ret = std::move(ret2); assert(ret() == true); +#endif // _LIBCPP_VERSION } } @@ -426,7 +430,7 @@ void throws_in_constructor_test() { ThrowsOnCopy cp; try { - std::not_fn(cp); + (void)std::not_fn(cp); assert(false); } catch (int const& value) { assert(value == 42); diff --git a/libcxx/test/support/msvc_stdlib_force_include.hpp b/libcxx/test/support/msvc_stdlib_force_include.hpp index 83120c7eb52..d9995f7bfdf 100644 --- a/libcxx/test/support/msvc_stdlib_force_include.hpp +++ b/libcxx/test/support/msvc_stdlib_force_include.hpp @@ -52,6 +52,13 @@ const AssertionDialogAvoider assertion_dialog_avoider{}; #define _MSVC_HAS_FEATURE_memory_sanitizer 0 #define _MSVC_HAS_FEATURE_thread_sanitizer 0 + #define __has_attribute(X) _MSVC_HAS_ATTRIBUTE_ ## X + #define _MSVC_HAS_ATTRIBUTE_vector_size 0 + + #ifdef _NOEXCEPT_TYPES_SUPPORTED + #define __cpp_noexcept_function_type 201510 + #endif // _NOEXCEPT_TYPES_SUPPORTED + // Silence compiler warnings. #pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored #pragma warning(disable: 4324) // structure was padded due to alignment specifier @@ -85,4 +92,12 @@ const AssertionDialogAvoider assertion_dialog_avoider{}; #define TEST_STD_VER 14 #endif // _HAS_CXX17 +// Simulate library feature-test macros. +#define __cpp_lib_invoke 201411 +#define __cpp_lib_void_t 201411 + +#if _HAS_CXX17 + #define __cpp_lib_atomic_is_always_lock_free 201603 +#endif // _HAS_CXX17 + #endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP |