getcompiler.c 534 B

123456789101112131415161718192021222324252627
  1. /* Return the compiler identification, if possible. */
  2. #include "Python.h"
  3. #ifndef COMPILER
  4. // Note the __clang__ conditional has to come before the __GNUC__ one because
  5. // clang pretends to be GCC.
  6. #if defined(__clang__)
  7. #define COMPILER "[Clang " __clang_version__ "]"
  8. #elif defined(__GNUC__)
  9. #define COMPILER "[GCC " __VERSION__ "]"
  10. // Generic fallbacks.
  11. #elif defined(__cplusplus)
  12. #define COMPILER "[C++]"
  13. #else
  14. #define COMPILER "[C]"
  15. #endif
  16. #endif /* !COMPILER */
  17. const char *
  18. Py_GetCompiler(void)
  19. {
  20. return COMPILER;
  21. }