cray.hpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. // Copyright 2011 John Maddock
  2. // Copyright 2013, 2017-2018 Cray, Inc.
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. // See http://www.boost.org for most recent version.
  7. // Cray C++ compiler setup.
  8. //
  9. // There are a few parameters that affect the macros defined in this file:
  10. //
  11. // - What version of CCE (Cray Compiling Environment) are we running? This
  12. // comes from the '_RELEASE_MAJOR', '_RELEASE_MINOR', and
  13. // '_RELEASE_PATCHLEVEL' macros.
  14. // - What C++ standards conformance level are we using (e.g. '-h
  15. // std=c++14')? This comes from the '__cplusplus' macro.
  16. // - Are we using GCC extensions ('-h gnu' or '-h nognu')? If we have '-h
  17. // gnu' then CCE emulates GCC, and the macros '__GNUC__',
  18. // '__GNUC_MINOR__', and '__GNUC_PATCHLEVEL__' are defined.
  19. //
  20. // This file is organized as follows:
  21. //
  22. // - Verify that the combination of parameters listed above is supported.
  23. // If we have an unsupported combination, we abort with '#error'.
  24. // - Establish baseline values for all Boost macros.
  25. // - Apply changes to the baseline macros based on compiler version. These
  26. // changes are cummulative so each version section only describes the
  27. // changes since the previous version.
  28. // - Within each version section, we may also apply changes based on
  29. // other parameters (i.e. C++ standards conformance level and GCC
  30. // extensions).
  31. //
  32. // To test changes to this file:
  33. //
  34. // ```
  35. // module load cce/8.6.5 # Pick the version you want to test.
  36. // cd boost/libs/config/test/all
  37. // b2 -j 8 toolset=cray cxxstd=03 cxxstd=11 cxxstd=14 cxxstd-dialect=gnu linkflags=-lrt
  38. // ```
  39. // Note: Using 'cxxstd-dialect=iso' is not supported at this time (the
  40. // tests run, but many tests fail).
  41. //
  42. // Note: 'linkflags=-lrt' is needed in Cray Linux Environment. Otherwise
  43. // you get an 'undefined reference to clock_gettime' error.
  44. //
  45. // Note: If a test '*_fail.cpp' file compiles, but fails to run, then it is
  46. // reported as a defect. However, this is not actually a defect. This is an
  47. // area where the test system is somewhat broken. Tests that are failing
  48. // because of this problem are noted in the comments.
  49. //
  50. // Pay attention to the macro definitions for the macros you wish to
  51. // modify. For example, only macros categorized as compiler macros should
  52. // appear in this file; platform macros should not appear in this file.
  53. // Also, some macros have to be defined to specific values; it is not
  54. // always enough to define or undefine a macro.
  55. //
  56. // Macro definitions are available in the source code at:
  57. //
  58. // `boost/libs/config/doc/html/boost_config/boost_macro_reference.html`
  59. //
  60. // Macro definitions are also available online at:
  61. //
  62. // http://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html
  63. //
  64. // Typically, if you enable a feature, and the tests pass, then you have
  65. // nothing to worry about. However, it's sometimes hard to figure out if a
  66. // disabled feature needs to stay disabled. To get a list of disabled
  67. // features, run 'b2' in 'boost/libs/config/checks'. These are the macros
  68. // you should pay attention to (in addition to macros that cause test
  69. // failures).
  70. ////
  71. //// Front matter
  72. ////
  73. // In a developer build of the Cray compiler (i.e. a compiler built by a
  74. // Cray employee), the release patch level is reported as "x". This gives
  75. // versions that look like e.g. "8.6.x".
  76. //
  77. // To accomplish this, the the Cray compiler preprocessor inserts:
  78. //
  79. // #define _RELEASE_PATCHLEVEL x
  80. //
  81. // If we are using a developer build of the compiler, we want to use the
  82. // configuration macros for the most recent patch level of the release. To
  83. // accomplish this, we'll pretend that _RELEASE_PATCHLEVEL is 99.
  84. //
  85. // However, it's difficult to detect if _RELEASE_PATCHLEVEL is x. We must
  86. // consider that the x will be expanded if x is defined as a macro
  87. // elsewhere. For example, imagine if someone put "-D x=3" on the command
  88. // line, and _RELEASE_PATCHLEVEL is x. Then _RELEASE_PATCHLEVEL would
  89. // expand to 3, and we could not distinguish it from an actual
  90. // _RELEASE_PATCHLEVEL of 3. This problem only affects developer builds; in
  91. // production builds, _RELEASE_PATCHLEVEL is always an integer.
  92. //
  93. // IMPORTANT: In developer builds, if x is defined as a macro, you will get
  94. // an incorrect configuration. The behavior in this case is undefined.
  95. //
  96. // Even if x is not defined, we have to use some trickery to detect if
  97. // _RELEASE_PATCHLEVEL is x. First we define BOOST_CRAY_x to some arbitrary
  98. // magic value, 9867657. Then we use BOOST_CRAY_APPEND to append the
  99. // expanded value of _RELEASE_PATCHLEVEL to the string "BOOST_CRAY_".
  100. //
  101. // - If _RELEASE_PATCHLEVEL is undefined, we get "BOOST_CRAY_".
  102. // - If _RELEASE_PATCHLEVEL is 5, we get "BOOST_CRAY_5".
  103. // - If _RELEASE_PATCHLEVEL is x (and x is not defined) we get
  104. // "BOOST_CRAY_x":
  105. //
  106. // Then we check if BOOST_CRAY_x is equal to the output of
  107. // BOOST_CRAY_APPEND. In other words, the output of BOOST_CRAY_APPEND is
  108. // treated as a macro name, and expanded again. If we can safely assume
  109. // that BOOST_CRAY_ is not a macro defined as our magic number, and
  110. // BOOST_CRAY_5 is not a macro defined as our magic number, then the only
  111. // way the equality test can pass is if _RELEASE_PATCHLEVEL expands to x.
  112. //
  113. // So, that is how we detect if we are using a developer build of the Cray
  114. // compiler.
  115. #define BOOST_CRAY_x 9867657 // Arbitrary number
  116. #define BOOST_CRAY_APPEND(MACRO) BOOST_CRAY_APPEND_INTERNAL(MACRO)
  117. #define BOOST_CRAY_APPEND_INTERNAL(MACRO) BOOST_CRAY_##MACRO
  118. #if BOOST_CRAY_x == BOOST_CRAY_APPEND(_RELEASE_PATCHLEVEL)
  119. // This is a developer build.
  120. //
  121. // - _RELEASE_PATCHLEVEL is defined as x, and x is not defined as a macro.
  122. // Pretend _RELEASE_PATCHLEVEL is 99, so we get the configuration for the
  123. // most recent patch level in this release.
  124. #define BOOST_CRAY_VERSION (_RELEASE_MAJOR * 10000 + _RELEASE_MINOR * 100 + 99)
  125. #else
  126. // This is a production build.
  127. //
  128. // _RELEASE_PATCHLEVEL is not defined as x, or x is defined as a macro.
  129. #define BOOST_CRAY_VERSION (_RELEASE_MAJOR * 10000 + _RELEASE_MINOR * 100 + _RELEASE_PATCHLEVEL)
  130. #endif // BOOST_CRAY_x == BOOST_CRAY_APPEND(_RELEASE_PATCHLEVEL)
  131. #undef BOOST_CRAY_APPEND_INTERNAL
  132. #undef BOOST_CRAY_APPEND
  133. #undef BOOST_CRAY_x
  134. #ifdef __GNUC__
  135. # define BOOST_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
  136. #endif
  137. #ifndef BOOST_COMPILER
  138. # define BOOST_COMPILER "Cray C++ version " BOOST_STRINGIZE(_RELEASE_MAJOR) "." BOOST_STRINGIZE(_RELEASE_MINOR) "." BOOST_STRINGIZE(_RELEASE_PATCHLEVEL)
  139. #endif
  140. // Since the Cray compiler defines '__GNUC__', we have to emulate some
  141. // additional GCC macros in order to make everything work.
  142. //
  143. // FIXME: Perhaps Cray should fix the compiler to define these additional
  144. // macros for GCC emulation?
  145. #if __cplusplus >= 201103L && defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__)
  146. # define __GXX_EXPERIMENTAL_CXX0X__ 1
  147. #endif
  148. ////
  149. //// Parameter validation
  150. ////
  151. // FIXME: Do we really need to support compilers before 8.5? Do they pass
  152. // the Boost.Config tests?
  153. #if BOOST_CRAY_VERSION < 80000
  154. # error "Boost is not configured for Cray compilers prior to version 8, please try the configure script."
  155. #endif
  156. // We only support recent EDG based compilers.
  157. #ifndef __EDG__
  158. # error "Unsupported Cray compiler, please try running the configure script."
  159. #endif
  160. ////
  161. //// Baseline values
  162. ////
  163. #include <boost/config/compiler/common_edg.hpp>
  164. #define BOOST_HAS_NRVO
  165. #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
  166. #define BOOST_NO_CXX11_AUTO_DECLARATIONS
  167. #define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
  168. #define BOOST_NO_CXX11_CHAR16_T
  169. #define BOOST_NO_CXX11_CHAR32_T
  170. #define BOOST_NO_CXX11_CONSTEXPR
  171. #define BOOST_NO_CXX11_DECLTYPE
  172. #define BOOST_NO_CXX11_DECLTYPE_N3276
  173. #define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
  174. #define BOOST_NO_CXX11_DELETED_FUNCTIONS
  175. #define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
  176. #define BOOST_NO_CXX11_FINAL
  177. #define BOOST_NO_CXX11_OVERRIDE
  178. #define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  179. #define BOOST_NO_CXX11_LAMBDAS
  180. #define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
  181. #define BOOST_NO_CXX11_NOEXCEPT
  182. #define BOOST_NO_CXX11_NULLPTR
  183. #define BOOST_NO_CXX11_RANGE_BASED_FOR
  184. #define BOOST_NO_CXX11_RAW_LITERALS
  185. #define BOOST_NO_CXX11_REF_QUALIFIERS
  186. #define BOOST_NO_CXX11_RVALUE_REFERENCES
  187. #define BOOST_NO_CXX11_SCOPED_ENUMS
  188. #define BOOST_NO_CXX11_SFINAE_EXPR
  189. #define BOOST_NO_CXX11_STATIC_ASSERT
  190. #define BOOST_NO_CXX11_TEMPLATE_ALIASES
  191. #define BOOST_NO_CXX11_THREAD_LOCAL
  192. #define BOOST_NO_CXX11_UNICODE_LITERALS
  193. #define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  194. #define BOOST_NO_CXX11_USER_DEFINED_LITERALS
  195. #define BOOST_NO_CXX11_VARIADIC_MACROS
  196. #define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  197. #define BOOST_NO_CXX11_UNRESTRICTED_UNION
  198. #define BOOST_NO_SFINAE_EXPR
  199. #define BOOST_NO_TWO_PHASE_NAME_LOOKUP
  200. //#define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
  201. #define BOOST_MATH_DISABLE_STD_FPCLASSIFY
  202. //#define BOOST_HAS_FPCLASSIFY
  203. #define BOOST_SP_USE_PTHREADS
  204. #define BOOST_AC_USE_PTHREADS
  205. //
  206. // Everything that follows is working around what are thought to be
  207. // compiler shortcomings. Revist all of these regularly.
  208. //
  209. //#define BOOST_USE_ENUM_STATIC_ASSERT
  210. //#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS //(this may be implied by the previous #define
  211. // These constants should be provided by the compiler.
  212. #ifndef __ATOMIC_RELAXED
  213. #define __ATOMIC_RELAXED 0
  214. #define __ATOMIC_CONSUME 1
  215. #define __ATOMIC_ACQUIRE 2
  216. #define __ATOMIC_RELEASE 3
  217. #define __ATOMIC_ACQ_REL 4
  218. #define __ATOMIC_SEQ_CST 5
  219. #endif
  220. ////
  221. //// Version changes
  222. ////
  223. //
  224. // 8.5.0
  225. //
  226. #if BOOST_CRAY_VERSION >= 80500
  227. #if __cplusplus >= 201103L
  228. #undef BOOST_HAS_NRVO
  229. #undef BOOST_NO_COMPLETE_VALUE_INITIALIZATION
  230. #undef BOOST_NO_CXX11_AUTO_DECLARATIONS
  231. #undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
  232. #undef BOOST_NO_CXX11_CHAR16_T
  233. #undef BOOST_NO_CXX11_CHAR32_T
  234. #undef BOOST_NO_CXX11_CONSTEXPR
  235. #undef BOOST_NO_CXX11_DECLTYPE
  236. #undef BOOST_NO_CXX11_DECLTYPE_N3276
  237. #undef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
  238. #undef BOOST_NO_CXX11_DELETED_FUNCTIONS
  239. #undef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
  240. #undef BOOST_NO_CXX11_FINAL
  241. #undef BOOST_NO_CXX11_OVERRIDE
  242. #undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  243. #undef BOOST_NO_CXX11_LAMBDAS
  244. #undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
  245. #undef BOOST_NO_CXX11_NOEXCEPT
  246. #undef BOOST_NO_CXX11_NULLPTR
  247. #undef BOOST_NO_CXX11_RANGE_BASED_FOR
  248. #undef BOOST_NO_CXX11_RAW_LITERALS
  249. #undef BOOST_NO_CXX11_REF_QUALIFIERS
  250. #undef BOOST_NO_CXX11_RVALUE_REFERENCES
  251. #undef BOOST_NO_CXX11_SCOPED_ENUMS
  252. #undef BOOST_NO_CXX11_SFINAE_EXPR
  253. #undef BOOST_NO_CXX11_STATIC_ASSERT
  254. #undef BOOST_NO_CXX11_TEMPLATE_ALIASES
  255. #undef BOOST_NO_CXX11_THREAD_LOCAL
  256. #undef BOOST_NO_CXX11_UNICODE_LITERALS
  257. #undef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  258. #undef BOOST_NO_CXX11_USER_DEFINED_LITERALS
  259. #undef BOOST_NO_CXX11_VARIADIC_MACROS
  260. #undef BOOST_NO_CXX11_VARIADIC_TEMPLATES
  261. #undef BOOST_NO_CXX11_UNRESTRICTED_UNION
  262. #undef BOOST_NO_SFINAE_EXPR
  263. #undef BOOST_NO_TWO_PHASE_NAME_LOOKUP
  264. #undef BOOST_MATH_DISABLE_STD_FPCLASSIFY
  265. #undef BOOST_SP_USE_PTHREADS
  266. #undef BOOST_AC_USE_PTHREADS
  267. #define BOOST_HAS_VARIADIC_TMPL
  268. #define BOOST_HAS_UNISTD_H
  269. #define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
  270. #define BOOST_HAS_TR1_COMPLEX_OVERLOADS
  271. #define BOOST_HAS_STDINT_H
  272. #define BOOST_HAS_STATIC_ASSERT
  273. #define BOOST_HAS_SIGACTION
  274. #define BOOST_HAS_SCHED_YIELD
  275. #define BOOST_HAS_RVALUE_REFS
  276. #define BOOST_HAS_PTHREADS
  277. #define BOOST_HAS_PTHREAD_YIELD
  278. #define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
  279. #define BOOST_HAS_PARTIAL_STD_ALLOCATOR
  280. #define BOOST_HAS_NRVO
  281. #define BOOST_HAS_NL_TYPES_H
  282. #define BOOST_HAS_NANOSLEEP
  283. #define BOOST_NO_CXX11_SMART_PTR
  284. #define BOOST_NO_CXX11_HDR_FUNCTIONAL
  285. #define BOOST_NO_CXX14_CONSTEXPR
  286. #define BOOST_HAS_LONG_LONG
  287. #define BOOST_HAS_FLOAT128
  288. #if __cplusplus < 201402L
  289. #define BOOST_NO_CXX11_DECLTYPE_N3276
  290. #endif // __cplusplus < 201402L
  291. #endif // __cplusplus >= 201103L
  292. #endif // BOOST_CRAY_VERSION >= 80500
  293. //
  294. // 8.6.4
  295. // (versions prior to 8.6.5 do not define _RELEASE_PATCHLEVEL)
  296. //
  297. #if BOOST_CRAY_VERSION >= 80600
  298. #if __cplusplus >= 199711L
  299. #define BOOST_HAS_FLOAT128
  300. #define BOOST_HAS_PTHREAD_YIELD // This is a platform macro, but it improves test results.
  301. #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION // This is correct. Test compiles, but fails to run.
  302. #undef BOOST_NO_CXX11_CHAR16_T
  303. #undef BOOST_NO_CXX11_CHAR32_T
  304. #undef BOOST_NO_CXX11_INLINE_NAMESPACES
  305. #undef BOOST_NO_CXX11_FINAL
  306. #undef BOOST_NO_CXX11_OVERRIDE
  307. #undef BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
  308. #undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  309. #define BOOST_NO_CXX11_SFINAE_EXPR // This is correct, even though '*_fail.cpp' test fails.
  310. #undef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  311. #undef BOOST_NO_CXX11_VARIADIC_MACROS
  312. #undef BOOST_NO_CXX11_VARIADIC_TEMPLATES
  313. // 'BOOST_NO_DEDUCED_TYPENAME' test is broken. The test files are enabled /
  314. // disabled with an '#ifdef BOOST_DEDUCED_TYPENAME'. However,
  315. // 'boost/libs/config/include/boost/config/detail/suffix.hpp' ensures that
  316. // 'BOOST_DEDUCED_TYPENAME' is always defined (the value it is defined as
  317. // depends on 'BOOST_NO_DEDUCED_TYPENAME'). So, modifying
  318. // 'BOOST_NO_DEDUCED_TYPENAME' has no effect on which tests are run.
  319. //
  320. // The 'no_ded_typename_pass.cpp' test should always compile and run
  321. // successfully, because 'BOOST_DEDUCED_TYPENAME' must always have an
  322. // appropriate value (it's not just something that you turn on or off).
  323. // Therefore, if you wish to test changes to 'BOOST_NO_DEDUCED_TYPENAME',
  324. // you have to modify 'no_ded_typename_pass.cpp' to unconditionally include
  325. // 'boost_no_ded_typename.ipp'.
  326. #undef BOOST_NO_DEDUCED_TYPENAME // This is correct. Test is broken.
  327. #undef BOOST_NO_SFINAE_EXPR
  328. #undef BOOST_NO_TWO_PHASE_NAME_LOOKUP
  329. #endif // __cplusplus >= 199711L
  330. #if __cplusplus >= 201103L
  331. #undef BOOST_NO_CXX11_ALIGNAS
  332. #undef BOOST_NO_CXX11_DECLTYPE_N3276
  333. #define BOOST_NO_CXX11_HDR_ATOMIC
  334. #undef BOOST_NO_CXX11_HDR_FUNCTIONAL
  335. #define BOOST_NO_CXX11_HDR_REGEX // This is correct. Test compiles, but fails to run.
  336. #undef BOOST_NO_CXX11_SFINAE_EXPR
  337. #undef BOOST_NO_CXX11_SMART_PTR
  338. #undef BOOST_NO_CXX11_TRAILING_RESULT_TYPES
  339. #endif // __cplusplus >= 201103L
  340. #if __cplusplus >= 201402L
  341. #undef BOOST_NO_CXX14_CONSTEXPR
  342. #define BOOST_NO_CXX14_DIGIT_SEPARATORS
  343. #endif // __cplusplus == 201402L
  344. #endif // BOOST_CRAY_VERSION >= 80600
  345. //
  346. // 8.6.5
  347. // (no change from 8.6.4)
  348. //
  349. //
  350. // 8.7.0
  351. //
  352. #if BOOST_CRAY_VERSION >= 80700
  353. #if __cplusplus >= 199711L
  354. #endif // __cplusplus >= 199711L
  355. #if __cplusplus >= 201103L
  356. #undef BOOST_NO_CXX11_HDR_ATOMIC
  357. #undef BOOST_NO_CXX11_HDR_REGEX
  358. #endif // __cplusplus >= 201103L
  359. #if __cplusplus >= 201402L
  360. #endif // __cplusplus == 201402L
  361. #endif // BOOST_CRAY_VERSION >= 80700
  362. //
  363. // Next release
  364. //
  365. #if BOOST_CRAY_VERSION > 80799
  366. #if __cplusplus >= 199711L
  367. #endif // __cplusplus >= 199711L
  368. #if __cplusplus >= 201103L
  369. #endif // __cplusplus >= 201103L
  370. #if __cplusplus >= 201402L
  371. #endif // __cplusplus == 201402L
  372. #endif // BOOST_CRAY_VERSION > 80799
  373. ////
  374. //// Remove temporary macros
  375. ////
  376. // I've commented out some '#undef' statements to signify that we purposely
  377. // want to keep certain macros.
  378. //#undef __GXX_EXPERIMENTAL_CXX0X__
  379. //#undef BOOST_COMPILER
  380. #undef BOOST_GCC_VERSION
  381. #undef BOOST_CRAY_VERSION