cray.hpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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_FUNCTION_TEMPLATE_DEFAULT_ARGS
  178. #define BOOST_NO_CXX11_LAMBDAS
  179. #define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
  180. #define BOOST_NO_CXX11_NOEXCEPT
  181. #define BOOST_NO_CXX11_NULLPTR
  182. #define BOOST_NO_CXX11_RANGE_BASED_FOR
  183. #define BOOST_NO_CXX11_RAW_LITERALS
  184. #define BOOST_NO_CXX11_REF_QUALIFIERS
  185. #define BOOST_NO_CXX11_RVALUE_REFERENCES
  186. #define BOOST_NO_CXX11_SCOPED_ENUMS
  187. #define BOOST_NO_CXX11_SFINAE_EXPR
  188. #define BOOST_NO_CXX11_STATIC_ASSERT
  189. #define BOOST_NO_CXX11_TEMPLATE_ALIASES
  190. #define BOOST_NO_CXX11_THREAD_LOCAL
  191. #define BOOST_NO_CXX11_UNICODE_LITERALS
  192. #define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  193. #define BOOST_NO_CXX11_USER_DEFINED_LITERALS
  194. #define BOOST_NO_CXX11_VARIADIC_MACROS
  195. #define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  196. #define BOOST_NO_SFINAE_EXPR
  197. #define BOOST_NO_TWO_PHASE_NAME_LOOKUP
  198. //#define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
  199. #define BOOST_MATH_DISABLE_STD_FPCLASSIFY
  200. //#define BOOST_HAS_FPCLASSIFY
  201. #define BOOST_SP_USE_PTHREADS
  202. #define BOOST_AC_USE_PTHREADS
  203. //
  204. // Everything that follows is working around what are thought to be
  205. // compiler shortcomings. Revist all of these regularly.
  206. //
  207. //#define BOOST_USE_ENUM_STATIC_ASSERT
  208. //#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS //(this may be implied by the previous #define
  209. // These constants should be provided by the compiler.
  210. #ifndef __ATOMIC_RELAXED
  211. #define __ATOMIC_RELAXED 0
  212. #define __ATOMIC_CONSUME 1
  213. #define __ATOMIC_ACQUIRE 2
  214. #define __ATOMIC_RELEASE 3
  215. #define __ATOMIC_ACQ_REL 4
  216. #define __ATOMIC_SEQ_CST 5
  217. #endif
  218. ////
  219. //// Version changes
  220. ////
  221. //
  222. // 8.5.0
  223. //
  224. #if BOOST_CRAY_VERSION >= 80500
  225. #if __cplusplus >= 201103L
  226. #undef BOOST_HAS_NRVO
  227. #undef BOOST_NO_COMPLETE_VALUE_INITIALIZATION
  228. #undef BOOST_NO_CXX11_AUTO_DECLARATIONS
  229. #undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
  230. #undef BOOST_NO_CXX11_CHAR16_T
  231. #undef BOOST_NO_CXX11_CHAR32_T
  232. #undef BOOST_NO_CXX11_CONSTEXPR
  233. #undef BOOST_NO_CXX11_DECLTYPE
  234. #undef BOOST_NO_CXX11_DECLTYPE_N3276
  235. #undef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
  236. #undef BOOST_NO_CXX11_DELETED_FUNCTIONS
  237. #undef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
  238. #undef BOOST_NO_CXX11_FINAL
  239. #undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  240. #undef BOOST_NO_CXX11_LAMBDAS
  241. #undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
  242. #undef BOOST_NO_CXX11_NOEXCEPT
  243. #undef BOOST_NO_CXX11_NULLPTR
  244. #undef BOOST_NO_CXX11_RANGE_BASED_FOR
  245. #undef BOOST_NO_CXX11_RAW_LITERALS
  246. #undef BOOST_NO_CXX11_REF_QUALIFIERS
  247. #undef BOOST_NO_CXX11_RVALUE_REFERENCES
  248. #undef BOOST_NO_CXX11_SCOPED_ENUMS
  249. #undef BOOST_NO_CXX11_SFINAE_EXPR
  250. #undef BOOST_NO_CXX11_STATIC_ASSERT
  251. #undef BOOST_NO_CXX11_TEMPLATE_ALIASES
  252. #undef BOOST_NO_CXX11_THREAD_LOCAL
  253. #undef BOOST_NO_CXX11_UNICODE_LITERALS
  254. #undef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  255. #undef BOOST_NO_CXX11_USER_DEFINED_LITERALS
  256. #undef BOOST_NO_CXX11_VARIADIC_MACROS
  257. #undef BOOST_NO_CXX11_VARIADIC_TEMPLATES
  258. #undef BOOST_NO_SFINAE_EXPR
  259. #undef BOOST_NO_TWO_PHASE_NAME_LOOKUP
  260. #undef BOOST_MATH_DISABLE_STD_FPCLASSIFY
  261. #undef BOOST_SP_USE_PTHREADS
  262. #undef BOOST_AC_USE_PTHREADS
  263. #define BOOST_HAS_VARIADIC_TMPL
  264. #define BOOST_HAS_UNISTD_H
  265. #define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
  266. #define BOOST_HAS_TR1_COMPLEX_OVERLOADS
  267. #define BOOST_HAS_STDINT_H
  268. #define BOOST_HAS_STATIC_ASSERT
  269. #define BOOST_HAS_SIGACTION
  270. #define BOOST_HAS_SCHED_YIELD
  271. #define BOOST_HAS_RVALUE_REFS
  272. #define BOOST_HAS_PTHREADS
  273. #define BOOST_HAS_PTHREAD_YIELD
  274. #define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
  275. #define BOOST_HAS_PARTIAL_STD_ALLOCATOR
  276. #define BOOST_HAS_NRVO
  277. #define BOOST_HAS_NL_TYPES_H
  278. #define BOOST_HAS_NANOSLEEP
  279. #define BOOST_NO_CXX11_SMART_PTR
  280. #define BOOST_NO_CXX11_HDR_FUNCTIONAL
  281. #define BOOST_NO_CXX14_CONSTEXPR
  282. #define BOOST_HAS_LONG_LONG
  283. #define BOOST_HAS_FLOAT128
  284. #if __cplusplus < 201402L
  285. #define BOOST_NO_CXX11_DECLTYPE_N3276
  286. #endif // __cplusplus < 201402L
  287. #endif // __cplusplus >= 201103L
  288. #endif // BOOST_CRAY_VERSION >= 80500
  289. //
  290. // 8.6.4
  291. // (versions prior to 8.6.5 do not define _RELEASE_PATCHLEVEL)
  292. //
  293. #if BOOST_CRAY_VERSION >= 80600
  294. #if __cplusplus >= 199711L
  295. #define BOOST_HAS_FLOAT128
  296. #define BOOST_HAS_PTHREAD_YIELD // This is a platform macro, but it improves test results.
  297. #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION // This is correct. Test compiles, but fails to run.
  298. #undef BOOST_NO_CXX11_CHAR16_T
  299. #undef BOOST_NO_CXX11_CHAR32_T
  300. #undef BOOST_NO_CXX11_INLINE_NAMESPACES
  301. #undef BOOST_NO_CXX11_FINAL
  302. #undef BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
  303. #undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  304. #define BOOST_NO_CXX11_SFINAE_EXPR // This is correct, even though '*_fail.cpp' test fails.
  305. #undef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  306. #undef BOOST_NO_CXX11_VARIADIC_MACROS
  307. #undef BOOST_NO_CXX11_VARIADIC_TEMPLATES
  308. // 'BOOST_NO_DEDUCED_TYPENAME' test is broken. The test files are enabled /
  309. // disabled with an '#ifdef BOOST_DEDUCED_TYPENAME'. However,
  310. // 'boost/libs/config/include/boost/config/detail/suffix.hpp' ensures that
  311. // 'BOOST_DEDUCED_TYPENAME' is always defined (the value it is defined as
  312. // depends on 'BOOST_NO_DEDUCED_TYPENAME'). So, modifying
  313. // 'BOOST_NO_DEDUCED_TYPENAME' has no effect on which tests are run.
  314. //
  315. // The 'no_ded_typename_pass.cpp' test should always compile and run
  316. // successfully, because 'BOOST_DEDUCED_TYPENAME' must always have an
  317. // appropriate value (it's not just something that you turn on or off).
  318. // Therefore, if you wish to test changes to 'BOOST_NO_DEDUCED_TYPENAME',
  319. // you have to modify 'no_ded_typename_pass.cpp' to unconditionally include
  320. // 'boost_no_ded_typename.ipp'.
  321. #undef BOOST_NO_DEDUCED_TYPENAME // This is correct. Test is broken.
  322. #undef BOOST_NO_SFINAE_EXPR
  323. #undef BOOST_NO_TWO_PHASE_NAME_LOOKUP
  324. #endif // __cplusplus >= 199711L
  325. #if __cplusplus >= 201103L
  326. #undef BOOST_NO_CXX11_ALIGNAS
  327. #undef BOOST_NO_CXX11_DECLTYPE_N3276
  328. #define BOOST_NO_CXX11_HDR_ATOMIC
  329. #undef BOOST_NO_CXX11_HDR_FUNCTIONAL
  330. #define BOOST_NO_CXX11_HDR_REGEX // This is correct. Test compiles, but fails to run.
  331. #undef BOOST_NO_CXX11_SFINAE_EXPR
  332. #undef BOOST_NO_CXX11_SMART_PTR
  333. #undef BOOST_NO_CXX11_TRAILING_RESULT_TYPES
  334. #endif // __cplusplus >= 201103L
  335. #if __cplusplus >= 201402L
  336. #undef BOOST_NO_CXX14_CONSTEXPR
  337. #define BOOST_NO_CXX14_DIGIT_SEPARATORS
  338. #endif // __cplusplus == 201402L
  339. #endif // BOOST_CRAY_VERSION >= 80600
  340. //
  341. // 8.6.5
  342. // (no change from 8.6.4)
  343. //
  344. //
  345. // 8.7.0
  346. //
  347. #if BOOST_CRAY_VERSION >= 80700
  348. #if __cplusplus >= 199711L
  349. #endif // __cplusplus >= 199711L
  350. #if __cplusplus >= 201103L
  351. #undef BOOST_NO_CXX11_HDR_ATOMIC
  352. #undef BOOST_NO_CXX11_HDR_REGEX
  353. #endif // __cplusplus >= 201103L
  354. #if __cplusplus >= 201402L
  355. #endif // __cplusplus == 201402L
  356. #endif // BOOST_CRAY_VERSION >= 80700
  357. //
  358. // Next release
  359. //
  360. #if BOOST_CRAY_VERSION > 80799
  361. #if __cplusplus >= 199711L
  362. #endif // __cplusplus >= 199711L
  363. #if __cplusplus >= 201103L
  364. #endif // __cplusplus >= 201103L
  365. #if __cplusplus >= 201402L
  366. #endif // __cplusplus == 201402L
  367. #endif // BOOST_CRAY_VERSION > 80799
  368. ////
  369. //// Remove temporary macros
  370. ////
  371. // I've commented out some '#undef' statements to signify that we purposely
  372. // want to keep certain macros.
  373. //#undef __GXX_EXPERIMENTAL_CXX0X__
  374. //#undef BOOST_COMPILER
  375. #undef BOOST_GCC_VERSION
  376. #undef BOOST_CRAY_VERSION