13#if !defined(HEDLEY_VERSION) || (HEDLEY_VERSION < 14)
14#if defined(HEDLEY_VERSION)
17#define HEDLEY_VERSION 14
19#if defined(HEDLEY_STRINGIFY_EX)
20#undef HEDLEY_STRINGIFY_EX
22#define HEDLEY_STRINGIFY_EX(x) #x
24#if defined(HEDLEY_STRINGIFY)
25#undef HEDLEY_STRINGIFY
27#define HEDLEY_STRINGIFY(x) HEDLEY_STRINGIFY_EX(x)
29#if defined(HEDLEY_CONCAT_EX)
30#undef HEDLEY_CONCAT_EX
32#define HEDLEY_CONCAT_EX(a, b) a##b
34#if defined(HEDLEY_CONCAT)
37#define HEDLEY_CONCAT(a, b) HEDLEY_CONCAT_EX(a, b)
39#if defined(HEDLEY_CONCAT3_EX)
40#undef HEDLEY_CONCAT3_EX
42#define HEDLEY_CONCAT3_EX(a, b, c) a##b##c
44#if defined(HEDLEY_CONCAT3)
47#define HEDLEY_CONCAT3(a, b, c) HEDLEY_CONCAT3_EX(a, b, c)
49#if defined(HEDLEY_VERSION_ENCODE)
50#undef HEDLEY_VERSION_ENCODE
52#define HEDLEY_VERSION_ENCODE(major, minor, revision) \
53 (((major) * 1000000) + ((minor) * 1000) + (revision))
55#if defined(HEDLEY_VERSION_DECODE_MAJOR)
56#undef HEDLEY_VERSION_DECODE_MAJOR
58#define HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000)
60#if defined(HEDLEY_VERSION_DECODE_MINOR)
61#undef HEDLEY_VERSION_DECODE_MINOR
63#define HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000)
65#if defined(HEDLEY_VERSION_DECODE_REVISION)
66#undef HEDLEY_VERSION_DECODE_REVISION
68#define HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000)
70#if defined(HEDLEY_GNUC_VERSION)
71#undef HEDLEY_GNUC_VERSION
73#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
74#define HEDLEY_GNUC_VERSION \
75 HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
76#elif defined(__GNUC__)
77#define HEDLEY_GNUC_VERSION HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0)
80#if defined(HEDLEY_GNUC_VERSION_CHECK)
81#undef HEDLEY_GNUC_VERSION_CHECK
83#if defined(HEDLEY_GNUC_VERSION)
84#define HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) \
85 (HEDLEY_GNUC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
87#define HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) (0)
90#if defined(HEDLEY_MSVC_VERSION)
91#undef HEDLEY_MSVC_VERSION
93#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL)
94#define HEDLEY_MSVC_VERSION \
95 HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, \
96 (_MSC_FULL_VER % 10000000) / 100000, \
97 (_MSC_FULL_VER % 100000) / 100)
98#elif defined(_MSC_FULL_VER) && !defined(__ICL)
99#define HEDLEY_MSVC_VERSION \
100 HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, \
101 (_MSC_FULL_VER % 1000000) / 10000, \
102 (_MSC_FULL_VER % 10000) / 10)
103#elif defined(_MSC_VER) && !defined(__ICL)
104#define HEDLEY_MSVC_VERSION \
105 HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0)
108#if defined(HEDLEY_MSVC_VERSION_CHECK)
109#undef HEDLEY_MSVC_VERSION_CHECK
111#if !defined(HEDLEY_MSVC_VERSION)
112#define HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) (0)
113#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
114#define HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) \
115 (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
116#elif defined(_MSC_VER) && (_MSC_VER >= 1200)
117#define HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) \
118 (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
120#define HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) \
121 (_MSC_VER >= ((major * 100) + (minor)))
124#if defined(HEDLEY_INTEL_VERSION)
125#undef HEDLEY_INTEL_VERSION
127#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && \
129#define HEDLEY_INTEL_VERSION \
130 HEDLEY_VERSION_ENCODE( \
131 __INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE)
132#elif defined(__INTEL_COMPILER) && !defined(__ICL)
133#define HEDLEY_INTEL_VERSION \
134 HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
137#if defined(HEDLEY_INTEL_VERSION_CHECK)
138#undef HEDLEY_INTEL_VERSION_CHECK
140#if defined(HEDLEY_INTEL_VERSION)
141#define HEDLEY_INTEL_VERSION_CHECK(major, minor, patch) \
142 (HEDLEY_INTEL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
144#define HEDLEY_INTEL_VERSION_CHECK(major, minor, patch) (0)
147#if defined(HEDLEY_INTEL_CL_VERSION)
148#undef HEDLEY_INTEL_CL_VERSION
150#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && \
152#define HEDLEY_INTEL_CL_VERSION \
153 HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0)
156#if defined(HEDLEY_INTEL_CL_VERSION_CHECK)
157#undef HEDLEY_INTEL_CL_VERSION_CHECK
159#if defined(HEDLEY_INTEL_CL_VERSION)
160#define HEDLEY_INTEL_CL_VERSION_CHECK(major, minor, patch) \
161 (HEDLEY_INTEL_CL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
163#define HEDLEY_INTEL_CL_VERSION_CHECK(major, minor, patch) (0)
166#if defined(HEDLEY_PGI_VERSION)
167#undef HEDLEY_PGI_VERSION
169#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && \
170 defined(__PGIC_PATCHLEVEL__)
171#define HEDLEY_PGI_VERSION \
172 HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
175#if defined(HEDLEY_PGI_VERSION_CHECK)
176#undef HEDLEY_PGI_VERSION_CHECK
178#if defined(HEDLEY_PGI_VERSION)
179#define HEDLEY_PGI_VERSION_CHECK(major, minor, patch) \
180 (HEDLEY_PGI_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
182#define HEDLEY_PGI_VERSION_CHECK(major, minor, patch) (0)
185#if defined(HEDLEY_SUNPRO_VERSION)
186#undef HEDLEY_SUNPRO_VERSION
188#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
189#define HEDLEY_SUNPRO_VERSION \
190 HEDLEY_VERSION_ENCODE( \
191 (((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), \
192 (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), \
193 (__SUNPRO_C & 0xf) * 10)
194#elif defined(__SUNPRO_C)
195#define HEDLEY_SUNPRO_VERSION \
196 HEDLEY_VERSION_ENCODE( \
197 (__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf)
198#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
199#define HEDLEY_SUNPRO_VERSION \
200 HEDLEY_VERSION_ENCODE( \
201 (((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), \
202 (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), \
203 (__SUNPRO_CC & 0xf) * 10)
204#elif defined(__SUNPRO_CC)
205#define HEDLEY_SUNPRO_VERSION \
206 HEDLEY_VERSION_ENCODE( \
207 (__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf)
210#if defined(HEDLEY_SUNPRO_VERSION_CHECK)
211#undef HEDLEY_SUNPRO_VERSION_CHECK
213#if defined(HEDLEY_SUNPRO_VERSION)
214#define HEDLEY_SUNPRO_VERSION_CHECK(major, minor, patch) \
215 (HEDLEY_SUNPRO_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
217#define HEDLEY_SUNPRO_VERSION_CHECK(major, minor, patch) (0)
220#if defined(HEDLEY_EMSCRIPTEN_VERSION)
221#undef HEDLEY_EMSCRIPTEN_VERSION
223#if defined(__EMSCRIPTEN__)
224#define HEDLEY_EMSCRIPTEN_VERSION \
225 HEDLEY_VERSION_ENCODE( \
226 __EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__)
229#if defined(HEDLEY_EMSCRIPTEN_VERSION_CHECK)
230#undef HEDLEY_EMSCRIPTEN_VERSION_CHECK
232#if defined(HEDLEY_EMSCRIPTEN_VERSION)
233#define HEDLEY_EMSCRIPTEN_VERSION_CHECK(major, minor, patch) \
234 (HEDLEY_EMSCRIPTEN_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
236#define HEDLEY_EMSCRIPTEN_VERSION_CHECK(major, minor, patch) (0)
239#if defined(HEDLEY_ARM_VERSION)
240#undef HEDLEY_ARM_VERSION
242#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
243#define HEDLEY_ARM_VERSION \
244 HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, \
245 (__ARMCOMPILER_VERSION % 1000000) / 10000, \
246 (__ARMCOMPILER_VERSION % 10000) / 100)
247#elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
248#define HEDLEY_ARM_VERSION \
249 HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, \
250 (__ARMCC_VERSION % 1000000) / 10000, \
251 (__ARMCC_VERSION % 10000) / 100)
254#if defined(HEDLEY_ARM_VERSION_CHECK)
255#undef HEDLEY_ARM_VERSION_CHECK
257#if defined(HEDLEY_ARM_VERSION)
258#define HEDLEY_ARM_VERSION_CHECK(major, minor, patch) \
259 (HEDLEY_ARM_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
261#define HEDLEY_ARM_VERSION_CHECK(major, minor, patch) (0)
264#if defined(HEDLEY_IBM_VERSION)
265#undef HEDLEY_IBM_VERSION
267#if defined(__ibmxl__)
268#define HEDLEY_IBM_VERSION \
269 HEDLEY_VERSION_ENCODE( \
270 __ibmxl_version__, __ibmxl_release__, __ibmxl_modification__)
271#elif defined(__xlC__) && defined(__xlC_ver__)
272#define HEDLEY_IBM_VERSION \
273 HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)
274#elif defined(__xlC__)
275#define HEDLEY_IBM_VERSION \
276 HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0)
279#if defined(HEDLEY_IBM_VERSION_CHECK)
280#undef HEDLEY_IBM_VERSION_CHECK
282#if defined(HEDLEY_IBM_VERSION)
283#define HEDLEY_IBM_VERSION_CHECK(major, minor, patch) \
284 (HEDLEY_IBM_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
286#define HEDLEY_IBM_VERSION_CHECK(major, minor, patch) (0)
289#if defined(HEDLEY_TI_VERSION)
290#undef HEDLEY_TI_VERSION
292#if defined(__TI_COMPILER_VERSION__) && \
293 (defined(__TMS470__) || defined(__TI_ARM__) || defined(__MSP430__) || \
294 defined(__TMS320C2000__))
295#if (__TI_COMPILER_VERSION__ >= 16000000)
296#define HEDLEY_TI_VERSION \
297 HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \
298 (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
299 (__TI_COMPILER_VERSION__ % 1000))
303#if defined(HEDLEY_TI_VERSION_CHECK)
304#undef HEDLEY_TI_VERSION_CHECK
306#if defined(HEDLEY_TI_VERSION)
307#define HEDLEY_TI_VERSION_CHECK(major, minor, patch) \
308 (HEDLEY_TI_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
310#define HEDLEY_TI_VERSION_CHECK(major, minor, patch) (0)
313#if defined(HEDLEY_TI_CL2000_VERSION)
314#undef HEDLEY_TI_CL2000_VERSION
316#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__)
317#define HEDLEY_TI_CL2000_VERSION \
318 HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \
319 (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
320 (__TI_COMPILER_VERSION__ % 1000))
323#if defined(HEDLEY_TI_CL2000_VERSION_CHECK)
324#undef HEDLEY_TI_CL2000_VERSION_CHECK
326#if defined(HEDLEY_TI_CL2000_VERSION)
327#define HEDLEY_TI_CL2000_VERSION_CHECK(major, minor, patch) \
328 (HEDLEY_TI_CL2000_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
330#define HEDLEY_TI_CL2000_VERSION_CHECK(major, minor, patch) (0)
333#if defined(HEDLEY_TI_CL430_VERSION)
334#undef HEDLEY_TI_CL430_VERSION
336#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__)
337#define HEDLEY_TI_CL430_VERSION \
338 HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \
339 (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
340 (__TI_COMPILER_VERSION__ % 1000))
343#if defined(HEDLEY_TI_CL430_VERSION_CHECK)
344#undef HEDLEY_TI_CL430_VERSION_CHECK
346#if defined(HEDLEY_TI_CL430_VERSION)
347#define HEDLEY_TI_CL430_VERSION_CHECK(major, minor, patch) \
348 (HEDLEY_TI_CL430_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
350#define HEDLEY_TI_CL430_VERSION_CHECK(major, minor, patch) (0)
353#if defined(HEDLEY_TI_ARMCL_VERSION)
354#undef HEDLEY_TI_ARMCL_VERSION
356#if defined(__TI_COMPILER_VERSION__) && \
357 (defined(__TMS470__) || defined(__TI_ARM__))
358#define HEDLEY_TI_ARMCL_VERSION \
359 HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \
360 (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
361 (__TI_COMPILER_VERSION__ % 1000))
364#if defined(HEDLEY_TI_ARMCL_VERSION_CHECK)
365#undef HEDLEY_TI_ARMCL_VERSION_CHECK
367#if defined(HEDLEY_TI_ARMCL_VERSION)
368#define HEDLEY_TI_ARMCL_VERSION_CHECK(major, minor, patch) \
369 (HEDLEY_TI_ARMCL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
371#define HEDLEY_TI_ARMCL_VERSION_CHECK(major, minor, patch) (0)
374#if defined(HEDLEY_TI_CL6X_VERSION)
375#undef HEDLEY_TI_CL6X_VERSION
377#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__)
378#define HEDLEY_TI_CL6X_VERSION \
379 HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \
380 (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
381 (__TI_COMPILER_VERSION__ % 1000))
384#if defined(HEDLEY_TI_CL6X_VERSION_CHECK)
385#undef HEDLEY_TI_CL6X_VERSION_CHECK
387#if defined(HEDLEY_TI_CL6X_VERSION)
388#define HEDLEY_TI_CL6X_VERSION_CHECK(major, minor, patch) \
389 (HEDLEY_TI_CL6X_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
391#define HEDLEY_TI_CL6X_VERSION_CHECK(major, minor, patch) (0)
394#if defined(HEDLEY_TI_CL7X_VERSION)
395#undef HEDLEY_TI_CL7X_VERSION
397#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__)
398#define HEDLEY_TI_CL7X_VERSION \
399 HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \
400 (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
401 (__TI_COMPILER_VERSION__ % 1000))
404#if defined(HEDLEY_TI_CL7X_VERSION_CHECK)
405#undef HEDLEY_TI_CL7X_VERSION_CHECK
407#if defined(HEDLEY_TI_CL7X_VERSION)
408#define HEDLEY_TI_CL7X_VERSION_CHECK(major, minor, patch) \
409 (HEDLEY_TI_CL7X_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
411#define HEDLEY_TI_CL7X_VERSION_CHECK(major, minor, patch) (0)
414#if defined(HEDLEY_TI_CLPRU_VERSION)
415#undef HEDLEY_TI_CLPRU_VERSION
417#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__)
418#define HEDLEY_TI_CLPRU_VERSION \
419 HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \
420 (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
421 (__TI_COMPILER_VERSION__ % 1000))
424#if defined(HEDLEY_TI_CLPRU_VERSION_CHECK)
425#undef HEDLEY_TI_CLPRU_VERSION_CHECK
427#if defined(HEDLEY_TI_CLPRU_VERSION)
428#define HEDLEY_TI_CLPRU_VERSION_CHECK(major, minor, patch) \
429 (HEDLEY_TI_CLPRU_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
431#define HEDLEY_TI_CLPRU_VERSION_CHECK(major, minor, patch) (0)
434#if defined(HEDLEY_CRAY_VERSION)
435#undef HEDLEY_CRAY_VERSION
438#if defined(_RELEASE_PATCHLEVEL)
439#define HEDLEY_CRAY_VERSION \
440 HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL)
442#define HEDLEY_CRAY_VERSION \
443 HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0)
447#if defined(HEDLEY_CRAY_VERSION_CHECK)
448#undef HEDLEY_CRAY_VERSION_CHECK
450#if defined(HEDLEY_CRAY_VERSION)
451#define HEDLEY_CRAY_VERSION_CHECK(major, minor, patch) \
452 (HEDLEY_CRAY_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
454#define HEDLEY_CRAY_VERSION_CHECK(major, minor, patch) (0)
457#if defined(HEDLEY_IAR_VERSION)
458#undef HEDLEY_IAR_VERSION
460#if defined(__IAR_SYSTEMS_ICC__)
462#define HEDLEY_IAR_VERSION \
463 HEDLEY_VERSION_ENCODE( \
464 (__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000))
466#define HEDLEY_IAR_VERSION HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0)
470#if defined(HEDLEY_IAR_VERSION_CHECK)
471#undef HEDLEY_IAR_VERSION_CHECK
473#if defined(HEDLEY_IAR_VERSION)
474#define HEDLEY_IAR_VERSION_CHECK(major, minor, patch) \
475 (HEDLEY_IAR_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
477#define HEDLEY_IAR_VERSION_CHECK(major, minor, patch) (0)
480#if defined(HEDLEY_TINYC_VERSION)
481#undef HEDLEY_TINYC_VERSION
483#if defined(__TINYC__)
484#define HEDLEY_TINYC_VERSION \
485 HEDLEY_VERSION_ENCODE( \
486 __TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)
489#if defined(HEDLEY_TINYC_VERSION_CHECK)
490#undef HEDLEY_TINYC_VERSION_CHECK
492#if defined(HEDLEY_TINYC_VERSION)
493#define HEDLEY_TINYC_VERSION_CHECK(major, minor, patch) \
494 (HEDLEY_TINYC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
496#define HEDLEY_TINYC_VERSION_CHECK(major, minor, patch) (0)
499#if defined(HEDLEY_DMC_VERSION)
500#undef HEDLEY_DMC_VERSION
503#define HEDLEY_DMC_VERSION \
504 HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf)
507#if defined(HEDLEY_DMC_VERSION_CHECK)
508#undef HEDLEY_DMC_VERSION_CHECK
510#if defined(HEDLEY_DMC_VERSION)
511#define HEDLEY_DMC_VERSION_CHECK(major, minor, patch) \
512 (HEDLEY_DMC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
514#define HEDLEY_DMC_VERSION_CHECK(major, minor, patch) (0)
517#if defined(HEDLEY_COMPCERT_VERSION)
518#undef HEDLEY_COMPCERT_VERSION
520#if defined(__COMPCERT_VERSION__)
521#define HEDLEY_COMPCERT_VERSION \
522 HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, \
523 (__COMPCERT_VERSION__ / 100) % 100, \
524 __COMPCERT_VERSION__ % 100)
527#if defined(HEDLEY_COMPCERT_VERSION_CHECK)
528#undef HEDLEY_COMPCERT_VERSION_CHECK
530#if defined(HEDLEY_COMPCERT_VERSION)
531#define HEDLEY_COMPCERT_VERSION_CHECK(major, minor, patch) \
532 (HEDLEY_COMPCERT_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
534#define HEDLEY_COMPCERT_VERSION_CHECK(major, minor, patch) (0)
537#if defined(HEDLEY_PELLES_VERSION)
538#undef HEDLEY_PELLES_VERSION
541#define HEDLEY_PELLES_VERSION \
542 HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0)
545#if defined(HEDLEY_PELLES_VERSION_CHECK)
546#undef HEDLEY_PELLES_VERSION_CHECK
548#if defined(HEDLEY_PELLES_VERSION)
549#define HEDLEY_PELLES_VERSION_CHECK(major, minor, patch) \
550 (HEDLEY_PELLES_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
552#define HEDLEY_PELLES_VERSION_CHECK(major, minor, patch) (0)
555#if defined(HEDLEY_GCC_VERSION)
556#undef HEDLEY_GCC_VERSION
558#if defined(HEDLEY_GNUC_VERSION) && !defined(__clang__) && \
559 !defined(HEDLEY_INTEL_VERSION) && !defined(HEDLEY_PGI_VERSION) && \
560 !defined(HEDLEY_ARM_VERSION) && !defined(HEDLEY_TI_VERSION) && \
561 !defined(HEDLEY_TI_ARMCL_VERSION) && !defined(HEDLEY_TI_CL430_VERSION) && \
562 !defined(HEDLEY_TI_CL2000_VERSION) && !defined(HEDLEY_TI_CL6X_VERSION) && \
563 !defined(HEDLEY_TI_CL7X_VERSION) && !defined(HEDLEY_TI_CLPRU_VERSION) && \
564 !defined(__COMPCERT__)
565#define HEDLEY_GCC_VERSION HEDLEY_GNUC_VERSION
568#if defined(HEDLEY_GCC_VERSION_CHECK)
569#undef HEDLEY_GCC_VERSION_CHECK
571#if defined(HEDLEY_GCC_VERSION)
572#define HEDLEY_GCC_VERSION_CHECK(major, minor, patch) \
573 (HEDLEY_GCC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch))
575#define HEDLEY_GCC_VERSION_CHECK(major, minor, patch) (0)
578#if defined(HEDLEY_HAS_ATTRIBUTE)
579#undef HEDLEY_HAS_ATTRIBUTE
581#if defined(__has_attribute)
582#define HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute)
584#define HEDLEY_HAS_ATTRIBUTE(attribute) (0)
587#if defined(HEDLEY_GNUC_HAS_ATTRIBUTE)
588#undef HEDLEY_GNUC_HAS_ATTRIBUTE
590#if defined(__has_attribute)
591#define HEDLEY_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
592 __has_attribute(attribute)
594#define HEDLEY_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
595 HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
598#if defined(HEDLEY_GCC_HAS_ATTRIBUTE)
599#undef HEDLEY_GCC_HAS_ATTRIBUTE
601#if defined(__has_attribute)
602#define HEDLEY_GCC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
603 __has_attribute(attribute)
605#define HEDLEY_GCC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
606 HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
609#if defined(HEDLEY_HAS_CPP_ATTRIBUTE)
610#undef HEDLEY_HAS_CPP_ATTRIBUTE
612#if defined(__has_cpp_attribute) && defined(__cplusplus) && \
613 (!defined(HEDLEY_SUNPRO_VERSION) || HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0))
614#define HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute)
616#define HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0)
619#if defined(HEDLEY_HAS_CPP_ATTRIBUTE_NS)
620#undef HEDLEY_HAS_CPP_ATTRIBUTE_NS
622#if !defined(__cplusplus) || !defined(__has_cpp_attribute)
623#define HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns, attribute) (0)
624#elif !defined(HEDLEY_PGI_VERSION) && !defined(HEDLEY_IAR_VERSION) && \
625 (!defined(HEDLEY_SUNPRO_VERSION) || \
626 HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0)) && \
627 (!defined(HEDLEY_MSVC_VERSION) || HEDLEY_MSVC_VERSION_CHECK(19, 20, 0))
628#define HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns, attribute) \
629 HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute)
631#define HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns, attribute) (0)
634#if defined(HEDLEY_GNUC_HAS_CPP_ATTRIBUTE)
635#undef HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
637#if defined(__has_cpp_attribute) && defined(__cplusplus)
638#define HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \
639 __has_cpp_attribute(attribute)
641#define HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \
642 HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
645#if defined(HEDLEY_GCC_HAS_CPP_ATTRIBUTE)
646#undef HEDLEY_GCC_HAS_CPP_ATTRIBUTE
648#if defined(__has_cpp_attribute) && defined(__cplusplus)
649#define HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \
650 __has_cpp_attribute(attribute)
652#define HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \
653 HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
656#if defined(HEDLEY_HAS_BUILTIN)
657#undef HEDLEY_HAS_BUILTIN
659#if defined(__has_builtin)
660#define HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin)
662#define HEDLEY_HAS_BUILTIN(builtin) (0)
665#if defined(HEDLEY_GNUC_HAS_BUILTIN)
666#undef HEDLEY_GNUC_HAS_BUILTIN
668#if defined(__has_builtin)
669#define HEDLEY_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
670 __has_builtin(builtin)
672#define HEDLEY_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
673 HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
676#if defined(HEDLEY_GCC_HAS_BUILTIN)
677#undef HEDLEY_GCC_HAS_BUILTIN
679#if defined(__has_builtin)
680#define HEDLEY_GCC_HAS_BUILTIN(builtin, major, minor, patch) \
681 __has_builtin(builtin)
683#define HEDLEY_GCC_HAS_BUILTIN(builtin, major, minor, patch) \
684 HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
687#if defined(HEDLEY_HAS_FEATURE)
688#undef HEDLEY_HAS_FEATURE
690#if defined(__has_feature)
691#define HEDLEY_HAS_FEATURE(feature) __has_feature(feature)
693#define HEDLEY_HAS_FEATURE(feature) (0)
696#if defined(HEDLEY_GNUC_HAS_FEATURE)
697#undef HEDLEY_GNUC_HAS_FEATURE
699#if defined(__has_feature)
700#define HEDLEY_GNUC_HAS_FEATURE(feature, major, minor, patch) \
701 __has_feature(feature)
703#define HEDLEY_GNUC_HAS_FEATURE(feature, major, minor, patch) \
704 HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
707#if defined(HEDLEY_GCC_HAS_FEATURE)
708#undef HEDLEY_GCC_HAS_FEATURE
710#if defined(__has_feature)
711#define HEDLEY_GCC_HAS_FEATURE(feature, major, minor, patch) \
712 __has_feature(feature)
714#define HEDLEY_GCC_HAS_FEATURE(feature, major, minor, patch) \
715 HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
718#if defined(HEDLEY_HAS_EXTENSION)
719#undef HEDLEY_HAS_EXTENSION
721#if defined(__has_extension)
722#define HEDLEY_HAS_EXTENSION(extension) __has_extension(extension)
724#define HEDLEY_HAS_EXTENSION(extension) (0)
727#if defined(HEDLEY_GNUC_HAS_EXTENSION)
728#undef HEDLEY_GNUC_HAS_EXTENSION
730#if defined(__has_extension)
731#define HEDLEY_GNUC_HAS_EXTENSION(extension, major, minor, patch) \
732 __has_extension(extension)
734#define HEDLEY_GNUC_HAS_EXTENSION(extension, major, minor, patch) \
735 HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
738#if defined(HEDLEY_GCC_HAS_EXTENSION)
739#undef HEDLEY_GCC_HAS_EXTENSION
741#if defined(__has_extension)
742#define HEDLEY_GCC_HAS_EXTENSION(extension, major, minor, patch) \
743 __has_extension(extension)
745#define HEDLEY_GCC_HAS_EXTENSION(extension, major, minor, patch) \
746 HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
749#if defined(HEDLEY_HAS_DECLSPEC_ATTRIBUTE)
750#undef HEDLEY_HAS_DECLSPEC_ATTRIBUTE
752#if defined(__has_declspec_attribute)
753#define HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) \
754 __has_declspec_attribute(attribute)
756#define HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0)
759#if defined(HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE)
760#undef HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
762#if defined(__has_declspec_attribute)
763#define HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \
764 __has_declspec_attribute(attribute)
766#define HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \
767 HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
770#if defined(HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE)
771#undef HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
773#if defined(__has_declspec_attribute)
774#define HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \
775 __has_declspec_attribute(attribute)
777#define HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \
778 HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
781#if defined(HEDLEY_HAS_WARNING)
782#undef HEDLEY_HAS_WARNING
784#if defined(__has_warning)
785#define HEDLEY_HAS_WARNING(warning) __has_warning(warning)
787#define HEDLEY_HAS_WARNING(warning) (0)
790#if defined(HEDLEY_GNUC_HAS_WARNING)
791#undef HEDLEY_GNUC_HAS_WARNING
793#if defined(__has_warning)
794#define HEDLEY_GNUC_HAS_WARNING(warning, major, minor, patch) \
795 __has_warning(warning)
797#define HEDLEY_GNUC_HAS_WARNING(warning, major, minor, patch) \
798 HEDLEY_GNUC_VERSION_CHECK(major, minor, patch)
801#if defined(HEDLEY_GCC_HAS_WARNING)
802#undef HEDLEY_GCC_HAS_WARNING
804#if defined(__has_warning)
805#define HEDLEY_GCC_HAS_WARNING(warning, major, minor, patch) \
806 __has_warning(warning)
808#define HEDLEY_GCC_HAS_WARNING(warning, major, minor, patch) \
809 HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
812#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
813 defined(__clang__) || HEDLEY_GCC_VERSION_CHECK(3, 0, 0) || \
814 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || HEDLEY_IAR_VERSION_CHECK(8, 0, 0) || \
815 HEDLEY_PGI_VERSION_CHECK(18, 4, 0) || HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
816 HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
817 HEDLEY_TI_ARMCL_VERSION_CHECK(4, 7, 0) || \
818 HEDLEY_TI_CL430_VERSION_CHECK(2, 0, 1) || \
819 HEDLEY_TI_CL2000_VERSION_CHECK(6, 1, 0) || \
820 HEDLEY_TI_CL6X_VERSION_CHECK(7, 0, 0) || \
821 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
822 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \
823 HEDLEY_CRAY_VERSION_CHECK(5, 0, 0) || \
824 HEDLEY_TINYC_VERSION_CHECK(0, 9, 17) || \
825 HEDLEY_SUNPRO_VERSION_CHECK(8, 0, 0) || \
826 (HEDLEY_IBM_VERSION_CHECK(10, 1, 0) && defined(__C99_PRAGMA_OPERATOR))
827#define HEDLEY_PRAGMA(value) _Pragma(#value)
828#elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0)
829#define HEDLEY_PRAGMA(value) __pragma(value)
831#define HEDLEY_PRAGMA(value)
834#if defined(HEDLEY_DIAGNOSTIC_PUSH)
835#undef HEDLEY_DIAGNOSTIC_PUSH
837#if defined(HEDLEY_DIAGNOSTIC_POP)
838#undef HEDLEY_DIAGNOSTIC_POP
840#if defined(__clang__)
841#define HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
842#define HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
843#elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
844#define HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
845#define HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
846#elif HEDLEY_GCC_VERSION_CHECK(4, 6, 0)
847#define HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
848#define HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
849#elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0) || \
850 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
851#define HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push))
852#define HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop))
853#elif HEDLEY_ARM_VERSION_CHECK(5, 6, 0)
854#define HEDLEY_DIAGNOSTIC_PUSH _Pragma("push")
855#define HEDLEY_DIAGNOSTIC_POP _Pragma("pop")
856#elif HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
857 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
858 HEDLEY_TI_CL430_VERSION_CHECK(4, 4, 0) || \
859 HEDLEY_TI_CL6X_VERSION_CHECK(8, 1, 0) || \
860 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
861 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
862#define HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push")
863#define HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop")
864#elif HEDLEY_PELLES_VERSION_CHECK(2, 90, 0)
865#define HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
866#define HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
868#define HEDLEY_DIAGNOSTIC_PUSH
869#define HEDLEY_DIAGNOSTIC_POP
874#if defined(HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
875#undef HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_
877#if defined(__cplusplus)
878#if HEDLEY_HAS_WARNING("-Wc++98-compat")
879#if HEDLEY_HAS_WARNING("-Wc++17-extensions")
880#if HEDLEY_HAS_WARNING("-Wc++1z-extensions")
881#define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
882 HEDLEY_DIAGNOSTIC_PUSH \
883 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
884 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
885 _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \
886 xpr HEDLEY_DIAGNOSTIC_POP
888#define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
889 HEDLEY_DIAGNOSTIC_PUSH \
890 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
891 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
892 xpr HEDLEY_DIAGNOSTIC_POP
895#define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
896 HEDLEY_DIAGNOSTIC_PUSH \
897 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
898 xpr HEDLEY_DIAGNOSTIC_POP
902#if !defined(HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
903#define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x
906#if defined(HEDLEY_CONST_CAST)
907#undef HEDLEY_CONST_CAST
909#if defined(__cplusplus)
910#define HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr))
911#elif HEDLEY_HAS_WARNING("-Wcast-qual") || \
912 HEDLEY_GCC_VERSION_CHECK(4, 6, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
913#define HEDLEY_CONST_CAST(T, expr) \
915 HEDLEY_DIAGNOSTIC_PUSH \
916 HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL((T)(expr)); \
917 HEDLEY_DIAGNOSTIC_POP \
920#define HEDLEY_CONST_CAST(T, expr) ((T)(expr))
923#if defined(HEDLEY_REINTERPRET_CAST)
924#undef HEDLEY_REINTERPRET_CAST
926#if defined(__cplusplus)
927#define HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr))
929#define HEDLEY_REINTERPRET_CAST(T, expr) ((T)(expr))
932#if defined(HEDLEY_STATIC_CAST)
933#undef HEDLEY_STATIC_CAST
935#if defined(__cplusplus)
936#define HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr))
938#define HEDLEY_STATIC_CAST(T, expr) ((T)(expr))
941#if defined(HEDLEY_CPP_CAST)
942#undef HEDLEY_CPP_CAST
944#if defined(__cplusplus)
945#if HEDLEY_HAS_WARNING("-Wold-style-cast")
946#define HEDLEY_CPP_CAST(T, expr) \
947 HEDLEY_DIAGNOSTIC_PUSH \
948 _Pragma("clang diagnostic ignored \"-Wold-style-cast\"")((T)(expr)) \
949 HEDLEY_DIAGNOSTIC_POP
950#elif HEDLEY_IAR_VERSION_CHECK(8, 3, 0)
951#define HEDLEY_CPP_CAST(T, expr) \
952 HEDLEY_DIAGNOSTIC_PUSH \
953 _Pragma("diag_suppress=Pe137") HEDLEY_DIAGNOSTIC_POP
955#define HEDLEY_CPP_CAST(T, expr) ((T)(expr))
958#define HEDLEY_CPP_CAST(T, expr) (expr)
961#if defined(HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED)
962#undef HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
964#if HEDLEY_HAS_WARNING("-Wdeprecated-declarations")
965#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
966 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
967#elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
968#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
969 _Pragma("warning(disable:1478 1786)")
970#elif HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
971#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
972 __pragma(warning(disable : 1478 1786))
973#elif HEDLEY_PGI_VERSION_CHECK(20, 7, 0)
974#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
975 _Pragma("diag_suppress 1215,1216,1444,1445")
976#elif HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
977#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
978#elif HEDLEY_GCC_VERSION_CHECK(4, 3, 0)
979#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
980 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
981#elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0)
982#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable : 4996))
983#elif HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
984 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
985 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
986 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
987 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
988 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
989 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
990 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
991 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
992 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
993 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
994 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
995 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
996 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
997 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
998#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718")
999#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) && !defined(__cplusplus)
1000#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
1001 _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)")
1002#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) && defined(__cplusplus)
1003#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
1004 _Pragma("error_messages(off,symdeprecated,symdeprecated2)")
1005#elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1006#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \
1007 _Pragma("diag_suppress=Pe1444,Pe1215")
1008#elif HEDLEY_PELLES_VERSION_CHECK(2, 90, 0)
1009#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)")
1011#define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
1014#if defined(HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS)
1015#undef HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
1017#if HEDLEY_HAS_WARNING("-Wunknown-pragmas")
1018#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
1019 _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"")
1020#elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1021#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
1022 _Pragma("warning(disable:161)")
1023#elif HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1024#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
1025 __pragma(warning(disable : 161))
1026#elif HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
1027#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675")
1028#elif HEDLEY_GCC_VERSION_CHECK(4, 3, 0)
1029#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
1030 _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"")
1031#elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0)
1032#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
1033 __pragma(warning(disable : 4068))
1034#elif HEDLEY_TI_VERSION_CHECK(16, 9, 0) || \
1035 HEDLEY_TI_CL6X_VERSION_CHECK(8, 0, 0) || \
1036 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1037 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 3, 0)
1038#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
1039#elif HEDLEY_TI_CL6X_VERSION_CHECK(8, 0, 0)
1040#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
1041#elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1042#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161")
1044#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
1047#if defined(HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES)
1048#undef HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
1050#if HEDLEY_HAS_WARNING("-Wunknown-attributes")
1051#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1052 _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"")
1053#elif HEDLEY_GCC_VERSION_CHECK(4, 6, 0)
1054#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1055 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
1056#elif HEDLEY_INTEL_VERSION_CHECK(17, 0, 0)
1057#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1058 _Pragma("warning(disable:1292)")
1059#elif HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1060#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1061 __pragma(warning(disable : 1292))
1062#elif HEDLEY_MSVC_VERSION_CHECK(19, 0, 0)
1063#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1064 __pragma(warning(disable : 5030))
1065#elif HEDLEY_PGI_VERSION_CHECK(20, 7, 0)
1066#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1067 _Pragma("diag_suppress 1097,1098")
1068#elif HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
1069#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1070 _Pragma("diag_suppress 1097")
1071#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus)
1072#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1073 _Pragma("error_messages(off,attrskipunsup)")
1074#elif HEDLEY_TI_VERSION_CHECK(18, 1, 0) || \
1075 HEDLEY_TI_CL6X_VERSION_CHECK(8, 3, 0) || \
1076 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0)
1077#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1078 _Pragma("diag_suppress 1173")
1079#elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1080#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \
1081 _Pragma("diag_suppress=Pe1097")
1083#define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
1086#if defined(HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL)
1087#undef HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
1089#if HEDLEY_HAS_WARNING("-Wcast-qual")
1090#define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
1091 _Pragma("clang diagnostic ignored \"-Wcast-qual\"")
1092#elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1093#define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
1094 _Pragma("warning(disable:2203 2331)")
1095#elif HEDLEY_GCC_VERSION_CHECK(3, 0, 0)
1096#define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
1097 _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
1099#define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
1102#if defined(HEDLEY_DEPRECATED)
1103#undef HEDLEY_DEPRECATED
1105#if defined(HEDLEY_DEPRECATED_FOR)
1106#undef HEDLEY_DEPRECATED_FOR
1108#if HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) || \
1109 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1110#define HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " #since))
1111#define HEDLEY_DEPRECATED_FOR(since, replacement) \
1112 __declspec(deprecated("Since " #since "; use " #replacement))
1113#elif HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \
1114 HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1115 HEDLEY_ARM_VERSION_CHECK(5, 6, 0) || \
1116 HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) || \
1117 HEDLEY_PGI_VERSION_CHECK(17, 10, 0) || HEDLEY_TI_VERSION_CHECK(18, 1, 0) || \
1118 HEDLEY_TI_ARMCL_VERSION_CHECK(18, 1, 0) || \
1119 HEDLEY_TI_CL6X_VERSION_CHECK(8, 3, 0) || \
1120 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1121 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 3, 0)
1122#define HEDLEY_DEPRECATED(since) \
1123 __attribute__((__deprecated__("Since " #since)))
1124#define HEDLEY_DEPRECATED_FOR(since, replacement) \
1125 __attribute__((__deprecated__("Since " #since "; use " #replacement)))
1126#elif defined(__cplusplus) && (__cplusplus >= 201402L)
1127#define HEDLEY_DEPRECATED(since) \
1128 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since" \
1130#define HEDLEY_DEPRECATED_FOR(since, replacement) \
1131 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \
1132 [[deprecated("Since " #since "; use " #replacement)]])
1133#elif HEDLEY_HAS_ATTRIBUTE(deprecated) || HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \
1134 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1135 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
1136 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1137 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1138 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
1139 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1140 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1141 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
1142 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1143 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1144 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1145 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1146 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
1147 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1148 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
1149#define HEDLEY_DEPRECATED(since) __attribute__((__deprecated__))
1150#define HEDLEY_DEPRECATED_FOR(since, replacement) \
1151 __attribute__((__deprecated__))
1152#elif HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \
1153 HEDLEY_PELLES_VERSION_CHECK(6, 50, 0) || \
1154 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1155#define HEDLEY_DEPRECATED(since) __declspec(deprecated)
1156#define HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated)
1157#elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1158#define HEDLEY_DEPRECATED(since) _Pragma("deprecated")
1159#define HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated")
1161#define HEDLEY_DEPRECATED(since)
1162#define HEDLEY_DEPRECATED_FOR(since, replacement)
1165#if defined(HEDLEY_UNAVAILABLE)
1166#undef HEDLEY_UNAVAILABLE
1168#if HEDLEY_HAS_ATTRIBUTE(warning) || HEDLEY_GCC_VERSION_CHECK(4, 3, 0) || \
1169 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1170#define HEDLEY_UNAVAILABLE(available_since) \
1171 __attribute__((__warning__("Not available until " #available_since)))
1173#define HEDLEY_UNAVAILABLE(available_since)
1176#if defined(HEDLEY_WARN_UNUSED_RESULT)
1177#undef HEDLEY_WARN_UNUSED_RESULT
1179#if defined(HEDLEY_WARN_UNUSED_RESULT_MSG)
1180#undef HEDLEY_WARN_UNUSED_RESULT_MSG
1182#if HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \
1183 HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1184 HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1185 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
1186 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1187 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1188 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
1189 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1190 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1191 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
1192 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1193 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1194 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1195 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1196 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
1197 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1198 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \
1199 (HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0) && defined(__cplusplus)) || \
1200 HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
1201#define HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
1202#define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) \
1203 __attribute__((__warn_unused_result__))
1204#elif (HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L)
1205#define HEDLEY_WARN_UNUSED_RESULT \
1206 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1207#define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) \
1208 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]])
1209#elif HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard)
1210#define HEDLEY_WARN_UNUSED_RESULT \
1211 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1212#define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) \
1213 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
1214#elif defined(_Check_return_)
1215#define HEDLEY_WARN_UNUSED_RESULT _Check_return_
1216#define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_
1218#define HEDLEY_WARN_UNUSED_RESULT
1219#define HEDLEY_WARN_UNUSED_RESULT_MSG(msg)
1222#if defined(HEDLEY_SENTINEL)
1223#undef HEDLEY_SENTINEL
1225#if HEDLEY_HAS_ATTRIBUTE(sentinel) || HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || \
1226 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || HEDLEY_ARM_VERSION_CHECK(5, 4, 0)
1227#define HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position)))
1229#define HEDLEY_SENTINEL(position)
1232#if defined(HEDLEY_NO_RETURN)
1233#undef HEDLEY_NO_RETURN
1235#if HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1236#define HEDLEY_NO_RETURN __noreturn
1237#elif HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1238#define HEDLEY_NO_RETURN __attribute__((__noreturn__))
1239#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
1240#define HEDLEY_NO_RETURN _Noreturn
1241#elif defined(__cplusplus) && (__cplusplus >= 201103L)
1242#define HEDLEY_NO_RETURN \
1243 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]])
1244#elif HEDLEY_HAS_ATTRIBUTE(noreturn) || HEDLEY_GCC_VERSION_CHECK(3, 2, 0) || \
1245 HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1246 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1247 HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1248 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
1249 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1250 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1251 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
1252 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1253 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1254 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
1255 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1256 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1257 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1258 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1259 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
1260 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1261 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
1262#define HEDLEY_NO_RETURN __attribute__((__noreturn__))
1263#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0)
1264#define HEDLEY_NO_RETURN _Pragma("does_not_return")
1265#elif HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \
1266 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1267#define HEDLEY_NO_RETURN __declspec(noreturn)
1268#elif HEDLEY_TI_CL6X_VERSION_CHECK(6, 0, 0) && defined(__cplusplus)
1269#define HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;")
1270#elif HEDLEY_COMPCERT_VERSION_CHECK(3, 2, 0)
1271#define HEDLEY_NO_RETURN __attribute((noreturn))
1272#elif HEDLEY_PELLES_VERSION_CHECK(9, 0, 0)
1273#define HEDLEY_NO_RETURN __declspec(noreturn)
1275#define HEDLEY_NO_RETURN
1278#if defined(HEDLEY_NO_ESCAPE)
1279#undef HEDLEY_NO_ESCAPE
1281#if HEDLEY_HAS_ATTRIBUTE(noescape)
1282#define HEDLEY_NO_ESCAPE __attribute__((__noescape__))
1284#define HEDLEY_NO_ESCAPE
1287#if defined(HEDLEY_UNREACHABLE)
1288#undef HEDLEY_UNREACHABLE
1290#if defined(HEDLEY_UNREACHABLE_RETURN)
1291#undef HEDLEY_UNREACHABLE_RETURN
1293#if defined(HEDLEY_ASSUME)
1296#if HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \
1297 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1298 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1299#define HEDLEY_ASSUME(expr) __assume(expr)
1300#elif HEDLEY_HAS_BUILTIN(__builtin_assume)
1301#define HEDLEY_ASSUME(expr) __builtin_assume(expr)
1302#elif HEDLEY_TI_CL2000_VERSION_CHECK(6, 2, 0) || \
1303 HEDLEY_TI_CL6X_VERSION_CHECK(4, 0, 0)
1304#if defined(__cplusplus)
1305#define HEDLEY_ASSUME(expr) std::_nassert(expr)
1307#define HEDLEY_ASSUME(expr) _nassert(expr)
1310#if (HEDLEY_HAS_BUILTIN(__builtin_unreachable) && \
1311 (!defined(HEDLEY_ARM_VERSION))) || \
1312 HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || HEDLEY_PGI_VERSION_CHECK(18, 10, 0) || \
1313 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || HEDLEY_IBM_VERSION_CHECK(13, 1, 5)
1314#define HEDLEY_UNREACHABLE() __builtin_unreachable()
1315#elif defined(HEDLEY_ASSUME)
1316#define HEDLEY_UNREACHABLE() HEDLEY_ASSUME(0)
1318#if !defined(HEDLEY_ASSUME)
1319#if defined(HEDLEY_UNREACHABLE)
1320#define HEDLEY_ASSUME(expr) \
1321 HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (HEDLEY_UNREACHABLE(), 1)))
1323#define HEDLEY_ASSUME(expr) HEDLEY_STATIC_CAST(void, expr)
1326#if defined(HEDLEY_UNREACHABLE)
1327#if HEDLEY_TI_CL2000_VERSION_CHECK(6, 2, 0) || \
1328 HEDLEY_TI_CL6X_VERSION_CHECK(4, 0, 0)
1329#define HEDLEY_UNREACHABLE_RETURN(value) \
1330 return (HEDLEY_STATIC_CAST(void, HEDLEY_ASSUME(0)), (value))
1332#define HEDLEY_UNREACHABLE_RETURN(value) HEDLEY_UNREACHABLE()
1335#define HEDLEY_UNREACHABLE_RETURN(value) return (value)
1337#if !defined(HEDLEY_UNREACHABLE)
1338#define HEDLEY_UNREACHABLE() HEDLEY_ASSUME(0)
1342#if HEDLEY_HAS_WARNING("-Wpedantic")
1343#pragma clang diagnostic ignored "-Wpedantic"
1345#if HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus)
1346#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
1348#if HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros", 4, 0, 0)
1349#if defined(__clang__)
1350#pragma clang diagnostic ignored "-Wvariadic-macros"
1351#elif defined(HEDLEY_GCC_VERSION)
1352#pragma GCC diagnostic ignored "-Wvariadic-macros"
1355#if defined(HEDLEY_NON_NULL)
1356#undef HEDLEY_NON_NULL
1358#if HEDLEY_HAS_ATTRIBUTE(nonnull) || HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \
1359 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || HEDLEY_ARM_VERSION_CHECK(4, 1, 0)
1360#define HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
1362#define HEDLEY_NON_NULL(...)
1366#if defined(HEDLEY_PRINTF_FORMAT)
1367#undef HEDLEY_PRINTF_FORMAT
1369#if defined(__MINGW32__) && HEDLEY_GCC_HAS_ATTRIBUTE(format, 4, 4, 0) && \
1370 !defined(__USE_MINGW_ANSI_STDIO)
1371#define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \
1372 __attribute__((__format__(ms_printf, string_idx, first_to_check)))
1373#elif defined(__MINGW32__) && HEDLEY_GCC_HAS_ATTRIBUTE(format, 4, 4, 0) && \
1374 defined(__USE_MINGW_ANSI_STDIO)
1375#define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \
1376 __attribute__((__format__(gnu_printf, string_idx, first_to_check)))
1377#elif HEDLEY_HAS_ATTRIBUTE(format) || HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \
1378 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || HEDLEY_ARM_VERSION_CHECK(5, 6, 0) || \
1379 HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1380 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
1381 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1382 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1383 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
1384 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1385 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1386 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
1387 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1388 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1389 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1390 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1391 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
1392 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1393 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
1394#define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \
1395 __attribute__((__format__(__printf__, string_idx, first_to_check)))
1396#elif HEDLEY_PELLES_VERSION_CHECK(6, 0, 0)
1397#define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \
1398 __declspec(vaformat(printf, string_idx, first_to_check))
1400#define HEDLEY_PRINTF_FORMAT(string_idx, first_to_check)
1403#if defined(HEDLEY_CONSTEXPR)
1404#undef HEDLEY_CONSTEXPR
1406#if defined(__cplusplus)
1407#if __cplusplus >= 201103L
1408#define HEDLEY_CONSTEXPR HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr)
1411#if !defined(HEDLEY_CONSTEXPR)
1412#define HEDLEY_CONSTEXPR
1415#if defined(HEDLEY_PREDICT)
1416#undef HEDLEY_PREDICT
1418#if defined(HEDLEY_LIKELY)
1421#if defined(HEDLEY_UNLIKELY)
1422#undef HEDLEY_UNLIKELY
1424#if defined(HEDLEY_UNPREDICTABLE)
1425#undef HEDLEY_UNPREDICTABLE
1427#if HEDLEY_HAS_BUILTIN(__builtin_unpredictable)
1428#define HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr))
1430#if (HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && \
1431 !defined(HEDLEY_PGI_VERSION)) || \
1432 HEDLEY_GCC_VERSION_CHECK(9, 0, 0)
1433#define HEDLEY_PREDICT(expr, value, probability) \
1434 __builtin_expect_with_probability((expr), (value), (probability))
1435#define HEDLEY_PREDICT_TRUE(expr, probability) \
1436 __builtin_expect_with_probability(!!(expr), 1, (probability))
1437#define HEDLEY_PREDICT_FALSE(expr, probability) \
1438 __builtin_expect_with_probability(!!(expr), 0, (probability))
1439#define HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1)
1440#define HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
1441#elif (HEDLEY_HAS_BUILTIN(__builtin_expect) && \
1442 !defined(HEDLEY_INTEL_CL_VERSION)) || \
1443 HEDLEY_GCC_VERSION_CHECK(3, 0, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1444 (HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0) && defined(__cplusplus)) || \
1445 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1446 HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1447 HEDLEY_TI_ARMCL_VERSION_CHECK(4, 7, 0) || \
1448 HEDLEY_TI_CL430_VERSION_CHECK(3, 1, 0) || \
1449 HEDLEY_TI_CL2000_VERSION_CHECK(6, 1, 0) || \
1450 HEDLEY_TI_CL6X_VERSION_CHECK(6, 1, 0) || \
1451 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1452 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \
1453 HEDLEY_TINYC_VERSION_CHECK(0, 9, 27) || HEDLEY_CRAY_VERSION_CHECK(8, 1, 0)
1454#define HEDLEY_PREDICT(expr, expected, probability) \
1455 (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) \
1456 : (HEDLEY_STATIC_CAST(void, expected), (expr)))
1457#define HEDLEY_PREDICT_TRUE(expr, probability) \
1459 double hedley_probability_ = (probability); \
1460 ((hedley_probability_ >= 0.9) \
1461 ? __builtin_expect(!!(expr), 1) \
1462 : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) \
1465#define HEDLEY_PREDICT_FALSE(expr, probability) \
1467 double hedley_probability_ = (probability); \
1468 ((hedley_probability_ >= 0.9) \
1469 ? __builtin_expect(!!(expr), 0) \
1470 : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) \
1473#define HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1)
1474#define HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
1476#define HEDLEY_PREDICT(expr, expected, probability) \
1477 (HEDLEY_STATIC_CAST(void, expected), (expr))
1478#define HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr))
1479#define HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr))
1480#define HEDLEY_LIKELY(expr) (!!(expr))
1481#define HEDLEY_UNLIKELY(expr) (!!(expr))
1483#if !defined(HEDLEY_UNPREDICTABLE)
1484#define HEDLEY_UNPREDICTABLE(expr) HEDLEY_PREDICT(expr, 1, 0.5)
1487#if defined(HEDLEY_MALLOC)
1490#if HEDLEY_HAS_ATTRIBUTE(malloc) || HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \
1491 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1492 HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1493 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_IBM_VERSION_CHECK(12, 1, 0) || \
1494 HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1495 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
1496 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1497 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1498 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
1499 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1500 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1501 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
1502 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1503 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1504 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1505 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1506 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
1507 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1508 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
1509#define HEDLEY_MALLOC __attribute__((__malloc__))
1510#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0)
1511#define HEDLEY_MALLOC _Pragma("returns_new_memory")
1512#elif HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) || \
1513 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1514#define HEDLEY_MALLOC __declspec(restrict)
1516#define HEDLEY_MALLOC
1519#if defined(HEDLEY_PURE)
1522#if HEDLEY_HAS_ATTRIBUTE(pure) || HEDLEY_GCC_VERSION_CHECK(2, 96, 0) || \
1523 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1524 HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1525 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1526 HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1527 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
1528 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1529 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1530 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
1531 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1532 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1533 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
1534 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1535 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1536 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1537 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1538 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
1539 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1540 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \
1541 HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
1542#define HEDLEY_PURE __attribute__((__pure__))
1543#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0)
1544#define HEDLEY_PURE _Pragma("does_not_write_global_data")
1545#elif defined(__cplusplus) && (HEDLEY_TI_CL430_VERSION_CHECK(2, 0, 1) || \
1546 HEDLEY_TI_CL6X_VERSION_CHECK(4, 0, 0) || \
1547 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0))
1548#define HEDLEY_PURE _Pragma("FUNC_IS_PURE;")
1553#if defined(HEDLEY_CONST)
1556#if HEDLEY_HAS_ATTRIBUTE(const) || HEDLEY_GCC_VERSION_CHECK(2, 5, 0) || \
1557 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1558 HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1559 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1560 HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1561 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
1562 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1563 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1564 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
1565 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1566 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1567 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
1568 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1569 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1570 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1571 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1572 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
1573 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1574 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \
1575 HEDLEY_PGI_VERSION_CHECK(17, 10, 0)
1576#define HEDLEY_CONST __attribute__((__const__))
1577#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0)
1578#define HEDLEY_CONST _Pragma("no_side_effect")
1580#define HEDLEY_CONST HEDLEY_PURE
1583#if defined(HEDLEY_RESTRICT)
1584#undef HEDLEY_RESTRICT
1586#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
1587 !defined(__cplusplus)
1588#define HEDLEY_RESTRICT restrict
1589#elif HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \
1590 HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) || \
1591 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1592 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) || \
1593 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1594 HEDLEY_PGI_VERSION_CHECK(17, 10, 0) || \
1595 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1596 HEDLEY_TI_CL2000_VERSION_CHECK(6, 2, 4) || \
1597 HEDLEY_TI_CL6X_VERSION_CHECK(8, 1, 0) || \
1598 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1599 (HEDLEY_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus)) || \
1600 HEDLEY_IAR_VERSION_CHECK(8, 0, 0) || defined(__clang__)
1601#define HEDLEY_RESTRICT __restrict
1602#elif HEDLEY_SUNPRO_VERSION_CHECK(5, 3, 0) && !defined(__cplusplus)
1603#define HEDLEY_RESTRICT _Restrict
1605#define HEDLEY_RESTRICT
1608#if defined(HEDLEY_INLINE)
1611#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
1612 (defined(__cplusplus) && (__cplusplus >= 199711L))
1613#define HEDLEY_INLINE inline
1614#elif defined(HEDLEY_GCC_VERSION) || HEDLEY_ARM_VERSION_CHECK(6, 2, 0)
1615#define HEDLEY_INLINE __inline__
1616#elif HEDLEY_MSVC_VERSION_CHECK(12, 0, 0) || \
1617 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) || \
1618 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1619 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 1, 0) || \
1620 HEDLEY_TI_CL430_VERSION_CHECK(3, 1, 0) || \
1621 HEDLEY_TI_CL2000_VERSION_CHECK(6, 2, 0) || \
1622 HEDLEY_TI_CL6X_VERSION_CHECK(8, 0, 0) || \
1623 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1624 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
1625#define HEDLEY_INLINE __inline
1627#define HEDLEY_INLINE
1630#if defined(HEDLEY_ALWAYS_INLINE)
1631#undef HEDLEY_ALWAYS_INLINE
1633#if HEDLEY_HAS_ATTRIBUTE(always_inline) || \
1634 HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1635 HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1636 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1637 HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1638 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
1639 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1640 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1641 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
1642 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1643 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1644 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
1645 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1646 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1647 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1648 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1649 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
1650 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1651 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
1652#define HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) HEDLEY_INLINE
1653#elif HEDLEY_MSVC_VERSION_CHECK(12, 0, 0) || \
1654 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1655#define HEDLEY_ALWAYS_INLINE __forceinline
1656#elif defined(__cplusplus) && (HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1657 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1658 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1659 HEDLEY_TI_CL6X_VERSION_CHECK(6, 1, 0) || \
1660 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1661 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0))
1662#define HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;")
1663#elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1664#define HEDLEY_ALWAYS_INLINE _Pragma("inline=forced")
1666#define HEDLEY_ALWAYS_INLINE HEDLEY_INLINE
1669#if defined(HEDLEY_NEVER_INLINE)
1670#undef HEDLEY_NEVER_INLINE
1672#if HEDLEY_HAS_ATTRIBUTE(noinline) || HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || \
1673 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1674 HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1675 HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \
1676 HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \
1677 (HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && \
1678 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1679 HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \
1680 (HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && \
1681 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1682 HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \
1683 (HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && \
1684 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1685 HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \
1686 (HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1687 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1688 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \
1689 HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \
1690 HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0)
1691#define HEDLEY_NEVER_INLINE __attribute__((__noinline__))
1692#elif HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \
1693 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1694#define HEDLEY_NEVER_INLINE __declspec(noinline)
1695#elif HEDLEY_PGI_VERSION_CHECK(10, 2, 0)
1696#define HEDLEY_NEVER_INLINE _Pragma("noinline")
1697#elif HEDLEY_TI_CL6X_VERSION_CHECK(6, 0, 0) && defined(__cplusplus)
1698#define HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;")
1699#elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1700#define HEDLEY_NEVER_INLINE _Pragma("inline=never")
1701#elif HEDLEY_COMPCERT_VERSION_CHECK(3, 2, 0)
1702#define HEDLEY_NEVER_INLINE __attribute((noinline))
1703#elif HEDLEY_PELLES_VERSION_CHECK(9, 0, 0)
1704#define HEDLEY_NEVER_INLINE __declspec(noinline)
1706#define HEDLEY_NEVER_INLINE
1709#if defined(HEDLEY_PRIVATE)
1710#undef HEDLEY_PRIVATE
1712#if defined(HEDLEY_PUBLIC)
1715#if defined(HEDLEY_IMPORT)
1718#if defined(_WIN32) || defined(__CYGWIN__)
1719#define HEDLEY_PRIVATE
1720#define HEDLEY_PUBLIC __declspec(dllexport)
1721#define HEDLEY_IMPORT __declspec(dllimport)
1723#if HEDLEY_HAS_ATTRIBUTE(visibility) || HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \
1724 HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \
1725 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1726 HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \
1727 (defined(__TI_EABI__) && ((HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && \
1728 defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
1729 HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0)))
1730#define HEDLEY_PRIVATE __attribute__((__visibility__("hidden")))
1731#define HEDLEY_PUBLIC __attribute__((__visibility__("default")))
1733#define HEDLEY_PRIVATE
1734#define HEDLEY_PUBLIC
1736#define HEDLEY_IMPORT extern
1739#if defined(HEDLEY_NO_THROW)
1740#undef HEDLEY_NO_THROW
1742#if HEDLEY_HAS_ATTRIBUTE(nothrow) || HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \
1743 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1744#define HEDLEY_NO_THROW __attribute__((__nothrow__))
1745#elif HEDLEY_MSVC_VERSION_CHECK(13, 1, 0) || \
1746 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) || \
1747 HEDLEY_ARM_VERSION_CHECK(4, 1, 0)
1748#define HEDLEY_NO_THROW __declspec(nothrow)
1750#define HEDLEY_NO_THROW
1753#if defined(HEDLEY_FALL_THROUGH)
1754#undef HEDLEY_FALL_THROUGH
1756#if HEDLEY_HAS_ATTRIBUTE(fallthrough) || HEDLEY_GCC_VERSION_CHECK(7, 0, 0)
1757#define HEDLEY_FALL_THROUGH __attribute__((__fallthrough__))
1758#elif HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang, fallthrough)
1759#define HEDLEY_FALL_THROUGH \
1760 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]])
1761#elif HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough)
1762#define HEDLEY_FALL_THROUGH \
1763 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]])
1764#elif defined(__fallthrough)
1765#define HEDLEY_FALL_THROUGH __fallthrough
1767#define HEDLEY_FALL_THROUGH
1770#if defined(HEDLEY_RETURNS_NON_NULL)
1771#undef HEDLEY_RETURNS_NON_NULL
1773#if HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || HEDLEY_GCC_VERSION_CHECK(4, 9, 0)
1774#define HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__))
1775#elif defined(_Ret_notnull_)
1776#define HEDLEY_RETURNS_NON_NULL _Ret_notnull_
1778#define HEDLEY_RETURNS_NON_NULL
1781#if defined(HEDLEY_ARRAY_PARAM)
1782#undef HEDLEY_ARRAY_PARAM
1784#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
1785 !defined(__STDC_NO_VLA__) && !defined(__cplusplus) && \
1786 !defined(HEDLEY_PGI_VERSION) && !defined(HEDLEY_TINYC_VERSION)
1787#define HEDLEY_ARRAY_PARAM(name) (name)
1789#define HEDLEY_ARRAY_PARAM(name)
1792#if defined(HEDLEY_IS_CONSTANT)
1793#undef HEDLEY_IS_CONSTANT
1795#if defined(HEDLEY_REQUIRE_CONSTEXPR)
1796#undef HEDLEY_REQUIRE_CONSTEXPR
1800#if defined(HEDLEY_IS_CONSTEXPR_)
1801#undef HEDLEY_IS_CONSTEXPR_
1803#if HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \
1804 HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1805 HEDLEY_TINYC_VERSION_CHECK(0, 9, 19) || HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \
1806 HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \
1807 HEDLEY_TI_CL6X_VERSION_CHECK(6, 1, 0) || \
1808 (HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0) && !defined(__cplusplus)) || \
1809 HEDLEY_CRAY_VERSION_CHECK(8, 1, 0)
1810#define HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr)
1812#if !defined(__cplusplus)
1813#if HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \
1814 HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \
1815 HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || HEDLEY_CRAY_VERSION_CHECK(8, 1, 0) || \
1816 HEDLEY_ARM_VERSION_CHECK(5, 4, 0) || HEDLEY_TINYC_VERSION_CHECK(0, 9, 24)
1817#if defined(__INTPTR_TYPE__)
1818#define HEDLEY_IS_CONSTEXPR_(expr) \
1819 __builtin_types_compatible_p( \
1820 __typeof__((1 ? (void*)((__INTPTR_TYPE__)((expr) * 0)) : (int*)0)), int*)
1823#define HEDLEY_IS_CONSTEXPR_(expr) \
1824 __builtin_types_compatible_p( \
1825 __typeof__((1 ? (void*)((intptr_t)((expr) * 0)) : (int*)0)), int*)
1827#elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \
1828 !defined(HEDLEY_SUNPRO_VERSION) && !defined(HEDLEY_PGI_VERSION) && \
1829 !defined(HEDLEY_IAR_VERSION)) || \
1830 HEDLEY_HAS_EXTENSION(c_generic_selections) || \
1831 HEDLEY_GCC_VERSION_CHECK(4, 9, 0) || HEDLEY_INTEL_VERSION_CHECK(17, 0, 0) || \
1832 HEDLEY_IBM_VERSION_CHECK(12, 1, 0) || HEDLEY_ARM_VERSION_CHECK(5, 3, 0)
1833#if defined(__INTPTR_TYPE__)
1834#define HEDLEY_IS_CONSTEXPR_(expr) \
1835 _Generic((1 ? (void*)((__INTPTR_TYPE__)((expr) * 0)) : (int*)0), \
1840#define HEDLEY_IS_CONSTEXPR_(expr) \
1841 _Generic((1 ? (void*)((intptr_t) * 0) : (int*)0), int*: 1, void*: 0)
1843#elif defined(HEDLEY_GCC_VERSION) || defined(HEDLEY_INTEL_VERSION) || \
1844 defined(HEDLEY_TINYC_VERSION) || defined(HEDLEY_TI_ARMCL_VERSION) || \
1845 HEDLEY_TI_CL430_VERSION_CHECK(18, 12, 0) || \
1846 defined(HEDLEY_TI_CL2000_VERSION) || defined(HEDLEY_TI_CL6X_VERSION) || \
1847 defined(HEDLEY_TI_CL7X_VERSION) || defined(HEDLEY_TI_CLPRU_VERSION) || \
1849#define HEDLEY_IS_CONSTEXPR_(expr) \
1850 (sizeof(void) != sizeof(*(1 ? ((void*)((expr) * 0L)) \
1851 : ((struct { char v[sizeof(void) * 2]; }*)1))))
1854#if defined(HEDLEY_IS_CONSTEXPR_)
1855#if !defined(HEDLEY_IS_CONSTANT)
1856#define HEDLEY_IS_CONSTANT(expr) HEDLEY_IS_CONSTEXPR_(expr)
1858#define HEDLEY_REQUIRE_CONSTEXPR(expr) \
1859 (HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1))
1861#if !defined(HEDLEY_IS_CONSTANT)
1862#define HEDLEY_IS_CONSTANT(expr) (0)
1864#define HEDLEY_REQUIRE_CONSTEXPR(expr) (expr)
1867#if defined(HEDLEY_BEGIN_C_DECLS)
1868#undef HEDLEY_BEGIN_C_DECLS
1870#if defined(HEDLEY_END_C_DECLS)
1871#undef HEDLEY_END_C_DECLS
1873#if defined(HEDLEY_C_DECL)
1876#if defined(__cplusplus)
1877#define HEDLEY_BEGIN_C_DECLS \
1880#define HEDLEY_END_C_DECLS }
1881#define HEDLEY_C_DECL extern "C"
1883#define HEDLEY_BEGIN_C_DECLS
1884#define HEDLEY_END_C_DECLS
1885#define HEDLEY_C_DECL
1888#if defined(HEDLEY_STATIC_ASSERT)
1889#undef HEDLEY_STATIC_ASSERT
1891#if !defined(__cplusplus) && \
1892 ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
1893 (HEDLEY_HAS_FEATURE(c_static_assert) && \
1894 !defined(HEDLEY_INTEL_CL_VERSION)) || \
1895 HEDLEY_GCC_VERSION_CHECK(6, 0, 0) || \
1896 HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || defined(_Static_assert))
1897#define HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
1898#elif (defined(__cplusplus) && (__cplusplus >= 201103L)) || \
1899 HEDLEY_MSVC_VERSION_CHECK(16, 0, 0) || \
1900 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1901#define HEDLEY_STATIC_ASSERT(expr, message) \
1902 HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message))
1904#define HEDLEY_STATIC_ASSERT(expr, message)
1907#if defined(HEDLEY_NULL)
1910#if defined(__cplusplus)
1911#if __cplusplus >= 201103L
1912#define HEDLEY_NULL HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr)
1914#define HEDLEY_NULL NULL
1916#define HEDLEY_NULL HEDLEY_STATIC_CAST(void*, 0)
1919#define HEDLEY_NULL NULL
1921#define HEDLEY_NULL ((void*)0)
1924#if defined(HEDLEY_MESSAGE)
1925#undef HEDLEY_MESSAGE
1927#if HEDLEY_HAS_WARNING("-Wunknown-pragmas")
1928#define HEDLEY_MESSAGE(msg) \
1929 HEDLEY_DIAGNOSTIC_PUSH \
1930 HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
1931 HEDLEY_PRAGMA(message msg) \
1932 HEDLEY_DIAGNOSTIC_POP
1933#elif HEDLEY_GCC_VERSION_CHECK(4, 4, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1934#define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message msg)
1935#elif HEDLEY_CRAY_VERSION_CHECK(5, 0, 0)
1936#define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(_CRI message msg)
1937#elif HEDLEY_IAR_VERSION_CHECK(8, 0, 0)
1938#define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message(msg))
1939#elif HEDLEY_PELLES_VERSION_CHECK(2, 0, 0)
1940#define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message(msg))
1942#define HEDLEY_MESSAGE(msg)
1945#if defined(HEDLEY_WARNING)
1946#undef HEDLEY_WARNING
1948#if HEDLEY_HAS_WARNING("-Wunknown-pragmas")
1949#define HEDLEY_WARNING(msg) \
1950 HEDLEY_DIAGNOSTIC_PUSH \
1951 HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
1952 HEDLEY_PRAGMA(clang warning msg) \
1953 HEDLEY_DIAGNOSTIC_POP
1954#elif HEDLEY_GCC_VERSION_CHECK(4, 8, 0) || \
1955 HEDLEY_PGI_VERSION_CHECK(18, 4, 0) || HEDLEY_INTEL_VERSION_CHECK(13, 0, 0)
1956#define HEDLEY_WARNING(msg) HEDLEY_PRAGMA(GCC warning msg)
1957#elif HEDLEY_MSVC_VERSION_CHECK(15, 0, 0) || \
1958 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
1959#define HEDLEY_WARNING(msg) HEDLEY_PRAGMA(message(msg))
1961#define HEDLEY_WARNING(msg) HEDLEY_MESSAGE(msg)
1964#if defined(HEDLEY_REQUIRE)
1965#undef HEDLEY_REQUIRE
1967#if defined(HEDLEY_REQUIRE_MSG)
1968#undef HEDLEY_REQUIRE_MSG
1970#if HEDLEY_HAS_ATTRIBUTE(diagnose_if)
1971#if HEDLEY_HAS_WARNING("-Wgcc-compat")
1972#define HEDLEY_REQUIRE(expr) \
1973 HEDLEY_DIAGNOSTIC_PUSH \
1974 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") __attribute__(( \
1975 diagnose_if(!(expr), #expr, "error"))) HEDLEY_DIAGNOSTIC_POP
1976#define HEDLEY_REQUIRE_MSG(expr, msg) \
1977 HEDLEY_DIAGNOSTIC_PUSH \
1978 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
1979 __attribute__((diagnose_if(!(expr), msg, "error"))) HEDLEY_DIAGNOSTIC_POP
1981#define HEDLEY_REQUIRE(expr) \
1982 __attribute__((diagnose_if(!(expr), #expr, "error")))
1983#define HEDLEY_REQUIRE_MSG(expr, msg) \
1984 __attribute__((diagnose_if(!(expr), msg, "error")))
1987#define HEDLEY_REQUIRE(expr)
1988#define HEDLEY_REQUIRE_MSG(expr, msg)
1991#if defined(HEDLEY_FLAGS)
1994#if HEDLEY_HAS_ATTRIBUTE(flag_enum)
1995#define HEDLEY_FLAGS __attribute__((__flag_enum__))
2000#if defined(HEDLEY_FLAGS_CAST)
2001#undef HEDLEY_FLAGS_CAST
2003#if HEDLEY_INTEL_VERSION_CHECK(19, 0, 0)
2004#define HEDLEY_FLAGS_CAST(T, expr) \
2006 HEDLEY_DIAGNOSTIC_PUSH \
2007 _Pragma("warning(disable:188)")((T)(expr)); \
2008 HEDLEY_DIAGNOSTIC_POP \
2011#define HEDLEY_FLAGS_CAST(T, expr) HEDLEY_STATIC_CAST(T, expr)
2014#if defined(HEDLEY_EMPTY_BASES)
2015#undef HEDLEY_EMPTY_BASES
2017#if (HEDLEY_MSVC_VERSION_CHECK(19, 0, 23918) && \
2018 !HEDLEY_MSVC_VERSION_CHECK(20, 0, 0)) || \
2019 HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0)
2020#define HEDLEY_EMPTY_BASES __declspec(empty_bases)
2022#define HEDLEY_EMPTY_BASES
2027#if defined(HEDLEY_GCC_NOT_CLANG_VERSION_CHECK)
2028#undef HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
2030#if defined(__clang__)
2031#define HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major, minor, patch) (0)
2033#define HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major, minor, patch) \
2034 HEDLEY_GCC_VERSION_CHECK(major, minor, patch)
2037#if defined(HEDLEY_CLANG_HAS_ATTRIBUTE)
2038#undef HEDLEY_CLANG_HAS_ATTRIBUTE
2040#define HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) HEDLEY_HAS_ATTRIBUTE(attribute)
2042#if defined(HEDLEY_CLANG_HAS_CPP_ATTRIBUTE)
2043#undef HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
2045#define HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) \
2046 HEDLEY_HAS_CPP_ATTRIBUTE(attribute)
2048#if defined(HEDLEY_CLANG_HAS_BUILTIN)
2049#undef HEDLEY_CLANG_HAS_BUILTIN
2051#define HEDLEY_CLANG_HAS_BUILTIN(builtin) HEDLEY_HAS_BUILTIN(builtin)
2053#if defined(HEDLEY_CLANG_HAS_FEATURE)
2054#undef HEDLEY_CLANG_HAS_FEATURE
2056#define HEDLEY_CLANG_HAS_FEATURE(feature) HEDLEY_HAS_FEATURE(feature)
2058#if defined(HEDLEY_CLANG_HAS_EXTENSION)
2059#undef HEDLEY_CLANG_HAS_EXTENSION
2061#define HEDLEY_CLANG_HAS_EXTENSION(extension) HEDLEY_HAS_EXTENSION(extension)
2063#if defined(HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE)
2064#undef HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
2066#define HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) \
2067 HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute)
2069#if defined(HEDLEY_CLANG_HAS_WARNING)
2070#undef HEDLEY_CLANG_HAS_WARNING
2072#define HEDLEY_CLANG_HAS_WARNING(warning) HEDLEY_HAS_WARNING(warning)
#define HEDLEY_DIAGNOSTIC_PUSH
#define HEDLEY_DIAGNOSTIC_POP