CMakeCCompilerId.c.in 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifdef __cplusplus
  2. # error "A C++ compiler has been selected for C."
  3. #endif
  4. #if defined(__18CXX)
  5. # define ID_VOID_MAIN
  6. #endif
  7. #if defined(__CLASSIC_C__)
  8. /* cv-qualifiers did not exist in K&R C */
  9. # define const
  10. # define volatile
  11. #endif
  12. @CMAKE_C_COMPILER_ID_CONTENT@
  13. /* Construct the string literal in pieces to prevent the source from
  14. getting matched. Store it in a pointer rather than an array
  15. because some compilers will just produce instructions to fill the
  16. array rather than assigning a pointer to a static array. */
  17. char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
  18. #ifdef SIMULATE_ID
  19. char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
  20. #endif
  21. #ifdef __QNXNTO__
  22. char const* qnxnto = "INFO" ":" "qnxnto[]";
  23. #endif
  24. #if defined(__CRAYXE) || defined(__CRAYXC)
  25. char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
  26. #endif
  27. @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
  28. @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
  29. #if !defined(__STDC__) && !defined(__clang__)
  30. # if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
  31. # define C_DIALECT "90"
  32. # else
  33. # define C_DIALECT
  34. # endif
  35. #elif __STDC_VERSION__ > 201710L
  36. # define C_DIALECT "23"
  37. #elif __STDC_VERSION__ >= 201710L
  38. # define C_DIALECT "17"
  39. #elif __STDC_VERSION__ >= 201000L
  40. # define C_DIALECT "11"
  41. #elif __STDC_VERSION__ >= 199901L
  42. # define C_DIALECT "99"
  43. #else
  44. # define C_DIALECT "90"
  45. #endif
  46. const char* info_language_dialect_default =
  47. "INFO" ":" "dialect_default[" C_DIALECT "]";
  48. /*--------------------------------------------------------------------------*/
  49. #ifdef ID_VOID_MAIN
  50. void main() {}
  51. #else
  52. # if defined(__CLASSIC_C__)
  53. int main(argc, argv) int argc; char *argv[];
  54. # else
  55. int main(int argc, char* argv[])
  56. # endif
  57. {
  58. int require = 0;
  59. require += info_compiler[argc];
  60. require += info_platform[argc];
  61. require += info_arch[argc];
  62. #ifdef COMPILER_VERSION_MAJOR
  63. require += info_version[argc];
  64. #endif
  65. #ifdef COMPILER_VERSION_INTERNAL
  66. require += info_version_internal[argc];
  67. #endif
  68. #ifdef SIMULATE_ID
  69. require += info_simulate[argc];
  70. #endif
  71. #ifdef SIMULATE_VERSION_MAJOR
  72. require += info_simulate_version[argc];
  73. #endif
  74. #if defined(__CRAYXE) || defined(__CRAYXC)
  75. require += info_cray[argc];
  76. #endif
  77. require += info_language_dialect_default[argc];
  78. (void)argv;
  79. return require;
  80. }
  81. #endif