Define BOOST_CLANG_VERSION

This commit is contained in:
Peter Dimov
2021-07-04 18:49:01 +03:00
parent f5bb9e5f5e
commit f6fdfb9291
3 changed files with 80 additions and 0 deletions

View File

@ -351,3 +351,5 @@
// Macro used to identify the Clang compiler. // Macro used to identify the Clang compiler.
#define BOOST_CLANG 1 #define BOOST_CLANG 1
// BOOST_CLANG_VERSION
#include <boost/config/compiler/clang_version.hpp>

View 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

View File

@ -288,3 +288,4 @@
// Macro used to identify the Clang compiler. // Macro used to identify the Clang compiler.
#define BOOST_CLANG 1 #define BOOST_CLANG 1
#define BOOST_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)