|
Description
The Clang
C/C++ compiler.
Macros
Type |
Macro |
Format |
Description |
Identification |
__clang__ |
|
|
Version |
__clang_major__ |
V |
V = Major version |
Version |
__clang_minor__ |
R |
R = Minor version |
Version |
__clang_patchlevel__ |
P |
P = Patch level |
Version |
__clang_version__ |
V.R.P (tags/RELEASE_VRP/final) |
V = Major version
R = Minor version
P = Patch level |
Notes
Notice that clang also defines the GNU C version macros, but you should
use the clang feature
checking macros to detect the availability of various features.
The values of the __clang_major__ ,
__clang_minor__ , and __clang_patchlevel__
macros are not consistent across distributions of the Clang compiler.
For example, the Clang 3.1 distribution available at http://clang.llvm.org
defines __clang_major__
and __clang_minor__ as
3 and 1 respectively. The version of Clang distributed with Apple XCode
4.4 is branded as "Apple Clang 4.0" and derives from the open source Clang
3.1 distribution, but defines these macros with the values 4 and 0 respectively.
Apple's Clang distribution can be identified by the presence of the __apple_build_version__
macro.
The meaning of the __clang__
and related macros has changed subtly over the years, from identifying
the Clang compiler to identifying compilers that use the Clang infrastructure.
For example, IBM XL C/C++ also defines these macros. IBM
XL C/C++ for Linux defines them starting from version 13.1.1. IBM
XL C/C++ for AIX defines them starting from version 16.1.
Clang also has an expectation that it is being ised in conjunction with
LLVM, so the compiler will define __llvm__ as well.
|