forked from boostorg/config
Merge pull request #385 from boostorg/pr/boost-clang-version
Add BOOST_CLANG_VERSION macro
This commit is contained in:
@ -1481,6 +1481,12 @@ compiler version macro.
|
||||
[[`BOOST_CLANG`][`<boost/config.hpp>`][
|
||||
Defined to 1 if the compiler is the Clang compiler.
|
||||
]]
|
||||
[[`BOOST_CLANG_VERSION`][`<boost/config.hpp>`][
|
||||
Defined to the version of the Clang compiler, usually
|
||||
`__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__`. On
|
||||
Apple Clang, has a best-effort value reflecting the upstream version, rather
|
||||
than the Apple version.
|
||||
]]
|
||||
[[`BOOST_BORLANDC`][`<boost/config.hpp>`][
|
||||
Defined to the value of __BORLANDC__ if the compiler is the Embarcadero
|
||||
non-clang based compiler.
|
||||
|
@ -351,3 +351,5 @@
|
||||
// Macro used to identify the Clang compiler.
|
||||
#define BOOST_CLANG 1
|
||||
|
||||
// BOOST_CLANG_VERSION
|
||||
#include <boost/config/compiler/clang_version.hpp>
|
||||
|
77
include/boost/config/compiler/clang_version.hpp
Normal file
77
include/boost/config/compiler/clang_version.hpp
Normal file
@ -0,0 +1,77 @@
|
||||
// Copyright 2021 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
|
||||
# define BOOST_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
|
||||
|
||||
#else
|
||||
# define BOOST_CLANG_REPORTED_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
|
||||
|
||||
// https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
|
||||
|
||||
# if BOOST_CLANG_REPORTED_VERSION >= 130000
|
||||
# define BOOST_CLANG_VERSION 120000
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 120005
|
||||
# define BOOST_CLANG_VERSION 110100
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 120000
|
||||
# define BOOST_CLANG_VERSION 100000
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 110003
|
||||
# define BOOST_CLANG_VERSION 90000
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 110000
|
||||
# define BOOST_CLANG_VERSION 80000
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 100001
|
||||
# define BOOST_CLANG_VERSION 70000
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 100000
|
||||
# define BOOST_CLANG_VERSION 60001
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 90100
|
||||
# define BOOST_CLANG_VERSION 50002
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 90000
|
||||
# define BOOST_CLANG_VERSION 40000
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 80000
|
||||
# define BOOST_CLANG_VERSION 30900
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 70300
|
||||
# define BOOST_CLANG_VERSION 30800
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 70000
|
||||
# define BOOST_CLANG_VERSION 30700
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 60100
|
||||
# define BOOST_CLANG_VERSION 30600
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 60000
|
||||
# define BOOST_CLANG_VERSION 30500
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 50100
|
||||
# define BOOST_CLANG_VERSION 30400
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 50000
|
||||
# define BOOST_CLANG_VERSION 30300
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 40200
|
||||
# define BOOST_CLANG_VERSION 30200
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 30100
|
||||
# define BOOST_CLANG_VERSION 30100
|
||||
|
||||
# elif BOOST_CLANG_REPORTED_VERSION >= 20100
|
||||
# define BOOST_CLANG_VERSION 30000
|
||||
|
||||
# else
|
||||
# define BOOST_CLANG_VERSION 20900
|
||||
|
||||
# endif
|
||||
|
||||
# undef BOOST_CLANG_REPORTED_VERSION
|
||||
#endif
|
@ -288,3 +288,4 @@
|
||||
// Macro used to identify the Clang compiler.
|
||||
#define BOOST_CLANG 1
|
||||
|
||||
#define BOOST_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
|
||||
|
@ -259,6 +259,12 @@
|
||||
#else
|
||||
#define BOOST_INTEL_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef BOOST_CLANG_VERSION
|
||||
#define BOOST_CLANG_VERSION_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define BOOST_CLANG_VERSION_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
|
||||
// Always define to zero, if it's used it'll be defined my MPL:
|
||||
#define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0
|
||||
|
||||
|
@ -380,6 +380,7 @@ void print_compiler_macros()
|
||||
PRINT_MACRO(__clang_minor__);
|
||||
PRINT_MACRO(__clang_version__);
|
||||
PRINT_MACRO(__clang_patchlevel__);
|
||||
PRINT_MACRO(__apple_build_version__);
|
||||
|
||||
// misc compilers not covered so far:
|
||||
PRINT_MACRO(__USLC__);
|
||||
@ -1268,6 +1269,8 @@ void print_boost_macros()
|
||||
PRINT_MACRO(BOOST_INTEL);
|
||||
PRINT_MACRO(BOOST_MSVC);
|
||||
PRINT_MACRO(BOOST_GCC);
|
||||
PRINT_MACRO(BOOST_CLANG);
|
||||
PRINT_MACRO(BOOST_CLANG_VERSION);
|
||||
PRINT_MACRO(BOOST_LIBSTDCXX_VERSION);
|
||||
PRINT_MACRO(BOOST_STD_EXTENSION_NAMESPACE);
|
||||
PRINT_MACRO(BOOST_UNREACHABLE_RETURN(0));
|
||||
|
Reference in New Issue
Block a user