From 345761b05475ec6fe16d755ad91fdd2a764b6966 Mon Sep 17 00:00:00 2001 From: morzhovets Date: Thu, 4 Jan 2024 17:11:34 +0400 Subject: [PATCH] libcxx/Support.h --- test/sources/LibcxxTester.h | 55 ++-------------------------- test/sources/libcxx/Support.h | 67 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 53 deletions(-) create mode 100644 test/sources/libcxx/Support.h diff --git a/test/sources/LibcxxTester.h b/test/sources/LibcxxTester.h index ada5f65a..7ce4a3be 100644 --- a/test/sources/LibcxxTester.h +++ b/test/sources/LibcxxTester.h @@ -12,60 +12,9 @@ #pragma once -#include -#include -#include -#include - -#ifdef __cpp_lib_optional -#include -#endif - -#if !defined(TEST_MSVC) && !defined(__cpp_lib_transparent_operators) -#define LIBCPP_HAS_NO_TRANSPARENT_OPERATORS -#endif - -#if !defined(LIBCPP_TEST_DEDUCTION_GUIDES) && defined(MOMO_HAS_DEDUCTION_GUIDES) -#if defined(TEST_MSVC) && _MSC_VER >= 1924 -#define LIBCPP_TEST_DEDUCTION_GUIDES -#endif -#if defined(TEST_GCC) && __GNUC__ >= 8 -#define LIBCPP_TEST_DEDUCTION_GUIDES -#endif -#endif - -//#define LIBCPP_HAS_BAD_NEWS_FOR_MOMO +#include "libcxx/Support.h" -//#define LIBCPP_TEST_MIN_ALLOCATOR -//#define LIBCPP_TEST_STACK_ALLOCATOR - -#include "libcxx/support/MoveOnly.h" -#include "libcxx/support/Copyable.h" -#include "libcxx/support/NotConstructible.h" -#include "libcxx/support/DefaultOnly.h" -#include "libcxx/support/Emplaceable.h" -#include "libcxx/support/Counter.h" -#include "libcxx/support/Moveable.h" -#include "libcxx/support/test_allocator.h" -#include "libcxx/support/test_iterators.h" -#include "libcxx/support/test_compare.h" -#include "libcxx/support/test_hash.h" -#include "libcxx/support/private_constructor.h" -#include "libcxx/support/is_transparent.h" -#include "libcxx/support/test_macros.h" -#include "libcxx/support/test_transparent_unordered.h" -//#include "libcxx/support/min_allocator.h" -//#include "libcxx/support/stack_allocator.h" - -struct LibcppIntHash -{ - size_t operator()(int key) const noexcept - { - return static_cast(key); - } -}; - -#define LIBCPP_CATCH(expr) try { (void)(expr); assert(false); } catch (...) {} +#include #define LIBCXX_TEST_BEGIN(name) \ namespace name { \ diff --git a/test/sources/libcxx/Support.h b/test/sources/libcxx/Support.h new file mode 100644 index 00000000..8f9c3145 --- /dev/null +++ b/test/sources/libcxx/Support.h @@ -0,0 +1,67 @@ +/**********************************************************\ + + This file is part of the + https://github.com/morzhovets/momo + project, distributed under the MIT License. See + https://github.com/morzhovets/momo/blob/branch_cpp11/LICENSE + for details. + + test/sources/libcxx/Support.h + +\**********************************************************/ + +#pragma once + +#include +#include +#include + +#ifdef __cpp_lib_optional +#include +#endif + +#if !defined(TEST_MSVC) && !defined(__cpp_lib_transparent_operators) +#define LIBCPP_HAS_NO_TRANSPARENT_OPERATORS +#endif + +#if !defined(LIBCPP_TEST_DEDUCTION_GUIDES) && defined(MOMO_HAS_DEDUCTION_GUIDES) +#if defined(TEST_MSVC) && _MSC_VER >= 1924 +#define LIBCPP_TEST_DEDUCTION_GUIDES +#endif +#if defined(TEST_GCC) && __GNUC__ >= 8 +#define LIBCPP_TEST_DEDUCTION_GUIDES +#endif +#endif + +//#define LIBCPP_HAS_BAD_NEWS_FOR_MOMO + +//#define LIBCPP_TEST_MIN_ALLOCATOR +//#define LIBCPP_TEST_STACK_ALLOCATOR + +#include "libcxx/support/MoveOnly.h" +#include "libcxx/support/Copyable.h" +#include "libcxx/support/NotConstructible.h" +#include "libcxx/support/DefaultOnly.h" +#include "libcxx/support/Emplaceable.h" +#include "libcxx/support/Counter.h" +#include "libcxx/support/Moveable.h" +#include "libcxx/support/test_allocator.h" +#include "libcxx/support/test_iterators.h" +#include "libcxx/support/test_compare.h" +#include "libcxx/support/test_hash.h" +#include "libcxx/support/private_constructor.h" +#include "libcxx/support/is_transparent.h" +#include "libcxx/support/test_macros.h" +#include "libcxx/support/test_transparent_unordered.h" +//#include "libcxx/support/min_allocator.h" +//#include "libcxx/support/stack_allocator.h" + +struct LibcppIntHash +{ + size_t operator()(int key) const noexcept + { + return static_cast(key); + } +}; + +#define LIBCPP_CATCH(expr) try { (void)(expr); assert(false); } catch (...) {}