DATAKIT API  V2025.1
dtk_compiler_gcc.h
Go to the documentation of this file.
1 #ifndef DTK_COMPILER_GCC_H
2 #define DTK_COMPILER_GCC_H
3 
4 //
5 // Define DTK_GCC so we know this is "real" GCC and not some pretender:
6 //
7 #define DTK_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
8 
9 #if !defined(__CUDACC__)
10 #define DTK_GCC DTK_GCC_VERSION
11 #endif
12 
13 //DTK_TOREMOVE_START
14 #ifdef AF51BDA7E49648f8AB95949F4CA52EF8
15 // Calling conventions
16 #define DTK_CDECL __attribute__((cdecl))
17 #define DTK_STDCALL __attribute__((stdcall))
18 #endif
19 //DTK_TOREMOVE_END
20 
21 
22 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
23 # define DTK_GCC_CXX11
24 #endif
25 
26 // C++0x features in 4.3.n and later
27 //
28 #if (DTK_GCC_VERSION >= 40300) && defined(DTK_GCC_CXX11)
29 // C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
30 // passed on the command line, which in turn defines
31 // __GXX_EXPERIMENTAL_CXX0X__.
32 # define DTK_HAS_STATIC_ASSERT
33 # define DTK_HAS_DECLTYPE
34 # define DTK_HAS_RVALUE_REFS
35 #else
36 # define DTK_NO_CXX11_STATIC_ASSERT
37 # define DTK_NO_CXX11_DECLTYPE
38 # define DTK_NO_CXX11_RVALUE_REFERENCES
39 #endif
40 
41 // C++0x features in 4.4.n and later
42 //
43 #if (DTK_GCC_VERSION < 40400) || !defined(DTK_GCC_CXX11)
44 # define DTK_NO_CXX11_CHAR16_T
45 # define DTK_NO_CXX11_CHAR32_T
46 # define DTK_NO_CXX11_VARIADIC_TEMPLATES
47 # define DTK_NO_CXX11_DELETED_FUNCTIONS
48 #endif
49 
50 // C++0x features in 4.5.0 and later
51 //
52 #if (DTK_GCC_VERSION < 40500) || !defined(DTK_GCC_CXX11)
53 # define DTK_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
54 #endif
55 
56 // C++0x features in 4.6.n and later
57 //
58 #if (DTK_GCC_VERSION < 40600) || !defined(DTK_GCC_CXX11)
59 #define DTK_NO_CXX11_NULLPTR
60 #define DTK_NO_CXX11_NOEXCEPT
61 #define DTK_NO_CXX11_CONSTEXPR
62 #endif
63 
64 //C++14
65 #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
66 # define DTK_NO_CXX14_CONSTEXPR
67 #endif
68 
69 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(DTK_CLANG)
70 # define DTK_MOVE_IS_EMPTY(T) __is_empty(T)
71 # define DTK_MOVE_IS_UNION(T) __is_union(T)
72 # define DTK_MOVE_IS_ENUM(T) __is_enum(T)
73 #endif
74 
75 //
76 // gcc has "long long"
77 // Except on Darwin with standard compliance enabled (-pedantic)
78 // Apple gcc helpfully defines this macro we can query
79 //
80 #if !defined(__DARWIN_NO_LONG_LONG)
81 # define DTK_HAS_LONG_LONG
82 #endif
83 
84 #endif