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 < 40800
10 # error "Compiler version error. GCC version 4.8.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 #include <cds/compiler/gcc/compiler_macro.h>
24 #define alignof __alignof__
26 // ***************************************
29 // Variadic template support (only if -std=c++0x compile-line option provided)
30 #if CDS_COMPILER_VERSION >= 40300
31 # define CDS_CXX11_VARIADIC_TEMPLATE_SUPPORT
35 #if CDS_COMPILER_VERSION >= 40300
36 # define CDS_RVALUE_SUPPORT
37 # define CDS_MOVE_SEMANTICS_SUPPORT
40 // Default template arguments for function templates
41 #if CDS_COMPILER_VERSION >= 40300
42 # define CDS_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS_SUPPORT
45 // C++11 inline namespace
46 #if CDS_COMPILER_VERSION >= 40400
47 # define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
50 // Delete definition and explicitly-defaulted function
51 #if CDS_COMPILER_VERSION >= 40400
52 // C++11 delete definition ( function declaration = delete)
53 # define CDS_CXX11_DELETE_DEFINITION_SUPPORT
55 // C++11 explicitly-defaulted function (= default) [std 8.4.2 [dcl.fct.def.default]]
56 # define CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT
60 #if CDS_COMPILER_VERSION >= 40500
61 # define CDS_CXX11_LAMBDA_SUPPORT
62 # if CDS_COMPILER_VERSION < 40800
63 # define CDS_BUG_STATIC_MEMBER_IN_LAMBDA
67 // Explicit conversion operator
68 #if CDS_COMPILER_VERSION >= 40500
69 # define CDS_CXX11_EXPLICIT_CONVERSION_OPERATOR_SUPPORT
72 #if CDS_COMPILER_VERSION >= 40600
73 # define CDS_CONSTEXPR constexpr
74 # define CDS_NOEXCEPT_SUPPORT noexcept
75 # define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
76 # if CDS_COMPILER_VERSION >= 40600 && CDS_COMPILER_VERSION < 40700
77 // GCC 4.6.x does not allow noexcept specification in defaulted function
78 // void foo() noexcept = default
79 // error: function
\91foo
\92 defaulted on its first declaration must not have an exception-specification
80 # define CDS_NOEXCEPT_DEFAULTED
81 # define CDS_NOEXCEPT_DEFAULTED_(expr)
82 // GCC 4.6.x: constexpr and const are incompatible in variable declaration
83 # define CDS_CONSTEXPR_CONST const
85 # define CDS_CONSTEXPR_CONST constexpr const
88 # define CDS_CONSTEXPR
89 # define CDS_CONSTEXPR_CONST const
90 # define CDS_NOEXCEPT_SUPPORT
91 # define CDS_NOEXCEPT_SUPPORT_(expr)
94 // C++11 template alias
95 #if CDS_COMPILER_VERSION >= 40700
96 # define CDS_CXX11_TEMPLATE_ALIAS_SUPPORT
99 // C++11 thread_local keyword
100 #if CDS_COMPILER_VERSION >= 40800
101 # define CDS_CXX11_THREAD_LOCAL_SUPPORT
105 #if defined( CDS_CXX11_EXPLICITLY_DEFAULTED_FUNCTION_SUPPORT ) && defined(CDS_MOVE_SEMANTICS_SUPPORT) && CDS_COMPILER_VERSION >= 40400 && CDS_COMPILER_VERSION < 40600
106 // GCC 4.4 - 4.5 bug: move ctor & assignment operator cannot be defaulted
107 # define CDS_DISABLE_DEFAULT_MOVE_CTOR
110 // Thread support library (thread, mutex, condition variable, chrono)
111 #if CDS_COMPILER_VERSION >= 40800
112 # define CDS_CXX11_STDLIB_THREAD
113 # define CDS_CXX11_STDLIB_MUTEX
114 # define CDS_CXX11_STDLIB_CONDITION_VARIABLE
115 # define CDS_CXX11_STDLIB_CHRONO
118 // Full SFINAE support
119 #if CDS_COMPILER_VERSION >= 40700
120 # define CDS_CXX11_SFINAE
123 // *************************************************
126 #define CDS_TYPE_ALIGNMENT(n) __attribute__ ((aligned (n)))
127 #define CDS_CLASS_ALIGNMENT(n) __attribute__ ((aligned (n)))
128 #define CDS_DATA_ALIGNMENT(n) __attribute__ ((aligned (n)))
131 #include <cds/compiler/gcc/compiler_barriers.h>
133 #endif // #ifndef __CDS_COMPILER_GCC_DEFS_H