/src/cpython/Python/getcompiler.c
Line | Count | Source |
1 | | |
2 | | /* Return the compiler identification, if possible. */ |
3 | | |
4 | | #include "Python.h" |
5 | | |
6 | | #ifdef _Py_COMPILER |
7 | | # define COMPILER _Py_COMPILER |
8 | | #endif |
9 | | |
10 | | #ifndef COMPILER |
11 | | |
12 | | // Note the __clang__ conditional has to come before the __GNUC__ one because |
13 | | // clang pretends to be GCC. |
14 | | #if defined(__clang__) |
15 | 28 | #define COMPILER "[Clang " __clang_version__ "]" |
16 | | #elif defined(__GNUC__) |
17 | | #define COMPILER "[GCC " __VERSION__ "]" |
18 | | // Generic fallbacks. |
19 | | #elif defined(__cplusplus) |
20 | | #define COMPILER "[C++]" |
21 | | #else |
22 | | #define COMPILER "[C]" |
23 | | #endif |
24 | | |
25 | | #endif /* !COMPILER */ |
26 | | |
27 | | const char * |
28 | | Py_GetCompiler(void) |
29 | 28 | { |
30 | 28 | return COMPILER; |
31 | 28 | } |