Sprout/sprout/detail/predef.hpp

137 lines
4.1 KiB
C++
Raw Normal View History

/*=============================================================================
2014-01-08 07:48:12 +00:00
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_DETAIL_PREDEF_HPP
#define SPROUT_DETAIL_PREDEF_HPP
#include <sprout/config.hpp>
//
2014-01-20 02:23:03 +00:00
// SPROUT_VERSION_NUMBER
//
#define SPROUT_VERSION_NUMBER(major, minor, patch) \
((((major) % 100) * 10000000) + (((minor) % 100) * 100000) + ((patch) % 100000))
//
// SPROUT_VERSION_NUMBER_ZERO
//
#define SPROUT_VERSION_NUMBER_ZERO \
SPROUT_VERSION_NUMBER(0, 0, 0)
//
// SPROUT_AVAILABLE_GCC
//
#if defined(__GNUC__)
2014-01-20 02:23:03 +00:00
# define SPROUT_AVAILABLE_GCC (1)
#else
2014-01-20 02:23:03 +00:00
# define SPROUT_AVAILABLE_GCC (0)
#endif
//
// SPROUT_VERSION_GCC
//
#if SPROUT_AVAILABLE_GCC
# define SPROUT_VERSION_GCC SPROUT_VERSION_NUMBER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#else
# define SPROUT_VERSION_GCC SPROUT_VERSION_NUMBER_ZERO
#endif
//
// SPROUT_GCC_LESS
// SPROUT_GCC_GREATER
// SPROUT_GCC_LESS_EQUAL
// SPROUT_GCC_GREATER_EQUAL
//
2014-01-20 02:23:03 +00:00
#if SPROUT_AVAILABLE_GCC
# define SPROUT_GCC_LESS(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) \
(SPROUT_VERSION_GCC >= SPROUT_VERSION_NUMBER(major, minor, patch))
#else
2014-01-20 02:23:03 +00:00
# define SPROUT_GCC_LESS(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) \
(0)
#endif
//
// SPROUT_GCC_BETWEEN
//
2014-01-20 02:23:03 +00:00
#if SPROUT_AVAILABLE_GCC
# define SPROUT_GCC_BETWEEN(first_version, last_version) \
(SPROUT_GCC_GREATER_EQUAL first_version && SPROUT_GCC_LESS last_version)
#else
2014-01-20 02:23:03 +00:00
# define SPROUT_GCC_BETWEEN(first_version, last_version) \
(0)
#endif
//
2014-01-20 02:23:03 +00:00
// SPROUT_AVAILABLE_CLANG
//
#if defined(__clang__)
2014-01-20 02:23:03 +00:00
# define SPROUT_AVAILABLE_CLANG (1)
#else
# define SPROUT_AVAILABLE_CLANG (0)
#endif
//
// SPROUT_VERSION_CLANG
//
#if SPROUT_AVAILABLE_CLANG
# define SPROUT_VERSION_CLANG SPROUT_VERSION_NUMBER(__clang_major__, __clang_minor__, __clang_patchlevel__)
#else
2014-01-20 02:23:03 +00:00
# define SPROUT_VERSION_CLANG SPROUT_VERSION_NUMBER_ZERO
#endif
//
// SPROUT_CLANG_HAS_FUTURE
//
2014-01-20 02:23:03 +00:00
#if SPROUT_AVAILABLE_CLANG
# define SPROUT_CLANG_HAS_FUTURE(future) (__has_feature(future))
#else
# define SPROUT_CLANG_HAS_FUTURE(future) (0)
#endif
//
// SPROUT_CLANG_LESS
// SPROUT_CLANG_GREATER
// SPROUT_CLANG_LESS_EQUAL
// SPROUT_CLANG_GREATER_EQUAL
//
2014-01-20 02:23:03 +00:00
#if SPROUT_AVAILABLE_CLANG
# define SPROUT_CLANG_LESS(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) \
(SPROUT_VERSION_CLANG >= SPROUT_VERSION_NUMBER(major, minor, patch))
#else
2014-01-20 02:23:03 +00:00
# define SPROUT_CLANG_LESS(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) \
(0)
#endif
//
// SPROUT_CLANG_BETWEEN
//
2014-01-20 02:23:03 +00:00
#if SPROUT_AVAILABLE_CLANG
# define SPROUT_CLANG_BETWEEN(first_version, last_version) \
(SPROUT_CLANG_GREATER_EQUAL first_version && SPROUT_CLANG_LESS last_version)
#else
2014-01-20 02:23:03 +00:00
# define SPROUT_CLANG_BETWEEN(first_version, last_version) \
(0)
#endif
#endif // #ifndef SPROUT_DETAIL_PREDEF_HPP