mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
fix version check macro
This commit is contained in:
parent
b881750699
commit
12e12373d0
8 changed files with 43 additions and 64 deletions
|
@ -14,12 +14,13 @@
|
|||
#include <sprout/array.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
#include <sprout/detail/predef.hpp>
|
||||
#include <testspr/tools.hpp>
|
||||
|
||||
namespace testspr {
|
||||
static void algorithm_bogo_sort_test() {
|
||||
using namespace sprout;
|
||||
#if !defined(__clang__) || !(__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
|
||||
#if SPROUT_CLANG_OR_LATER(3, 4, 0)
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 5>{{5, 1, 4, 2, 3}};
|
||||
|
||||
|
|
|
@ -14,12 +14,13 @@
|
|||
#include <sprout/array.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
#include <sprout/detail/predef.hpp>
|
||||
#include <testspr/tools.hpp>
|
||||
|
||||
namespace testspr {
|
||||
static void algorithm_bogo_sort_result_test() {
|
||||
using namespace sprout;
|
||||
#if !defined(__clang__) || !(__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
|
||||
#if SPROUT_CLANG_OR_LATER(3, 4, 0)
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 5>{{5, 1, 4, 2, 3}};
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
// SPROUT_INT[N]_C
|
||||
// SPROUT_UINT[N]_C
|
||||
//
|
||||
#if SPROUT_CLANG_BETWEEN((3, 0, 0), (3, 3, 0)) && !defined(__STDC_CONSTANT_MACROS)
|
||||
#if SPROUT_CLANG_IN_RANGE((3, 0, 0), (3, 3, 0)) && !defined(__STDC_CONSTANT_MACROS)
|
||||
# define SPROUT_INT8_C(n) n
|
||||
# define SPROUT_UINT8_C(n) n
|
||||
# define SPROUT_INT16_C(n) n
|
||||
|
|
|
@ -38,38 +38,28 @@
|
|||
# define SPROUT_VERSION_GCC SPROUT_VERSION_NUMBER_ZERO
|
||||
#endif
|
||||
//
|
||||
// SPROUT_GCC_LESS
|
||||
// SPROUT_GCC_GREATER
|
||||
// SPROUT_GCC_LESS_EQUAL
|
||||
// SPROUT_GCC_GREATER_EQUAL
|
||||
// SPROUT_GCC_EARLIER
|
||||
// SPROUT_GCC_OR_LATER
|
||||
//
|
||||
#if SPROUT_AVAILABLE_GCC
|
||||
# define SPROUT_GCC_LESS(major, minor, patch) \
|
||||
# define SPROUT_GCC_EARLIER(major, minor, patch) \
|
||||
(SPROUT_VERSION_GCC < SPROUT_VERSION_NUMBER(major, minor, patch))
|
||||
# define SPROUT_GCC_GREATER(major, minor, patch) \
|
||||
(SPROUT_VERSION_GCC > SPROUT_VERSION_NUMBER(major, minor, patch))
|
||||
# define SPROUT_GCC_LESS_EQUAL(major, minor, patch) \
|
||||
(SPROUT_VERSION_GCC <= SPROUT_VERSION_NUMBER(major, minor, patch))
|
||||
# define SPROUT_GCC_GREATER_EQUAL(major, minor, patch) \
|
||||
# define SPROUT_GCC_OR_LATER(major, minor, patch) \
|
||||
(SPROUT_VERSION_GCC >= SPROUT_VERSION_NUMBER(major, minor, patch))
|
||||
#else
|
||||
# define SPROUT_GCC_LESS(major, minor, patch) \
|
||||
# define SPROUT_GCC_EARLIER(major, minor, patch) \
|
||||
(0)
|
||||
# define SPROUT_GCC_GREATER(major, minor, patch) \
|
||||
(0)
|
||||
# define SPROUT_GCC_LESS_EQUAL(major, minor, patch) \
|
||||
(0)
|
||||
# define SPROUT_GCC_GREATER_EQUAL(major, minor, patch) \
|
||||
# define SPROUT_GCC_OR_LATER(major, minor, patch) \
|
||||
(0)
|
||||
#endif
|
||||
//
|
||||
// SPROUT_GCC_BETWEEN
|
||||
// SPROUT_GCC_IN_RANGE
|
||||
//
|
||||
#if SPROUT_AVAILABLE_GCC
|
||||
# define SPROUT_GCC_BETWEEN(first_version, last_version) \
|
||||
(SPROUT_GCC_GREATER_EQUAL first_version && SPROUT_GCC_LESS last_version)
|
||||
# define SPROUT_GCC_IN_RANGE(first_version, last_version) \
|
||||
(SPROUT_GCC_OR_LATER first_version && SPROUT_GCC_EARLIER last_version)
|
||||
#else
|
||||
# define SPROUT_GCC_BETWEEN(first_version, last_version) \
|
||||
# define SPROUT_GCC_IN_RANGE(first_version, last_version) \
|
||||
(0)
|
||||
#endif
|
||||
|
||||
|
@ -98,38 +88,28 @@
|
|||
# define SPROUT_CLANG_HAS_FUTURE(future) (0)
|
||||
#endif
|
||||
//
|
||||
// SPROUT_CLANG_LESS
|
||||
// SPROUT_CLANG_GREATER
|
||||
// SPROUT_CLANG_LESS_EQUAL
|
||||
// SPROUT_CLANG_GREATER_EQUAL
|
||||
// SPROUT_CLANG_EARLIER
|
||||
// SPROUT_CLANG_OR_LATER
|
||||
//
|
||||
#if SPROUT_AVAILABLE_CLANG
|
||||
# define SPROUT_CLANG_LESS(major, minor, patch) \
|
||||
# define SPROUT_CLANG_EARLIER(major, minor, patch) \
|
||||
(SPROUT_VERSION_CLANG < SPROUT_VERSION_NUMBER(major, minor, patch))
|
||||
# define SPROUT_CLANG_GREATER(major, minor, patch) \
|
||||
(SPROUT_VERSION_CLANG > SPROUT_VERSION_NUMBER(major, minor, patch))
|
||||
# define SPROUT_CLANG_LESS_EQUAL(major, minor, patch) \
|
||||
(SPROUT_VERSION_CLANG <= SPROUT_VERSION_NUMBER(major, minor, patch))
|
||||
# define SPROUT_CLANG_GREATER_EQUAL(major, minor, patch) \
|
||||
# define SPROUT_CLANG_OR_LATER(major, minor, patch) \
|
||||
(SPROUT_VERSION_CLANG >= SPROUT_VERSION_NUMBER(major, minor, patch))
|
||||
#else
|
||||
# define SPROUT_CLANG_LESS(major, minor, patch) \
|
||||
# define SPROUT_CLANG_EARLIER(major, minor, patch) \
|
||||
(0)
|
||||
# define SPROUT_CLANG_GREATER(major, minor, patch) \
|
||||
(0)
|
||||
# define SPROUT_CLANG_LESS_EQUAL(major, minor, patch) \
|
||||
(0)
|
||||
# define SPROUT_CLANG_GREATER_EQUAL(major, minor, patch) \
|
||||
# define SPROUT_CLANG_OR_LATER(major, minor, patch) \
|
||||
(0)
|
||||
#endif
|
||||
//
|
||||
// SPROUT_CLANG_BETWEEN
|
||||
// SPROUT_CLANG_IN_RANGE
|
||||
//
|
||||
#if SPROUT_AVAILABLE_CLANG
|
||||
# define SPROUT_CLANG_BETWEEN(first_version, last_version) \
|
||||
(SPROUT_CLANG_GREATER_EQUAL first_version && SPROUT_CLANG_LESS last_version)
|
||||
# define SPROUT_CLANG_IN_RANGE(first_version, last_version) \
|
||||
(SPROUT_CLANG_OR_LATER first_version && SPROUT_CLANG_EARLIER last_version)
|
||||
#else
|
||||
# define SPROUT_CLANG_BETWEEN(first_version, last_version) \
|
||||
# define SPROUT_CLANG_IN_RANGE(first_version, last_version) \
|
||||
(0)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace sprout {
|
|||
: init(v.init)
|
||||
, val(v.is_initialized() ? holder_type(*v) : holder_type())
|
||||
{}
|
||||
#if SPROUT_GCC_BETWEEN((4, 8, 0), (4, 8, 2))
|
||||
#if SPROUT_GCC_IN_RANGE((4, 8, 0), (4, 8, 2))
|
||||
optional(optional&&) = default;
|
||||
#else
|
||||
SPROUT_CONSTEXPR optional(optional&& v)
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace sprout {
|
|||
, base_type(sprout::forward<UHead>(h))
|
||||
{}
|
||||
tuple_impl(tuple_impl const&) = default;
|
||||
#if SPROUT_GCC_BETWEEN((4, 8, 0), (4, 8, 2))
|
||||
#if SPROUT_GCC_IN_RANGE((4, 8, 0), (4, 8, 2))
|
||||
tuple_impl(tuple_impl&&) = default;
|
||||
#else
|
||||
SPROUT_CONSTEXPR tuple_impl(tuple_impl&& t)
|
||||
|
|
|
@ -209,17 +209,17 @@ namespace sprout {
|
|||
struct is_trivially_constructible
|
||||
: public sprout::false_type
|
||||
{};
|
||||
#if SPROUT_CLANG_HAS_FUTURE(has_trivial_constructor) || SPROUT_GCC_GREATER_EQUAL(4, 3, 0)
|
||||
#if SPROUT_CLANG_HAS_FUTURE(has_trivial_constructor) || SPROUT_GCC_OR_LATER(4, 3, 0)
|
||||
template<typename T>
|
||||
struct is_trivially_constructible<T>
|
||||
: public sprout::integral_constant<bool, __has_trivial_constructor(T)>
|
||||
{};
|
||||
#else // #if SPROUT_CLANG_HAS_FUTURE(has_trivial_constructor) || SPROUT_GCC_GREATER_EQUAL(4, 3, 0)
|
||||
#else // #if SPROUT_CLANG_HAS_FUTURE(has_trivial_constructor) || SPROUT_GCC_OR_LATER(4, 3, 0)
|
||||
template<typename T>
|
||||
struct is_trivially_constructible<T>
|
||||
: public sprout::is_scalar<T>
|
||||
{};
|
||||
#endif // #if SPROUT_CLANG_HAS_FUTURE(has_trivial_constructor) || SPROUT_GCC_GREATER_EQUAL(4, 3, 0)
|
||||
#endif // #if SPROUT_CLANG_HAS_FUTURE(has_trivial_constructor) || SPROUT_GCC_OR_LATER(4, 3, 0)
|
||||
template<typename T>
|
||||
struct is_trivially_constructible<T, T&>
|
||||
: public sprout::is_scalar<T>
|
||||
|
@ -324,13 +324,13 @@ namespace sprout {
|
|||
: public sprout::detail::type_traits_wrapper<std::is_trivially_move_assignable<T> >
|
||||
{};
|
||||
#endif // #if !defined(_LIBCPP_VERSION)
|
||||
#if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0)
|
||||
#if SPROUT_CLANG_HAS_FUTURE(has_trivial_destructor) || SPROUT_GCC_GREATER_EQUAL(4, 3, 0)
|
||||
#if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0)
|
||||
#if SPROUT_CLANG_HAS_FUTURE(has_trivial_destructor) || SPROUT_GCC_OR_LATER(4, 3, 0)
|
||||
template<typename T>
|
||||
struct is_trivially_destructible
|
||||
: public sprout::integral_constant<bool, __has_trivial_destructor(T)>
|
||||
{};
|
||||
#else // #if SPROUT_CLANG_HAS_FUTURE(has_trivial_destructor) || SPROUT_GCC_GREATER_EQUAL(4, 3, 0)
|
||||
#else // #if SPROUT_CLANG_HAS_FUTURE(has_trivial_destructor) || SPROUT_GCC_OR_LATER(4, 3, 0)
|
||||
template<typename T>
|
||||
struct is_trivially_destructible
|
||||
: public sprout::integral_constant<
|
||||
|
@ -339,13 +339,13 @@ namespace sprout {
|
|||
|| std::is_reference<typename std::remove_all_extents<T>::type>::value
|
||||
>
|
||||
{};
|
||||
#endif // #if SPROUT_CLANG_HAS_FUTURE(has_trivial_destructor) || SPROUT_GCC_GREATER_EQUAL(4, 3, 0)
|
||||
#else // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0)
|
||||
#endif // #if SPROUT_CLANG_HAS_FUTURE(has_trivial_destructor) || SPROUT_GCC_OR_LATER(4, 3, 0)
|
||||
#else // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0)
|
||||
template<typename T>
|
||||
struct is_trivially_destructible
|
||||
: public sprout::detail::type_traits_wrapper<std::is_trivially_destructible<T> >
|
||||
{};
|
||||
#endif // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0)
|
||||
#endif // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0)
|
||||
template<typename T, typename... Args>
|
||||
struct is_nothrow_constructible
|
||||
: public sprout::detail::type_traits_wrapper<std::is_nothrow_constructible<T, Args...> >
|
||||
|
@ -374,7 +374,7 @@ namespace sprout {
|
|||
struct is_nothrow_move_assignable
|
||||
: public sprout::detail::type_traits_wrapper<std::is_nothrow_move_assignable<T> >
|
||||
{};
|
||||
#if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0)
|
||||
#if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0)
|
||||
template<typename T>
|
||||
struct is_nothrow_destructible
|
||||
: public sprout::integral_constant<
|
||||
|
@ -383,12 +383,12 @@ namespace sprout {
|
|||
|| std::is_reference<typename std::remove_all_extents<T>::type>::value
|
||||
>
|
||||
{};
|
||||
#else // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0)
|
||||
#else // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0)
|
||||
template<typename T>
|
||||
struct is_nothrow_destructible
|
||||
: public sprout::detail::type_traits_wrapper<std::is_nothrow_destructible<T> >
|
||||
{};
|
||||
#endif // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0)
|
||||
#endif // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0)
|
||||
template<typename T>
|
||||
struct has_virtual_destructor
|
||||
: public sprout::detail::type_traits_wrapper<std::has_virtual_destructor<T> >
|
||||
|
|
|
@ -9,19 +9,16 @@
|
|||
#define SPROUT_WORKAROUND_BASE_CLASS_CONSTRUCT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/detail/predef.hpp>
|
||||
|
||||
//
|
||||
// SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT
|
||||
//
|
||||
#ifndef SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT
|
||||
# if defined(__clang__)
|
||||
# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
|
||||
# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT 1
|
||||
# else
|
||||
# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT 0
|
||||
# endif
|
||||
# if SPROUT_CLANG_OR_LATER(3, 4, 0)
|
||||
# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT (1)
|
||||
# else
|
||||
# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT 0
|
||||
# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT (0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue