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