CNL
2.0.2 (development)
Compositional Numeric Library
config.h
Go to the documentation of this file.
1
2
// Copyright John McFarlane 2016.
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file ../../LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
9
10
#if !defined(CNL_IMPL_CONFIG_H)
11
#define CNL_IMPL_CONFIG_H
12
14
// CNL_DEBUG and CNL_RELEASE macro definitions
15
16
// Customization point: define either CNL_DEBUG or CNL_RELEASE
17
// to affect how contract violations are handled
18
// in builds that don't support contract [[attributes]].
19
#if defined(CNL_DEBUG) && defined(CNL_RELEASE)
20
#error Mutually exclusive macros, CNL_DEBUG are both defined CNL_RELEASE.
21
#elif !defined(CNL_DEBUG) && !defined(CNL_RELEASE)
22
#if defined(NDEBUG)
23
#define CNL_RELEASE
24
#else
25
#define CNL_DEBUG
26
#endif
27
#endif
28
30
// CNL_INT128_ENABLED macro definition
31
32
#if defined(CNL_INT128_ENABLED)
33
#error CNL_INT128_ENABLED already defined
34
#endif
35
36
#if !defined(CNL_USE_INT128)
37
#if defined(__GLIBCXX_TYPE_INT_N_0)
43
#define CNL_USE_INT128 1 // NOLINT(cppcoreguidelines-macro-usage)
44
#else
45
#define CNL_USE_INT128 0 // NOLINT(cppcoreguidelines-macro-usage)
46
#endif
47
#endif
48
49
#if CNL_USE_INT128
50
#define CNL_INT128_ENABLED
54
#endif
55
57
// CNL_EXCEPTIONS_ENABLED macro definition
58
59
#if defined(CNL_EXCEPTIONS_ENABLED)
60
#error CNL_EXCEPTIONS_ENABLED already defined
61
#endif
62
63
#if defined(_MSC_VER)
64
#if defined(_CPPUNWIND)
65
#define CNL_EXCEPTIONS_ENABLED
66
#endif
67
#elif defined(__clang__) || defined(__GNUG__)
68
#if defined(__EXCEPTIONS)
69
#define CNL_EXCEPTIONS_ENABLED
70
#endif
71
#else
72
#define CNL_EXCEPTIONS_ENABLED
73
#endif
74
76
// CNL_TEMPLATE_AUTO feature test
77
78
#if defined(CNL_TEMPLATE_AUTO)
79
#error CNL_TEMPLATE_AUTO already defined
80
#endif
81
82
// not because MSVC defines __cpp_template_auto
83
// but because if it ever did,
84
// the workaround for this would probably have to change:
85
// https://godbolt.org/g/wbLMuN
86
#if defined(_MSC_VER)
87
#define CNL_TEMPLATE_AUTO_DISABLED
88
#endif
89
90
#if defined(__cpp_nontype_template_parameter_auto) && !defined(CNL_TEMPLATE_AUTO_DISABLED)
91
#define CNL_TEMPLATE_AUTO
92
#endif
93
95
// CNL_GCC_INTRINSICS_ENABLED macro definition
96
97
#if defined(CNL_GCC_INTRINSICS_ENABLED)
98
#error CNL_GCC_INTRINSICS_ENABLED already defined
99
#endif
100
101
#if defined(CNL_USE_GCC_INTRINSICS)
102
#if CNL_USE_GCC_INTRINSICS
103
#define CNL_GCC_INTRINSICS_ENABLED
104
#endif
105
#elif defined(__clang__) || defined(__GNUG__)
106
#define CNL_GCC_INTRINSICS_ENABLED
107
#endif
108
110
// CNL_IOSTREAMS_ENABLED macro definition
111
112
#if defined(CNL_IOSTREAMS_ENABLED)
113
#error CNL_IOSTREAMS_ENABLED already defined
114
#endif
115
116
#if defined(CNL_USE_IOSTREAMS)
117
#if CNL_USE_IOSTREAMS
118
#define CNL_IOSTREAMS_ENABLED
119
#endif
120
#elif defined(__STDC_HOSTED__)
121
#if __STDC_HOSTED__
122
#define CNL_IOSTREAMS_ENABLED
123
#else
124
// Either CNL_USE_IOSTREAMS or __STDC_HOSTED__
125
// must be defined and set to either 0 or 1.
126
#error __STDC_HOSTED__ not defined
127
#endif
128
#endif
129
131
// CNL_BUILTIN_OVERFLOW_ENABLED
132
133
#if defined(CNL_BUILTIN_OVERFLOW_ENABLED)
134
#error CNL_BUILTIN_OVERFLOW_ENABLED already defined
135
#endif
136
137
#if defined(CNL_BUILTIN_OVERFLOW_SUPPORTED_BY_TOOLCHAIN)
138
#error CNL_BUILTIN_OVERFLOW_SUPPORTED_BY_TOOLCHAIN already defined
139
#elif defined(__GNUG__) && !defined(__clang__)
140
#define CNL_BUILTIN_OVERFLOW_SUPPORTED_BY_TOOLCHAIN
141
#endif
142
143
#if defined(CNL_BUILTIN_OVERFLOW_SUPPORTED_BY_TOOLCHAIN)
144
#define CNL_BUILTIN_OVERFLOW_ENABLED
145
#endif
146
148
// int-to-string macro
149
150
#define CNL_STR_HELPER(x) #x // NOLINT(cppcoreguidelines-macro-usage)
151
#define CNL_STR(x) CNL_STR_HELPER(x) // NOLINT(cppcoreguidelines-macro-usage)
152
153
#endif // CNL_IMPL_CONFIG_H
cnl
_impl
config.h
Generated by
1.8.17