Macros to identify the XL C/C++ compiler

Most of the macros related to the XL C/C++ compiler are predefined and protected, which means that the compiler will issue a warning if you try to undefine or redefine them. You can use the -dM (-qshowmacros) -E compiler options to view the values of the predefined macros.

Table 1. Compiler-related predefined macros
Predefined macro name Description Predefined value
C only begins__IBMC__1 Indicates the level of the XL C compiler. An integer in format VRM, where:
V
Represents the version number
R
Represents the release number
M
Represents the modification number
C++ only begins__IBMCPP__1 Indicates the level of the XL C++ compiler. An integer in format VRM, where:
V
Represents the version number
R
Represents the release number
M
Represents the modification number
__xlC__1 Indicates the VR level of the XL C and XL C++ compilers in hexadecimal format. The XL C compiler predefines this macro. A 4-digit hexadecimal integer in format 0xVVRR, where:
V
Represents the version number
R
Represents the release number
__xlC_ver__1 Indicates the MF level of the XL C and XL C++ compilers in hexadecimal format. The XL C compiler predefines this macro. An 8-digit hexadecimal integer in format 0x0000MMFF, where:
M
Represents the modification number
F
Represents the fix level
C only begins__xlc__1 Indicates the level of the XL C compiler. A string in format V.R.M.F, where:
V
Represents the version number
R
Represents the release number
M
Represents the modification number
F
Represents the fix level
__clang__ Indicates that Clang front end is used. 1
__clang_major__ Indicates the major version number of the Clang front end. 4
__clang_minor__ Indicates the minor version number of the Clang front end. 0
__clang_patchlevel__ Indicates the patch level number of the Clang front end. 1
__clang_version__ Indicates the full version of the Clang front end. 4.0.1 (tags/RELEASE_401/final)
__ibmxl__ Indicates the XL C/C++ compiler is being used. 1
__ibmxl_vrm__ Indicates the VRM level of the XL C/C++ compiler using a single integer for sorting purposes. A hexadecimal integer whose value is as follows:
(((__ibmxl_version__) << 24) | \
 ((__ibmxl_release__) << 16) | \ 
 ((__ibmxl_modification__) << 8) \
)
__ibmxl_version__ Indicates the version number of the XL C/C++ compiler. An integer that represents the version number
__ibmxl_release__ Indicates the release number of the XL C/C++ compiler. An integer that represents the release number
__ibmxl_modification__ Indicates the modification number of the XL C/C++ compiler. An integer that represents the modification number
__ibmxl_ptf_fix_level__ Indicates the PTF fix level of the XL C/C++ compiler. An integer that represents the fix number
__llvm__ Indicates that an LLVM backend is used. 1
Note:
  1. This macro is not defined when the default -qnoxlcompatmacros option is in effect. To migrate programs from IBM® XL C/C++ for Linux V13.1 or earlier for big endian distributions or IBM XL C/C++ for AIX® to release versions starting from IBM XL C/C++ for Linux, V13.1.6 for little endian distributions, you must use the -qxlcompatmacros option to define this macro.


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us