CMakeCXXCompilerId.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. /* This source file must have a .cpp extension so that all C++ compilers
  2. recognize the extension without flags. Borland does not know .cxx for
  3. example. */
  4. #ifndef __cplusplus
  5. # error "A C compiler has been selected for C++."
  6. #endif
  7. /* Version number components: V=Version, R=Revision, P=Patch
  8. Version date components: YYYY=Year, MM=Month, DD=Day */
  9. #if defined(__COMO__)
  10. # define COMPILER_ID "Comeau"
  11. /* __COMO_VERSION__ = VRR */
  12. # define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
  13. # define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
  14. #elif defined(__INTEL_COMPILER) || defined(__ICC)
  15. # define COMPILER_ID "Intel"
  16. # if defined(_MSC_VER)
  17. # define SIMULATE_ID "MSVC"
  18. # endif
  19. /* __INTEL_COMPILER = VRP */
  20. # define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
  21. # define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
  22. # if defined(__INTEL_COMPILER_UPDATE)
  23. # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
  24. # else
  25. # define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
  26. # endif
  27. # if defined(__INTEL_COMPILER_BUILD_DATE)
  28. /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
  29. # define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
  30. # endif
  31. # if defined(_MSC_VER)
  32. /* _MSC_VER = VVRR */
  33. # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
  34. # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
  35. # endif
  36. #elif defined(__PATHCC__)
  37. # define COMPILER_ID "PathScale"
  38. # define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
  39. # define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
  40. # if defined(__PATHCC_PATCHLEVEL__)
  41. # define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
  42. # endif
  43. #elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
  44. # define COMPILER_ID "Embarcadero"
  45. # define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
  46. # define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
  47. # define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
  48. #elif defined(__BORLANDC__)
  49. # define COMPILER_ID "Borland"
  50. /* __BORLANDC__ = 0xVRR */
  51. # define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
  52. # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
  53. #elif defined(__WATCOMC__) && __WATCOMC__ < 1200
  54. # define COMPILER_ID "Watcom"
  55. /* __WATCOMC__ = VVRR */
  56. # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
  57. # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
  58. # if (__WATCOMC__ % 10) > 0
  59. # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
  60. # endif
  61. #elif defined(__WATCOMC__)
  62. # define COMPILER_ID "OpenWatcom"
  63. /* __WATCOMC__ = VVRP + 1100 */
  64. # define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
  65. # define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
  66. # if (__WATCOMC__ % 10) > 0
  67. # define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
  68. # endif
  69. #elif defined(__SUNPRO_CC)
  70. # define COMPILER_ID "SunPro"
  71. # if __SUNPRO_CC >= 0x5100
  72. /* __SUNPRO_CC = 0xVRRP */
  73. # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
  74. # define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
  75. # define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
  76. # else
  77. /* __SUNPRO_CC = 0xVRP */
  78. # define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
  79. # define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
  80. # define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
  81. # endif
  82. #elif defined(__HP_aCC)
  83. # define COMPILER_ID "HP"
  84. /* __HP_aCC = VVRRPP */
  85. # define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
  86. # define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
  87. # define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
  88. #elif defined(__DECCXX)
  89. # define COMPILER_ID "Compaq"
  90. /* __DECCXX_VER = VVRRTPPPP */
  91. # define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
  92. # define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
  93. # define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
  94. #elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
  95. # define COMPILER_ID "zOS"
  96. /* __IBMCPP__ = VRP */
  97. # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
  98. # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
  99. # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
  100. #elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
  101. # define COMPILER_ID "XL"
  102. /* __IBMCPP__ = VRP */
  103. # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
  104. # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
  105. # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
  106. #elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
  107. # define COMPILER_ID "VisualAge"
  108. /* __IBMCPP__ = VRP */
  109. # define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
  110. # define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
  111. # define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
  112. #elif defined(__PGI)
  113. # define COMPILER_ID "PGI"
  114. # define COMPILER_VERSION_MAJOR DEC(__PGIC__)
  115. # define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
  116. # if defined(__PGIC_PATCHLEVEL__)
  117. # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
  118. # endif
  119. #elif defined(_CRAYC)
  120. # define COMPILER_ID "Cray"
  121. # define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
  122. # define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
  123. #elif defined(__TI_COMPILER_VERSION__)
  124. # define COMPILER_ID "TI"
  125. /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
  126. # define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
  127. # define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
  128. # define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
  129. #elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
  130. # define COMPILER_ID "Fujitsu"
  131. #elif defined(__SCO_VERSION__)
  132. # define COMPILER_ID "SCO"
  133. #elif defined(__clang__) && defined(__apple_build_version__)
  134. # define COMPILER_ID "AppleClang"
  135. # if defined(_MSC_VER)
  136. # define SIMULATE_ID "MSVC"
  137. # endif
  138. # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
  139. # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
  140. # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
  141. # if defined(_MSC_VER)
  142. /* _MSC_VER = VVRR */
  143. # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
  144. # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
  145. # endif
  146. # define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
  147. #elif defined(__clang__)
  148. # define COMPILER_ID "Clang"
  149. # if defined(_MSC_VER)
  150. # define SIMULATE_ID "MSVC"
  151. # endif
  152. # define COMPILER_VERSION_MAJOR DEC(__clang_major__)
  153. # define COMPILER_VERSION_MINOR DEC(__clang_minor__)
  154. # define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
  155. # if defined(_MSC_VER)
  156. /* _MSC_VER = VVRR */
  157. # define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
  158. # define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
  159. # endif
  160. #elif defined(__GNUC__)
  161. # define COMPILER_ID "GNU"
  162. # define COMPILER_VERSION_MAJOR DEC(__GNUC__)
  163. # if defined(__GNUC_MINOR__)
  164. # define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
  165. # endif
  166. # if defined(__GNUC_PATCHLEVEL__)
  167. # define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
  168. # endif
  169. #elif defined(_MSC_VER)
  170. # define COMPILER_ID "MSVC"
  171. /* _MSC_VER = VVRR */
  172. # define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
  173. # define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
  174. # if defined(_MSC_FULL_VER)
  175. # if _MSC_VER >= 1400
  176. /* _MSC_FULL_VER = VVRRPPPPP */
  177. # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
  178. # else
  179. /* _MSC_FULL_VER = VVRRPPPP */
  180. # define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
  181. # endif
  182. # endif
  183. # if defined(_MSC_BUILD)
  184. # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
  185. # endif
  186. #elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
  187. # define COMPILER_ID "ADSP"
  188. #if defined(__VISUALDSPVERSION__)
  189. /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
  190. # define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
  191. # define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
  192. # define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
  193. #endif
  194. #elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
  195. # define COMPILER_ID "IAR"
  196. #elif defined(__ARMCC_VERSION)
  197. # define COMPILER_ID "ARMCC"
  198. #if __ARMCC_VERSION >= 1000000
  199. /* __ARMCC_VERSION = VRRPPPP */
  200. # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
  201. # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
  202. # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
  203. #else
  204. /* __ARMCC_VERSION = VRPPPP */
  205. # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
  206. # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
  207. # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
  208. #endif
  209. #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
  210. # define COMPILER_ID "MIPSpro"
  211. # if defined(_SGI_COMPILER_VERSION)
  212. /* _SGI_COMPILER_VERSION = VRP */
  213. # define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
  214. # define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
  215. # define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
  216. # else
  217. /* _COMPILER_VERSION = VRP */
  218. # define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
  219. # define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
  220. # define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
  221. # endif
  222. /* These compilers are either not known or too old to define an
  223. identification macro. Try to identify the platform and guess that
  224. it is the native compiler. */
  225. #elif defined(__sgi)
  226. # define COMPILER_ID "MIPSpro"
  227. #elif defined(__hpux) || defined(__hpua)
  228. # define COMPILER_ID "HP"
  229. #else /* unknown compiler */
  230. # define COMPILER_ID ""
  231. #endif
  232. /* Construct the string literal in pieces to prevent the source from
  233. getting matched. Store it in a pointer rather than an array
  234. because some compilers will just produce instructions to fill the
  235. array rather than assigning a pointer to a static array. */
  236. char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
  237. #ifdef SIMULATE_ID
  238. char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
  239. #endif
  240. #ifdef __QNXNTO__
  241. char const* qnxnto = "INFO" ":" "qnxnto[]";
  242. #endif
  243. #if defined(__CRAYXE) || defined(__CRAYXC)
  244. char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
  245. #endif
  246. #define STRINGIFY_HELPER(X) #X
  247. #define STRINGIFY(X) STRINGIFY_HELPER(X)
  248. /* Identify known platforms by name. */
  249. #if defined(__linux) || defined(__linux__) || defined(linux)
  250. # define PLATFORM_ID "Linux"
  251. #elif defined(__CYGWIN__)
  252. # define PLATFORM_ID "Cygwin"
  253. #elif defined(__MINGW32__)
  254. # define PLATFORM_ID "MinGW"
  255. #elif defined(__APPLE__)
  256. # define PLATFORM_ID "Darwin"
  257. #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
  258. # define PLATFORM_ID "Windows"
  259. #elif defined(__FreeBSD__) || defined(__FreeBSD)
  260. # define PLATFORM_ID "FreeBSD"
  261. #elif defined(__NetBSD__) || defined(__NetBSD)
  262. # define PLATFORM_ID "NetBSD"
  263. #elif defined(__OpenBSD__) || defined(__OPENBSD)
  264. # define PLATFORM_ID "OpenBSD"
  265. #elif defined(__sun) || defined(sun)
  266. # define PLATFORM_ID "SunOS"
  267. #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
  268. # define PLATFORM_ID "AIX"
  269. #elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
  270. # define PLATFORM_ID "IRIX"
  271. #elif defined(__hpux) || defined(__hpux__)
  272. # define PLATFORM_ID "HP-UX"
  273. #elif defined(__HAIKU__)
  274. # define PLATFORM_ID "Haiku"
  275. #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
  276. # define PLATFORM_ID "BeOS"
  277. #elif defined(__QNX__) || defined(__QNXNTO__)
  278. # define PLATFORM_ID "QNX"
  279. #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
  280. # define PLATFORM_ID "Tru64"
  281. #elif defined(__riscos) || defined(__riscos__)
  282. # define PLATFORM_ID "RISCos"
  283. #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
  284. # define PLATFORM_ID "SINIX"
  285. #elif defined(__UNIX_SV__)
  286. # define PLATFORM_ID "UNIX_SV"
  287. #elif defined(__bsdos__)
  288. # define PLATFORM_ID "BSDOS"
  289. #elif defined(_MPRAS) || defined(MPRAS)
  290. # define PLATFORM_ID "MP-RAS"
  291. #elif defined(__osf) || defined(__osf__)
  292. # define PLATFORM_ID "OSF1"
  293. #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
  294. # define PLATFORM_ID "SCO_SV"
  295. #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
  296. # define PLATFORM_ID "ULTRIX"
  297. #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
  298. # define PLATFORM_ID "Xenix"
  299. #elif defined(__WATCOMC__)
  300. # if defined(__LINUX__)
  301. # define PLATFORM_ID "Linux"
  302. # elif defined(__DOS__)
  303. # define PLATFORM_ID "DOS"
  304. # elif defined(__OS2__)
  305. # define PLATFORM_ID "OS2"
  306. # elif defined(__WINDOWS__)
  307. # define PLATFORM_ID "Windows3x"
  308. # else /* unknown platform */
  309. # define PLATFORM_ID
  310. # endif
  311. #else /* unknown platform */
  312. # define PLATFORM_ID
  313. #endif
  314. /* For windows compilers MSVC and Intel we can determine
  315. the architecture of the compiler being used. This is because
  316. the compilers do not have flags that can change the architecture,
  317. but rather depend on which compiler is being used
  318. */
  319. #if defined(_WIN32) && defined(_MSC_VER)
  320. # if defined(_M_IA64)
  321. # define ARCHITECTURE_ID "IA64"
  322. # elif defined(_M_X64) || defined(_M_AMD64)
  323. # define ARCHITECTURE_ID "x64"
  324. # elif defined(_M_IX86)
  325. # define ARCHITECTURE_ID "X86"
  326. # elif defined(_M_ARM)
  327. # if _M_ARM == 4
  328. # define ARCHITECTURE_ID "ARMV4I"
  329. # elif _M_ARM == 5
  330. # define ARCHITECTURE_ID "ARMV5I"
  331. # else
  332. # define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
  333. # endif
  334. # elif defined(_M_MIPS)
  335. # define ARCHITECTURE_ID "MIPS"
  336. # elif defined(_M_SH)
  337. # define ARCHITECTURE_ID "SHx"
  338. # else /* unknown architecture */
  339. # define ARCHITECTURE_ID ""
  340. # endif
  341. #elif defined(__WATCOMC__)
  342. # if defined(_M_I86)
  343. # define ARCHITECTURE_ID "I86"
  344. # elif defined(_M_IX86)
  345. # define ARCHITECTURE_ID "X86"
  346. # else /* unknown architecture */
  347. # define ARCHITECTURE_ID ""
  348. # endif
  349. #else
  350. # define ARCHITECTURE_ID
  351. #endif
  352. /* Convert integer to decimal digit literals. */
  353. #define DEC(n) \
  354. ('0' + (((n) / 10000000)%10)), \
  355. ('0' + (((n) / 1000000)%10)), \
  356. ('0' + (((n) / 100000)%10)), \
  357. ('0' + (((n) / 10000)%10)), \
  358. ('0' + (((n) / 1000)%10)), \
  359. ('0' + (((n) / 100)%10)), \
  360. ('0' + (((n) / 10)%10)), \
  361. ('0' + ((n) % 10))
  362. /* Convert integer to hex digit literals. */
  363. #define HEX(n) \
  364. ('0' + ((n)>>28 & 0xF)), \
  365. ('0' + ((n)>>24 & 0xF)), \
  366. ('0' + ((n)>>20 & 0xF)), \
  367. ('0' + ((n)>>16 & 0xF)), \
  368. ('0' + ((n)>>12 & 0xF)), \
  369. ('0' + ((n)>>8 & 0xF)), \
  370. ('0' + ((n)>>4 & 0xF)), \
  371. ('0' + ((n) & 0xF))
  372. /* Construct a string literal encoding the version number components. */
  373. #ifdef COMPILER_VERSION_MAJOR
  374. char const info_version[] = {
  375. 'I', 'N', 'F', 'O', ':',
  376. 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
  377. COMPILER_VERSION_MAJOR,
  378. # ifdef COMPILER_VERSION_MINOR
  379. '.', COMPILER_VERSION_MINOR,
  380. # ifdef COMPILER_VERSION_PATCH
  381. '.', COMPILER_VERSION_PATCH,
  382. # ifdef COMPILER_VERSION_TWEAK
  383. '.', COMPILER_VERSION_TWEAK,
  384. # endif
  385. # endif
  386. # endif
  387. ']','\0'};
  388. #endif
  389. /* Construct a string literal encoding the version number components. */
  390. #ifdef SIMULATE_VERSION_MAJOR
  391. char const info_simulate_version[] = {
  392. 'I', 'N', 'F', 'O', ':',
  393. 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
  394. SIMULATE_VERSION_MAJOR,
  395. # ifdef SIMULATE_VERSION_MINOR
  396. '.', SIMULATE_VERSION_MINOR,
  397. # ifdef SIMULATE_VERSION_PATCH
  398. '.', SIMULATE_VERSION_PATCH,
  399. # ifdef SIMULATE_VERSION_TWEAK
  400. '.', SIMULATE_VERSION_TWEAK,
  401. # endif
  402. # endif
  403. # endif
  404. ']','\0'};
  405. #endif
  406. /* Construct the string literal in pieces to prevent the source from
  407. getting matched. Store it in a pointer rather than an array
  408. because some compilers will just produce instructions to fill the
  409. array rather than assigning a pointer to a static array. */
  410. char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
  411. char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
  412. const char* info_language_dialect_default = "INFO" ":" "dialect_default["
  413. #if __cplusplus >= 201402L
  414. "14"
  415. #elif __cplusplus >= 201103L
  416. "11"
  417. #else
  418. "98"
  419. #endif
  420. "]";
  421. /*--------------------------------------------------------------------------*/
  422. int main(int argc, char* argv[])
  423. {
  424. int require = 0;
  425. require += info_compiler[argc];
  426. require += info_platform[argc];
  427. #ifdef COMPILER_VERSION_MAJOR
  428. require += info_version[argc];
  429. #endif
  430. #ifdef SIMULATE_ID
  431. require += info_simulate[argc];
  432. #endif
  433. #ifdef SIMULATE_VERSION_MAJOR
  434. require += info_simulate_version[argc];
  435. #endif
  436. #if defined(__CRAYXE) || defined(__CRAYXC)
  437. require += info_cray[argc];
  438. #endif
  439. require += info_language_dialect_default[argc];
  440. (void)argv;
  441. return require;
  442. }