|
12 | 12 | // See the License for the specific language governing permissions and
|
13 | 13 | // limitations under the License.
|
14 | 14 |
|
| 15 | +// util.hpp |
| 16 | +#pragma push_macro("bsoncxx_concat") |
| 17 | +#undef bsoncxx_concat |
| 18 | +#pragma push_macro("bsoncxx_concat_impl") |
| 19 | +#undef bsoncxx_concat_impl |
| 20 | +#pragma push_macro("bsoncxx_stringify") |
| 21 | +#undef bsoncxx_stringify |
| 22 | +#pragma push_macro("bsoncxx_stringify_impl") |
| 23 | +#undef bsoncxx_stringify_impl |
| 24 | +#pragma push_macro("bsoncxx_pragma") |
| 25 | +#undef bsoncxx_pragma |
| 26 | +#pragma push_macro("_bsoncxxPragma") |
| 27 | +#undef _bsoncxxPragma |
| 28 | +#pragma push_macro("bsoncxx_force_semicolon") |
| 29 | +#undef bsoncxx_force_semicolon |
| 30 | +#pragma push_macro("bsoncxx_returns") |
| 31 | +#undef bsoncxx_returns |
| 32 | +#pragma push_macro("bsoncxx_cxx14_constexpr") |
| 33 | +#undef bsoncxx_cxx14_constexpr |
| 34 | +#pragma push_macro("bsoncxx_disable_warning") |
| 35 | +#undef bsoncxx_disable_warning |
| 36 | +#pragma push_macro("bsoncxx_push_warnings") |
| 37 | +#undef bsoncxx_push_warnings |
| 38 | +#pragma push_macro("bsoncxx_pop_warnings") |
| 39 | +#undef bsoncxx_pop_warnings |
| 40 | +#pragma push_macro("_bsoncxxDisableWarningImpl_for_GCC") |
| 41 | +#undef _bsoncxxDisableWarningImpl_for_GCC |
| 42 | +#pragma push_macro("_bsoncxxDisableWarningImpl_for_Clang") |
| 43 | +#undef _bsoncxxDisableWarningImpl_for_Clang |
| 44 | +#pragma push_macro("_bsoncxxDisableWarningImpl_for_MSVC") |
| 45 | +#undef _bsoncxxDisableWarningImpl_for_MSVC |
| 46 | +#pragma push_macro("_bsoncxxDisableWarningImpl_for_GNU") |
| 47 | +#undef _bsoncxxDisableWarningImpl_for_GNU |
| 48 | + |
15 | 49 | // compiler.hpp
|
16 | 50 | #pragma push_macro("BSONCXX_INLINE")
|
17 | 51 | #undef BSONCXX_INLINE
|
18 | 52 | #pragma push_macro("BSONCXX_CALL")
|
19 | 53 | #undef BSONCXX_CALL
|
| 54 | +#pragma push_macro("bsoncxx_if_msvc") |
| 55 | +#undef bsoncxx_if_msvc |
| 56 | +#pragma push_macro("bsoncxx_if_gcc") |
| 57 | +#undef bsoncxx_if_gcc |
| 58 | +#pragma push_macro("bsoncxx_if_clang") |
| 59 | +#undef bsoncxx_if_clang |
| 60 | +#pragma push_macro("bsoncxx_if_gnu_like") |
| 61 | +#undef bsoncxx_if_gnu_like |
20 | 62 |
|
21 | 63 | // config.hpp (generated by CMake)
|
22 | 64 | #pragma push_macro("BSONCXX_INLINE_NAMESPACE_BEGIN")
|
|
60 | 102 | #pragma push_macro("BSONCXX_NO_DEPRECATED")
|
61 | 103 | #undef BSONCXX_NO_DEPRECATED
|
62 | 104 |
|
| 105 | +#include <bsoncxx/config/util.hpp> |
| 106 | +// |
63 | 107 | #include <bsoncxx/config/compiler.hpp>
|
64 | 108 | #include <bsoncxx/config/config.hpp>
|
65 | 109 | #include <bsoncxx/config/export.hpp>
|
|
90 | 134 | /// @namespace bsoncxx::v_noabi::stdx
|
91 | 135 | /// Declares polyfills for C++17 forward compatibility.
|
92 | 136 | ///
|
93 |
| - |
94 |
| -#pragma push_macro("mongo_cxx14_constexpr") |
95 |
| -#if __cplusplus >= 201402L |
96 |
| -#define mongo_cxx14_constexpr constexpr |
97 |
| -#else |
98 |
| -#define mongo_cxx14_constexpr inline |
99 |
| -#endif |
100 |
| - |
101 |
| -#pragma push_macro("bsoncxx_returns") |
102 |
| -/** |
103 |
| - * @brief Add a trailing noexcept, decltype-return, and return-body to a function definition. |
104 |
| - */ |
105 |
| -#define bsoncxx_returns(...) \ |
106 |
| - noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) { \ |
107 |
| - return __VA_ARGS__; \ |
108 |
| - } \ |
109 |
| - bsoncxx_force_semicolon |
110 |
| - |
111 |
| -// clang-format off |
112 |
| - |
113 |
| -#pragma push_macro("bsoncxx_if_msvc") |
114 |
| -#define bsoncxx_if_msvc(...) |
115 |
| -#pragma push_macro("bsoncxx_if_gcc") |
116 |
| -#define bsoncxx_if_gcc(...) |
117 |
| -#pragma push_macro("bsoncxx_if_clang") |
118 |
| -#define bsoncxx_if_clang(...) |
119 |
| -#pragma push_macro("bsoncxx_if_gnu_like") |
120 |
| -#define bsoncxx_if_gnu_like(...) \ |
121 |
| - bsoncxx_if_gcc(__VA_ARGS__) \ |
122 |
| - bsoncxx_if_clang(__VA_ARGS__) |
123 |
| - |
124 |
| -#ifdef __GNUC__ |
125 |
| - #ifdef __clang__ |
126 |
| - #undef bsoncxx_if_clang |
127 |
| - #define bsoncxx_if_clang(...) __VA_ARGS__ |
128 |
| - #else |
129 |
| - #undef bsoncxx_if_gcc |
130 |
| - #define bsoncxx_if_gcc(...) __VA_ARGS__ |
131 |
| - #endif |
132 |
| -#elif defined(_MSC_VER) |
133 |
| - #undef bsoncxx_if_msvc |
134 |
| - #undef bsoncxx_if_msvc(...) __VA_ARGS__ |
135 |
| -#endif |
136 |
| - |
137 |
| -#pragma push_macro("bsoncxx_stringify") |
138 |
| -#pragma push_macro("bsoncxx_stringify_impl") |
139 |
| -#define bsoncxx_stringify(...) bsoncxx_stringify_impl(__VA_ARGS__) |
140 |
| -#define bsoncxx_stringify_impl(...) #__VA_ARGS__ |
141 |
| - |
142 |
| -#pragma push_macro("bsoncxx_pragma") |
143 |
| -#define bsoncxx_pragma(...) _Pragma(bsoncxx_stringify(__VA_ARGS__)) |
144 |
| - |
145 |
| -#pragma push_macro("bsoncxx_force_semicolon") |
146 |
| -/** |
147 |
| - * @brief Use in a declaration position to force the appearence of a semicolon as the next token |
148 |
| - */ |
149 |
| -#define bsoncxx_force_semicolon static_assert(true, "") |
150 |
| - |
151 |
| -#pragma push_macro("bsoncxx_concat") |
152 |
| -#pragma push_macro("bsoncxx_concat_impl") |
153 |
| -#define bsoncxx_concat(A, ...) bsoncxx_concat_impl(A, __VA_ARGS__) |
154 |
| -#define bsoncxx_concat_impl(A, ...) A##__VA_ARGS__ |
155 |
| - |
156 |
| -#pragma push_macro("bsoncxx_disable_warning") |
157 |
| -/** |
158 |
| - * @brief Disable a warning for a particular compiler. |
159 |
| - * |
160 |
| - * The argument should be of the form: |
161 |
| - * |
162 |
| - * - Clang(<flag-string>) |
163 |
| - * - GCC(<flag-string>) |
164 |
| - * - GNU(<flag-string>) |
165 |
| - * - MSVC(<id-integer>) |
166 |
| - */ |
167 |
| -#define bsoncxx_disable_warning(Spec) bsoncxx_concat(BSONCXX_DISABLE_WARNING_IMPL_, Spec) |
168 |
| - |
169 |
| -#pragma push_macro("bsoncxx_push_warnings") |
170 |
| -/** |
171 |
| - * @brief Push the current compiler diagnostics settings state |
172 |
| - */ |
173 |
| -#define bsoncxx_push_warnings() \ |
174 |
| - bsoncxx_if_gnu_like(bsoncxx_pragma(GCC diagnostic push);) \ |
175 |
| - bsoncxx_if_msvc(bsoncxx_pragma(warning(push));) \ |
176 |
| - bsoncxx_force_semicolon |
177 |
| - |
178 |
| -#pragma push_macro("bsoncxx_pop_warnings") |
179 |
| -/** |
180 |
| - * @brief Restore prior compiler diagnostics settings from before the most |
181 |
| - * recent bsoncxx_push_warnings() |
182 |
| - */ |
183 |
| -#define bsoncxx_pop_warnings() \ |
184 |
| - bsoncxx_if_gnu_like(bsoncxx_pragma(GCC diagnostic pop);) \ |
185 |
| - bsoncxx_if_msvc(bsoncxx_pragma(warning(pop));) \ |
186 |
| - bsoncxx_force_semicolon |
187 |
| - |
188 |
| -#pragma push_macro("BSONCXX_DISABLE_WARNING_IMPL_GCC") |
189 |
| -#define BSONCXX_DISABLE_WARNING_IMPL_GCC(...) \ |
190 |
| - bsoncxx_if_gcc(bsoncxx_pragma(GCC diagnostic ignored __VA_ARGS__);) \ |
191 |
| - bsoncxx_force_semicolon |
192 |
| - |
193 |
| -#pragma push_macro("BSONCXX_DISABLE_WARNING_IMPL_Clang") |
194 |
| -#define BSONCXX_DISABLE_WARNING_IMPL_Clang(...) \ |
195 |
| - bsoncxx_if_clang(bsoncxx_pragma(GCC diagnostic ignored __VA_ARGS__);) \ |
196 |
| - bsoncxx_force_semicolon |
197 |
| - |
198 |
| -#pragma push_macro("BSONCXX_DISABLE_WARNING_IMPL_GNU") |
199 |
| -#define BSONCXX_DISABLE_WARNING_IMPL_GNU(...) \ |
200 |
| - BSONCXX_DISABLE_WARNING_IMPL_GCC(__VA_ARGS__); \ |
201 |
| - BSONCXX_DISABLE_WARNING_IMPL_Clang(__VA_ARGS__) |
202 |
| - |
203 |
| -#pragma push_macro("BSONCXX_DISABLE_WARNING_IMPL_MSVC") |
204 |
| -#define BSONCXX_DISABLE_WARNING_IMPL_MSVC(...) \ |
205 |
| - bsoncxx_if_msvc(warning(disable : __VA_ARGS__)) |
206 |
| - |
207 |
| -// clang-format on |
0 commit comments