diff --git a/libs/algorithm/test/bogo_sort.cpp b/libs/algorithm/test/bogo_sort.cpp index c214a04e..eb4284c5 100644 --- a/libs/algorithm/test/bogo_sort.cpp +++ b/libs/algorithm/test/bogo_sort.cpp @@ -14,12 +14,13 @@ #include #include #include +#include #include 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{{5, 1, 4, 2, 3}}; diff --git a/libs/algorithm/test/bogo_sort_result.cpp b/libs/algorithm/test/bogo_sort_result.cpp index 17850dd2..383f4b6e 100644 --- a/libs/algorithm/test/bogo_sort_result.cpp +++ b/libs/algorithm/test/bogo_sort_result.cpp @@ -14,12 +14,13 @@ #include #include #include +#include #include 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{{5, 1, 4, 2, 3}}; SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED); diff --git a/sprout/cstdint.hpp b/sprout/cstdint.hpp index c8d00683..9efdde2c 100644 --- a/sprout/cstdint.hpp +++ b/sprout/cstdint.hpp @@ -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 diff --git a/sprout/detail/predef.hpp b/sprout/detail/predef.hpp index 5bb2e117..e0f90b0a 100644 --- a/sprout/detail/predef.hpp +++ b/sprout/detail/predef.hpp @@ -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 diff --git a/sprout/optional/optional.hpp b/sprout/optional/optional.hpp index 9a6556f4..3ac376a3 100644 --- a/sprout/optional/optional.hpp +++ b/sprout/optional/optional.hpp @@ -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) diff --git a/sprout/tuple/tuple/tuple_decl.hpp b/sprout/tuple/tuple/tuple_decl.hpp index 31e39ac4..4c96032f 100644 --- a/sprout/tuple/tuple/tuple_decl.hpp +++ b/sprout/tuple/tuple/tuple_decl.hpp @@ -189,7 +189,7 @@ namespace sprout { , base_type(sprout::forward(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) diff --git a/sprout/type_traits/std_type_traits.hpp b/sprout/type_traits/std_type_traits.hpp index 54aa2ee9..417b1b70 100644 --- a/sprout/type_traits/std_type_traits.hpp +++ b/sprout/type_traits/std_type_traits.hpp @@ -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 struct is_trivially_constructible : public sprout::integral_constant {}; -#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 struct is_trivially_constructible : public sprout::is_scalar {}; -#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 struct is_trivially_constructible : public sprout::is_scalar @@ -324,13 +324,13 @@ namespace sprout { : public sprout::detail::type_traits_wrapper > {}; #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 struct is_trivially_destructible : public sprout::integral_constant {}; -#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 struct is_trivially_destructible : public sprout::integral_constant< @@ -339,13 +339,13 @@ namespace sprout { || std::is_reference::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 struct is_trivially_destructible : public sprout::detail::type_traits_wrapper > {}; -#endif // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0) +#endif // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0) template struct is_nothrow_constructible : public sprout::detail::type_traits_wrapper > @@ -374,7 +374,7 @@ namespace sprout { struct is_nothrow_move_assignable : public sprout::detail::type_traits_wrapper > {}; -#if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0) +#if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0) template struct is_nothrow_destructible : public sprout::integral_constant< @@ -383,12 +383,12 @@ namespace sprout { || std::is_reference::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 struct is_nothrow_destructible : public sprout::detail::type_traits_wrapper > {}; -#endif // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0) +#endif // #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0) template struct has_virtual_destructor : public sprout::detail::type_traits_wrapper > diff --git a/sprout/workaround/base_class_construct.hpp b/sprout/workaround/base_class_construct.hpp index 0da4a4b0..f9c7fe25 100644 --- a/sprout/workaround/base_class_construct.hpp +++ b/sprout/workaround/base_class_construct.hpp @@ -9,19 +9,16 @@ #define SPROUT_WORKAROUND_BASE_CLASS_CONSTRUCT_HPP #include +#include // // 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