fix version check macro

This commit is contained in:
bolero-MURAKAMI 2014-01-20 13:09:54 +09:00
parent b881750699
commit 12e12373d0
8 changed files with 43 additions and 64 deletions

View file

@ -14,12 +14,13 @@
#include <sprout/array.hpp> #include <sprout/array.hpp>
#include <sprout/sub_array.hpp> #include <sprout/sub_array.hpp>
#include <sprout/container.hpp> #include <sprout/container.hpp>
#include <sprout/detail/predef.hpp>
#include <testspr/tools.hpp> #include <testspr/tools.hpp>
namespace testspr { namespace testspr {
static void algorithm_bogo_sort_test() { static void algorithm_bogo_sort_test() {
using namespace sprout; 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 arr1 = array<int, 5>{{5, 1, 4, 2, 3}};

View file

@ -14,12 +14,13 @@
#include <sprout/array.hpp> #include <sprout/array.hpp>
#include <sprout/sub_array.hpp> #include <sprout/sub_array.hpp>
#include <sprout/container.hpp> #include <sprout/container.hpp>
#include <sprout/detail/predef.hpp>
#include <testspr/tools.hpp> #include <testspr/tools.hpp>
namespace testspr { namespace testspr {
static void algorithm_bogo_sort_result_test() { static void algorithm_bogo_sort_result_test() {
using namespace sprout; 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 arr1 = array<int, 5>{{5, 1, 4, 2, 3}};
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED); SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED);

View file

@ -17,7 +17,7 @@
// SPROUT_INT[N]_C // SPROUT_INT[N]_C
// SPROUT_UINT[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_INT8_C(n) n
# define SPROUT_UINT8_C(n) n # define SPROUT_UINT8_C(n) n
# define SPROUT_INT16_C(n) n # define SPROUT_INT16_C(n) n

View file

@ -38,38 +38,28 @@
# define SPROUT_VERSION_GCC SPROUT_VERSION_NUMBER_ZERO # define SPROUT_VERSION_GCC SPROUT_VERSION_NUMBER_ZERO
#endif #endif
// //
// SPROUT_GCC_LESS // SPROUT_GCC_EARLIER
// SPROUT_GCC_GREATER // SPROUT_GCC_OR_LATER
// SPROUT_GCC_LESS_EQUAL
// SPROUT_GCC_GREATER_EQUAL
// //
#if SPROUT_AVAILABLE_GCC #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)) (SPROUT_VERSION_GCC < SPROUT_VERSION_NUMBER(major, minor, patch))
# define SPROUT_GCC_GREATER(major, minor, patch) \ # define SPROUT_GCC_OR_LATER(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) \
(SPROUT_VERSION_GCC >= SPROUT_VERSION_NUMBER(major, minor, patch)) (SPROUT_VERSION_GCC >= SPROUT_VERSION_NUMBER(major, minor, patch))
#else #else
# define SPROUT_GCC_LESS(major, minor, patch) \ # define SPROUT_GCC_EARLIER(major, minor, patch) \
(0) (0)
# define SPROUT_GCC_GREATER(major, minor, patch) \ # define SPROUT_GCC_OR_LATER(major, minor, patch) \
(0)
# define SPROUT_GCC_LESS_EQUAL(major, minor, patch) \
(0)
# define SPROUT_GCC_GREATER_EQUAL(major, minor, patch) \
(0) (0)
#endif #endif
// //
// SPROUT_GCC_BETWEEN // SPROUT_GCC_IN_RANGE
// //
#if SPROUT_AVAILABLE_GCC #if SPROUT_AVAILABLE_GCC
# define SPROUT_GCC_BETWEEN(first_version, last_version) \ # define SPROUT_GCC_IN_RANGE(first_version, last_version) \
(SPROUT_GCC_GREATER_EQUAL first_version && SPROUT_GCC_LESS last_version) (SPROUT_GCC_OR_LATER first_version && SPROUT_GCC_EARLIER last_version)
#else #else
# define SPROUT_GCC_BETWEEN(first_version, last_version) \ # define SPROUT_GCC_IN_RANGE(first_version, last_version) \
(0) (0)
#endif #endif
@ -98,38 +88,28 @@
# define SPROUT_CLANG_HAS_FUTURE(future) (0) # define SPROUT_CLANG_HAS_FUTURE(future) (0)
#endif #endif
// //
// SPROUT_CLANG_LESS // SPROUT_CLANG_EARLIER
// SPROUT_CLANG_GREATER // SPROUT_CLANG_OR_LATER
// SPROUT_CLANG_LESS_EQUAL
// SPROUT_CLANG_GREATER_EQUAL
// //
#if SPROUT_AVAILABLE_CLANG #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)) (SPROUT_VERSION_CLANG < SPROUT_VERSION_NUMBER(major, minor, patch))
# define SPROUT_CLANG_GREATER(major, minor, patch) \ # define SPROUT_CLANG_OR_LATER(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) \
(SPROUT_VERSION_CLANG >= SPROUT_VERSION_NUMBER(major, minor, patch)) (SPROUT_VERSION_CLANG >= SPROUT_VERSION_NUMBER(major, minor, patch))
#else #else
# define SPROUT_CLANG_LESS(major, minor, patch) \ # define SPROUT_CLANG_EARLIER(major, minor, patch) \
(0) (0)
# define SPROUT_CLANG_GREATER(major, minor, patch) \ # define SPROUT_CLANG_OR_LATER(major, minor, patch) \
(0)
# define SPROUT_CLANG_LESS_EQUAL(major, minor, patch) \
(0)
# define SPROUT_CLANG_GREATER_EQUAL(major, minor, patch) \
(0) (0)
#endif #endif
// //
// SPROUT_CLANG_BETWEEN // SPROUT_CLANG_IN_RANGE
// //
#if SPROUT_AVAILABLE_CLANG #if SPROUT_AVAILABLE_CLANG
# define SPROUT_CLANG_BETWEEN(first_version, last_version) \ # define SPROUT_CLANG_IN_RANGE(first_version, last_version) \
(SPROUT_CLANG_GREATER_EQUAL first_version && SPROUT_CLANG_LESS last_version) (SPROUT_CLANG_OR_LATER first_version && SPROUT_CLANG_EARLIER last_version)
#else #else
# define SPROUT_CLANG_BETWEEN(first_version, last_version) \ # define SPROUT_CLANG_IN_RANGE(first_version, last_version) \
(0) (0)
#endif #endif

View file

@ -107,7 +107,7 @@ namespace sprout {
: init(v.init) : init(v.init)
, val(v.is_initialized() ? holder_type(*v) : holder_type()) , 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; optional(optional&&) = default;
#else #else
SPROUT_CONSTEXPR optional(optional&& v) SPROUT_CONSTEXPR optional(optional&& v)

View file

@ -189,7 +189,7 @@ namespace sprout {
, base_type(sprout::forward<UHead>(h)) , base_type(sprout::forward<UHead>(h))
{} {}
tuple_impl(tuple_impl const&) = default; 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; tuple_impl(tuple_impl&&) = default;
#else #else
SPROUT_CONSTEXPR tuple_impl(tuple_impl&& t) SPROUT_CONSTEXPR tuple_impl(tuple_impl&& t)

View file

@ -209,17 +209,17 @@ namespace sprout {
struct is_trivially_constructible struct is_trivially_constructible
: public sprout::false_type : 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> template<typename T>
struct is_trivially_constructible<T> struct is_trivially_constructible<T>
: public sprout::integral_constant<bool, __has_trivial_constructor(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> template<typename T>
struct is_trivially_constructible<T> struct is_trivially_constructible<T>
: public sprout::is_scalar<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> template<typename T>
struct is_trivially_constructible<T, T&> struct is_trivially_constructible<T, T&>
: public sprout::is_scalar<T> : public sprout::is_scalar<T>
@ -324,13 +324,13 @@ namespace sprout {
: public sprout::detail::type_traits_wrapper<std::is_trivially_move_assignable<T> > : public sprout::detail::type_traits_wrapper<std::is_trivially_move_assignable<T> >
{}; {};
#endif // #if !defined(_LIBCPP_VERSION) #endif // #if !defined(_LIBCPP_VERSION)
#if !defined(_LIBCPP_VERSION) && SPROUT_GCC_LESS(4, 8, 0) #if !defined(_LIBCPP_VERSION) && SPROUT_GCC_EARLIER(4, 8, 0)
#if SPROUT_CLANG_HAS_FUTURE(has_trivial_destructor) || SPROUT_GCC_GREATER_EQUAL(4, 3, 0) #if SPROUT_CLANG_HAS_FUTURE(has_trivial_destructor) || SPROUT_GCC_OR_LATER(4, 3, 0)
template<typename T> template<typename T>
struct is_trivially_destructible struct is_trivially_destructible
: public sprout::integral_constant<bool, __has_trivial_destructor(T)> : 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> template<typename T>
struct is_trivially_destructible struct is_trivially_destructible
: public sprout::integral_constant< : public sprout::integral_constant<
@ -339,13 +339,13 @@ namespace sprout {
|| std::is_reference<typename std::remove_all_extents<T>::type>::value || 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) #endif // #if SPROUT_CLANG_HAS_FUTURE(has_trivial_destructor) || SPROUT_GCC_OR_LATER(4, 3, 0)
#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> template<typename T>
struct is_trivially_destructible struct is_trivially_destructible
: public sprout::detail::type_traits_wrapper<std::is_trivially_destructible<T> > : 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> template<typename T, typename... Args>
struct is_nothrow_constructible struct is_nothrow_constructible
: public sprout::detail::type_traits_wrapper<std::is_nothrow_constructible<T, Args...> > : public sprout::detail::type_traits_wrapper<std::is_nothrow_constructible<T, Args...> >
@ -374,7 +374,7 @@ namespace sprout {
struct is_nothrow_move_assignable struct is_nothrow_move_assignable
: public sprout::detail::type_traits_wrapper<std::is_nothrow_move_assignable<T> > : 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> template<typename T>
struct is_nothrow_destructible struct is_nothrow_destructible
: public sprout::integral_constant< : public sprout::integral_constant<
@ -383,12 +383,12 @@ namespace sprout {
|| std::is_reference<typename std::remove_all_extents<T>::type>::value || 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> template<typename T>
struct is_nothrow_destructible struct is_nothrow_destructible
: public sprout::detail::type_traits_wrapper<std::is_nothrow_destructible<T> > : 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> template<typename T>
struct has_virtual_destructor struct has_virtual_destructor
: public sprout::detail::type_traits_wrapper<std::has_virtual_destructor<T> > : public sprout::detail::type_traits_wrapper<std::has_virtual_destructor<T> >

View file

@ -9,19 +9,16 @@
#define SPROUT_WORKAROUND_BASE_CLASS_CONSTRUCT_HPP #define SPROUT_WORKAROUND_BASE_CLASS_CONSTRUCT_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/detail/predef.hpp>
// //
// SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT // SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT
// //
#ifndef SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT #ifndef SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT
# if defined(__clang__) # if SPROUT_CLANG_OR_LATER(3, 4, 0)
# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)) # define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT (1)
# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT 1
# else
# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT 0
# endif
# else # else
# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT 0 # define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT (0)
# endif # endif
#endif #endif