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)
12 // See http://www.boost.org for most recent version.
14 // GNU C++ compiler setup.
17 // Define BOOST_GCC so we know this is "real" GCC and not some pretender:
19 #define BOOST_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
20 #if !defined(__CUDACC__)
21 #define BOOST_GCC BOOST_GCC_VERSION
24 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
25 # define BOOST_GCC_CXX11
29 # if defined (__PATHSCALE__)
30 # define BOOST_NO_TWO_PHASE_NAME_LOOKUP
31 # define BOOST_NO_IS_ABSTRACT
34 # if __GNUC_MINOR__ < 4
35 # define BOOST_NO_IS_ABSTRACT
37 # define BOOST_NO_CXX11_EXTERN_TEMPLATE
41 // All problems to gcc-3.x and earlier here:
43 #define BOOST_NO_TWO_PHASE_NAME_LOOKUP
45 # define BOOST_NO_IS_ABSTRACT
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
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
66 #if !defined(__EXCEPTIONS) && !defined(BOOST_NO_EXCEPTIONS)
67 # define BOOST_NO_EXCEPTIONS
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.
76 #if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__)
77 # define BOOST_HAS_THREADS
81 // gcc has "long long"
82 // Except on Darwin with standard compliance enabled (-pedantic)
83 // Apple gcc helpfully defines this macro we can query
85 #if !defined(__DARWIN_NO_LONG_LONG)
86 # define BOOST_HAS_LONG_LONG
90 // gcc implements the named return value optimization since version 3.1
92 #define BOOST_HAS_NRVO
94 // Branch prediction hints
95 #define BOOST_LIKELY(x) __builtin_expect(x, 1)
96 #define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
99 // Dynamic shared object (DSO) and dynamic-link library (DLL) support
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.
106 # define BOOST_HAS_DECLSPEC
107 # define BOOST_SYMBOL_EXPORT __attribute__((__dllexport__))
108 # define BOOST_SYMBOL_IMPORT __attribute__((__dllimport__))
110 # define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
111 # define BOOST_SYMBOL_IMPORT
113 # define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
115 // config/platform/win32.hpp will define BOOST_SYMBOL_EXPORT, etc., unless already defined
116 # define BOOST_SYMBOL_EXPORT
120 // RTTI and typeinfo detection is possible post gcc-4.3:
122 #if BOOST_GCC_VERSION > 40300
124 # ifndef BOOST_NO_TYPEID
125 # define BOOST_NO_TYPEID
127 # ifndef BOOST_NO_RTTI
128 # define BOOST_NO_RTTI
134 // Recent GCC versions have __int128 when in 64-bit mode.
136 // We disable this if the compiler is really nvcc as it
137 // doesn't actually support __int128 as of CUDA_VERSION=5000
138 // even though it defines __SIZEOF_INT128__.
139 // See https://svn.boost.org/trac/boost/ticket/8048
140 // Only re-enable this for nvcc if you're absolutely sure
141 // of the circumstances under which it's supported:
143 #if defined(__SIZEOF_INT128__) && !defined(__CUDACC__)
144 # define BOOST_HAS_INT128
147 // C++0x features in 4.3.n and later
149 #if (BOOST_GCC_VERSION >= 40300) && defined(BOOST_GCC_CXX11)
150 // C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
151 // passed on the command line, which in turn defines
152 // __GXX_EXPERIMENTAL_CXX0X__.
153 # define BOOST_HAS_DECLTYPE
154 # define BOOST_HAS_RVALUE_REFS
155 # define BOOST_HAS_STATIC_ASSERT
156 # define BOOST_HAS_VARIADIC_TMPL
158 # define BOOST_NO_CXX11_DECLTYPE
159 # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
160 # define BOOST_NO_CXX11_RVALUE_REFERENCES
161 # define BOOST_NO_CXX11_STATIC_ASSERT
164 // C++0x features in 4.4.n and later
166 #if (BOOST_GCC_VERSION < 40400) || !defined(BOOST_GCC_CXX11)
167 # define BOOST_NO_CXX11_AUTO_DECLARATIONS
168 # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
169 # define BOOST_NO_CXX11_CHAR16_T
170 # define BOOST_NO_CXX11_CHAR32_T
171 # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
172 # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
173 # define BOOST_NO_CXX11_DELETED_FUNCTIONS
174 # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
175 # define BOOST_NO_CXX11_INLINE_NAMESPACES
176 # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
179 #if BOOST_GCC_VERSION < 40500
180 # define BOOST_NO_SFINAE_EXPR
183 // GCC 4.5 forbids declaration of defaulted functions in private or protected sections
184 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 5) || !defined(BOOST_GCC_CXX11)
185 # define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS
188 // C++0x features in 4.5.0 and later
190 #if (BOOST_GCC_VERSION < 40500) || !defined(BOOST_GCC_CXX11)
191 # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
192 # define BOOST_NO_CXX11_LAMBDAS
193 # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
194 # define BOOST_NO_CXX11_RAW_LITERALS
195 # define BOOST_NO_CXX11_UNICODE_LITERALS
198 // C++0x features in 4.5.1 and later
200 #if (BOOST_GCC_VERSION < 40501) || !defined(BOOST_GCC_CXX11)
201 // scoped enums have a serious bug in 4.4.0, so define BOOST_NO_CXX11_SCOPED_ENUMS before 4.5.1
202 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064
203 # define BOOST_NO_CXX11_SCOPED_ENUMS
206 // C++0x features in 4.6.n and later
208 #if (BOOST_GCC_VERSION < 40600) || !defined(BOOST_GCC_CXX11)
209 #define BOOST_NO_CXX11_CONSTEXPR
210 #define BOOST_NO_CXX11_NOEXCEPT
211 #define BOOST_NO_CXX11_NULLPTR
212 #define BOOST_NO_CXX11_RANGE_BASED_FOR
213 #define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
216 // C++0x features in 4.7.n and later
218 #if (BOOST_GCC_VERSION < 40700) || !defined(BOOST_GCC_CXX11)
219 # define BOOST_NO_CXX11_FINAL
220 # define BOOST_NO_CXX11_TEMPLATE_ALIASES
221 # define BOOST_NO_CXX11_USER_DEFINED_LITERALS
222 # define BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
225 // C++0x features in 4.8.n and later
227 #if (BOOST_GCC_VERSION < 40800) || !defined(BOOST_GCC_CXX11)
228 # define BOOST_NO_CXX11_ALIGNAS
231 // C++0x features in 4.8.1 and later
233 #if (BOOST_GCC_VERSION < 40801) || !defined(BOOST_GCC_CXX11)
234 # define BOOST_NO_CXX11_DECLTYPE_N3276
235 # define BOOST_NO_CXX11_REF_QUALIFIERS
236 # define BOOST_NO_CXX14_BINARY_LITERALS
239 // C++14 features in 4.9.0 and later
241 #if (BOOST_GCC_VERSION < 40900) || (__cplusplus < 201300)
242 # define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
243 # define BOOST_NO_CXX14_GENERIC_LAMBDAS
244 # define BOOST_NO_CXX14_DIGIT_SEPARATORS
245 # define BOOST_NO_CXX14_DECLTYPE_AUTO
246 # if !((BOOST_GCC_VERSION >= 40801) && (BOOST_GCC_VERSION < 40900) && defined(BOOST_GCC_CXX11))
247 # define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
253 #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
254 # define BOOST_NO_CXX14_AGGREGATE_NSDMI
256 #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
257 # define BOOST_NO_CXX14_CONSTEXPR
259 #if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
260 # define BOOST_NO_CXX14_VARIABLE_TEMPLATES
266 # define BOOST_ATTRIBUTE_UNUSED __attribute__((unused))
269 #ifndef BOOST_COMPILER
270 # define BOOST_COMPILER "GNU C++ version " __VERSION__
273 // ConceptGCC compiler:
274 // http://www.generic-programming.org/software/ConceptGCC/
275 #ifdef __GXX_CONCEPTS__
276 # define BOOST_HAS_CONCEPTS
277 # define BOOST_COMPILER "ConceptGCC version " __VERSION__
281 // we don't know gcc prior to version 3.30:
282 #if (BOOST_GCC_VERSION< 30300)
283 # error "Compiler not configured - please reconfigure"
286 // last known and checked version is 4.9:
287 #if (BOOST_GCC_VERSION > 40900)
288 # if defined(BOOST_ASSERT_CONFIG)
289 # error "Unknown compiler version - please run the configure tests and report the results"
291 // we don't emit warnings here anymore since there are no defect macros defined for
292 // gcc post 3.4, so any failures are gcc regressions...
293 //# warning "Unknown compiler version - please run the configure tests and report the results"