blob: 59c0dbf92aebf42fabf41661b8262aa89a15b60b [file] [log] [blame]
Guido van Rossumf857a6b1996-05-23 22:50:26 +00001
Guido van Rossum582646a1996-05-28 22:30:17 +00002/* Return the compiler identification, if possible. */
3
4#include "Python.h"
Guido van Rossumf857a6b1996-05-23 22:50:26 +00005
6#ifndef COMPILER
Guido van Rossum582646a1996-05-28 22:30:17 +00007
Benjamin Peterson7faf7e52017-10-05 21:15:14 -07008// Note the __clang__ conditional has to come before the __GNUC__ one because
9// clang pretends to be GCC.
10#if defined(__clang__)
11#define COMPILER "\n[Clang " __clang_version__ "]"
12#elif defined(__GNUC__)
Guido van Rossumf26cda62000-09-05 04:40:39 +000013#define COMPILER "\n[GCC " __VERSION__ "]"
Benjamin Peterson7faf7e52017-10-05 21:15:14 -070014// Generic fallbacks.
15#elif defined(__cplusplus)
Guido van Rossum667d7041995-08-04 04:20:48 +000016#define COMPILER "[C++]"
17#else
18#define COMPILER "[C]"
19#endif
Guido van Rossum582646a1996-05-28 22:30:17 +000020
Guido van Rossumf857a6b1996-05-23 22:50:26 +000021#endif /* !COMPILER */
Guido van Rossum667d7041995-08-04 04:20:48 +000022
Guido van Rossum8fb26ed1997-07-19 19:48:41 +000023const char *
Thomas Woutersf70ef4f2000-07-22 18:47:25 +000024Py_GetCompiler(void)
Guido van Rossum667d7041995-08-04 04:20:48 +000025{
Benjamin Petersona8ed1172017-10-05 00:09:01 -070026 return COMPILER;
Guido van Rossum667d7041995-08-04 04:20:48 +000027}