Open Broadcaster Software
Free, open source software for live streaming and recording
hedley.h
Go to the documentation of this file.
1 /* Hedley - https://nemequ.github.io/hedley
2  * Created by Evan Nemerson <evan@nemerson.com>
3  *
4  * To the extent possible under law, the author(s) have dedicated all
5  * copyright and related and neighboring rights to this software to
6  * the public domain worldwide. This software is distributed without
7  * any warranty.
8  *
9  * For details, see <http://creativecommons.org/publicdomain/zero/1.0/>.
10  * SPDX-License-Identifier: CC0-1.0
11  */
12 
13 #if !defined(HEDLEY_VERSION) || (HEDLEY_VERSION < 10)
14 #if defined(HEDLEY_VERSION)
15 #undef HEDLEY_VERSION
16 #endif
17 #define HEDLEY_VERSION 10
18 
19 #if defined(HEDLEY_STRINGIFY_EX)
20 #undef HEDLEY_STRINGIFY_EX
21 #endif
22 #define HEDLEY_STRINGIFY_EX(x) #x
23 
24 #if defined(HEDLEY_STRINGIFY)
25 #undef HEDLEY_STRINGIFY
26 #endif
27 #define HEDLEY_STRINGIFY(x) HEDLEY_STRINGIFY_EX(x)
28 
29 #if defined(HEDLEY_CONCAT_EX)
30 #undef HEDLEY_CONCAT_EX
31 #endif
32 #define HEDLEY_CONCAT_EX(a, b) a##b
33 
34 #if defined(HEDLEY_CONCAT)
35 #undef HEDLEY_CONCAT
36 #endif
37 #define HEDLEY_CONCAT(a, b) HEDLEY_CONCAT_EX(a, b)
38 
39 #if defined(HEDLEY_VERSION_ENCODE)
40 #undef HEDLEY_VERSION_ENCODE
41 #endif
42 #define HEDLEY_VERSION_ENCODE(major, minor, revision) \
43  (((major)*1000000) + ((minor)*1000) + (revision))
44 
45 #if defined(HEDLEY_VERSION_DECODE_MAJOR)
46 #undef HEDLEY_VERSION_DECODE_MAJOR
47 #endif
48 #define HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000)
49 
50 #if defined(HEDLEY_VERSION_DECODE_MINOR)
51 #undef HEDLEY_VERSION_DECODE_MINOR
52 #endif
53 #define HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000)
54 
55 #if defined(HEDLEY_VERSION_DECODE_REVISION)
56 #undef HEDLEY_VERSION_DECODE_REVISION
57 #endif
58 #define HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000)
59 
60 #if defined(HEDLEY_GNUC_VERSION)
61 #undef HEDLEY_GNUC_VERSION
62 #endif
63 #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
64 #define HEDLEY_GNUC_VERSION \
65  HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
66 #elif defined(__GNUC__)
67 #define HEDLEY_GNUC_VERSION HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0)
68 #endif
69 
70 #if defined(HEDLEY_GNUC_VERSION_CHECK)
71 #undef HEDLEY_GNUC_VERSION_CHECK
72 #endif
73 #if defined(HEDLEY_GNUC_VERSION)
74 #define HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) \
75  (HEDLEY_GNUC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
76 #else
77 #define HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) (0)
78 #endif
79 
80 #if defined(HEDLEY_MSVC_VERSION)
81 #undef HEDLEY_MSVC_VERSION
82 #endif
83 #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000)
84 #define HEDLEY_MSVC_VERSION \
85  HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, \
86  (_MSC_FULL_VER % 10000000) / 100000, \
87  (_MSC_FULL_VER % 100000) / 100)
88 #elif defined(_MSC_FULL_VER)
89 #define HEDLEY_MSVC_VERSION \
90  HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, \
91  (_MSC_FULL_VER % 1000000) / 10000, \
92  (_MSC_FULL_VER % 10000) / 10)
93 #elif defined(_MSC_VER)
94 #define HEDLEY_MSVC_VERSION \
95  HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0)
96 #endif
97 
98 #if defined(HEDLEY_MSVC_VERSION_CHECK)
99 #undef HEDLEY_MSVC_VERSION_CHECK
100 #endif
101 #if !defined(_MSC_VER)
102 #define HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) (0)
103 #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
104 #define HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) \
105  (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
106 #elif defined(_MSC_VER) && (_MSC_VER >= 1200)
107 #define HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) \
108  (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
109 #else
110 #define HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) \
111  (_MSC_VER >= ((major * 100) + (minor)))
112 #endif
113 
114 #if defined(HEDLEY_INTEL_VERSION)
115 #undef HEDLEY_INTEL_VERSION
116 #endif
117 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
118 #define HEDLEY_INTEL_VERSION \
119  HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, \
120  __INTEL_COMPILER_UPDATE)
121 #elif defined(__INTEL_COMPILER)
122 #define HEDLEY_INTEL_VERSION \
123  HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
124 #endif
125 
126 #if defined(HEDLEY_INTEL_VERSION_CHECK)
127 #undef HEDLEY_INTEL_VERSION_CHECK
128 #endif
129 #if defined(HEDLEY_INTEL_VERSION)
130 #define HEDLEY_INTEL_VERSION_CHECK(major, minor, patch) \
131  (HEDLEY_INTEL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
132 #else
133 #define HEDLEY_INTEL_VERSION_CHECK(major, minor, patch) (0)
134 #endif
135 
136 #if defined(HEDLEY_PGI_VERSION)
137 #undef HEDLEY_PGI_VERSION
138 #endif
139 #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && \
140  defined(__PGIC_PATCHLEVEL__)
141 #define HEDLEY_PGI_VERSION \
142  HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
143 #endif
144 
145 #if defined(HEDLEY_PGI_VERSION_CHECK)
146 #undef HEDLEY_PGI_VERSION_CHECK
147 #endif
148 #if defined(HEDLEY_PGI_VERSION)
149 #define HEDLEY_PGI_VERSION_CHECK(major, minor, patch) \
150  (HEDLEY_PGI_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
151 #else
152 #define HEDLEY_PGI_VERSION_CHECK(major, minor, patch) (0)
153 #endif
154 
155 #if defined(HEDLEY_SUNPRO_VERSION)
156 #undef HEDLEY_SUNPRO_VERSION
157 #endif
158 #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
159 #define HEDLEY_SUNPRO_VERSION \
160  HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + \
161  ((__SUNPRO_C >> 12) & 0xf), \
162  (((__SUNPRO_C >> 8) & 0xf) * 10) + \
163  ((__SUNPRO_C >> 4) & 0xf), \
164  (__SUNPRO_C & 0xf) * 10)
165 #elif defined(__SUNPRO_C)
166 #define HEDLEY_SUNPRO_VERSION \
167  HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, \
168  (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C)&0xf)
169 #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
170 #define HEDLEY_SUNPRO_VERSION \
171  HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + \
172  ((__SUNPRO_CC >> 12) & 0xf), \
173  (((__SUNPRO_CC >> 8) & 0xf) * 10) + \
174  ((__SUNPRO_CC >> 4) & 0xf), \
175  (__SUNPRO_CC & 0xf) * 10)
176 #elif defined(__SUNPRO_CC)
177 #define HEDLEY_SUNPRO_VERSION \
178  HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, \
179  (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC)&0xf)
180 #endif
181 
182 #if defined(HEDLEY_SUNPRO_VERSION_CHECK)
183 #undef HEDLEY_SUNPRO_VERSION_CHECK
184 #endif
185 #if defined(HEDLEY_SUNPRO_VERSION)
186 #define HEDLEY_SUNPRO_VERSION_CHECK(major, minor, patch) \
187  (HEDLEY_SUNPRO_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
188 #else
189 #define HEDLEY_SUNPRO_VERSION_CHECK(major, minor, patch) (0)
190 #endif
191 
192 #if defined(HEDLEY_EMSCRIPTEN_VERSION)
193 #undef HEDLEY_EMSCRIPTEN_VERSION
194 #endif
195 #if defined(__EMSCRIPTEN__)
196 #define HEDLEY_EMSCRIPTEN_VERSION \
197  HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, \
198  __EMSCRIPTEN_tiny__)
199 #endif
200 
201 #if defined(HEDLEY_EMSCRIPTEN_VERSION_CHECK)
202 #undef HEDLEY_EMSCRIPTEN_VERSION_CHECK
203 #endif
204 #if defined(HEDLEY_EMSCRIPTEN_VERSION)
205 #define HEDLEY_EMSCRIPTEN_VERSION_CHECK(major, minor, patch) \
206  (HEDLEY_EMSCRIPTEN_VERSION >= \
207  HEDLEY_VERSION_ENCODE(major, minor, patch))
208 #else
209 #define HEDLEY_EMSCRIPTEN_VERSION_CHECK(major, minor, patch) (0)
210 #endif
211 
212 #if defined(HEDLEY_ARM_VERSION)
213 #undef HEDLEY_ARM_VERSION
214 #endif
215 #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
216 #define HEDLEY_ARM_VERSION \
217  HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, \
218  (__ARMCOMPILER_VERSION % 1000000) / 10000, \
219  (__ARMCOMPILER_VERSION % 10000) / 100)
220 #elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
221 #define HEDLEY_ARM_VERSION \
222  HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, \
223  (__ARMCC_VERSION % 1000000) / 10000, \
224  (__ARMCC_VERSION % 10000) / 100)
225 #endif
226 
227 #if defined(HEDLEY_ARM_VERSION_CHECK)
228 #undef HEDLEY_ARM_VERSION_CHECK
229 #endif
230 #if defined(HEDLEY_ARM_VERSION)
231 #define HEDLEY_ARM_VERSION_CHECK(major, minor, patch) \
232  (HEDLEY_ARM_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
233 #else
234 #define HEDLEY_ARM_VERSION_CHECK(major, minor, patch) (0)
235 #endif
236 
237 #if defined(HEDLEY_IBM_VERSION)
238 #undef HEDLEY_IBM_VERSION
239 #endif
240 #if defined(__ibmxl__)
241 #define HEDLEY_IBM_VERSION \
242  HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, \
243  __ibmxl_modification__)
244 #elif defined(__xlC__) && defined(__xlC_ver__)
245 #define HEDLEY_IBM_VERSION \
246  HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, \
247  (__xlC_ver__ >> 8) & 0xff)
248 #elif defined(__xlC__)
249 #define HEDLEY_IBM_VERSION \
250  HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0)
251 #endif
252 
253 #if defined(HEDLEY_IBM_VERSION_CHECK)
254 #undef HEDLEY_IBM_VERSION_CHECK
255 #endif
256 #if defined(HEDLEY_IBM_VERSION)
257 #define HEDLEY_IBM_VERSION_CHECK(major, minor, patch) \
258  (HEDLEY_IBM_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
259 #else
260 #define HEDLEY_IBM_VERSION_CHECK(major, minor, patch) (0)
261 #endif
262 
263 #if defined(HEDLEY_TI_VERSION)
264 #undef HEDLEY_TI_VERSION
265 #endif
266 #if defined(__TI_COMPILER_VERSION__)
267 #define HEDLEY_TI_VERSION \
268  HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \
269  (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
270  (__TI_COMPILER_VERSION__ % 1000))
271 #endif
272 
273 #if defined(HEDLEY_TI_VERSION_CHECK)
274 #undef HEDLEY_TI_VERSION_CHECK
275 #endif
276 #if defined(HEDLEY_TI_VERSION)
277 #define HEDLEY_TI_VERSION_CHECK(major, minor, patch) \
278  (HEDLEY_TI_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
279 #else
280 #define HEDLEY_TI_VERSION_CHECK(major, minor, patch) (0)
281 #endif
282 
283 #if defined(HEDLEY_CRAY_VERSION)
284 #undef HEDLEY_CRAY_VERSION
285 #endif
286 #if defined(_CRAYC)
287 #if defined(_RELEASE_PATCHLEVEL)
288 #define HEDLEY_CRAY_VERSION \
289  HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, \
290  _RELEASE_PATCHLEVEL)
291 #else
292 #define HEDLEY_CRAY_VERSION \
293  HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0)
294 #endif
295 #endif
296 
297 #if defined(HEDLEY_CRAY_VERSION_CHECK)
298 #undef HEDLEY_CRAY_VERSION_CHECK
299 #endif
300 #if defined(HEDLEY_CRAY_VERSION)
301 #define HEDLEY_CRAY_VERSION_CHECK(major, minor, patch) \
302  (HEDLEY_CRAY_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
303 #else
304 #define HEDLEY_CRAY_VERSION_CHECK(major, minor, patch) (0)
305 #endif
306 
307 #if defined(HEDLEY_IAR_VERSION)
308 #undef HEDLEY_IAR_VERSION
309 #endif
310 #if defined(__IAR_SYSTEMS_ICC__)
311 #if __VER__ > 1000
312 #define HEDLEY_IAR_VERSION \
313  HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), \
314  (__VER__ % 1000))
315 #else
316 #define HEDLEY_IAR_VERSION HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0)
317 #endif
318 #endif
319 
320 #if defined(HEDLEY_IAR_VERSION_CHECK)
321 #undef HEDLEY_IAR_VERSION_CHECK
322 #endif
323 #if defined(HEDLEY_IAR_VERSION)
324 #define HEDLEY_IAR_VERSION_CHECK(major, minor, patch) \
325  (HEDLEY_IAR_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
326 #else
327 #define HEDLEY_IAR_VERSION_CHECK(major, minor, patch) (0)
328 #endif
329 
330 #if defined(HEDLEY_TINYC_VERSION)
331 #undef HEDLEY_TINYC_VERSION
332 #endif
333 #if defined(__TINYC__)
334 #define HEDLEY_TINYC_VERSION \
335  HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, \
336  __TINYC__ % 100)
337 #endif
338 
339 #if defined(HEDLEY_TINYC_VERSION_CHECK)
340 #undef HEDLEY_TINYC_VERSION_CHECK
341 #endif
342 #if defined(HEDLEY_TINYC_VERSION)
343 #define HEDLEY_TINYC_VERSION_CHECK(major, minor, patch) \
344  (HEDLEY_TINYC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
345 #else
346 #define HEDLEY_TINYC_VERSION_CHECK(major, minor, patch) (0)
347 #endif
348 
349 #if defined(HEDLEY_DMC_VERSION)
350 #undef HEDLEY_DMC_VERSION
351 #endif
352 #if defined(__DMC__)
353 #define HEDLEY_DMC_VERSION \
354  HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf)
355 #endif
356 
357 #if defined(HEDLEY_DMC_VERSION_CHECK)
358 #undef HEDLEY_DMC_VERSION_CHECK
359 #endif
360 #if defined(HEDLEY_DMC_VERSION)
361 #define HEDLEY_DMC_VERSION_CHECK(major, minor, patch) \
362  (HEDLEY_DMC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
363 #else
364 #define HEDLEY_DMC_VERSION_CHECK(major, minor, patch) (0)
365 #endif
366 
367 #if defined(HEDLEY_COMPCERT_VERSION)
368 #undef HEDLEY_COMPCERT_VERSION
369 #endif
370 #if defined(__COMPCERT_VERSION__)
371 #define HEDLEY_COMPCERT_VERSION \
372  HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, \
373  (__COMPCERT_VERSION__ / 100) % 100, \
374  __COMPCERT_VERSION__ % 100)
375 #endif
376 
377 #if defined(HEDLEY_COMPCERT_VERSION_CHECK)
378 #undef HEDLEY_COMPCERT_VERSION_CHECK
379 #endif
380 #if defined(HEDLEY_COMPCERT_VERSION)
381 #define HEDLEY_COMPCERT_VERSION_CHECK(major, minor, patch) \
382  (HEDLEY_COMPCERT_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
383 #else
384 #define HEDLEY_COMPCERT_VERSION_CHECK(major, minor, patch) (0)
385 #endif
386 
387 #if defined(HEDLEY_PELLES_VERSION)
388 #undef HEDLEY_PELLES_VERSION
389 #endif
390 #if defined(__POCC__)
391 #define HEDLEY_PELLES_VERSION \
392  HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0)
393 #endif
394 
395 #if defined(HEDLEY_PELLES_VERSION_CHECK)
396 #undef HEDLEY_PELLES_VERSION_CHECK
397 #endif
398 #if defined(HEDLEY_PELLES_VERSION)
399 #define HEDLEY_PELLES_VERSION_CHECK(major, minor, patch) \
400  (HEDLEY_PELLES_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
401 #else
402 #define HEDLEY_PELLES_VERSION_CHECK(major, minor, patch) (0)
403 #endif
404 
405 #if defined(HEDLEY_GCC_VERSION)
406 #undef HEDLEY_GCC_VERSION
407 #endif
408 #if defined(HEDLEY_GNUC_VERSION) && !defined(__clang__) && \
409  !defined(HEDLEY_INTEL_VERSION) && !defined(HEDLEY_PGI_VERSION) && \
410  !defined(HEDLEY_ARM_VERSION) && !defined(HEDLEY_TI_VERSION) && \
411  !defined(__COMPCERT__)
412 #define HEDLEY_GCC_VERSION HEDLEY_GNUC_VERSION
413 #endif
414 
415 #if defined(HEDLEY_GCC_VERSION_CHECK)
416 #undef HEDLEY_GCC_VERSION_CHECK
417 #endif
418 #if defined(HEDLEY_GCC_VERSION)
419 #define HEDLEY_GCC_VERSION_CHECK(major, minor, patch) \
420  (HEDLEY_GCC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
421 #else
422 #define HEDLEY_GCC_VERSION_CHECK(major, minor, patch) (0)
423 #endif
424 
425 #if defined(HEDLEY_HAS_ATTRIBUTE)
426 #undef HEDLEY_HAS_ATTRIBUTE
427 #endif
428 #if defined(__has_attribute)
429 #define HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute)
430 #else
431 #define HEDLEY_HAS_ATTRIBUTE(attribute) (0)
432 #endif
433 
434 #if defined(HEDLEY_GNUC_HAS_ATTRIBUTE)
435 #undef HEDLEY_GNUC_HAS_ATTRIBUTE
436 #endif
437 #if defined(__has_attribute)
438 #define HEDLEY_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
439  __has_attribute(attribute)
440 #else
441 #define HEDLEY_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
442  HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
443 #endif
444 
445 #if defined(HEDLEY_GCC_HAS_ATTRIBUTE)
446 #undef HEDLEY_GCC_HAS_ATTRIBUTE
447 #endif
448 #if defined(__has_attribute)
449 #define HEDLEY_GCC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
450  __has_attribute(attribute)
451 #else
452 #define HEDLEY_GCC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
453  HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
454 #endif
455 
456 #if defined(HEDLEY_HAS_CPP_ATTRIBUTE)
457 #undef HEDLEY_HAS_CPP_ATTRIBUTE
458 #endif
459 #if defined(__has_cpp_attribute) && defined(__cplusplus)
460 #define HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute)
461 #else
462 #define HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0)
463 #endif
464 
465 #if defined(HEDLEY_GNUC_HAS_CPP_ATTRIBUTE)
466 #undef HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
467 #endif
468 #if defined(__has_cpp_attribute) && defined(__cplusplus)
469 #define HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \
470  __has_cpp_attribute(attribute)
471 #else
472 #define HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \
473  HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
474 #endif
475 
476 #if defined(HEDLEY_GCC_HAS_CPP_ATTRIBUTE)
477 #undef HEDLEY_GCC_HAS_CPP_ATTRIBUTE
478 #endif
479 #if defined(__has_cpp_attribute) && defined(__cplusplus)
480 #define HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \
481  __has_cpp_attribute(attribute)
482 #else
483 #define HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \
484  HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
485 #endif
486 
487 #if defined(HEDLEY_HAS_BUILTIN)
488 #undef HEDLEY_HAS_BUILTIN
489 #endif
490 #if defined(__has_builtin)
491 #define HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin)
492 #else
493 #define HEDLEY_HAS_BUILTIN(builtin) (0)
494 #endif
495 
496 #if defined(HEDLEY_GNUC_HAS_BUILTIN)
497 #undef HEDLEY_GNUC_HAS_BUILTIN
498 #endif
499 #if defined(__has_builtin)
500 #define HEDLEY_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
501  __has_builtin(builtin)
502 #else
503 #define HEDLEY_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
504  HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
505 #endif
506 
507 #if defined(HEDLEY_GCC_HAS_BUILTIN)
508 #undef HEDLEY_GCC_HAS_BUILTIN
509 #endif
510 #if defined(__has_builtin)
511 #define HEDLEY_GCC_HAS_BUILTIN(builtin, major, minor, patch) \
512  __has_builtin(builtin)
513 #else
514 #define HEDLEY_GCC_HAS_BUILTIN(builtin, major, minor, patch) \
515  HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
516 #endif
517 
518 #if defined(HEDLEY_HAS_FEATURE)
519 #undef HEDLEY_HAS_FEATURE
520 #endif
521 #if defined(__has_feature)
522 #define HEDLEY_HAS_FEATURE(feature) __has_feature(feature)
523 #else
524 #define HEDLEY_HAS_FEATURE(feature) (0)
525 #endif
526 
527 #if defined(HEDLEY_GNUC_HAS_FEATURE)
528 #undef HEDLEY_GNUC_HAS_FEATURE
529 #endif
530 #if defined(__has_feature)
531 #define HEDLEY_GNUC_HAS_FEATURE(feature, major, minor, patch) \
532  __has_feature(feature)
533 #else
534 #define HEDLEY_GNUC_HAS_FEATURE(feature, major, minor, patch) \
535  HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
536 #endif
537 
538 #if defined(HEDLEY_GCC_HAS_FEATURE)
539 #undef HEDLEY_GCC_HAS_FEATURE
540 #endif
541 #if defined(__has_feature)
542 #define HEDLEY_GCC_HAS_FEATURE(feature, major, minor, patch) \
543  __has_feature(feature)
544 #else
545 #define HEDLEY_GCC_HAS_FEATURE(feature, major, minor, patch) \
546  HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
547 #endif
548 
549 #if defined(HEDLEY_HAS_EXTENSION)
550 #undef HEDLEY_HAS_EXTENSION
551 #endif
552 #if defined(__has_extension)
553 #define HEDLEY_HAS_EXTENSION(extension) __has_extension(extension)
554 #else
555 #define HEDLEY_HAS_EXTENSION(extension) (0)
556 #endif
557 
558 #if defined(HEDLEY_GNUC_HAS_EXTENSION)
559 #undef HEDLEY_GNUC_HAS_EXTENSION
560 #endif
561 #if defined(__has_extension)
562 #define HEDLEY_GNUC_HAS_EXTENSION(extension, major, minor, patch) \
563  __has_extension(extension)
564 #else
565 #define HEDLEY_GNUC_HAS_EXTENSION(extension, major, minor, patch) \
566  HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
567 #endif
568 
569 #if defined(HEDLEY_GCC_HAS_EXTENSION)
570 #undef HEDLEY_GCC_HAS_EXTENSION
571 #endif
572 #if defined(__has_extension)
573 #define HEDLEY_GCC_HAS_EXTENSION(extension, major, minor, patch) \
574  __has_extension(extension)
575 #else
576 #define HEDLEY_GCC_HAS_EXTENSION(extension, major, minor, patch) \
577  HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
578 #endif
579 
580 #if defined(HEDLEY_HAS_DECLSPEC_ATTRIBUTE)
581 #undef HEDLEY_HAS_DECLSPEC_ATTRIBUTE
582 #endif
583 #if defined(__has_declspec_attribute)
584 #define HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) \
585  __has_declspec_attribute(attribute)
586 #else
587 #define HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0)
588 #endif
589 
590 #if defined(HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE)
591 #undef HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
592 #endif
593 #if defined(__has_declspec_attribute)
594 #define HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \
595  __has_declspec_attribute(attribute)
596 #else
597 #define HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \
598  HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
599 #endif
600 
601 #if defined(HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE)
602 #undef HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
603 #endif
604 #if defined(__has_declspec_attribute)
605 #define HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \
606  __has_declspec_attribute(attribute)
607 #else
608 #define HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \
609  HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
610 #endif
611 
612 #if defined(HEDLEY_HAS_WARNING)
613 #undef HEDLEY_HAS_WARNING
614 #endif
615 #if defined(__has_warning)
616 #define HEDLEY_HAS_WARNING(warning) __has_warning(warning)
617 #else
618 #define HEDLEY_HAS_WARNING(warning) (0)
619 #endif
620 
621 #if defined(HEDLEY_GNUC_HAS_WARNING)
622 #undef HEDLEY_GNUC_HAS_WARNING
623 #endif
624 #if defined(__has_warning)
625 #define HEDLEY_GNUC_HAS_WARNING(warning, major, minor, patch) \
626  __has_warning(warning)
627 #else
628 #define HEDLEY_GNUC_HAS_WARNING(warning, major, minor, patch) \
629  HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
630 #endif
631 
632 #if defined(HEDLEY_GCC_HAS_WARNING)
633 #undef HEDLEY_GCC_HAS_WARNING
634 #endif
635 #if defined(__has_warning)
636 #define HEDLEY_GCC_HAS_WARNING(warning, major, minor, patch) \
637  __has_warning(warning)
638 #else
639 #define HEDLEY_GCC_HAS_WARNING(warning, major, minor, patch) \
640  HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
641 #endif
642 
643 #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
644  defined(__clang__) || HEDLEY_GCC_VERSION_CHECK(3, 0, 0) || \
645  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
646  HEDLEY_IAR_VERSION_CHECK(8, 0, 0) || \
647  HEDLEY_PGI_VERSION_CHECK(18, 4, 0) || \
648  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
649  HEDLEY_TI_VERSION_CHECK(6, 0, 0) || \
650  HEDLEY_CRAY_VERSION_CHECK(5, 0, 0) || \
651  HEDLEY_TINYC_VERSION_CHECK(0, 9, 17) || \
652  HEDLEY_SUNPRO_VERSION_CHECK(8, 0, 0) || \
653  (HEDLEY_IBM_VERSION_CHECK(10, 1, 0) && defined(__C99_PRAGMA_OPERATOR))
654 #define HEDLEY_PRAGMA(value) _Pragma(#value)
655 #elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0)
656 #define HEDLEY_PRAGMA(value) __pragma(value)
657 #else
658 #define HEDLEY_PRAGMA(value)
659 #endif
660 
661 #if defined(HEDLEY_DIAGNOSTIC_PUSH)
662 #undef HEDLEY_DIAGNOSTIC_PUSH
663 #endif
664 #if defined(HEDLEY_DIAGNOSTIC_POP)
665 #undef HEDLEY_DIAGNOSTIC_POP
666 #endif
667 #if defined(__clang__)
668 #define HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
669 #define HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
670 #elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
671 #define HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
672 #define HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
673 #elif HEDLEY_GCC_VERSION_CHECK(4, 6, 0)
674 #define HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
675 #define HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
676 #elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0)
677 #define HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push))
678 #define HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop))
679 #elif HEDLEY_ARM_VERSION_CHECK(5, 6, 0)
680 #define HEDLEY_DIAGNOSTIC_PUSH _Pragma("push")
681 #define HEDLEY_DIAGNOSTIC_POP _Pragma("pop")
682 #elif HEDLEY_TI_VERSION_CHECK(8, 1, 0)
683 #define HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push")
684 #define HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop")
685 #elif HEDLEY_PELLES_VERSION_CHECK(2, 90, 0)
686 #define HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
687 #define HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
688 #else
689 #define HEDLEY_DIAGNOSTIC_PUSH
690 #define HEDLEY_DIAGNOSTIC_POP
691 #endif
692 
693 #if defined(HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED)
694 #undef HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
695 #endif
696 #if HEDLEY_HAS_WARNING("-Wdeprecated-declarations")
697 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
698  _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
699 #elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
700 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
701  _Pragma("warning(disable:1478 1786)")
702 #elif HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
703 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
704 #elif HEDLEY_GCC_VERSION_CHECK(4, 3, 0)
705 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
706  _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
707 #elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0)
708 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable : 4996))
709 #elif HEDLEY_TI_VERSION_CHECK(8, 0, 0)
710 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718")
711 #elif HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) && !defined(__cplusplus)
712 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
713  _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)")
714 #elif HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) && defined(__cplusplus)
715 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
716  _Pragma("error_messages(off,symdeprecated,symdeprecated2)")
717 #elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
718 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
719  _Pragma("diag_suppress=Pe1444,Pe1215")
720 #elif HEDLEY_PELLES_VERSION_CHECK(2, 90, 0)
721 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)")
722 #else
723 #define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
724 #endif
725 
726 #if defined(HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS)
727 #undef HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
728 #endif
729 #if HEDLEY_HAS_WARNING("-Wunknown-pragmas")
730 #define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
731  _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"")
732 #elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
733 #define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
734  _Pragma("warning(disable:161)")
735 #elif HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
736 #define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675")
737 #elif HEDLEY_GCC_VERSION_CHECK(4, 3, 0)
738 #define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
739  _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"")
740 #elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0)
741 #define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
742  __pragma(warning(disable : 4068))
743 #elif HEDLEY_TI_VERSION_CHECK(8, 0, 0)
744 #define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
745 #elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
746 #define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161")
747 #else
748 #define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
749 #endif
750 
751 #if defined(HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL)
752 #undef HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
753 #endif
754 #if HEDLEY_HAS_WARNING("-Wcast-qual")
755 #define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
756  _Pragma("clang diagnostic ignored \"-Wcast-qual\"")
757 #elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
758 #define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
759  _Pragma("warning(disable:2203 2331)")
760 #elif HEDLEY_GCC_VERSION_CHECK(3, 0, 0)
761 #define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
762  _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
763 #else
764 #define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
765 #endif
766 
767 #if defined(HEDLEY_DEPRECATED)
768 #undef HEDLEY_DEPRECATED
769 #endif
770 #if defined(HEDLEY_DEPRECATED_FOR)
771 #undef HEDLEY_DEPRECATED_FOR
772 #endif
773 #if defined(__cplusplus) && (__cplusplus >= 201402L)
774 #define HEDLEY_DEPRECATED(since) [[deprecated("Since " #since)]]
775 #define HEDLEY_DEPRECATED_FOR(since, replacement) \
776  [[deprecated("Since " #since "; use " #replacement)]]
777 #elif HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \
778  HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || \
779  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
780  HEDLEY_ARM_VERSION_CHECK(5, 6, 0) || \
781  HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) || \
782  HEDLEY_PGI_VERSION_CHECK(17, 10, 0) || \
783  HEDLEY_TI_VERSION_CHECK(8, 3, 0)
784 #define HEDLEY_DEPRECATED(since) \
785  __attribute__((__deprecated__("Since " #since)))
786 #define HEDLEY_DEPRECATED_FOR(since, replacement) \
787  __attribute__((__deprecated__("Since " #since "; use " #replacement)))
788 #elif HEDLEY_HAS_ATTRIBUTE(deprecated) || HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \
789  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
790  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
791  (HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \
792  defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
793 #define HEDLEY_DEPRECATED(since) __attribute__((__deprecated__))
794 #define HEDLEY_DEPRECATED_FOR(since, replacement) \
795  __attribute__((__deprecated__))
796 #elif HEDLEY_MSVC_VERSION_CHECK(14, 0, 0)
797 #define HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " #since))
798 #define HEDLEY_DEPRECATED_FOR(since, replacement) \
799  __declspec(deprecated("Since " #since "; use " #replacement))
800 #elif HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \
801  HEDLEY_PELLES_VERSION_CHECK(6, 50, 0)
802 #define HEDLEY_DEPRECATED(since) __declspec(deprecated)
803 #define HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated)
804 #elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
805 #define HEDLEY_DEPRECATED(since) _Pragma("deprecated")
806 #define HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated")
807 #else
808 #define HEDLEY_DEPRECATED(since)
809 #define HEDLEY_DEPRECATED_FOR(since, replacement)
810 #endif
811 
812 #if defined(HEDLEY_UNAVAILABLE)
813 #undef HEDLEY_UNAVAILABLE
814 #endif
815 #if HEDLEY_HAS_ATTRIBUTE(warning) || HEDLEY_GCC_VERSION_CHECK(4, 3, 0) || \
816  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
817 #define HEDLEY_UNAVAILABLE(available_since) \
818  __attribute__((__warning__("Not available until " #available_since)))
819 #else
820 #define HEDLEY_UNAVAILABLE(available_since)
821 #endif
822 
823 #if defined(HEDLEY_WARN_UNUSED_RESULT)
824 #undef HEDLEY_WARN_UNUSED_RESULT
825 #endif
826 #if defined(__cplusplus) && (__cplusplus >= 201703L)
827 #define HEDLEY_WARN_UNUSED_RESULT [[nodiscard]]
828 #elif HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \
829  HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || \
830  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
831  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
832  (HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \
833  defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
834  (HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0) && defined(__cplusplus)) || \
835  HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
836 #define HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
837 #elif defined(_Check_return_) /* SAL */
838 #define HEDLEY_WARN_UNUSED_RESULT _Check_return_
839 #else
840 #define HEDLEY_WARN_UNUSED_RESULT
841 #endif
842 
843 #if defined(HEDLEY_SENTINEL)
844 #undef HEDLEY_SENTINEL
845 #endif
846 #if HEDLEY_HAS_ATTRIBUTE(sentinel) || HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || \
847  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
848  HEDLEY_ARM_VERSION_CHECK(5, 4, 0)
849 #define HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position)))
850 #else
851 #define HEDLEY_SENTINEL(position)
852 #endif
853 
854 #if defined(HEDLEY_NO_RETURN)
855 #undef HEDLEY_NO_RETURN
856 #endif
857 #if HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
858 #define HEDLEY_NO_RETURN __noreturn
859 #elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
860 #define HEDLEY_NO_RETURN __attribute__((__noreturn__))
861 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
862 #define HEDLEY_NO_RETURN _Noreturn
863 #elif defined(__cplusplus) && (__cplusplus >= 201103L)
864 #define HEDLEY_NO_RETURN [[noreturn]]
865 #elif HEDLEY_HAS_ATTRIBUTE(noreturn) || HEDLEY_GCC_VERSION_CHECK(3, 2, 0) || \
866  HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
867  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
868  HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
869  HEDLEY_TI_VERSION_CHECK(18, 0, 0) || \
870  (HEDLEY_TI_VERSION_CHECK(17, 3, 0) && \
871  defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
872 #define HEDLEY_NO_RETURN __attribute__((__noreturn__))
873 #elif HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0)
874 #define HEDLEY_NO_RETURN _Pragma("does_not_return")
875 #elif HEDLEY_MSVC_VERSION_CHECK(13, 10, 0)
876 #define HEDLEY_NO_RETURN __declspec(noreturn)
877 #elif HEDLEY_TI_VERSION_CHECK(6, 0, 0) && defined(__cplusplus)
878 #define HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;")
879 #elif HEDLEY_COMPCERT_VERSION_CHECK(3, 2, 0)
880 #define HEDLEY_NO_RETURN __attribute((noreturn))
881 #elif HEDLEY_PELLES_VERSION_CHECK(9, 0, 0)
882 #define HEDLEY_NO_RETURN __declspec(noreturn)
883 #else
884 #define HEDLEY_NO_RETURN
885 #endif
886 
887 #if defined(HEDLEY_UNREACHABLE)
888 #undef HEDLEY_UNREACHABLE
889 #endif
890 #if defined(HEDLEY_UNREACHABLE_RETURN)
891 #undef HEDLEY_UNREACHABLE_RETURN
892 #endif
893 #if (HEDLEY_HAS_BUILTIN(__builtin_unreachable) && \
894  (!defined(HEDLEY_ARM_VERSION))) || \
895  HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || \
896  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
897  HEDLEY_IBM_VERSION_CHECK(13, 1, 5)
898 #define HEDLEY_UNREACHABLE() __builtin_unreachable()
899 #elif HEDLEY_MSVC_VERSION_CHECK(13, 10, 0)
900 #define HEDLEY_UNREACHABLE() __assume(0)
901 #elif HEDLEY_TI_VERSION_CHECK(6, 0, 0)
902 #if defined(__cplusplus)
903 #define HEDLEY_UNREACHABLE() std::_nassert(0)
904 #else
905 #define HEDLEY_UNREACHABLE() _nassert(0)
906 #endif
907 #define HEDLEY_UNREACHABLE_RETURN(value) return value
908 #elif defined(EXIT_FAILURE)
909 #define HEDLEY_UNREACHABLE() abort()
910 #else
911 #define HEDLEY_UNREACHABLE()
912 #define HEDLEY_UNREACHABLE_RETURN(value) return value
913 #endif
914 #if !defined(HEDLEY_UNREACHABLE_RETURN)
915 #define HEDLEY_UNREACHABLE_RETURN(value) HEDLEY_UNREACHABLE()
916 #endif
917 
918 #if defined(HEDLEY_ASSUME)
919 #undef HEDLEY_ASSUME
920 #endif
921 #if HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
922 #define HEDLEY_ASSUME(expr) __assume(expr)
923 #elif HEDLEY_HAS_BUILTIN(__builtin_assume)
924 #define HEDLEY_ASSUME(expr) __builtin_assume(expr)
925 #elif HEDLEY_TI_VERSION_CHECK(6, 0, 0)
926 #if defined(__cplusplus)
927 #define HEDLEY_ASSUME(expr) std::_nassert(expr)
928 #else
929 #define HEDLEY_ASSUME(expr) _nassert(expr)
930 #endif
931 #elif (HEDLEY_HAS_BUILTIN(__builtin_unreachable) && \
932  !defined(HEDLEY_ARM_VERSION)) || \
933  HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || \
934  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
935  HEDLEY_IBM_VERSION_CHECK(13, 1, 5)
936 #define HEDLEY_ASSUME(expr) ((void)((expr) ? 1 : (__builtin_unreachable(), 1)))
937 #else
938 #define HEDLEY_ASSUME(expr) ((void)(expr))
939 #endif
940 
942 #if HEDLEY_HAS_WARNING("-Wvariadic-macros") || HEDLEY_GCC_VERSION_CHECK(4, 0, 0)
943 #if defined(__clang__)
944 #pragma clang diagnostic ignored "-Wvariadic-macros"
945 #elif defined(HEDLEY_GCC_VERSION)
946 #pragma GCC diagnostic ignored "-Wvariadic-macros"
947 #endif
948 #endif
949 #if defined(HEDLEY_NON_NULL)
950 #undef HEDLEY_NON_NULL
951 #endif
952 #if HEDLEY_HAS_ATTRIBUTE(nonnull) || HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \
953  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
954  HEDLEY_ARM_VERSION_CHECK(4, 1, 0)
955 #define HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
956 #else
957 #define HEDLEY_NON_NULL(...)
958 #endif
960 
961 #if defined(HEDLEY_PRINTF_FORMAT)
962 #undef HEDLEY_PRINTF_FORMAT
963 #endif
964 #if defined(__MINGW32__) && HEDLEY_GCC_HAS_ATTRIBUTE(format, 4, 4, 0) && \
965  !defined(__USE_MINGW_ANSI_STDIO)
966 #define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \
967  __attribute__((__format__(ms_printf, string_idx, first_to_check)))
968 #elif defined(__MINGW32__) && HEDLEY_GCC_HAS_ATTRIBUTE(format, 4, 4, 0) && \
969  defined(__USE_MINGW_ANSI_STDIO)
970 #define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \
971  __attribute__((__format__(gnu_printf, string_idx, first_to_check)))
972 #elif HEDLEY_HAS_ATTRIBUTE(format) || HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \
973  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
974  HEDLEY_ARM_VERSION_CHECK(5, 6, 0) || \
975  HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
976  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
977  (HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \
978  defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
979 #define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \
980  __attribute__((__format__(__printf__, string_idx, first_to_check)))
981 #elif HEDLEY_PELLES_VERSION_CHECK(6, 0, 0)
982 #define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \
983  __declspec(vaformat(printf, string_idx, first_to_check))
984 #else
985 #define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check)
986 #endif
987 
988 #if defined(HEDLEY_CONSTEXPR)
989 #undef HEDLEY_CONSTEXPR
990 #endif
991 #if defined(__cplusplus)
992 #if __cplusplus >= 201103L
993 #define HEDLEY_CONSTEXPR constexpr
994 #endif
995 #endif
996 #if !defined(HEDLEY_CONSTEXPR)
997 #define HEDLEY_CONSTEXPR
998 #endif
999 
1000 #if defined(HEDLEY_PREDICT)
1001 #undef HEDLEY_PREDICT
1002 #endif
1003 #if defined(HEDLEY_LIKELY)
1004 #undef HEDLEY_LIKELY
1005 #endif
1006 #if defined(HEDLEY_UNLIKELY)
1007 #undef HEDLEY_UNLIKELY
1008 #endif
1009 #if defined(HEDLEY_UNPREDICTABLE)
1010 #undef HEDLEY_UNPREDICTABLE
1011 #endif
1012 #if HEDLEY_HAS_BUILTIN(__builtin_unpredictable)
1013 #define HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable(!!(expr))
1014 #endif
1015 #if HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) || \
1016  HEDLEY_GCC_VERSION_CHECK(9, 0, 0)
1017 #define HEDLEY_PREDICT(expr, value, probability) \
1018  __builtin_expect_with_probability(expr, value, probability)
1019 #define HEDLEY_PREDICT_TRUE(expr, probability) \
1020  __builtin_expect_with_probability(!!(expr), 1, probability)
1021 #define HEDLEY_PREDICT_FALSE(expr, probability) \
1022  __builtin_expect_with_probability(!!(expr), 0, probability)
1023 #define HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1)
1024 #define HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
1025 #if !defined(HEDLEY_BUILTIN_UNPREDICTABLE)
1026 #define HEDLEY_BUILTIN_UNPREDICTABLE(expr) \
1027  __builtin_expect_with_probability(!!(expr), 1, 0.5)
1028 #endif
1029 #elif HEDLEY_HAS_BUILTIN(__builtin_expect) || \
1030  HEDLEY_GCC_VERSION_CHECK(3, 0, 0) || \
1031  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1032  (HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0) && defined(__cplusplus)) || \
1033  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1034  HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1035  HEDLEY_TI_VERSION_CHECK(6, 1, 0) || \
1036  HEDLEY_TINYC_VERSION_CHECK(0, 9, 27)
1037 #define HEDLEY_PREDICT(expr, expected, probability) \
1038  (((probability) >= 0.9) ? __builtin_expect(!!(expr), (expected)) \
1039  : (((void)(expected)), !!(expr)))
1040 #define HEDLEY_PREDICT_TRUE(expr, probability) \
1041  (__extension__({ \
1042  HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \
1043  ((hedley_probability_ >= 0.9) \
1044  ? __builtin_expect(!!(expr), 1) \
1045  : ((hedley_probability_ <= 0.1) \
1046  ? __builtin_expect(!!(expr), 0) \
1047  : !!(expr))); \
1048  }))
1049 #define HEDLEY_PREDICT_FALSE(expr, probability) \
1050  (__extension__({ \
1051  HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \
1052  ((hedley_probability_ >= 0.9) \
1053  ? __builtin_expect(!!(expr), 0) \
1054  : ((hedley_probability_ <= 0.1) \
1055  ? __builtin_expect(!!(expr), 1) \
1056  : !!(expr))); \
1057  }))
1058 #define HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1)
1059 #define HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
1060 #else
1061 #define HEDLEY_PREDICT(expr, expected, probability) \
1062  (((void)(expected)), !!(expr))
1063 #define HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr))
1064 #define HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr))
1065 #define HEDLEY_LIKELY(expr) (!!(expr))
1066 #define HEDLEY_UNLIKELY(expr) (!!(expr))
1067 #endif
1068 #if !defined(HEDLEY_UNPREDICTABLE)
1069 #define HEDLEY_UNPREDICTABLE(expr) HEDLEY_PREDICT(expr, 1, 0.5)
1070 #endif
1071 
1072 #if defined(HEDLEY_MALLOC)
1073 #undef HEDLEY_MALLOC
1074 #endif
1075 #if HEDLEY_HAS_ATTRIBUTE(malloc) || HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \
1076  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1077  HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1078  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1079  HEDLEY_IBM_VERSION_CHECK(12, 1, 0) || \
1080  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
1081  (HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \
1082  defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
1083 #define HEDLEY_MALLOC __attribute__((__malloc__))
1084 #elif HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0)
1085 #define HEDLEY_MALLOC _Pragma("returns_new_memory")
1086 #elif HEDLEY_MSVC_VERSION_CHECK(14, 0, 0)
1087 #define HEDLEY_MALLOC __declspec(restrict)
1088 #else
1089 #define HEDLEY_MALLOC
1090 #endif
1091 
1092 #if defined(HEDLEY_PURE)
1093 #undef HEDLEY_PURE
1094 #endif
1095 #if HEDLEY_HAS_ATTRIBUTE(pure) || HEDLEY_GCC_VERSION_CHECK(2, 96, 0) || \
1096  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1097  HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1098  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1099  HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1100  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
1101  (HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \
1102  defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1103  HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
1104 #define HEDLEY_PURE __attribute__((__pure__))
1105 #elif HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0)
1106 #define HEDLEY_PURE _Pragma("does_not_write_global_data")
1107 #elif HEDLEY_TI_VERSION_CHECK(6, 0, 0) && defined(__cplusplus)
1108 #define HEDLEY_PURE _Pragma("FUNC_IS_PURE;")
1109 #else
1110 #define HEDLEY_PURE
1111 #endif
1112 
1113 #if defined(HEDLEY_CONST)
1114 #undef HEDLEY_CONST
1115 #endif
1116 #if HEDLEY_HAS_ATTRIBUTE(const) || HEDLEY_GCC_VERSION_CHECK(2, 5, 0) || \
1117  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1118  HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1119  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1120  HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1121  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
1122  (HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \
1123  defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1124  HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
1125 #define HEDLEY_CONST __attribute__((__const__))
1126 #elif HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0)
1127 #define HEDLEY_CONST _Pragma("no_side_effect")
1128 #else
1129 #define HEDLEY_CONST HEDLEY_PURE
1130 #endif
1131 
1132 #if defined(HEDLEY_RESTRICT)
1133 #undef HEDLEY_RESTRICT
1134 #endif
1135 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
1136  !defined(__cplusplus)
1137 #define HEDLEY_RESTRICT restrict
1138 #elif HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \
1139  HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) || \
1140  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1141  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1142  HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1143  HEDLEY_PGI_VERSION_CHECK(17, 10, 0) || \
1144  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
1145  (HEDLEY_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus)) || \
1146  HEDLEY_IAR_VERSION_CHECK(8, 0, 0) || defined(__clang__)
1147 #define HEDLEY_RESTRICT __restrict
1148 #elif HEDLEY_SUNPRO_VERSION_CHECK(5, 3, 0) && !defined(__cplusplus)
1149 #define HEDLEY_RESTRICT _Restrict
1150 #else
1151 #define HEDLEY_RESTRICT
1152 #endif
1153 
1154 #if defined(HEDLEY_INLINE)
1155 #undef HEDLEY_INLINE
1156 #endif
1157 #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
1158  (defined(__cplusplus) && (__cplusplus >= 199711L))
1159 #define HEDLEY_INLINE inline
1160 #elif defined(HEDLEY_GCC_VERSION) || HEDLEY_ARM_VERSION_CHECK(6, 2, 0)
1161 #define HEDLEY_INLINE __inline__
1162 #elif HEDLEY_MSVC_VERSION_CHECK(12, 0, 0) || \
1163  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_TI_VERSION_CHECK(8, 0, 0)
1164 #define HEDLEY_INLINE __inline
1165 #else
1166 #define HEDLEY_INLINE
1167 #endif
1168 
1169 #if defined(HEDLEY_ALWAYS_INLINE)
1170 #undef HEDLEY_ALWAYS_INLINE
1171 #endif
1172 #if HEDLEY_HAS_ATTRIBUTE(always_inline) || \
1173  HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || \
1174  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1175  HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1176  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1177  HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1178  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
1179  (HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \
1180  defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
1181 #define HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) HEDLEY_INLINE
1182 #elif HEDLEY_MSVC_VERSION_CHECK(12, 0, 0)
1183 #define HEDLEY_ALWAYS_INLINE __forceinline
1184 #elif HEDLEY_TI_VERSION_CHECK(7, 0, 0) && defined(__cplusplus)
1185 #define HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;")
1186 #elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1187 #define HEDLEY_ALWAYS_INLINE _Pragma("inline=forced")
1188 #else
1189 #define HEDLEY_ALWAYS_INLINE HEDLEY_INLINE
1190 #endif
1191 
1192 #if defined(HEDLEY_NEVER_INLINE)
1193 #undef HEDLEY_NEVER_INLINE
1194 #endif
1195 #if HEDLEY_HAS_ATTRIBUTE(noinline) || HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || \
1196  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1197  HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1198  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1199  HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1200  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
1201  (HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \
1202  defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
1203 #define HEDLEY_NEVER_INLINE __attribute__((__noinline__))
1204 #elif HEDLEY_MSVC_VERSION_CHECK(13, 10, 0)
1205 #define HEDLEY_NEVER_INLINE __declspec(noinline)
1206 #elif HEDLEY_PGI_VERSION_CHECK(10, 2, 0)
1207 #define HEDLEY_NEVER_INLINE _Pragma("noinline")
1208 #elif HEDLEY_TI_VERSION_CHECK(6, 0, 0) && defined(__cplusplus)
1209 #define HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;")
1210 #elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1211 #define HEDLEY_NEVER_INLINE _Pragma("inline=never")
1212 #elif HEDLEY_COMPCERT_VERSION_CHECK(3, 2, 0)
1213 #define HEDLEY_NEVER_INLINE __attribute((noinline))
1214 #elif HEDLEY_PELLES_VERSION_CHECK(9, 0, 0)
1215 #define HEDLEY_NEVER_INLINE __declspec(noinline)
1216 #else
1217 #define HEDLEY_NEVER_INLINE
1218 #endif
1219 
1220 #if defined(HEDLEY_PRIVATE)
1221 #undef HEDLEY_PRIVATE
1222 #endif
1223 #if defined(HEDLEY_PUBLIC)
1224 #undef HEDLEY_PUBLIC
1225 #endif
1226 #if defined(HEDLEY_IMPORT)
1227 #undef HEDLEY_IMPORT
1228 #endif
1229 #if defined(_WIN32) || defined(__CYGWIN__)
1230 #define HEDLEY_PRIVATE
1231 #define HEDLEY_PUBLIC __declspec(dllexport)
1232 #define HEDLEY_IMPORT __declspec(dllimport)
1233 #else
1234 #if HEDLEY_HAS_ATTRIBUTE(visibility) || HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \
1235  HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1236  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1237  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1238  HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \
1239  HEDLEY_TI_VERSION_CHECK(8, 0, 0) || \
1240  (HEDLEY_TI_VERSION_CHECK(7, 3, 0) && defined(__TI_EABI__) && \
1241  defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
1242 #define HEDLEY_PRIVATE __attribute__((__visibility__("hidden")))
1243 #define HEDLEY_PUBLIC __attribute__((__visibility__("default")))
1244 #else
1245 #define HEDLEY_PRIVATE
1246 #define HEDLEY_PUBLIC
1247 #endif
1248 #define HEDLEY_IMPORT extern
1249 #endif
1250 
1251 #if defined(HEDLEY_NO_THROW)
1252 #undef HEDLEY_NO_THROW
1253 #endif
1254 #if HEDLEY_HAS_ATTRIBUTE(nothrow) || HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \
1255  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1256 #define HEDLEY_NO_THROW __attribute__((__nothrow__))
1257 #elif HEDLEY_MSVC_VERSION_CHECK(13, 1, 0) || HEDLEY_ARM_VERSION_CHECK(4, 1, 0)
1258 #define HEDLEY_NO_THROW __declspec(nothrow)
1259 #else
1260 #define HEDLEY_NO_THROW
1261 #endif
1262 
1263 #if defined(HEDLEY_FALL_THROUGH)
1264 #undef HEDLEY_FALL_THROUGH
1265 #endif
1266 #if defined(__cplusplus) && \
1267  (!defined(HEDLEY_SUNPRO_VERSION) || \
1268  HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0)) && \
1269  !defined(HEDLEY_PGI_VERSION)
1270 #if (__cplusplus >= 201703L) || \
1271  ((__cplusplus >= 201103L) && HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough))
1272 #define HEDLEY_FALL_THROUGH [[fallthrough]]
1273 #elif (__cplusplus >= 201103L) && HEDLEY_HAS_CPP_ATTRIBUTE(clang::fallthrough)
1274 #define HEDLEY_FALL_THROUGH [[clang::fallthrough]]
1275 #elif (__cplusplus >= 201103L) && HEDLEY_GCC_VERSION_CHECK(7, 0, 0)
1276 #define HEDLEY_FALL_THROUGH [[gnu::fallthrough]]
1277 #endif
1278 #endif
1279 #if !defined(HEDLEY_FALL_THROUGH)
1280 #if HEDLEY_GNUC_HAS_ATTRIBUTE(fallthrough, 7, 0, 0) && \
1281  !defined(HEDLEY_PGI_VERSION)
1282 #define HEDLEY_FALL_THROUGH __attribute__((__fallthrough__))
1283 #elif defined(__fallthrough) /* SAL */
1284 #define HEDLEY_FALL_THROUGH __fallthrough
1285 #else
1286 #define HEDLEY_FALL_THROUGH
1287 #endif
1288 #endif
1289 
1290 #if defined(HEDLEY_RETURNS_NON_NULL)
1291 #undef HEDLEY_RETURNS_NON_NULL
1292 #endif
1293 #if HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || HEDLEY_GCC_VERSION_CHECK(4, 9, 0)
1294 #define HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__))
1295 #elif defined(_Ret_notnull_) /* SAL */
1296 #define HEDLEY_RETURNS_NON_NULL _Ret_notnull_
1297 #else
1298 #define HEDLEY_RETURNS_NON_NULL
1299 #endif
1300 
1301 #if defined(HEDLEY_ARRAY_PARAM)
1302 #undef HEDLEY_ARRAY_PARAM
1303 #endif
1304 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
1305  !defined(__STDC_NO_VLA__) && !defined(__cplusplus) && \
1306  !defined(HEDLEY_PGI_VERSION) && !defined(HEDLEY_TINYC_VERSION)
1307 #define HEDLEY_ARRAY_PARAM(name) (name)
1308 #else
1309 #define HEDLEY_ARRAY_PARAM(name)
1310 #endif
1311 
1312 #if defined(HEDLEY_IS_CONSTANT)
1313 #undef HEDLEY_IS_CONSTANT
1314 #endif
1315 #if defined(HEDLEY_REQUIRE_CONSTEXPR)
1316 #undef HEDLEY_REQUIRE_CONSTEXPR
1317 #endif
1318 /* Note the double-underscore. For internal use only; no API
1319  * guarantees! */
1320 #if defined(HEDLEY__IS_CONSTEXPR)
1321 #undef HEDLEY__IS_CONSTEXPR
1322 #endif
1323 
1324 #if HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \
1325  HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || \
1326  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1327  HEDLEY_TINYC_VERSION_CHECK(0, 9, 19) || \
1328  HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1329  HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \
1330  HEDLEY_TI_VERSION_CHECK(6, 1, 0) || \
1331  (HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0) && !defined(__cplusplus)) || \
1332  HEDLEY_CRAY_VERSION_CHECK(8, 1, 0)
1333 #define HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr)
1334 #endif
1335 #if !defined(__cplusplus)
1336 #if HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \
1337  HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || \
1338  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1339  HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \
1340  HEDLEY_CRAY_VERSION_CHECK(8, 1, 0) || \
1341  HEDLEY_ARM_VERSION_CHECK(5, 4, 0) || \
1342  HEDLEY_TINYC_VERSION_CHECK(0, 9, 24)
1343 #if defined(__INTPTR_TYPE__)
1344 #define HEDLEY__IS_CONSTEXPR(expr) \
1345  __builtin_types_compatible_p( \
1346  __typeof__((1 ? (void *)((__INTPTR_TYPE__)((expr)*0)) \
1347  : (int *)0)), \
1348  int *)
1349 #else
1350 #include <stdint.h>
1351 #define HEDLEY__IS_CONSTEXPR(expr) \
1352  __builtin_types_compatible_p( \
1353  __typeof__((1 ? (void *)((intptr_t)((expr)*0)) : (int *)0)), \
1354  int *)
1355 #endif
1356 #elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \
1357  !defined(HEDLEY_SUNPRO_VERSION) && !defined(HEDLEY_PGI_VERSION)) || \
1358  HEDLEY_HAS_EXTENSION(c_generic_selections) || \
1359  HEDLEY_GCC_VERSION_CHECK(4, 9, 0) || \
1360  HEDLEY_INTEL_VERSION_CHECK(17, 0, 0) || \
1361  HEDLEY_IBM_VERSION_CHECK(12, 1, 0) || \
1362  HEDLEY_ARM_VERSION_CHECK(5, 3, 0)
1363 #if defined(__INTPTR_TYPE__)
1364 #define HEDLEY__IS_CONSTEXPR(expr) \
1365  _Generic((1 ? (void *)((__INTPTR_TYPE__)((expr)*0)) : (int *)0), \
1366  int * : 1, void * : 0)
1367 #else
1368 #include <stdint.h>
1369 #define HEDLEY__IS_CONSTEXPR(expr) \
1370  _Generic((1 ? (void *)((intptr_t)*0) : (int *)0), int * : 1, void * : 0)
1371 #endif
1372 #elif defined(HEDLEY_GCC_VERSION) || defined(HEDLEY_INTEL_VERSION) || \
1373  defined(HEDLEY_TINYC_VERSION) || defined(HEDLEY_TI_VERSION) || \
1374  defined(__clang__)
1375 #define HEDLEY__IS_CONSTEXPR(expr) \
1376  (sizeof(void) != sizeof(*(1 ? ((void *)((expr)*0L)) : ((struct { \
1377  char v[sizeof(void) * 2]; \
1378  } *)1))))
1379 #endif
1380 #endif
1381 #if defined(HEDLEY__IS_CONSTEXPR)
1382 #if !defined(HEDLEY_IS_CONSTANT)
1383 #define HEDLEY_IS_CONSTANT(expr) HEDLEY__IS_CONSTEXPR(expr)
1384 #endif
1385 #define HEDLEY_REQUIRE_CONSTEXPR(expr) \
1386  (HEDLEY__IS_CONSTEXPR(expr) ? (expr) : (-1))
1387 #else
1388 #if !defined(HEDLEY_IS_CONSTANT)
1389 #define HEDLEY_IS_CONSTANT(expr) (0)
1390 #endif
1391 #define HEDLEY_REQUIRE_CONSTEXPR(expr) (expr)
1392 #endif
1393 
1394 #if defined(HEDLEY_BEGIN_C_DECLS)
1395 #undef HEDLEY_BEGIN_C_DECLS
1396 #endif
1397 #if defined(HEDLEY_END_C_DECLS)
1398 #undef HEDLEY_END_C_DECLS
1399 #endif
1400 #if defined(HEDLEY_C_DECL)
1401 #undef HEDLEY_C_DECL
1402 #endif
1403 #if defined(__cplusplus)
1404 #define HEDLEY_BEGIN_C_DECLS extern "C" {
1405 #define HEDLEY_END_C_DECLS }
1406 #define HEDLEY_C_DECL extern "C"
1407 #else
1408 #define HEDLEY_BEGIN_C_DECLS
1409 #define HEDLEY_END_C_DECLS
1410 #define HEDLEY_C_DECL
1411 #endif
1412 
1413 #if defined(HEDLEY_STATIC_ASSERT)
1414 #undef HEDLEY_STATIC_ASSERT
1415 #endif
1416 #if !defined(__cplusplus) && \
1417  ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
1418  HEDLEY_HAS_FEATURE(c_static_assert) || \
1419  HEDLEY_GCC_VERSION_CHECK(6, 0, 0) || \
1420  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || defined(_Static_assert))
1421 #define HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
1422 #elif (defined(__cplusplus) && (__cplusplus >= 201103L)) || \
1423  HEDLEY_MSVC_VERSION_CHECK(16, 0, 0) || \
1424  (defined(__cplusplus) && HEDLEY_TI_VERSION_CHECK(8, 3, 0))
1425 #define HEDLEY_STATIC_ASSERT(expr, message) static_assert(expr, message)
1426 #else
1427 #define HEDLEY_STATIC_ASSERT(expr, message)
1428 #endif
1429 
1430 #if defined(HEDLEY_CONST_CAST)
1431 #undef HEDLEY_CONST_CAST
1432 #endif
1433 #if defined(__cplusplus)
1434 #define HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr))
1435 #elif HEDLEY_HAS_WARNING("-Wcast-qual") || \
1436  HEDLEY_GCC_VERSION_CHECK(4, 6, 0) || \
1437  HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1438 #define HEDLEY_CONST_CAST(T, expr) \
1439  (__extension__({ \
1440  HEDLEY_DIAGNOSTIC_PUSH \
1441  HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL((T)(expr)); \
1442  HEDLEY_DIAGNOSTIC_POP \
1443  }))
1444 #else
1445 #define HEDLEY_CONST_CAST(T, expr) ((T)(expr))
1446 #endif
1447 
1448 #if defined(HEDLEY_REINTERPRET_CAST)
1449 #undef HEDLEY_REINTERPRET_CAST
1450 #endif
1451 #if defined(__cplusplus)
1452 #define HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr))
1453 #else
1454 #define HEDLEY_REINTERPRET_CAST(T, expr) (*((T *)&(expr)))
1455 #endif
1456 
1457 #if defined(HEDLEY_STATIC_CAST)
1458 #undef HEDLEY_STATIC_CAST
1459 #endif
1460 #if defined(__cplusplus)
1461 #define HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr))
1462 #else
1463 #define HEDLEY_STATIC_CAST(T, expr) ((T)(expr))
1464 #endif
1465 
1466 #if defined(HEDLEY_CPP_CAST)
1467 #undef HEDLEY_CPP_CAST
1468 #endif
1469 #if defined(__cplusplus)
1470 #define HEDLEY_CPP_CAST(T, expr) static_cast<T>(expr)
1471 #else
1472 #define HEDLEY_CPP_CAST(T, expr) (expr)
1473 #endif
1474 
1475 #if defined(HEDLEY_MESSAGE)
1476 #undef HEDLEY_MESSAGE
1477 #endif
1478 #if HEDLEY_HAS_WARNING("-Wunknown-pragmas")
1479 #define HEDLEY_MESSAGE(msg) \
1480  HEDLEY_DIAGNOSTIC_PUSH \
1481  HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
1482  HEDLEY_PRAGMA(message msg) \
1483  HEDLEY_DIAGNOSTIC_POP
1484 #elif HEDLEY_GCC_VERSION_CHECK(4, 4, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1485 #define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message msg)
1486 #elif HEDLEY_CRAY_VERSION_CHECK(5, 0, 0)
1487 #define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(_CRI message msg)
1488 #elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1489 #define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message(msg))
1490 #elif HEDLEY_PELLES_VERSION_CHECK(2, 0, 0)
1491 #define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message(msg))
1492 #else
1493 #define HEDLEY_MESSAGE(msg)
1494 #endif
1495 
1496 #if defined(HEDLEY_WARNING)
1497 #undef HEDLEY_WARNING
1498 #endif
1499 #if HEDLEY_HAS_WARNING("-Wunknown-pragmas")
1500 #define HEDLEY_WARNING(msg) \
1501  HEDLEY_DIAGNOSTIC_PUSH \
1502  HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
1503  HEDLEY_PRAGMA(clang warning msg) \
1504  HEDLEY_DIAGNOSTIC_POP
1505 #elif HEDLEY_GCC_VERSION_CHECK(4, 8, 0) || HEDLEY_PGI_VERSION_CHECK(18, 4, 0)
1506 #define HEDLEY_WARNING(msg) HEDLEY_PRAGMA(GCC warning msg)
1507 #elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0)
1508 #define HEDLEY_WARNING(msg) HEDLEY_PRAGMA(message(msg))
1509 #else
1510 #define HEDLEY_WARNING(msg) HEDLEY_MESSAGE(msg)
1511 #endif
1512 
1513 #if defined(HEDLEY_REQUIRE_MSG)
1514 #undef HEDLEY_REQUIRE_MSG
1515 #endif
1516 #if HEDLEY_HAS_ATTRIBUTE(diagnose_if)
1517 #if HEDLEY_HAS_WARNING("-Wgcc-compat")
1518 #define HEDLEY_REQUIRE_MSG(expr, msg) \
1519  HEDLEY_DIAGNOSTIC_PUSH \
1520  _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
1521  __attribute__((__diagnose_if__(!(expr), msg, "error"))) \
1522  HEDLEY_DIAGNOSTIC_POP
1523 #else
1524 #define HEDLEY_REQUIRE_MSG(expr, msg) \
1525  __attribute__((__diagnose_if__(!(expr), msg, "error")))
1526 #endif
1527 #else
1528 #define HEDLEY_REQUIRE_MSG(expr, msg)
1529 #endif
1530 
1531 #if defined(HEDLEY_REQUIRE)
1532 #undef HEDLEY_REQUIRE
1533 #endif
1534 #define HEDLEY_REQUIRE(expr) HEDLEY_REQUIRE_MSG(expr, #expr)
1535 
1536 #if defined(HEDLEY_FLAGS)
1537 #undef HEDLEY_FLAGS
1538 #endif
1539 #if HEDLEY_HAS_ATTRIBUTE(flag_enum)
1540 #define HEDLEY_FLAGS __attribute__((__flag_enum__))
1541 #endif
1542 
1543 #if defined(HEDLEY_FLAGS_CAST)
1544 #undef HEDLEY_FLAGS_CAST
1545 #endif
1546 #if HEDLEY_INTEL_VERSION_CHECK(19, 0, 0)
1547 #define HEDLEY_FLAGS_CAST(T, expr) \
1548  (__extension__({ \
1549  HEDLEY_DIAGNOSTIC_PUSH \
1550  _Pragma("warning(disable:188)")((T)(expr)); \
1551  HEDLEY_DIAGNOSTIC_POP \
1552  }))
1553 #else
1554 #define HEDLEY_FLAGS_CAST(T, expr) HEDLEY_STATIC_CAST(T, expr)
1555 #endif
1556 
1557 #if defined(HEDLEY_EMPTY_BASES)
1558 #undef HEDLEY_EMPTY_BASES
1559 #endif
1560 #if HEDLEY_MSVC_VERSION_CHECK(19, 0, 23918) && \
1561  !HEDLEY_MSVC_VERSION_CHECK(20, 0, 0)
1562 #define HEDLEY_EMPTY_BASES __declspec(empty_bases)
1563 #else
1564 #define HEDLEY_EMPTY_BASES
1565 #endif
1566 
1567 /* Remaining macros are deprecated. */
1568 
1569 #if defined(HEDLEY_GCC_NOT_CLANG_VERSION_CHECK)
1570 #undef HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
1571 #endif
1572 #if defined(__clang__)
1573 #define HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major, minor, patch) (0)
1574 #else
1575 #define HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major, minor, patch) \
1576  HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
1577 #endif
1578 
1579 #if defined(HEDLEY_CLANG_HAS_ATTRIBUTE)
1580 #undef HEDLEY_CLANG_HAS_ATTRIBUTE
1581 #endif
1582 #define HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) HEDLEY_HAS_ATTRIBUTE(attribute)
1583 
1584 #if defined(HEDLEY_CLANG_HAS_CPP_ATTRIBUTE)
1585 #undef HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
1586 #endif
1587 #define HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) \
1588  HEDLEY_HAS_CPP_ATTRIBUTE(attribute)
1589 
1590 #if defined(HEDLEY_CLANG_HAS_BUILTIN)
1591 #undef HEDLEY_CLANG_HAS_BUILTIN
1592 #endif
1593 #define HEDLEY_CLANG_HAS_BUILTIN(builtin) HEDLEY_HAS_BUILTIN(builtin)
1594 
1595 #if defined(HEDLEY_CLANG_HAS_FEATURE)
1596 #undef HEDLEY_CLANG_HAS_FEATURE
1597 #endif
1598 #define HEDLEY_CLANG_HAS_FEATURE(feature) HEDLEY_HAS_FEATURE(feature)
1599 
1600 #if defined(HEDLEY_CLANG_HAS_EXTENSION)
1601 #undef HEDLEY_CLANG_HAS_EXTENSION
1602 #endif
1603 #define HEDLEY_CLANG_HAS_EXTENSION(extension) HEDLEY_HAS_EXTENSION(extension)
1604 
1605 #if defined(HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE)
1606 #undef HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
1607 #endif
1608 #define HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) \
1609  HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute)
1610 
1611 #if defined(HEDLEY_CLANG_HAS_WARNING)
1612 #undef HEDLEY_CLANG_HAS_WARNING
1613 #endif
1614 #define HEDLEY_CLANG_HAS_WARNING(warning) HEDLEY_HAS_WARNING(warning)
1615 
1616 #endif /* !defined(HEDLEY_VERSION) || (HEDLEY_VERSION < X) */
#define HEDLEY_DIAGNOSTIC_POP
Definition: hedley.h:690
#define HEDLEY_DIAGNOSTIC_PUSH
Definition: hedley.h:689