nlib
Config_clang.h
1 
2 #pragma once
3 #ifndef INCLUDE_NN_NLIB_CONFIG_CLANG_H_
4 #define INCLUDE_NN_NLIB_CONFIG_CLANG_H_
5 #ifndef INCLUDE_NN_NLIB_CONFIG_H_
6 # error do not include directly
7 #endif
8 
9 #if defined(__clang__)
10 
11 #define NLIB_CXX11_SWAPHEADER
12 
13 #if __cplusplus > 199711L
14 # define NLIB_CXX11_UNIQUEPTR
15 # define NLIB_CXX11_EXTERN_TEMPLATES
16 # define NLIB_CXX11_DEFAULT_TEMPLATE_ARGUMENT_FOR_FUNCTION_TEMPLATES
17 #endif
18 
19 #if __has_feature(cxx_exceptions)
20 # define NLIB_EXCEPTION_ENABLED
21 #endif
22 
23 #if __has_feature(cxx_lambdas)
24 # define NLIB_CXX11_LAMBDAS
25 #endif
26 
27 #if __has_feature(cxx_rvalue_references)
28 # define NLIB_CXX11_RVALUE_REFERENCES
29 #endif
30 
31 #if __has_feature(cxx_alias_templates)
32 # define NLIB_CXX11_TEMPLATE_ALIAS
33 #endif
34 
35 #if __has_feature(cxx_deleted_functions) && __has_feature(cxx_defaulted_functions)
36 # define NLIB_CXX11_DEFAULTED_AND_DELETED_FUNCTIONS
37 #endif
38 
39 #if __has_feature(cxx_explicit_conversions)
40 # define NLIB_CXX11_EXPLICIT_CONVERSION_OPERATORS
41 #endif
42 
43 #if __has_feature(cxx_nullptr)
44 # define NLIB_CXX11_NULL_POINTER_CONSTANT
45 #endif
46 
47 #if __has_feature(cxx_static_assert)
48 # define NLIB_CXX11_STATIC_ASSERTIONS
49 #endif
50 
51 #if __has_feature(cxx_range_for)
52 # define NLIB_CXX11_RANGE_BASED_FOR
53 #endif
54 
55 #if __has_feature(cxx_override_control)
56 # define NLIB_CXX11_EXPLICIT_VIRTUAL_OVERRIDES
57 #endif
58 
59 #if __has_feature(cxx_constexpr)
60 # define NLIB_CXX11_CONSTEXPR
61 #endif
62 
63 #if __has_feature(cxx_alignas)
64 # define NLIB_CXX11_ALIGNMENT_SUPPORT
65 #endif
66 
67 #if __has_feature(cxx_variadic_templates)
68 # define NLIB_CXX11_VARIADIC_TEMPLATES
69 #endif
70 
71 #if __has_feature(cxx_delegating_constructors)
72 # define NLIB_CXX11_DELEGATING_CONSTRUCTORS
73 #endif
74 
75 #if __has_include(<chrono>)
76 # define NLIB_CXX11_STDLIB_CHRONO
77 #endif
78 
79 #if __has_include(<atomic>)
80 # define NLIB_CXX11_STDLIB_ATOMIC
81 #endif
82 
83 #if __has_include(<random>)
84 # define NLIB_CXX11_STDLIB_RANDOM
85 #endif
86 
87 #if __has_include(<array>)
88 # define NLIB_CXX11_STDLIB_ARRAY
89 #endif
90 
91 #if __has_include(<unordered_set>) && __has_include(<unordered_map>)
92 # define NLIB_CXX11_STDLIB_UNORDERED
93 #endif
94 
95 #if __has_include(<tuple>)
96 # define NLIB_CXX11_STDLIB_TUPLE
97 #endif
98 
99 #include <cassert> // NOLINT
100 #ifndef NLIB_ASSERT
101 #define NLIB_ASSERT assert
102 #endif
103 
104 #define NLIB_ALIGNAS(x) __attribute__((aligned(x)))
105 #define NLIB_ALIGNOF(tp) __alignof__(tp)
106 
107 #define NLIB_HAS_NATIVE_TYPETRAITS
108 
109 // libstdc++ workaround, See https://svn.boost.org/trac/boost/ticket/7473
110 #if !__has_include(<ext/cmath>) && !__has_include(<ext/__hash>)
111 # ifdef NLIB_CXX11_STDLIB_ATOMIC
112 # undef NLIB_CXX11_STDLIB_ATOMIC
113 # endif
114 # ifdef NLIB_HAS_NATIVE_TYPETRAITS
115 # undef NLIB_HAS_NATIVE_TYPETRAITS
116 # endif
117 # ifdef NLIB_CXX11_STDLIB_RANDOM
118 # undef NLIB_CXX11_STDLIB_RANDOM
119 # endif
120 #endif
121 
122 // libstdc++ workaround, See https://svn.boost.org/trac/boost/ticket/7473
123 #if !__has_include(<future>)
124 # ifdef NLIB_CXX11_UNIQUEPTR
125 # undef NLIB_CXX11_UNIQUEPTR
126 # endif
127 # ifdef NLIB_CXX11_STDLIB_UNORDERED
128 # undef NLIB_CXX11_STDLIB_UNORDERED
129 # endif
130 # ifdef NLIB_CXX11_STDLIB_TUPLE
131 # undef NLIB_CXX11_STDLIB_TUPLE
132 # endif
133 #endif
134 
135 #endif
136 #endif // INCLUDE_NN_NLIB_CONFIG_CLANG_H_