Brian Silverman | 9d8fa39 | 2018-08-04 17:09:24 -0700 | [diff] [blame^] | 1 | // (C) Copyright John Maddock 2001 - 2003. |
| 2 | // (C) Copyright Darin Adler 2001 - 2002. |
| 3 | // (C) Copyright Jens Maurer 2001 - 2002. |
| 4 | // (C) Copyright Beman Dawes 2001 - 2003. |
| 5 | // (C) Copyright Douglas Gregor 2002. |
| 6 | // (C) Copyright David Abrahams 2002 - 2003. |
| 7 | // (C) Copyright Synge Todo 2003. |
| 8 | // Use, modification and distribution are subject to the |
| 9 | // Boost Software License, Version 1.0. (See accompanying file |
| 10 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 11 | |
| 12 | // See http://www.boost.org for most recent version. |
| 13 | |
| 14 | // GNU C++ compiler setup. |
| 15 | |
| 16 | // |
| 17 | // Define BOOST_GCC so we know this is "real" GCC and not some pretender: |
| 18 | // |
| 19 | #define BOOST_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) |
| 20 | #if !defined(__CUDACC__) |
| 21 | #define BOOST_GCC BOOST_GCC_VERSION |
| 22 | #endif |
| 23 | |
| 24 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) |
| 25 | # define BOOST_GCC_CXX11 |
| 26 | #endif |
| 27 | |
| 28 | #if __GNUC__ == 3 |
| 29 | # if defined (__PATHSCALE__) |
| 30 | # define BOOST_NO_TWO_PHASE_NAME_LOOKUP |
| 31 | # define BOOST_NO_IS_ABSTRACT |
| 32 | # endif |
| 33 | |
| 34 | # if __GNUC_MINOR__ < 4 |
| 35 | # define BOOST_NO_IS_ABSTRACT |
| 36 | # endif |
| 37 | # define BOOST_NO_CXX11_EXTERN_TEMPLATE |
| 38 | #endif |
| 39 | #if __GNUC__ < 4 |
| 40 | // |
| 41 | // All problems to gcc-3.x and earlier here: |
| 42 | // |
| 43 | #define BOOST_NO_TWO_PHASE_NAME_LOOKUP |
| 44 | # ifdef __OPEN64__ |
| 45 | # define BOOST_NO_IS_ABSTRACT |
| 46 | # endif |
| 47 | #endif |
| 48 | |
| 49 | // GCC prior to 3.4 had #pragma once too but it didn't work well with filesystem links |
| 50 | #if BOOST_GCC_VERSION >= 30400 |
| 51 | #define BOOST_HAS_PRAGMA_ONCE |
| 52 | #endif |
| 53 | |
| 54 | #if BOOST_GCC_VERSION < 40400 |
| 55 | // Previous versions of GCC did not completely implement value-initialization: |
| 56 | // GCC Bug 30111, "Value-initialization of POD base class doesn't initialize |
| 57 | // members", reported by Jonathan Wakely in 2006, |
| 58 | // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 (fixed for GCC 4.4) |
| 59 | // GCC Bug 33916, "Default constructor fails to initialize array members", |
| 60 | // reported by Michael Elizabeth Chastain in 2007, |
| 61 | // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 (fixed for GCC 4.2.4) |
| 62 | // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues |
| 63 | #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION |
| 64 | #endif |
| 65 | |
| 66 | #if !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS) |
| 67 | # define BOOST_NO_EXCEPTIONS |
| 68 | #endif |
| 69 | |
| 70 | |
| 71 | // |
| 72 | // Threading support: Turn this on unconditionally here (except for |
| 73 | // those platforms where we can know for sure). It will get turned off again |
| 74 | // later if no threading API is detected. |
| 75 | // |
| 76 | #if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__) |
| 77 | # define BOOST_HAS_THREADS |
| 78 | #endif |
| 79 | |
| 80 | // |
| 81 | // gcc has "long long" |
| 82 | // Except on Darwin with standard compliance enabled (-pedantic) |
| 83 | // Apple gcc helpfully defines this macro we can query |
| 84 | // |
| 85 | #if !defined(__DARWIN_NO_LONG_LONG) |
| 86 | # define BOOST_HAS_LONG_LONG |
| 87 | #endif |
| 88 | |
| 89 | // |
| 90 | // gcc implements the named return value optimization since version 3.1 |
| 91 | // |
| 92 | #define BOOST_HAS_NRVO |
| 93 | |
| 94 | // Branch prediction hints |
| 95 | #define BOOST_LIKELY(x) __builtin_expect(x, 1) |
| 96 | #define BOOST_UNLIKELY(x) __builtin_expect(x, 0) |
| 97 | |
| 98 | // |
| 99 | // Dynamic shared object (DSO) and dynamic-link library (DLL) support |
| 100 | // |
| 101 | #if __GNUC__ >= 4 |
| 102 | # if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) |
| 103 | // All Win32 development environments, including 64-bit Windows and MinGW, define |
| 104 | // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment, |
| 105 | // so does not define _WIN32 or its variants, but still supports dllexport/dllimport. |
| 106 | # define BOOST_HAS_DECLSPEC |
| 107 | # define BOOST_SYMBOL_EXPORT __attribute__((__dllexport__)) |
| 108 | # define BOOST_SYMBOL_IMPORT __attribute__((__dllimport__)) |
| 109 | # else |
| 110 | # define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default"))) |
| 111 | # define BOOST_SYMBOL_IMPORT |
| 112 | # endif |
| 113 | # define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default"))) |
| 114 | #else |
| 115 | // config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined |
| 116 | # define BOOST_SYMBOL_EXPORT |
| 117 | #endif |
| 118 | |
| 119 | // |
| 120 | // RTTI and typeinfo detection is possible post gcc-4.3: |
| 121 | // |
| 122 | #if BOOST_GCC_VERSION > 40300 |
| 123 | # ifndef __GXX_RTTI |
| 124 | # ifndef BOOST_NO_TYPEID |
| 125 | # define BOOST_NO_TYPEID |
| 126 | # endif |
| 127 | # ifndef BOOST_NO_RTTI |
| 128 | # define BOOST_NO_RTTI |
| 129 | # endif |
| 130 | # endif |
| 131 | #endif |
| 132 | |
| 133 | // |
| 134 | // Recent GCC versions have __int128 when in 64-bit mode. |
| 135 | // |
| 136 | // We disable this if the compiler is really nvcc with C++03 as it |
| 137 | // doesn't actually support __int128 as of CUDA_VERSION=7500 |
| 138 | // even though it defines __SIZEOF_INT128__. |
| 139 | // See https://svn.boost.org/trac/boost/ticket/8048 |
| 140 | // https://svn.boost.org/trac/boost/ticket/11852 |
| 141 | // Only re-enable this for nvcc if you're absolutely sure |
| 142 | // of the circumstances under which it's supported: |
| 143 | // |
| 144 | #if defined(__CUDACC__) |
| 145 | # if defined(BOOST_GCC_CXX11) |
| 146 | # define BOOST_NVCC_CXX11 |
| 147 | # else |
| 148 | # define BOOST_NVCC_CXX03 |
| 149 | # endif |
| 150 | #endif |
| 151 | |
| 152 | #if defined(__SIZEOF_INT128__) && !defined(BOOST_NVCC_CXX03) |
| 153 | # define BOOST_HAS_INT128 |
| 154 | #endif |
| 155 | // |
| 156 | // Recent GCC versions have a __float128 native type, we need to |
| 157 | // include a std lib header to detect this - not ideal, but we'll |
| 158 | // be including <cstddef> later anyway when we select the std lib. |
| 159 | // |
| 160 | // Nevertheless, as of CUDA 7.5, using __float128 with the host |
| 161 | // compiler in pre-C++11 mode is still not supported. |
| 162 | // See https://svn.boost.org/trac/boost/ticket/11852 |
| 163 | // |
| 164 | #ifdef __cplusplus |
| 165 | #include <cstddef> |
| 166 | #else |
| 167 | #include <stddef.h> |
| 168 | #endif |
| 169 | #if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(BOOST_NVCC_CXX03) |
| 170 | # define BOOST_HAS_FLOAT128 |
| 171 | #endif |
| 172 | |
| 173 | // C++0x features in 4.3.n and later |
| 174 | // |
| 175 | #if (BOOST_GCC_VERSION >= 40300) && defined(BOOST_GCC_CXX11) |
| 176 | // C++0x features are only enabled when -std=c++0x or -std=gnu++0x are |
| 177 | // passed on the command line, which in turn defines |
| 178 | // __GXX_EXPERIMENTAL_CXX0X__. |
| 179 | # define BOOST_HAS_DECLTYPE |
| 180 | # define BOOST_HAS_RVALUE_REFS |
| 181 | # define BOOST_HAS_STATIC_ASSERT |
| 182 | # define BOOST_HAS_VARIADIC_TMPL |
| 183 | #else |
| 184 | # define BOOST_NO_CXX11_DECLTYPE |
| 185 | # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS |
| 186 | # define BOOST_NO_CXX11_RVALUE_REFERENCES |
| 187 | # define BOOST_NO_CXX11_STATIC_ASSERT |
| 188 | #endif |
| 189 | |
| 190 | // C++0x features in 4.4.n and later |
| 191 | // |
| 192 | #if (BOOST_GCC_VERSION < 40400) || !defined(BOOST_GCC_CXX11) |
| 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_HDR_INITIALIZER_LIST |
| 198 | # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS |
| 199 | # define BOOST_NO_CXX11_DELETED_FUNCTIONS |
| 200 | # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES |
| 201 | # define BOOST_NO_CXX11_INLINE_NAMESPACES |
| 202 | # define BOOST_NO_CXX11_VARIADIC_TEMPLATES |
| 203 | #endif |
| 204 | |
| 205 | #if BOOST_GCC_VERSION < 40500 |
| 206 | # define BOOST_NO_SFINAE_EXPR |
| 207 | #endif |
| 208 | |
| 209 | // GCC 4.5 forbids declaration of defaulted functions in private or protected sections |
| 210 | #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 5) || !defined(BOOST_GCC_CXX11) |
| 211 | # define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS |
| 212 | #endif |
| 213 | |
| 214 | // C++0x features in 4.5.0 and later |
| 215 | // |
| 216 | #if (BOOST_GCC_VERSION < 40500) || !defined(BOOST_GCC_CXX11) |
| 217 | # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS |
| 218 | # define BOOST_NO_CXX11_LAMBDAS |
| 219 | # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS |
| 220 | # define BOOST_NO_CXX11_RAW_LITERALS |
| 221 | # define BOOST_NO_CXX11_UNICODE_LITERALS |
| 222 | #endif |
| 223 | |
| 224 | // C++0x features in 4.5.1 and later |
| 225 | // |
| 226 | #if (BOOST_GCC_VERSION < 40501) || !defined(BOOST_GCC_CXX11) |
| 227 | // scoped enums have a serious bug in 4.4.0, so define BOOST_NO_CXX11_SCOPED_ENUMS before 4.5.1 |
| 228 | // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 |
| 229 | # define BOOST_NO_CXX11_SCOPED_ENUMS |
| 230 | #endif |
| 231 | |
| 232 | // C++0x features in 4.6.n and later |
| 233 | // |
| 234 | #if (BOOST_GCC_VERSION < 40600) || !defined(BOOST_GCC_CXX11) |
| 235 | #define BOOST_NO_CXX11_CONSTEXPR |
| 236 | #define BOOST_NO_CXX11_DEFAULTED_MOVES |
| 237 | #define BOOST_NO_CXX11_NOEXCEPT |
| 238 | #define BOOST_NO_CXX11_NULLPTR |
| 239 | #define BOOST_NO_CXX11_RANGE_BASED_FOR |
| 240 | #define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX |
| 241 | #endif |
| 242 | |
| 243 | // C++0x features in 4.7.n and later |
| 244 | // |
| 245 | #if (BOOST_GCC_VERSION < 40700) || !defined(BOOST_GCC_CXX11) |
| 246 | # define BOOST_NO_CXX11_FINAL |
| 247 | # define BOOST_NO_CXX11_TEMPLATE_ALIASES |
| 248 | # define BOOST_NO_CXX11_USER_DEFINED_LITERALS |
| 249 | # define BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS |
| 250 | #endif |
| 251 | |
| 252 | // C++0x features in 4.8.n and later |
| 253 | // |
| 254 | #if (BOOST_GCC_VERSION < 40800) || !defined(BOOST_GCC_CXX11) |
| 255 | # define BOOST_NO_CXX11_ALIGNAS |
| 256 | # define BOOST_NO_CXX11_THREAD_LOCAL |
| 257 | # define BOOST_NO_CXX11_SFINAE_EXPR |
| 258 | #endif |
| 259 | |
| 260 | // C++0x features in 4.8.1 and later |
| 261 | // |
| 262 | #if (BOOST_GCC_VERSION < 40801) || !defined(BOOST_GCC_CXX11) |
| 263 | # define BOOST_NO_CXX11_DECLTYPE_N3276 |
| 264 | # define BOOST_NO_CXX11_REF_QUALIFIERS |
| 265 | # define BOOST_NO_CXX14_BINARY_LITERALS |
| 266 | #endif |
| 267 | |
| 268 | // C++14 features in 4.9.0 and later |
| 269 | // |
| 270 | #if (BOOST_GCC_VERSION < 40900) || (__cplusplus < 201300) |
| 271 | # define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION |
| 272 | # define BOOST_NO_CXX14_GENERIC_LAMBDAS |
| 273 | # define BOOST_NO_CXX14_DIGIT_SEPARATORS |
| 274 | # define BOOST_NO_CXX14_DECLTYPE_AUTO |
| 275 | # if !((BOOST_GCC_VERSION >= 40801) && (BOOST_GCC_VERSION < 40900) && defined(BOOST_GCC_CXX11)) |
| 276 | # define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES |
| 277 | # endif |
| 278 | #endif |
| 279 | |
| 280 | |
| 281 | // C++ 14: |
| 282 | #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) |
| 283 | # define BOOST_NO_CXX14_AGGREGATE_NSDMI |
| 284 | #endif |
| 285 | #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304) |
| 286 | # define BOOST_NO_CXX14_CONSTEXPR |
| 287 | #endif |
| 288 | #if (BOOST_GCC_VERSION < 50200) || !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304) |
| 289 | # define BOOST_NO_CXX14_VARIABLE_TEMPLATES |
| 290 | #endif |
| 291 | |
| 292 | // C++17 |
| 293 | #if !defined(__cpp_structured_bindings) || (__cpp_structured_bindings < 201606) |
| 294 | # define BOOST_NO_CXX17_STRUCTURED_BINDINGS |
| 295 | #endif |
| 296 | #if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606) |
| 297 | # define BOOST_NO_CXX17_INLINE_VARIABLES |
| 298 | #endif |
| 299 | #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) |
| 300 | # define BOOST_NO_CXX17_FOLD_EXPRESSIONS |
| 301 | #endif |
| 302 | #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) |
| 303 | # define BOOST_NO_CXX17_IF_CONSTEXPR |
| 304 | #endif |
| 305 | |
| 306 | #if __GNUC__ >= 7 |
| 307 | # define BOOST_FALLTHROUGH __attribute__((fallthrough)) |
| 308 | #endif |
| 309 | |
| 310 | #ifdef __MINGW32__ |
| 311 | // Currently (June 2017) thread_local is broken on mingw for all current compiler releases, see |
| 312 | // https://sourceforge.net/p/mingw-w64/bugs/527/ |
| 313 | // Not setting this causes program termination on thread exit. |
| 314 | #define BOOST_NO_CXX11_THREAD_LOCAL |
| 315 | #endif |
| 316 | |
| 317 | // |
| 318 | // Unused attribute: |
| 319 | #if __GNUC__ >= 4 |
| 320 | # define BOOST_ATTRIBUTE_UNUSED __attribute__((__unused__)) |
| 321 | #endif |
| 322 | |
| 323 | // Type aliasing hint. Supported since gcc 3.3. |
| 324 | #define BOOST_MAY_ALIAS __attribute__((__may_alias__)) |
| 325 | |
| 326 | // |
| 327 | // __builtin_unreachable: |
| 328 | #if BOOST_GCC_VERSION >= 40800 |
| 329 | #define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable(); |
| 330 | #endif |
| 331 | |
| 332 | #ifndef BOOST_COMPILER |
| 333 | # define BOOST_COMPILER "GNU C++ version " __VERSION__ |
| 334 | #endif |
| 335 | |
| 336 | // ConceptGCC compiler: |
| 337 | // http://www.generic-programming.org/software/ConceptGCC/ |
| 338 | #ifdef __GXX_CONCEPTS__ |
| 339 | # define BOOST_HAS_CONCEPTS |
| 340 | # define BOOST_COMPILER "ConceptGCC version " __VERSION__ |
| 341 | #endif |
| 342 | |
| 343 | // versions check: |
| 344 | // we don't know gcc prior to version 3.30: |
| 345 | #if (BOOST_GCC_VERSION< 30300) |
| 346 | # error "Compiler not configured - please reconfigure" |
| 347 | #endif |
| 348 | // |
| 349 | // last known and checked version is 7.1: |
| 350 | #if (BOOST_GCC_VERSION > 70100) |
| 351 | # if defined(BOOST_ASSERT_CONFIG) |
| 352 | # error "Boost.Config is older than your compiler - please check for an updated Boost release." |
| 353 | # else |
| 354 | // we don't emit warnings here anymore since there are no defect macros defined for |
| 355 | // gcc post 3.4, so any failures are gcc regressions... |
| 356 | //# warning "Unknown compiler version - please run the configure tests and report the results" |
| 357 | # endif |
| 358 | #endif |
| 359 | |