feature_tests.cxx 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. const char features[] = {"\n"
  2. "CXX_FEATURE:"
  3. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_aggregate_nsdmi)
  4. "1"
  5. #else
  6. "0"
  7. #endif
  8. "cxx_aggregate_default_initializers\n"
  9. "CXX_FEATURE:"
  10. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_alias_templates)
  11. "1"
  12. #else
  13. "0"
  14. #endif
  15. "cxx_alias_templates\n"
  16. "CXX_FEATURE:"
  17. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_alignas)
  18. "1"
  19. #else
  20. "0"
  21. #endif
  22. "cxx_alignas\n"
  23. "CXX_FEATURE:"
  24. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_alignas)
  25. "1"
  26. #else
  27. "0"
  28. #endif
  29. "cxx_alignof\n"
  30. "CXX_FEATURE:"
  31. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_attributes)
  32. "1"
  33. #else
  34. "0"
  35. #endif
  36. "cxx_attributes\n"
  37. "CXX_FEATURE:"
  38. #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L
  39. "1"
  40. #else
  41. "0"
  42. #endif
  43. "cxx_attribute_deprecated\n"
  44. "CXX_FEATURE:"
  45. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_auto_type)
  46. "1"
  47. #else
  48. "0"
  49. #endif
  50. "cxx_auto_type\n"
  51. "CXX_FEATURE:"
  52. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_binary_literals)
  53. "1"
  54. #else
  55. "0"
  56. #endif
  57. "cxx_binary_literals\n"
  58. "CXX_FEATURE:"
  59. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_constexpr)
  60. "1"
  61. #else
  62. "0"
  63. #endif
  64. "cxx_constexpr\n"
  65. "CXX_FEATURE:"
  66. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_contextual_conversions)
  67. "1"
  68. #else
  69. "0"
  70. #endif
  71. "cxx_contextual_conversions\n"
  72. "CXX_FEATURE:"
  73. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_decltype)
  74. "1"
  75. #else
  76. "0"
  77. #endif
  78. "cxx_decltype\n"
  79. "CXX_FEATURE:"
  80. #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L
  81. "1"
  82. #else
  83. "0"
  84. #endif
  85. "cxx_decltype_auto\n"
  86. "CXX_FEATURE:"
  87. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_decltype_incomplete_return_types)
  88. "1"
  89. #else
  90. "0"
  91. #endif
  92. "cxx_decltype_incomplete_return_types\n"
  93. "CXX_FEATURE:"
  94. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_default_function_template_args)
  95. "1"
  96. #else
  97. "0"
  98. #endif
  99. "cxx_default_function_template_args\n"
  100. "CXX_FEATURE:"
  101. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_defaulted_functions)
  102. "1"
  103. #else
  104. "0"
  105. #endif
  106. "cxx_defaulted_functions\n"
  107. "CXX_FEATURE:"
  108. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_defaulted_functions)
  109. "1"
  110. #else
  111. "0"
  112. #endif
  113. "cxx_defaulted_move_initializers\n"
  114. "CXX_FEATURE:"
  115. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_delegating_constructors)
  116. "1"
  117. #else
  118. "0"
  119. #endif
  120. "cxx_delegating_constructors\n"
  121. "CXX_FEATURE:"
  122. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_deleted_functions)
  123. "1"
  124. #else
  125. "0"
  126. #endif
  127. "cxx_deleted_functions\n"
  128. "CXX_FEATURE:"
  129. #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L
  130. "1"
  131. #else
  132. "0"
  133. #endif
  134. "cxx_digit_separators\n"
  135. "CXX_FEATURE:"
  136. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 201103L
  137. "1"
  138. #else
  139. "0"
  140. #endif
  141. "cxx_enum_forward_declarations\n"
  142. "CXX_FEATURE:"
  143. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_explicit_conversions)
  144. "1"
  145. #else
  146. "0"
  147. #endif
  148. "cxx_explicit_conversions\n"
  149. "CXX_FEATURE:"
  150. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 201103L
  151. "1"
  152. #else
  153. "0"
  154. #endif
  155. "cxx_extended_friend_declarations\n"
  156. "CXX_FEATURE:"
  157. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 201103L
  158. "1"
  159. #else
  160. "0"
  161. #endif
  162. "cxx_extern_templates\n"
  163. "CXX_FEATURE:"
  164. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_override_control)
  165. "1"
  166. #else
  167. "0"
  168. #endif
  169. "cxx_final\n"
  170. "CXX_FEATURE:"
  171. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 201103L
  172. "1"
  173. #else
  174. "0"
  175. #endif
  176. "cxx_func_identifier\n"
  177. "CXX_FEATURE:"
  178. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_generalized_initializers)
  179. "1"
  180. #else
  181. "0"
  182. #endif
  183. "cxx_generalized_initializers\n"
  184. "CXX_FEATURE:"
  185. #if ((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L
  186. "1"
  187. #else
  188. "0"
  189. #endif
  190. "cxx_generic_lambdas\n"
  191. "CXX_FEATURE:"
  192. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_inheriting_constructors)
  193. "1"
  194. #else
  195. "0"
  196. #endif
  197. "cxx_inheriting_constructors\n"
  198. "CXX_FEATURE:"
  199. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 201103L
  200. "1"
  201. #else
  202. "0"
  203. #endif
  204. "cxx_inline_namespaces\n"
  205. "CXX_FEATURE:"
  206. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_lambdas)
  207. "1"
  208. #else
  209. "0"
  210. #endif
  211. "cxx_lambdas\n"
  212. "CXX_FEATURE:"
  213. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_init_captures)
  214. "1"
  215. #else
  216. "0"
  217. #endif
  218. "cxx_lambda_init_captures\n"
  219. "CXX_FEATURE:"
  220. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_local_type_template_args)
  221. "1"
  222. #else
  223. "0"
  224. #endif
  225. "cxx_local_type_template_args\n"
  226. "CXX_FEATURE:"
  227. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 201103L
  228. "1"
  229. #else
  230. "0"
  231. #endif
  232. "cxx_long_long_type\n"
  233. "CXX_FEATURE:"
  234. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_noexcept)
  235. "1"
  236. #else
  237. "0"
  238. #endif
  239. "cxx_noexcept\n"
  240. "CXX_FEATURE:"
  241. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_nonstatic_member_init)
  242. "1"
  243. #else
  244. "0"
  245. #endif
  246. "cxx_nonstatic_member_init\n"
  247. "CXX_FEATURE:"
  248. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_nullptr)
  249. "1"
  250. #else
  251. "0"
  252. #endif
  253. "cxx_nullptr\n"
  254. "CXX_FEATURE:"
  255. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_override_control)
  256. "1"
  257. #else
  258. "0"
  259. #endif
  260. "cxx_override\n"
  261. "CXX_FEATURE:"
  262. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_range_for)
  263. "1"
  264. #else
  265. "0"
  266. #endif
  267. "cxx_range_for\n"
  268. "CXX_FEATURE:"
  269. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_raw_string_literals)
  270. "1"
  271. #else
  272. "0"
  273. #endif
  274. "cxx_raw_string_literals\n"
  275. "CXX_FEATURE:"
  276. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_reference_qualified_functions)
  277. "1"
  278. #else
  279. "0"
  280. #endif
  281. "cxx_reference_qualified_functions\n"
  282. "CXX_FEATURE:"
  283. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_relaxed_constexpr)
  284. "1"
  285. #else
  286. "0"
  287. #endif
  288. "cxx_relaxed_constexpr\n"
  289. "CXX_FEATURE:"
  290. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_return_type_deduction)
  291. "1"
  292. #else
  293. "0"
  294. #endif
  295. "cxx_return_type_deduction\n"
  296. "CXX_FEATURE:"
  297. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 201103L
  298. "1"
  299. #else
  300. "0"
  301. #endif
  302. "cxx_right_angle_brackets\n"
  303. "CXX_FEATURE:"
  304. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_rvalue_references)
  305. "1"
  306. #else
  307. "0"
  308. #endif
  309. "cxx_rvalue_references\n"
  310. "CXX_FEATURE:"
  311. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 201103L
  312. "1"
  313. #else
  314. "0"
  315. #endif
  316. "cxx_sizeof_member\n"
  317. "CXX_FEATURE:"
  318. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_static_assert)
  319. "1"
  320. #else
  321. "0"
  322. #endif
  323. "cxx_static_assert\n"
  324. "CXX_FEATURE:"
  325. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_strong_enums)
  326. "1"
  327. #else
  328. "0"
  329. #endif
  330. "cxx_strong_enums\n"
  331. "CXX_FEATURE:"
  332. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 199711L
  333. "1"
  334. #else
  335. "0"
  336. #endif
  337. "cxx_template_template_parameters\n"
  338. "CXX_FEATURE:"
  339. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_thread_local)
  340. "1"
  341. #else
  342. "0"
  343. #endif
  344. "cxx_thread_local\n"
  345. "CXX_FEATURE:"
  346. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_trailing_return)
  347. "1"
  348. #else
  349. "0"
  350. #endif
  351. "cxx_trailing_return_types\n"
  352. "CXX_FEATURE:"
  353. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_unicode_literals)
  354. "1"
  355. #else
  356. "0"
  357. #endif
  358. "cxx_unicode_literals\n"
  359. "CXX_FEATURE:"
  360. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_generalized_initializers)
  361. "1"
  362. #else
  363. "0"
  364. #endif
  365. "cxx_uniform_initialization\n"
  366. "CXX_FEATURE:"
  367. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_unrestricted_unions)
  368. "1"
  369. #else
  370. "0"
  371. #endif
  372. "cxx_unrestricted_unions\n"
  373. "CXX_FEATURE:"
  374. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_user_literals)
  375. "1"
  376. #else
  377. "0"
  378. #endif
  379. "cxx_user_literals\n"
  380. "CXX_FEATURE:"
  381. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_variable_templates)
  382. "1"
  383. #else
  384. "0"
  385. #endif
  386. "cxx_variable_templates\n"
  387. "CXX_FEATURE:"
  388. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __cplusplus >= 201103L
  389. "1"
  390. #else
  391. "0"
  392. #endif
  393. "cxx_variadic_macros\n"
  394. "CXX_FEATURE:"
  395. #if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_variadic_templates)
  396. "1"
  397. #else
  398. "0"
  399. #endif
  400. "cxx_variadic_templates\n"
  401. };
  402. int main(int argc, char** argv) { (void)argv; return features[argc]; }