3 #ifndef __CDS_COMPILER_GCC_DEFS_H
4 #define __CDS_COMPILER_GCC_DEFS_H
7 #define CDS_COMPILER_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
9 #if CDS_COMPILER_VERSION < 40300
10 # error "Compiler version error. GCC version 4.3.0 and above is supported"
15 # define CDS_COMPILER__NAME ("GNU C++ " __VERSION__)
17 # define CDS_COMPILER__NAME "GNU C++"
19 #define CDS_COMPILER__NICK "gcc"
21 // C++11 atomic support
22 #if CDS_COMPILER_VERSION >= 40700
23 # define CDS_CXX11_ATOMIC_SUPPORT 1
24 #elif defined(CDS_CXX11_ATOMIC_GCC)
25 # define CDS_CXX11_ATOMIC_SUPPORT 1
29 #include <cds/compiler/gcc/compiler_macro.h>
32 #define alignof __alignof__
34 // ***************************************
37 // Variadic template support (only if -std=c++0x compile-line option provided)
38 #if CDS_COMPILER_VERSION >= 40300
39 # define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT
43 #if CDS_COMPILER_VERSION >= 40300
44 # define CDS_RVALUE_SUPPORT
45 # define CDS_MOVE_SEMANTICS_SUPPORT
48 // Default template arguments for function templates
49 #if CDS_COMPILER_VERSION >= 40300
50 # define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
53 // C++11 inline namespace
54 #if CDS_COMPILER_VERSION >= 40400
55 # define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
58 // Delete definition and explicitly-defaulted function
59 #if CDS_COMPILER_VERSION >= 40400
60 // C++11 delete definition ( function declaration = delete)
61 # define CDS_CXX11_DELETE_DEFINITION_SUPPORT
63 // C++11 explicitly-defaulted function (= default) [std 8.4.2 [dcl.fct.def.default]]
64 # define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
68 #if CDS_COMPILER_VERSION >= 40500
69 # define CDS_CXX11_LAMBDA_SUPPORT
70 # if CDS_COMPILER_VERSION < 40800
71 # define CDS_BUG_STATIC_MEMBER_IN_LAMBDA
75 // Explicit conversion operator
76 #if CDS_COMPILER_VERSION >= 40500
77 # define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
80 #if CDS_COMPILER_VERSION >= 40600
81 # define CDS_CONSTEXPR constexpr
82 # define CDS_NOEXCEPT_SUPPORT noexcept
83 # define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
84 # if CDS_COMPILER_VERSION >= 40600 && CDS_COMPILER_VERSION < 40700
85 // GCC 4.6.x does not allow noexcept specification in defaulted function
86 // void foo() noexcept = default
87 // error: function
\91foo
\92 defaulted on its first declaration must not have an exception-specification
88 # define CDS_NOEXCEPT_DEFAULTED
89 # define CDS_NOEXCEPT_DEFAULTED_(expr)
90 // GCC 4.6.x: constexpr and const are incompatible in variable declaration
91 # define CDS_CONSTEXPR_CONST const
93 # define CDS_CONSTEXPR_CONST constexpr const
96 # define CDS_CONSTEXPR
97 # define CDS_CONSTEXPR_CONST const
98 # define CDS_NOEXCEPT_SUPPORT
99 # define CDS_NOEXCEPT_SUPPORT_(expr)
102 // C++11 template alias
103 #if CDS_COMPILER_VERSION >= 40700
104 # define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
107 // C++11 thread_local keyword
108 #if CDS_COMPILER_VERSION >= 40800
109 # define CDS_CXX11_THREAD_LOCAL_SUPPORT
113 #if defined( CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT ) && defined(CDS_MOVE_SEMANTICS_SUPPORT) && CDS_COMPILER_VERSION >= 40400 && CDS_COMPILER_VERSION < 40600
114 // GCC 4.4 - 4.5 bug: move ctor & assignment operator cannot be defaulted
115 # define CDS_DISABLE_DEFAULT_MOVE_CTOR
118 #include <cds/compiler/cstdint_std.h>
120 // Thread support library (thread, mutex, condition variable, chrono)
121 #if CDS_COMPILER_VERSION >= 40800
122 # define CDS_CXX11_STDLIB_THREAD
123 # define CDS_CXX11_STDLIB_MUTEX
124 # define CDS_CXX11_STDLIB_CONDITION_VARIABLE
125 # define CDS_CXX11_STDLIB_CHRONO
128 // Full SFINAE support
129 #if CDS_COMPILER_VERSION >= 40700
130 # define CDS_CXX11_SFINAE
133 // *************************************************
136 #define CDS_TYPE_ALIGNMENT(n) __attribute__ ((aligned (n)))
137 #define CDS_CLASS_ALIGNMENT(n) __attribute__ ((aligned (n)))
138 #define CDS_DATA_ALIGNMENT(n) __attribute__ ((aligned (n)))
141 #include <cds/compiler/gcc/compiler_barriers.h>
143 #endif // #ifndef __CDS_COMPILER_GCC_DEFS_H