CMakeCCompilerId.c.in 2.0 KB

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