36f26f2f566f81190736b49047c0ba55eba14366
[libcds.git] / cds / compiler / gcc / defs.h
1 //$$CDS-header$$
2
3 #ifndef CDSLIB_COMPILER_GCC_DEFS_H
4 #define CDSLIB_COMPILER_GCC_DEFS_H
5
6 // Compiler version
7 #define CDS_COMPILER_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
8
9 #if CDS_COMPILER_VERSION < 40800
10 #   error "Compiler version error. GCC version 4.8.0 and above is supported"
11 #endif
12
13 // Compiler name
14 #ifdef __VERSION__
15 #   define  CDS_COMPILER__NAME    ("GNU C++ " __VERSION__)
16 #else
17 #   define  CDS_COMPILER__NAME    "GNU C++"
18 #endif
19 #define  CDS_COMPILER__NICK        "gcc"
20
21 #include <cds/compiler/gcc/compiler_macro.h>
22
23 #define alignof __alignof__
24
25 // ***************************************
26 // C++11 features
27
28 // C++11 inline namespace
29 #define CDS_CXX11_INLINE_NAMESPACE_SUPPORT
30
31 // constexpr
32 #define CDS_CONSTEXPR    constexpr
33
34 // noexcept
35 #define CDS_NOEXCEPT_SUPPORT        noexcept
36 #define CDS_NOEXCEPT_SUPPORT_(expr) noexcept(expr)
37
38 // C++11 thread_local keyword
39 #define CDS_CXX11_THREAD_LOCAL_SUPPORT
40
41 // Full SFINAE support
42 #define CDS_CXX11_SFINAE
43
44 // Inheriting constructors
45 #define CDS_CXX11_INHERITING_CTOR
46
47 // *************************************************
48 // Features
49 // If you run under Thread Sanitizer, pass -DCDS_THREAD_SANITIZER_ENABLED in compiler command line
50 //#define CDS_THREAD_SANITIZER_ENABLED
51
52 // *************************************************
53 // Alignment macro
54
55 #define CDS_TYPE_ALIGNMENT(n)   __attribute__ ((aligned (n)))
56 #define CDS_CLASS_ALIGNMENT(n)  __attribute__ ((aligned (n)))
57 #define CDS_DATA_ALIGNMENT(n)   __attribute__ ((aligned (n)))
58
59 // Attributes
60 #if CDS_COMPILER_VERSION >= 40900
61 #   if __cplusplus < 201103
62 #       define CDS_DEPRECATED( reason ) __attribute__((deprecated( reason )))
63 #   elif __cplusplus == 201103 // C++11
64 #       define CDS_DEPRECATED( reason ) [[gnu::deprecated(reason)]]
65 #   else  // C++14
66 #       define CDS_DEPRECATED( reason ) [[deprecated(reason)]]
67 #   endif
68 #else
69 #   define CDS_DEPRECATED( reason ) __attribute__((deprecated( reason )))
70 #endif
71
72 #include <cds/compiler/gcc/compiler_barriers.h>
73
74 #endif // #ifndef CDSLIB_COMPILER_GCC_DEFS_H