Sprout/sprout/detail/predef.hpp

117 lines
3.2 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
//
2014-01-20 04:09:54 +00:00
// SPROUT_GCC_EARLIER
// SPROUT_GCC_OR_LATER
//
2014-01-20 02:23:03 +00:00
#if SPROUT_AVAILABLE_GCC
2014-01-20 04:09:54 +00:00
# define SPROUT_GCC_EARLIER(major, minor, patch) \
2014-01-20 02:23:03 +00:00
(SPROUT_VERSION_GCC < SPROUT_VERSION_NUMBER(major, minor, patch))
2014-01-20 04:09:54 +00:00
# define SPROUT_GCC_OR_LATER(major, minor, patch) \
2014-01-20 02:23:03 +00:00
(SPROUT_VERSION_GCC >= SPROUT_VERSION_NUMBER(major, minor, patch))
#else
2014-01-20 04:09:54 +00:00
# define SPROUT_GCC_EARLIER(major, minor, patch) \
2014-01-20 02:23:03 +00:00
(0)
2014-01-20 04:09:54 +00:00
# define SPROUT_GCC_OR_LATER(major, minor, patch) \
2014-01-20 02:23:03 +00:00
(0)
#endif
//
2014-01-20 04:09:54 +00:00
// SPROUT_GCC_IN_RANGE
//
2014-01-20 02:23:03 +00:00
#if SPROUT_AVAILABLE_GCC
2014-01-20 04:09:54 +00:00
# define SPROUT_GCC_IN_RANGE(first_version, last_version) \
(SPROUT_GCC_OR_LATER first_version && SPROUT_GCC_EARLIER last_version)
#else
2014-01-20 04:09:54 +00:00
# define SPROUT_GCC_IN_RANGE(first_version, last_version) \
2014-01-20 02:23:03 +00:00
(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
//
2014-01-20 04:09:54 +00:00
// SPROUT_CLANG_EARLIER
// SPROUT_CLANG_OR_LATER
//
2014-01-20 02:23:03 +00:00
#if SPROUT_AVAILABLE_CLANG
2014-01-20 04:09:54 +00:00
# define SPROUT_CLANG_EARLIER(major, minor, patch) \
2014-01-20 02:23:03 +00:00
(SPROUT_VERSION_CLANG < SPROUT_VERSION_NUMBER(major, minor, patch))
2014-01-20 04:09:54 +00:00
# define SPROUT_CLANG_OR_LATER(major, minor, patch) \
2014-01-20 02:23:03 +00:00
(SPROUT_VERSION_CLANG >= SPROUT_VERSION_NUMBER(major, minor, patch))
#else
2014-01-20 04:09:54 +00:00
# define SPROUT_CLANG_EARLIER(major, minor, patch) \
2014-01-20 02:23:03 +00:00
(0)
2014-01-20 04:09:54 +00:00
# define SPROUT_CLANG_OR_LATER(major, minor, patch) \
2014-01-20 02:23:03 +00:00
(0)
#endif
//
2014-01-20 04:09:54 +00:00
// SPROUT_CLANG_IN_RANGE
//
2014-01-20 02:23:03 +00:00
#if SPROUT_AVAILABLE_CLANG
2014-01-20 04:09:54 +00:00
# define SPROUT_CLANG_IN_RANGE(first_version, last_version) \
(SPROUT_CLANG_OR_LATER first_version && SPROUT_CLANG_EARLIER last_version)
#else
2014-01-20 04:09:54 +00:00
# define SPROUT_CLANG_IN_RANGE(first_version, last_version) \
2014-01-20 02:23:03 +00:00
(0)
#endif
#endif // #ifndef SPROUT_DETAIL_PREDEF_HPP