CMakeCCompilerId.c.in 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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__)
  30. # if (defined(_MSC_VER) && !defined(__clang__)) \
  31. || (defined(__ibmxl__) || defined(__IBMC__))
  32. # define C_DIALECT "90"
  33. # else
  34. # define C_DIALECT
  35. # endif
  36. #elif __STDC_VERSION__ >= 201000L
  37. # define C_DIALECT "11"
  38. #elif __STDC_VERSION__ >= 199901L
  39. # define C_DIALECT "99"
  40. #else
  41. # define C_DIALECT "90"
  42. #endif
  43. const char* info_language_dialect_default =
  44. "INFO" ":" "dialect_default[" C_DIALECT "]";
  45. /*--------------------------------------------------------------------------*/
  46. #ifdef ID_VOID_MAIN
  47. void main() {}
  48. #else
  49. # if defined(__CLASSIC_C__)
  50. int main(argc, argv) int argc; char *argv[];
  51. # else
  52. int main(int argc, char* argv[])
  53. # endif
  54. {
  55. int require = 0;
  56. require += info_compiler[argc];
  57. require += info_platform[argc];
  58. require += info_arch[argc];
  59. #ifdef COMPILER_VERSION_MAJOR
  60. require += info_version[argc];
  61. #endif
  62. #ifdef COMPILER_VERSION_INTERNAL
  63. require += info_version_internal[argc];
  64. #endif
  65. #ifdef SIMULATE_ID
  66. require += info_simulate[argc];
  67. #endif
  68. #ifdef SIMULATE_VERSION_MAJOR
  69. require += info_simulate_version[argc];
  70. #endif
  71. #if defined(__CRAYXE) || defined(__CRAYXC)
  72. require += info_cray[argc];
  73. #endif
  74. require += info_language_dialect_default[argc];
  75. (void)argv;
  76. return require;
  77. }
  78. #endif