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 < 14) 14 #if defined(HEDLEY_VERSION) 15 # undef HEDLEY_VERSION 16 #endif 17 #define HEDLEY_VERSION 14 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_CONCAT3_EX) 40 # undef HEDLEY_CONCAT3_EX 41 #endif 42 #define HEDLEY_CONCAT3_EX(a,b,c) a##b##c 43 44 #if defined(HEDLEY_CONCAT3) 45 # undef HEDLEY_CONCAT3 46 #endif 47 #define HEDLEY_CONCAT3(a,b,c) HEDLEY_CONCAT3_EX(a,b,c) 48 49 #if defined(HEDLEY_VERSION_ENCODE) 50 # undef HEDLEY_VERSION_ENCODE 51 #endif 52 #define HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) 53 54 #if defined(HEDLEY_VERSION_DECODE_MAJOR) 55 # undef HEDLEY_VERSION_DECODE_MAJOR 56 #endif 57 #define HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) 58 59 #if defined(HEDLEY_VERSION_DECODE_MINOR) 60 # undef HEDLEY_VERSION_DECODE_MINOR 61 #endif 62 #define HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) 63 64 #if defined(HEDLEY_VERSION_DECODE_REVISION) 65 # undef HEDLEY_VERSION_DECODE_REVISION 66 #endif 67 #define HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) 68 69 #if defined(HEDLEY_GNUC_VERSION) 70 # undef HEDLEY_GNUC_VERSION 71 #endif 72 #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) 73 # define HEDLEY_GNUC_VERSION HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) 74 #elif defined(__GNUC__) 75 # define HEDLEY_GNUC_VERSION HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) 76 #endif 77 78 #if defined(HEDLEY_GNUC_VERSION_CHECK) 79 # undef HEDLEY_GNUC_VERSION_CHECK 80 #endif 81 #if defined(HEDLEY_GNUC_VERSION) 82 # define HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (HEDLEY_GNUC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 83 #else 84 # define HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) 85 #endif 86 87 #if defined(HEDLEY_MSVC_VERSION) 88 # undef HEDLEY_MSVC_VERSION 89 #endif 90 #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) 91 # define HEDLEY_MSVC_VERSION HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) 92 #elif defined(_MSC_FULL_VER) && !defined(__ICL) 93 # define HEDLEY_MSVC_VERSION HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) 94 #elif defined(_MSC_VER) && !defined(__ICL) 95 # define HEDLEY_MSVC_VERSION 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(HEDLEY_MSVC_VERSION) 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) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) 105 #elif defined(_MSC_VER) && (_MSC_VER >= 1200) 106 # define HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) 107 #else 108 # define HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) 109 #endif 110 111 #if defined(HEDLEY_INTEL_VERSION) 112 # undef HEDLEY_INTEL_VERSION 113 #endif 114 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) 115 # define HEDLEY_INTEL_VERSION HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) 116 #elif defined(__INTEL_COMPILER) && !defined(__ICL) 117 # define HEDLEY_INTEL_VERSION HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) 118 #endif 119 120 #if defined(HEDLEY_INTEL_VERSION_CHECK) 121 # undef HEDLEY_INTEL_VERSION_CHECK 122 #endif 123 #if defined(HEDLEY_INTEL_VERSION) 124 # define HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (HEDLEY_INTEL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 125 #else 126 # define HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) 127 #endif 128 129 #if defined(HEDLEY_INTEL_CL_VERSION) 130 # undef HEDLEY_INTEL_CL_VERSION 131 #endif 132 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) 133 # define HEDLEY_INTEL_CL_VERSION HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) 134 #endif 135 136 #if defined(HEDLEY_INTEL_CL_VERSION_CHECK) 137 # undef HEDLEY_INTEL_CL_VERSION_CHECK 138 #endif 139 #if defined(HEDLEY_INTEL_CL_VERSION) 140 # define HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (HEDLEY_INTEL_CL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 141 #else 142 # define HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) 143 #endif 144 145 #if defined(HEDLEY_PGI_VERSION) 146 # undef HEDLEY_PGI_VERSION 147 #endif 148 #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) 149 # define HEDLEY_PGI_VERSION HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) 150 #endif 151 152 #if defined(HEDLEY_PGI_VERSION_CHECK) 153 # undef HEDLEY_PGI_VERSION_CHECK 154 #endif 155 #if defined(HEDLEY_PGI_VERSION) 156 # define HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (HEDLEY_PGI_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 157 #else 158 # define HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) 159 #endif 160 161 #if defined(HEDLEY_SUNPRO_VERSION) 162 # undef HEDLEY_SUNPRO_VERSION 163 #endif 164 #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) 165 # define HEDLEY_SUNPRO_VERSION HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) 166 #elif defined(__SUNPRO_C) 167 # define HEDLEY_SUNPRO_VERSION HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) 168 #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) 169 # define HEDLEY_SUNPRO_VERSION HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) 170 #elif defined(__SUNPRO_CC) 171 # define HEDLEY_SUNPRO_VERSION HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) 172 #endif 173 174 #if defined(HEDLEY_SUNPRO_VERSION_CHECK) 175 # undef HEDLEY_SUNPRO_VERSION_CHECK 176 #endif 177 #if defined(HEDLEY_SUNPRO_VERSION) 178 # define HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (HEDLEY_SUNPRO_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 179 #else 180 # define HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) 181 #endif 182 183 #if defined(HEDLEY_EMSCRIPTEN_VERSION) 184 # undef HEDLEY_EMSCRIPTEN_VERSION 185 #endif 186 #if defined(__EMSCRIPTEN__) 187 # define HEDLEY_EMSCRIPTEN_VERSION HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) 188 #endif 189 190 #if defined(HEDLEY_EMSCRIPTEN_VERSION_CHECK) 191 # undef HEDLEY_EMSCRIPTEN_VERSION_CHECK 192 #endif 193 #if defined(HEDLEY_EMSCRIPTEN_VERSION) 194 # define HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (HEDLEY_EMSCRIPTEN_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 195 #else 196 # define HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) 197 #endif 198 199 #if defined(HEDLEY_ARM_VERSION) 200 # undef HEDLEY_ARM_VERSION 201 #endif 202 #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) 203 # define HEDLEY_ARM_VERSION HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) 204 #elif defined(__CC_ARM) && defined(__ARMCC_VERSION) 205 # define HEDLEY_ARM_VERSION HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) 206 #endif 207 208 #if defined(HEDLEY_ARM_VERSION_CHECK) 209 # undef HEDLEY_ARM_VERSION_CHECK 210 #endif 211 #if defined(HEDLEY_ARM_VERSION) 212 # define HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (HEDLEY_ARM_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 213 #else 214 # define HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) 215 #endif 216 217 #if defined(HEDLEY_IBM_VERSION) 218 # undef HEDLEY_IBM_VERSION 219 #endif 220 #if defined(__ibmxl__) 221 # define HEDLEY_IBM_VERSION HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) 222 #elif defined(__xlC__) && defined(__xlC_ver__) 223 # define HEDLEY_IBM_VERSION HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) 224 #elif defined(__xlC__) 225 # define HEDLEY_IBM_VERSION HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) 226 #endif 227 228 #if defined(HEDLEY_IBM_VERSION_CHECK) 229 # undef HEDLEY_IBM_VERSION_CHECK 230 #endif 231 #if defined(HEDLEY_IBM_VERSION) 232 # define HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (HEDLEY_IBM_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 233 #else 234 # define HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) 235 #endif 236 237 #if defined(HEDLEY_TI_VERSION) 238 # undef HEDLEY_TI_VERSION 239 #endif 240 #if \ 241 defined(__TI_COMPILER_VERSION__) && \ 242 ( \ 243 defined(__TMS470__) || defined(__TI_ARM__) || \ 244 defined(__MSP430__) || \ 245 defined(__TMS320C2000__) \ 246 ) 247 # if (__TI_COMPILER_VERSION__ >= 16000000) 248 # define HEDLEY_TI_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 249 # endif 250 #endif 251 252 #if defined(HEDLEY_TI_VERSION_CHECK) 253 # undef HEDLEY_TI_VERSION_CHECK 254 #endif 255 #if defined(HEDLEY_TI_VERSION) 256 # define HEDLEY_TI_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 257 #else 258 # define HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) 259 #endif 260 261 #if defined(HEDLEY_TI_CL2000_VERSION) 262 # undef HEDLEY_TI_CL2000_VERSION 263 #endif 264 #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) 265 # define HEDLEY_TI_CL2000_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 266 #endif 267 268 #if defined(HEDLEY_TI_CL2000_VERSION_CHECK) 269 # undef HEDLEY_TI_CL2000_VERSION_CHECK 270 #endif 271 #if defined(HEDLEY_TI_CL2000_VERSION) 272 # define HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CL2000_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 273 #else 274 # define HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) 275 #endif 276 277 #if defined(HEDLEY_TI_CL430_VERSION) 278 # undef HEDLEY_TI_CL430_VERSION 279 #endif 280 #if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) 281 # define HEDLEY_TI_CL430_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 282 #endif 283 284 #if defined(HEDLEY_TI_CL430_VERSION_CHECK) 285 # undef HEDLEY_TI_CL430_VERSION_CHECK 286 #endif 287 #if defined(HEDLEY_TI_CL430_VERSION) 288 # define HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CL430_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 289 #else 290 # define HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) 291 #endif 292 293 #if defined(HEDLEY_TI_ARMCL_VERSION) 294 # undef HEDLEY_TI_ARMCL_VERSION 295 #endif 296 #if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) 297 # define HEDLEY_TI_ARMCL_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 298 #endif 299 300 #if defined(HEDLEY_TI_ARMCL_VERSION_CHECK) 301 # undef HEDLEY_TI_ARMCL_VERSION_CHECK 302 #endif 303 #if defined(HEDLEY_TI_ARMCL_VERSION) 304 # define HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_ARMCL_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 305 #else 306 # define HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) 307 #endif 308 309 #if defined(HEDLEY_TI_CL6X_VERSION) 310 # undef HEDLEY_TI_CL6X_VERSION 311 #endif 312 #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) 313 # define HEDLEY_TI_CL6X_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 314 #endif 315 316 #if defined(HEDLEY_TI_CL6X_VERSION_CHECK) 317 # undef HEDLEY_TI_CL6X_VERSION_CHECK 318 #endif 319 #if defined(HEDLEY_TI_CL6X_VERSION) 320 # define HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CL6X_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 321 #else 322 # define HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) 323 #endif 324 325 #if defined(HEDLEY_TI_CL7X_VERSION) 326 # undef HEDLEY_TI_CL7X_VERSION 327 #endif 328 #if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) 329 # define HEDLEY_TI_CL7X_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 330 #endif 331 332 #if defined(HEDLEY_TI_CL7X_VERSION_CHECK) 333 # undef HEDLEY_TI_CL7X_VERSION_CHECK 334 #endif 335 #if defined(HEDLEY_TI_CL7X_VERSION) 336 # define HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CL7X_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 337 #else 338 # define HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) 339 #endif 340 341 #if defined(HEDLEY_TI_CLPRU_VERSION) 342 # undef HEDLEY_TI_CLPRU_VERSION 343 #endif 344 #if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) 345 # define HEDLEY_TI_CLPRU_VERSION HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) 346 #endif 347 348 #if defined(HEDLEY_TI_CLPRU_VERSION_CHECK) 349 # undef HEDLEY_TI_CLPRU_VERSION_CHECK 350 #endif 351 #if defined(HEDLEY_TI_CLPRU_VERSION) 352 # define HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (HEDLEY_TI_CLPRU_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 353 #else 354 # define HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) 355 #endif 356 357 #if defined(HEDLEY_CRAY_VERSION) 358 # undef HEDLEY_CRAY_VERSION 359 #endif 360 #if defined(_CRAYC) 361 # if defined(_RELEASE_PATCHLEVEL) 362 # define HEDLEY_CRAY_VERSION HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) 363 # else 364 # define HEDLEY_CRAY_VERSION HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) 365 # endif 366 #endif 367 368 #if defined(HEDLEY_CRAY_VERSION_CHECK) 369 # undef HEDLEY_CRAY_VERSION_CHECK 370 #endif 371 #if defined(HEDLEY_CRAY_VERSION) 372 # define HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (HEDLEY_CRAY_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 373 #else 374 # define HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) 375 #endif 376 377 #if defined(HEDLEY_IAR_VERSION) 378 # undef HEDLEY_IAR_VERSION 379 #endif 380 #if defined(__IAR_SYSTEMS_ICC__) 381 # if __VER__ > 1000 382 # define HEDLEY_IAR_VERSION HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) 383 # else 384 # define HEDLEY_IAR_VERSION HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0) 385 # endif 386 #endif 387 388 #if defined(HEDLEY_IAR_VERSION_CHECK) 389 # undef HEDLEY_IAR_VERSION_CHECK 390 #endif 391 #if defined(HEDLEY_IAR_VERSION) 392 # define HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (HEDLEY_IAR_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 393 #else 394 # define HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) 395 #endif 396 397 #if defined(HEDLEY_TINYC_VERSION) 398 # undef HEDLEY_TINYC_VERSION 399 #endif 400 #if defined(__TINYC__) 401 # define HEDLEY_TINYC_VERSION HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) 402 #endif 403 404 #if defined(HEDLEY_TINYC_VERSION_CHECK) 405 # undef HEDLEY_TINYC_VERSION_CHECK 406 #endif 407 #if defined(HEDLEY_TINYC_VERSION) 408 # define HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (HEDLEY_TINYC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 409 #else 410 # define HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) 411 #endif 412 413 #if defined(HEDLEY_DMC_VERSION) 414 # undef HEDLEY_DMC_VERSION 415 #endif 416 #if defined(__DMC__) 417 # define HEDLEY_DMC_VERSION HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) 418 #endif 419 420 #if defined(HEDLEY_DMC_VERSION_CHECK) 421 # undef HEDLEY_DMC_VERSION_CHECK 422 #endif 423 #if defined(HEDLEY_DMC_VERSION) 424 # define HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (HEDLEY_DMC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 425 #else 426 # define HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) 427 #endif 428 429 #if defined(HEDLEY_COMPCERT_VERSION) 430 # undef HEDLEY_COMPCERT_VERSION 431 #endif 432 #if defined(__COMPCERT_VERSION__) 433 # define HEDLEY_COMPCERT_VERSION HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) 434 #endif 435 436 #if defined(HEDLEY_COMPCERT_VERSION_CHECK) 437 # undef HEDLEY_COMPCERT_VERSION_CHECK 438 #endif 439 #if defined(HEDLEY_COMPCERT_VERSION) 440 # define HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (HEDLEY_COMPCERT_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 441 #else 442 # define HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) 443 #endif 444 445 #if defined(HEDLEY_PELLES_VERSION) 446 # undef HEDLEY_PELLES_VERSION 447 #endif 448 #if defined(__POCC__) 449 # define HEDLEY_PELLES_VERSION HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) 450 #endif 451 452 #if defined(HEDLEY_PELLES_VERSION_CHECK) 453 # undef HEDLEY_PELLES_VERSION_CHECK 454 #endif 455 #if defined(HEDLEY_PELLES_VERSION) 456 # define HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (HEDLEY_PELLES_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 457 #else 458 # define HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) 459 #endif 460 461 #if defined(HEDLEY_GCC_VERSION) 462 # undef HEDLEY_GCC_VERSION 463 #endif 464 #if \ 465 defined(HEDLEY_GNUC_VERSION) && \ 466 !defined(__clang__) && \ 467 !defined(HEDLEY_INTEL_VERSION) && \ 468 !defined(HEDLEY_PGI_VERSION) && \ 469 !defined(HEDLEY_ARM_VERSION) && \ 470 !defined(HEDLEY_TI_VERSION) && \ 471 !defined(HEDLEY_TI_ARMCL_VERSION) && \ 472 !defined(HEDLEY_TI_CL430_VERSION) && \ 473 !defined(HEDLEY_TI_CL2000_VERSION) && \ 474 !defined(HEDLEY_TI_CL6X_VERSION) && \ 475 !defined(HEDLEY_TI_CL7X_VERSION) && \ 476 !defined(HEDLEY_TI_CLPRU_VERSION) && \ 477 !defined(__COMPCERT__) 478 # define HEDLEY_GCC_VERSION HEDLEY_GNUC_VERSION 479 #endif 480 481 #if defined(HEDLEY_GCC_VERSION_CHECK) 482 # undef HEDLEY_GCC_VERSION_CHECK 483 #endif 484 #if defined(HEDLEY_GCC_VERSION) 485 # define HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (HEDLEY_GCC_VERSION >= HEDLEY_VERSION_ENCODE(major, minor, patch)) 486 #else 487 # define HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) 488 #endif 489 490 #if defined(HEDLEY_HAS_ATTRIBUTE) 491 # undef HEDLEY_HAS_ATTRIBUTE 492 #endif 493 #if defined(__has_attribute) 494 # define HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) 495 #else 496 # define HEDLEY_HAS_ATTRIBUTE(attribute) (0) 497 #endif 498 499 #if defined(HEDLEY_GNUC_HAS_ATTRIBUTE) 500 # undef HEDLEY_GNUC_HAS_ATTRIBUTE 501 #endif 502 #if defined(__has_attribute) 503 # define HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) 504 #else 505 # define HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 506 #endif 507 508 #if defined(HEDLEY_GCC_HAS_ATTRIBUTE) 509 # undef HEDLEY_GCC_HAS_ATTRIBUTE 510 #endif 511 #if defined(__has_attribute) 512 # define HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) 513 #else 514 # define HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 515 #endif 516 517 #if defined(HEDLEY_HAS_CPP_ATTRIBUTE) 518 # undef HEDLEY_HAS_CPP_ATTRIBUTE 519 #endif 520 #if \ 521 defined(__has_cpp_attribute) && \ 522 defined(__cplusplus) && \ 523 (!defined(HEDLEY_SUNPRO_VERSION) || HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) 524 # define HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) 525 #else 526 # define HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) 527 #endif 528 529 #if defined(HEDLEY_HAS_CPP_ATTRIBUTE_NS) 530 # undef HEDLEY_HAS_CPP_ATTRIBUTE_NS 531 #endif 532 #if !defined(__cplusplus) || !defined(__has_cpp_attribute) 533 # define HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) 534 #elif \ 535 !defined(HEDLEY_PGI_VERSION) && \ 536 !defined(HEDLEY_IAR_VERSION) && \ 537 (!defined(HEDLEY_SUNPRO_VERSION) || HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ 538 (!defined(HEDLEY_MSVC_VERSION) || HEDLEY_MSVC_VERSION_CHECK(19,20,0)) 539 # define HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) 540 #else 541 # define HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) 542 #endif 543 544 #if defined(HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) 545 # undef HEDLEY_GNUC_HAS_CPP_ATTRIBUTE 546 #endif 547 #if defined(__has_cpp_attribute) && defined(__cplusplus) 548 # define HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) 549 #else 550 # define HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 551 #endif 552 553 #if defined(HEDLEY_GCC_HAS_CPP_ATTRIBUTE) 554 # undef HEDLEY_GCC_HAS_CPP_ATTRIBUTE 555 #endif 556 #if defined(__has_cpp_attribute) && defined(__cplusplus) 557 # define HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) 558 #else 559 # define HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 560 #endif 561 562 #if defined(HEDLEY_HAS_BUILTIN) 563 # undef HEDLEY_HAS_BUILTIN 564 #endif 565 #if defined(__has_builtin) 566 # define HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) 567 #else 568 # define HEDLEY_HAS_BUILTIN(builtin) (0) 569 #endif 570 571 #if defined(HEDLEY_GNUC_HAS_BUILTIN) 572 # undef HEDLEY_GNUC_HAS_BUILTIN 573 #endif 574 #if defined(__has_builtin) 575 # define HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) 576 #else 577 # define HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 578 #endif 579 580 #if defined(HEDLEY_GCC_HAS_BUILTIN) 581 # undef HEDLEY_GCC_HAS_BUILTIN 582 #endif 583 #if defined(__has_builtin) 584 # define HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) 585 #else 586 # define HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 587 #endif 588 589 #if defined(HEDLEY_HAS_FEATURE) 590 # undef HEDLEY_HAS_FEATURE 591 #endif 592 #if defined(__has_feature) 593 # define HEDLEY_HAS_FEATURE(feature) __has_feature(feature) 594 #else 595 # define HEDLEY_HAS_FEATURE(feature) (0) 596 #endif 597 598 #if defined(HEDLEY_GNUC_HAS_FEATURE) 599 # undef HEDLEY_GNUC_HAS_FEATURE 600 #endif 601 #if defined(__has_feature) 602 # define HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) 603 #else 604 # define HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 605 #endif 606 607 #if defined(HEDLEY_GCC_HAS_FEATURE) 608 # undef HEDLEY_GCC_HAS_FEATURE 609 #endif 610 #if defined(__has_feature) 611 # define HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) 612 #else 613 # define HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 614 #endif 615 616 #if defined(HEDLEY_HAS_EXTENSION) 617 # undef HEDLEY_HAS_EXTENSION 618 #endif 619 #if defined(__has_extension) 620 # define HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) 621 #else 622 # define HEDLEY_HAS_EXTENSION(extension) (0) 623 #endif 624 625 #if defined(HEDLEY_GNUC_HAS_EXTENSION) 626 # undef HEDLEY_GNUC_HAS_EXTENSION 627 #endif 628 #if defined(__has_extension) 629 # define HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) 630 #else 631 # define HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 632 #endif 633 634 #if defined(HEDLEY_GCC_HAS_EXTENSION) 635 # undef HEDLEY_GCC_HAS_EXTENSION 636 #endif 637 #if defined(__has_extension) 638 # define HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) 639 #else 640 # define HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 641 #endif 642 643 #if defined(HEDLEY_HAS_DECLSPEC_ATTRIBUTE) 644 # undef HEDLEY_HAS_DECLSPEC_ATTRIBUTE 645 #endif 646 #if defined(__has_declspec_attribute) 647 # define HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) 648 #else 649 # define HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) 650 #endif 651 652 #if defined(HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) 653 # undef HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE 654 #endif 655 #if defined(__has_declspec_attribute) 656 # define HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) 657 #else 658 # define HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 659 #endif 660 661 #if defined(HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) 662 # undef HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE 663 #endif 664 #if defined(__has_declspec_attribute) 665 # define HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) 666 #else 667 # define HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 668 #endif 669 670 #if defined(HEDLEY_HAS_WARNING) 671 # undef HEDLEY_HAS_WARNING 672 #endif 673 #if defined(__has_warning) 674 # define HEDLEY_HAS_WARNING(warning) __has_warning(warning) 675 #else 676 # define HEDLEY_HAS_WARNING(warning) (0) 677 #endif 678 679 #if defined(HEDLEY_GNUC_HAS_WARNING) 680 # undef HEDLEY_GNUC_HAS_WARNING 681 #endif 682 #if defined(__has_warning) 683 # define HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) 684 #else 685 # define HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) 686 #endif 687 688 #if defined(HEDLEY_GCC_HAS_WARNING) 689 # undef HEDLEY_GCC_HAS_WARNING 690 #endif 691 #if defined(__has_warning) 692 # define HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) 693 #else 694 # define HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 695 #endif 696 697 #if \ 698 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ 699 defined(__clang__) || \ 700 HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ 701 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 702 HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ 703 HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ 704 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 705 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 706 HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ 707 HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ 708 HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ 709 HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ 710 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 711 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 712 HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ 713 HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ 714 HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ 715 (HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) 716 # define HEDLEY_PRAGMA(value) _Pragma(#value) 717 #elif HEDLEY_MSVC_VERSION_CHECK(15,0,0) 718 # define HEDLEY_PRAGMA(value) __pragma(value) 719 #else 720 # define HEDLEY_PRAGMA(value) 721 #endif 722 723 #if defined(HEDLEY_DIAGNOSTIC_PUSH) 724 # undef HEDLEY_DIAGNOSTIC_PUSH 725 #endif 726 #if defined(HEDLEY_DIAGNOSTIC_POP) 727 # undef HEDLEY_DIAGNOSTIC_POP 728 #endif 729 #if defined(__clang__) 730 # define HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") 731 # define HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") 732 #elif HEDLEY_INTEL_VERSION_CHECK(13,0,0) 733 # define HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") 734 # define HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") 735 #elif HEDLEY_GCC_VERSION_CHECK(4,6,0) 736 # define HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") 737 # define HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") 738 #elif \ 739 HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ 740 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 741 # define HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) 742 # define HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) 743 #elif HEDLEY_ARM_VERSION_CHECK(5,6,0) 744 # define HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") 745 # define HEDLEY_DIAGNOSTIC_POP _Pragma("pop") 746 #elif \ 747 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 748 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 749 HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ 750 HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ 751 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 752 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 753 # define HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") 754 # define HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") 755 #elif HEDLEY_PELLES_VERSION_CHECK(2,90,0) 756 # define HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") 757 # define HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") 758 #else 759 # define HEDLEY_DIAGNOSTIC_PUSH 760 # define HEDLEY_DIAGNOSTIC_POP 761 #endif 762 763 /* HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for 764 HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ 765 #if defined(HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) 766 # undef HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ 767 #endif 768 #if defined(__cplusplus) 769 # if HEDLEY_HAS_WARNING("-Wc++98-compat") 770 # if HEDLEY_HAS_WARNING("-Wc++17-extensions") 771 # if HEDLEY_HAS_WARNING("-Wc++1z-extensions") 772 # define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ 773 HEDLEY_DIAGNOSTIC_PUSH \ 774 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ 775 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ 776 _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ 777 xpr \ 778 HEDLEY_DIAGNOSTIC_POP 779 # else 780 # define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ 781 HEDLEY_DIAGNOSTIC_PUSH \ 782 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ 783 _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ 784 xpr \ 785 HEDLEY_DIAGNOSTIC_POP 786 # endif 787 # else 788 # define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ 789 HEDLEY_DIAGNOSTIC_PUSH \ 790 _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ 791 xpr \ 792 HEDLEY_DIAGNOSTIC_POP 793 # endif 794 # endif 795 #endif 796 #if !defined(HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) 797 # define HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x 798 #endif 799 800 #if defined(HEDLEY_CONST_CAST) 801 # undef HEDLEY_CONST_CAST 802 #endif 803 #if defined(__cplusplus) 804 # define HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr)) 805 #elif \ 806 HEDLEY_HAS_WARNING("-Wcast-qual") || \ 807 HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ 808 HEDLEY_INTEL_VERSION_CHECK(13,0,0) 809 # define HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ 810 HEDLEY_DIAGNOSTIC_PUSH \ 811 HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ 812 ((T) (expr)); \ 813 HEDLEY_DIAGNOSTIC_POP \ 814 })) 815 #else 816 # define HEDLEY_CONST_CAST(T, expr) ((T) (expr)) 817 #endif 818 819 #if defined(HEDLEY_REINTERPRET_CAST) 820 # undef HEDLEY_REINTERPRET_CAST 821 #endif 822 #if defined(__cplusplus) 823 # define HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr)) 824 #else 825 # define HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) 826 #endif 827 828 #if defined(HEDLEY_STATIC_CAST) 829 # undef HEDLEY_STATIC_CAST 830 #endif 831 #if defined(__cplusplus) 832 # define HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr)) 833 #else 834 # define HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) 835 #endif 836 837 #if defined(HEDLEY_CPP_CAST) 838 # undef HEDLEY_CPP_CAST 839 #endif 840 #if defined(__cplusplus) 841 # if HEDLEY_HAS_WARNING("-Wold-style-cast") 842 # define HEDLEY_CPP_CAST(T, expr) \ 843 HEDLEY_DIAGNOSTIC_PUSH \ 844 _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ 845 ((T) (expr)) \ 846 HEDLEY_DIAGNOSTIC_POP 847 # elif HEDLEY_IAR_VERSION_CHECK(8,3,0) 848 # define HEDLEY_CPP_CAST(T, expr) \ 849 HEDLEY_DIAGNOSTIC_PUSH \ 850 _Pragma("diag_suppress=Pe137") \ 851 HEDLEY_DIAGNOSTIC_POP 852 # else 853 # define HEDLEY_CPP_CAST(T, expr) ((T) (expr)) 854 # endif 855 #else 856 # define HEDLEY_CPP_CAST(T, expr) (expr) 857 #endif 858 859 #if defined(HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) 860 # undef HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED 861 #endif 862 #if HEDLEY_HAS_WARNING("-Wdeprecated-declarations") 863 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") 864 #elif HEDLEY_INTEL_VERSION_CHECK(13,0,0) 865 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") 866 #elif HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 867 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) 868 #elif HEDLEY_PGI_VERSION_CHECK(20,7,0) 869 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") 870 #elif HEDLEY_PGI_VERSION_CHECK(17,10,0) 871 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") 872 #elif HEDLEY_GCC_VERSION_CHECK(4,3,0) 873 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") 874 #elif HEDLEY_MSVC_VERSION_CHECK(15,0,0) 875 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) 876 #elif \ 877 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 878 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 879 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 880 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 881 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 882 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 883 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 884 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 885 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 886 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 887 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 888 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") 889 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) 890 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") 891 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) 892 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") 893 #elif HEDLEY_IAR_VERSION_CHECK(8,0,0) 894 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") 895 #elif HEDLEY_PELLES_VERSION_CHECK(2,90,0) 896 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") 897 #else 898 # define HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED 899 #endif 900 901 #if defined(HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) 902 # undef HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS 903 #endif 904 #if HEDLEY_HAS_WARNING("-Wunknown-pragmas") 905 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") 906 #elif HEDLEY_INTEL_VERSION_CHECK(13,0,0) 907 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") 908 #elif HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 909 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) 910 #elif HEDLEY_PGI_VERSION_CHECK(17,10,0) 911 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") 912 #elif HEDLEY_GCC_VERSION_CHECK(4,3,0) 913 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") 914 #elif HEDLEY_MSVC_VERSION_CHECK(15,0,0) 915 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) 916 #elif \ 917 HEDLEY_TI_VERSION_CHECK(16,9,0) || \ 918 HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ 919 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 920 HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) 921 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") 922 #elif HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) 923 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") 924 #elif HEDLEY_IAR_VERSION_CHECK(8,0,0) 925 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") 926 #else 927 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS 928 #endif 929 930 #if defined(HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) 931 # undef HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES 932 #endif 933 #if HEDLEY_HAS_WARNING("-Wunknown-attributes") 934 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") 935 #elif HEDLEY_GCC_VERSION_CHECK(4,6,0) 936 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") 937 #elif HEDLEY_INTEL_VERSION_CHECK(17,0,0) 938 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") 939 #elif HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 940 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) 941 #elif HEDLEY_MSVC_VERSION_CHECK(19,0,0) 942 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) 943 #elif HEDLEY_PGI_VERSION_CHECK(20,7,0) 944 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") 945 #elif HEDLEY_PGI_VERSION_CHECK(17,10,0) 946 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") 947 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) 948 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") 949 #elif \ 950 HEDLEY_TI_VERSION_CHECK(18,1,0) || \ 951 HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ 952 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) 953 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") 954 #elif HEDLEY_IAR_VERSION_CHECK(8,0,0) 955 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") 956 #else 957 # define HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES 958 #endif 959 960 #if defined(HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) 961 # undef HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL 962 #endif 963 #if HEDLEY_HAS_WARNING("-Wcast-qual") 964 # define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") 965 #elif HEDLEY_INTEL_VERSION_CHECK(13,0,0) 966 # define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") 967 #elif HEDLEY_GCC_VERSION_CHECK(3,0,0) 968 # define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") 969 #else 970 # define HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL 971 #endif 972 973 #if defined(HEDLEY_DEPRECATED) 974 # undef HEDLEY_DEPRECATED 975 #endif 976 #if defined(HEDLEY_DEPRECATED_FOR) 977 # undef HEDLEY_DEPRECATED_FOR 978 #endif 979 #if \ 980 HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ 981 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 982 # define HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) 983 # define HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) 984 #elif \ 985 HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \ 986 HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ 987 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 988 HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ 989 HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ 990 HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ 991 HEDLEY_TI_VERSION_CHECK(18,1,0) || \ 992 HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ 993 HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ 994 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 995 HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) 996 # define HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) 997 # define HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) 998 #elif defined(__cplusplus) && (__cplusplus >= 201402L) 999 # define HEDLEY_DEPRECATED(since) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) 1000 # define HEDLEY_DEPRECATED_FOR(since, replacement) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) 1001 #elif \ 1002 HEDLEY_HAS_ATTRIBUTE(deprecated) || \ 1003 HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ 1004 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1005 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1006 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1007 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1008 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1009 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1010 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1011 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1012 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1013 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1014 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1015 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1016 # define HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) 1017 # define HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) 1018 #elif \ 1019 HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ 1020 HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ 1021 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1022 # define HEDLEY_DEPRECATED(since) __declspec(deprecated) 1023 # define HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) 1024 #elif HEDLEY_IAR_VERSION_CHECK(8,0,0) 1025 # define HEDLEY_DEPRECATED(since) _Pragma("deprecated") 1026 # define HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") 1027 #else 1028 # define HEDLEY_DEPRECATED(since) 1029 # define HEDLEY_DEPRECATED_FOR(since, replacement) 1030 #endif 1031 1032 #if defined(HEDLEY_UNAVAILABLE) 1033 # undef HEDLEY_UNAVAILABLE 1034 #endif 1035 #if \ 1036 HEDLEY_HAS_ATTRIBUTE(warning) || \ 1037 HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ 1038 HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1039 # define HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) 1040 #else 1041 # define HEDLEY_UNAVAILABLE(available_since) 1042 #endif 1043 1044 #if defined(HEDLEY_WARN_UNUSED_RESULT) 1045 # undef HEDLEY_WARN_UNUSED_RESULT 1046 #endif 1047 #if defined(HEDLEY_WARN_UNUSED_RESULT_MSG) 1048 # undef HEDLEY_WARN_UNUSED_RESULT_MSG 1049 #endif 1050 #if \ 1051 HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ 1052 HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ 1053 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1054 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1055 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1056 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1057 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1058 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1059 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1060 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1061 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1062 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1063 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1064 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 1065 (HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ 1066 HEDLEY_PGI_VERSION_CHECK(17,10,0) 1067 # define HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) 1068 # define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) 1069 #elif (HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) 1070 # define HEDLEY_WARN_UNUSED_RESULT HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) 1071 # define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) 1072 #elif HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) 1073 # define HEDLEY_WARN_UNUSED_RESULT HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) 1074 # define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) 1075 #elif defined(_Check_return_) /* SAL */ 1076 # define HEDLEY_WARN_UNUSED_RESULT _Check_return_ 1077 # define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ 1078 #else 1079 # define HEDLEY_WARN_UNUSED_RESULT 1080 # define HEDLEY_WARN_UNUSED_RESULT_MSG(msg) 1081 #endif 1082 1083 #if defined(HEDLEY_SENTINEL) 1084 # undef HEDLEY_SENTINEL 1085 #endif 1086 #if \ 1087 HEDLEY_HAS_ATTRIBUTE(sentinel) || \ 1088 HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ 1089 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1090 HEDLEY_ARM_VERSION_CHECK(5,4,0) 1091 # define HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) 1092 #else 1093 # define HEDLEY_SENTINEL(position) 1094 #endif 1095 1096 #if defined(HEDLEY_NO_RETURN) 1097 # undef HEDLEY_NO_RETURN 1098 #endif 1099 #if HEDLEY_IAR_VERSION_CHECK(8,0,0) 1100 # define HEDLEY_NO_RETURN __noreturn 1101 #elif HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1102 # define HEDLEY_NO_RETURN __attribute__((__noreturn__)) 1103 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L 1104 # define HEDLEY_NO_RETURN _Noreturn 1105 #elif defined(__cplusplus) && (__cplusplus >= 201103L) 1106 # define HEDLEY_NO_RETURN HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) 1107 #elif \ 1108 HEDLEY_HAS_ATTRIBUTE(noreturn) || \ 1109 HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ 1110 HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1111 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1112 HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1113 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1114 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1115 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1116 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1117 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1118 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1119 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1120 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1121 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1122 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1123 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1124 # define HEDLEY_NO_RETURN __attribute__((__noreturn__)) 1125 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) 1126 # define HEDLEY_NO_RETURN _Pragma("does_not_return") 1127 #elif \ 1128 HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ 1129 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1130 # define HEDLEY_NO_RETURN __declspec(noreturn) 1131 #elif HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) 1132 # define HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") 1133 #elif HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) 1134 # define HEDLEY_NO_RETURN __attribute((noreturn)) 1135 #elif HEDLEY_PELLES_VERSION_CHECK(9,0,0) 1136 # define HEDLEY_NO_RETURN __declspec(noreturn) 1137 #else 1138 # define HEDLEY_NO_RETURN 1139 #endif 1140 1141 #if defined(HEDLEY_NO_ESCAPE) 1142 # undef HEDLEY_NO_ESCAPE 1143 #endif 1144 #if HEDLEY_HAS_ATTRIBUTE(noescape) 1145 # define HEDLEY_NO_ESCAPE __attribute__((__noescape__)) 1146 #else 1147 # define HEDLEY_NO_ESCAPE 1148 #endif 1149 1150 #if defined(HEDLEY_UNREACHABLE) 1151 # undef HEDLEY_UNREACHABLE 1152 #endif 1153 #if defined(HEDLEY_UNREACHABLE_RETURN) 1154 # undef HEDLEY_UNREACHABLE_RETURN 1155 #endif 1156 #if defined(HEDLEY_ASSUME) 1157 # undef HEDLEY_ASSUME 1158 #endif 1159 #if \ 1160 HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ 1161 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1162 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1163 # define HEDLEY_ASSUME(expr) __assume(expr) 1164 #elif HEDLEY_HAS_BUILTIN(__builtin_assume) 1165 # define HEDLEY_ASSUME(expr) __builtin_assume(expr) 1166 #elif \ 1167 HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ 1168 HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) 1169 # if defined(__cplusplus) 1170 # define HEDLEY_ASSUME(expr) std::_nassert(expr) 1171 # else 1172 # define HEDLEY_ASSUME(expr) _nassert(expr) 1173 # endif 1174 #endif 1175 #if \ 1176 (HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(HEDLEY_ARM_VERSION))) || \ 1177 HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ 1178 HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ 1179 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1180 HEDLEY_IBM_VERSION_CHECK(13,1,5) 1181 # define HEDLEY_UNREACHABLE() __builtin_unreachable() 1182 #elif defined(HEDLEY_ASSUME) 1183 # define HEDLEY_UNREACHABLE() HEDLEY_ASSUME(0) 1184 #endif 1185 #if !defined(HEDLEY_ASSUME) 1186 # if defined(HEDLEY_UNREACHABLE) 1187 # define HEDLEY_ASSUME(expr) HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (HEDLEY_UNREACHABLE(), 1))) 1188 # else 1189 # define HEDLEY_ASSUME(expr) HEDLEY_STATIC_CAST(void, expr) 1190 # endif 1191 #endif 1192 #if defined(HEDLEY_UNREACHABLE) 1193 # if \ 1194 HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ 1195 HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) 1196 # define HEDLEY_UNREACHABLE_RETURN(value) return (HEDLEY_STATIC_CAST(void, HEDLEY_ASSUME(0)), (value)) 1197 # else 1198 # define HEDLEY_UNREACHABLE_RETURN(value) HEDLEY_UNREACHABLE() 1199 # endif 1200 #else 1201 # define HEDLEY_UNREACHABLE_RETURN(value) return (value) 1202 #endif 1203 #if !defined(HEDLEY_UNREACHABLE) 1204 # define HEDLEY_UNREACHABLE() HEDLEY_ASSUME(0) 1205 #endif 1206 1207 HEDLEY_DIAGNOSTIC_PUSH 1208 #if HEDLEY_HAS_WARNING("-Wpedantic") 1209 # pragma clang diagnostic ignored "-Wpedantic" 1210 #endif 1211 #if HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) 1212 # pragma clang diagnostic ignored "-Wc++98-compat-pedantic" 1213 #endif 1214 #if HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) 1215 # if defined(__clang__) 1216 # pragma clang diagnostic ignored "-Wvariadic-macros" 1217 # elif defined(HEDLEY_GCC_VERSION) 1218 # pragma GCC diagnostic ignored "-Wvariadic-macros" 1219 # endif 1220 #endif 1221 #if defined(HEDLEY_NON_NULL) 1222 # undef HEDLEY_NON_NULL 1223 #endif 1224 #if \ 1225 HEDLEY_HAS_ATTRIBUTE(nonnull) || \ 1226 HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ 1227 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1228 HEDLEY_ARM_VERSION_CHECK(4,1,0) 1229 # define HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) 1230 #else 1231 # define HEDLEY_NON_NULL(...) 1232 #endif 1233 HEDLEY_DIAGNOSTIC_POP 1234 1235 #if defined(HEDLEY_PRINTF_FORMAT) 1236 # undef HEDLEY_PRINTF_FORMAT 1237 #endif 1238 #if defined(__MINGW32__) && HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) 1239 # define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) 1240 #elif defined(__MINGW32__) && HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) 1241 # define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) 1242 #elif \ 1243 HEDLEY_HAS_ATTRIBUTE(format) || \ 1244 HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ 1245 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1246 HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ 1247 HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1248 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1249 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1250 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1251 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1252 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1253 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1254 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1255 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1256 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1257 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1258 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1259 # define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) 1260 #elif HEDLEY_PELLES_VERSION_CHECK(6,0,0) 1261 # define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) 1262 #else 1263 # define HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) 1264 #endif 1265 1266 #if defined(HEDLEY_CONSTEXPR) 1267 # undef HEDLEY_CONSTEXPR 1268 #endif 1269 #if defined(__cplusplus) 1270 # if __cplusplus >= 201103L 1271 # define HEDLEY_CONSTEXPR HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) 1272 # endif 1273 #endif 1274 #if !defined(HEDLEY_CONSTEXPR) 1275 # define HEDLEY_CONSTEXPR 1276 #endif 1277 1278 #if defined(HEDLEY_PREDICT) 1279 # undef HEDLEY_PREDICT 1280 #endif 1281 #if defined(HEDLEY_LIKELY) 1282 # undef HEDLEY_LIKELY 1283 #endif 1284 #if defined(HEDLEY_UNLIKELY) 1285 # undef HEDLEY_UNLIKELY 1286 #endif 1287 #if defined(HEDLEY_UNPREDICTABLE) 1288 # undef HEDLEY_UNPREDICTABLE 1289 #endif 1290 #if HEDLEY_HAS_BUILTIN(__builtin_unpredictable) 1291 # define HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) 1292 #endif 1293 #if \ 1294 (HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(HEDLEY_PGI_VERSION)) || \ 1295 HEDLEY_GCC_VERSION_CHECK(9,0,0) 1296 # define HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) 1297 # define HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) 1298 # define HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) 1299 # define HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) 1300 # define HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) 1301 #elif \ 1302 (HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(HEDLEY_INTEL_CL_VERSION)) || \ 1303 HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ 1304 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1305 (HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ 1306 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1307 HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1308 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1309 HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ 1310 HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ 1311 HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ 1312 HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ 1313 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1314 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 1315 HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ 1316 HEDLEY_CRAY_VERSION_CHECK(8,1,0) 1317 # define HEDLEY_PREDICT(expr, expected, probability) \ 1318 (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (HEDLEY_STATIC_CAST(void, expected), (expr))) 1319 # define HEDLEY_PREDICT_TRUE(expr, probability) \ 1320 (__extension__ ({ \ 1321 double hedley_probability_ = (probability); \ 1322 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ 1323 })) 1324 # define HEDLEY_PREDICT_FALSE(expr, probability) \ 1325 (__extension__ ({ \ 1326 double hedley_probability_ = (probability); \ 1327 ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ 1328 })) 1329 # define HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) 1330 # define HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) 1331 #else 1332 # define HEDLEY_PREDICT(expr, expected, probability) (HEDLEY_STATIC_CAST(void, expected), (expr)) 1333 # define HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) 1334 # define HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) 1335 # define HEDLEY_LIKELY(expr) (!!(expr)) 1336 # define HEDLEY_UNLIKELY(expr) (!!(expr)) 1337 #endif 1338 #if !defined(HEDLEY_UNPREDICTABLE) 1339 # define HEDLEY_UNPREDICTABLE(expr) HEDLEY_PREDICT(expr, 1, 0.5) 1340 #endif 1341 1342 #if defined(HEDLEY_MALLOC) 1343 # undef HEDLEY_MALLOC 1344 #endif 1345 #if \ 1346 HEDLEY_HAS_ATTRIBUTE(malloc) || \ 1347 HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ 1348 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1349 HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1350 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1351 HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ 1352 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1353 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1354 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1355 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1356 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1357 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1358 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1359 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1360 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1361 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1362 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1363 # define HEDLEY_MALLOC __attribute__((__malloc__)) 1364 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) 1365 # define HEDLEY_MALLOC _Pragma("returns_new_memory") 1366 #elif \ 1367 HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ 1368 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1369 # define HEDLEY_MALLOC __declspec(restrict) 1370 #else 1371 # define HEDLEY_MALLOC 1372 #endif 1373 1374 #if defined(HEDLEY_PURE) 1375 # undef HEDLEY_PURE 1376 #endif 1377 #if \ 1378 HEDLEY_HAS_ATTRIBUTE(pure) || \ 1379 HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ 1380 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1381 HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1382 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1383 HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1384 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1385 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1386 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1387 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1388 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1389 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1390 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1391 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1392 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1393 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1394 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 1395 HEDLEY_PGI_VERSION_CHECK(17,10,0) 1396 # define HEDLEY_PURE __attribute__((__pure__)) 1397 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) 1398 # define HEDLEY_PURE _Pragma("does_not_write_global_data") 1399 #elif defined(__cplusplus) && \ 1400 ( \ 1401 HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ 1402 HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ 1403 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ 1404 ) 1405 # define HEDLEY_PURE _Pragma("FUNC_IS_PURE;") 1406 #else 1407 # define HEDLEY_PURE 1408 #endif 1409 1410 #if defined(HEDLEY_CONST) 1411 # undef HEDLEY_CONST 1412 #endif 1413 #if \ 1414 HEDLEY_HAS_ATTRIBUTE(const) || \ 1415 HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ 1416 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1417 HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1418 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1419 HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1420 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1421 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1422 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1423 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1424 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1425 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1426 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1427 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1428 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1429 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1430 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ 1431 HEDLEY_PGI_VERSION_CHECK(17,10,0) 1432 # define HEDLEY_CONST __attribute__((__const__)) 1433 #elif \ 1434 HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) 1435 # define HEDLEY_CONST _Pragma("no_side_effect") 1436 #else 1437 # define HEDLEY_CONST HEDLEY_PURE 1438 #endif 1439 1440 #if defined(HEDLEY_RESTRICT) 1441 # undef HEDLEY_RESTRICT 1442 #endif 1443 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) 1444 # define HEDLEY_RESTRICT restrict 1445 #elif \ 1446 HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ 1447 HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ 1448 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1449 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ 1450 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1451 HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1452 HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ 1453 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1454 HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ 1455 HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ 1456 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1457 (HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ 1458 HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ 1459 defined(__clang__) 1460 # define HEDLEY_RESTRICT __restrict 1461 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) 1462 # define HEDLEY_RESTRICT _Restrict 1463 #else 1464 # define HEDLEY_RESTRICT 1465 #endif 1466 1467 #if defined(HEDLEY_INLINE) 1468 # undef HEDLEY_INLINE 1469 #endif 1470 #if \ 1471 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ 1472 (defined(__cplusplus) && (__cplusplus >= 199711L)) 1473 # define HEDLEY_INLINE inline 1474 #elif \ 1475 defined(HEDLEY_GCC_VERSION) || \ 1476 HEDLEY_ARM_VERSION_CHECK(6,2,0) 1477 # define HEDLEY_INLINE __inline__ 1478 #elif \ 1479 HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ 1480 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ 1481 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1482 HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ 1483 HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ 1484 HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ 1485 HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ 1486 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1487 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1488 # define HEDLEY_INLINE __inline 1489 #else 1490 # define HEDLEY_INLINE 1491 #endif 1492 1493 #if defined(HEDLEY_ALWAYS_INLINE) 1494 # undef HEDLEY_ALWAYS_INLINE 1495 #endif 1496 #if \ 1497 HEDLEY_HAS_ATTRIBUTE(always_inline) || \ 1498 HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ 1499 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1500 HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1501 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1502 HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1503 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1504 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1505 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1506 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1507 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1508 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1509 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1510 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1511 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1512 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1513 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1514 # define HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) HEDLEY_INLINE 1515 #elif \ 1516 HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ 1517 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1518 # define HEDLEY_ALWAYS_INLINE __forceinline 1519 #elif defined(__cplusplus) && \ 1520 ( \ 1521 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1522 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1523 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1524 HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ 1525 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1526 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ 1527 ) 1528 # define HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") 1529 #elif HEDLEY_IAR_VERSION_CHECK(8,0,0) 1530 # define HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") 1531 #else 1532 # define HEDLEY_ALWAYS_INLINE HEDLEY_INLINE 1533 #endif 1534 1535 #if defined(HEDLEY_NEVER_INLINE) 1536 # undef HEDLEY_NEVER_INLINE 1537 #endif 1538 #if \ 1539 HEDLEY_HAS_ATTRIBUTE(noinline) || \ 1540 HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ 1541 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1542 HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1543 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1544 HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ 1545 HEDLEY_TI_VERSION_CHECK(15,12,0) || \ 1546 (HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1547 HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ 1548 (HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1549 HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ 1550 (HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1551 HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ 1552 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1553 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ 1554 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ 1555 HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) 1556 # define HEDLEY_NEVER_INLINE __attribute__((__noinline__)) 1557 #elif \ 1558 HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ 1559 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1560 # define HEDLEY_NEVER_INLINE __declspec(noinline) 1561 #elif HEDLEY_PGI_VERSION_CHECK(10,2,0) 1562 # define HEDLEY_NEVER_INLINE _Pragma("noinline") 1563 #elif HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) 1564 # define HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") 1565 #elif HEDLEY_IAR_VERSION_CHECK(8,0,0) 1566 # define HEDLEY_NEVER_INLINE _Pragma("inline=never") 1567 #elif HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) 1568 # define HEDLEY_NEVER_INLINE __attribute((noinline)) 1569 #elif HEDLEY_PELLES_VERSION_CHECK(9,0,0) 1570 # define HEDLEY_NEVER_INLINE __declspec(noinline) 1571 #else 1572 # define HEDLEY_NEVER_INLINE 1573 #endif 1574 1575 #if defined(HEDLEY_PRIVATE) 1576 # undef HEDLEY_PRIVATE 1577 #endif 1578 #if defined(HEDLEY_PUBLIC) 1579 # undef HEDLEY_PUBLIC 1580 #endif 1581 #if defined(HEDLEY_IMPORT) 1582 # undef HEDLEY_IMPORT 1583 #endif 1584 #if defined(_WIN32) || defined(__CYGWIN__) 1585 # define HEDLEY_PRIVATE 1586 # define HEDLEY_PUBLIC __declspec(dllexport) 1587 # define HEDLEY_IMPORT __declspec(dllimport) 1588 #else 1589 # if \ 1590 HEDLEY_HAS_ATTRIBUTE(visibility) || \ 1591 HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ 1592 HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ 1593 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1594 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1595 HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ 1596 ( \ 1597 defined(__TI_EABI__) && \ 1598 ( \ 1599 (HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ 1600 HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ 1601 ) \ 1602 ) 1603 # define HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) 1604 # define HEDLEY_PUBLIC __attribute__((__visibility__("default"))) 1605 # else 1606 # define HEDLEY_PRIVATE 1607 # define HEDLEY_PUBLIC 1608 # endif 1609 # define HEDLEY_IMPORT extern 1610 #endif 1611 1612 #if defined(HEDLEY_NO_THROW) 1613 # undef HEDLEY_NO_THROW 1614 #endif 1615 #if \ 1616 HEDLEY_HAS_ATTRIBUTE(nothrow) || \ 1617 HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ 1618 HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1619 # define HEDLEY_NO_THROW __attribute__((__nothrow__)) 1620 #elif \ 1621 HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ 1622 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ 1623 HEDLEY_ARM_VERSION_CHECK(4,1,0) 1624 # define HEDLEY_NO_THROW __declspec(nothrow) 1625 #else 1626 # define HEDLEY_NO_THROW 1627 #endif 1628 1629 #if defined(HEDLEY_FALL_THROUGH) 1630 # undef HEDLEY_FALL_THROUGH 1631 #endif 1632 #if \ 1633 HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ 1634 HEDLEY_GCC_VERSION_CHECK(7,0,0) 1635 # define HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) 1636 #elif HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) 1637 # define HEDLEY_FALL_THROUGH HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) 1638 #elif HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) 1639 # define HEDLEY_FALL_THROUGH HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) 1640 #elif defined(__fallthrough) /* SAL */ 1641 # define HEDLEY_FALL_THROUGH __fallthrough 1642 #else 1643 # define HEDLEY_FALL_THROUGH 1644 #endif 1645 1646 #if defined(HEDLEY_RETURNS_NON_NULL) 1647 # undef HEDLEY_RETURNS_NON_NULL 1648 #endif 1649 #if \ 1650 HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ 1651 HEDLEY_GCC_VERSION_CHECK(4,9,0) 1652 # define HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) 1653 #elif defined(_Ret_notnull_) /* SAL */ 1654 # define HEDLEY_RETURNS_NON_NULL _Ret_notnull_ 1655 #else 1656 # define HEDLEY_RETURNS_NON_NULL 1657 #endif 1658 1659 #if defined(HEDLEY_ARRAY_PARAM) 1660 # undef HEDLEY_ARRAY_PARAM 1661 #endif 1662 #if \ 1663 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ 1664 !defined(__STDC_NO_VLA__) && \ 1665 !defined(__cplusplus) && \ 1666 !defined(HEDLEY_PGI_VERSION) && \ 1667 !defined(HEDLEY_TINYC_VERSION) 1668 # define HEDLEY_ARRAY_PARAM(name) (name) 1669 #else 1670 # define HEDLEY_ARRAY_PARAM(name) 1671 #endif 1672 1673 #if defined(HEDLEY_IS_CONSTANT) 1674 # undef HEDLEY_IS_CONSTANT 1675 #endif 1676 #if defined(HEDLEY_REQUIRE_CONSTEXPR) 1677 # undef HEDLEY_REQUIRE_CONSTEXPR 1678 #endif 1679 /* HEDLEY_IS_CONSTEXPR_ is for 1680 HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ 1681 #if defined(HEDLEY_IS_CONSTEXPR_) 1682 # undef HEDLEY_IS_CONSTEXPR_ 1683 #endif 1684 #if \ 1685 HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ 1686 HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ 1687 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1688 HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ 1689 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ 1690 HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ 1691 HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ 1692 (HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ 1693 HEDLEY_CRAY_VERSION_CHECK(8,1,0) 1694 # define HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) 1695 #endif 1696 #if !defined(__cplusplus) 1697 # if \ 1698 HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ 1699 HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ 1700 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1701 HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ 1702 HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ 1703 HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ 1704 HEDLEY_TINYC_VERSION_CHECK(0,9,24) 1705 # if defined(__INTPTR_TYPE__) 1706 # define HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) 1707 # else 1708 # include <stdint.h> 1709 # define HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) 1710 # endif 1711 # elif \ 1712 ( \ 1713 defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ 1714 !defined(HEDLEY_SUNPRO_VERSION) && \ 1715 !defined(HEDLEY_PGI_VERSION) && \ 1716 !defined(HEDLEY_IAR_VERSION)) || \ 1717 HEDLEY_HAS_EXTENSION(c_generic_selections) || \ 1718 HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ 1719 HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ 1720 HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ 1721 HEDLEY_ARM_VERSION_CHECK(5,3,0) 1722 # if defined(__INTPTR_TYPE__) 1723 # define HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) 1724 # else 1725 # include <stdint.h> 1726 # define HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) 1727 # endif 1728 # elif \ 1729 defined(HEDLEY_GCC_VERSION) || \ 1730 defined(HEDLEY_INTEL_VERSION) || \ 1731 defined(HEDLEY_TINYC_VERSION) || \ 1732 defined(HEDLEY_TI_ARMCL_VERSION) || \ 1733 HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ 1734 defined(HEDLEY_TI_CL2000_VERSION) || \ 1735 defined(HEDLEY_TI_CL6X_VERSION) || \ 1736 defined(HEDLEY_TI_CL7X_VERSION) || \ 1737 defined(HEDLEY_TI_CLPRU_VERSION) || \ 1738 defined(__clang__) 1739 # define HEDLEY_IS_CONSTEXPR_(expr) ( \ 1740 sizeof(void) != \ 1741 sizeof(*( \ 1742 1 ? \ 1743 ((void*) ((expr) * 0L) ) : \ 1744 ((struct { char v[sizeof(void) * 2]; } *) 1) \ 1745 ) \ 1746 ) \ 1747 ) 1748 # endif 1749 #endif 1750 #if defined(HEDLEY_IS_CONSTEXPR_) 1751 # if !defined(HEDLEY_IS_CONSTANT) 1752 # define HEDLEY_IS_CONSTANT(expr) HEDLEY_IS_CONSTEXPR_(expr) 1753 # endif 1754 # define HEDLEY_REQUIRE_CONSTEXPR(expr) (HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) 1755 #else 1756 # if !defined(HEDLEY_IS_CONSTANT) 1757 # define HEDLEY_IS_CONSTANT(expr) (0) 1758 # endif 1759 # define HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) 1760 #endif 1761 1762 #if defined(HEDLEY_BEGIN_C_DECLS) 1763 # undef HEDLEY_BEGIN_C_DECLS 1764 #endif 1765 #if defined(HEDLEY_END_C_DECLS) 1766 # undef HEDLEY_END_C_DECLS 1767 #endif 1768 #if defined(HEDLEY_C_DECL) 1769 # undef HEDLEY_C_DECL 1770 #endif 1771 #if defined(__cplusplus) 1772 # define HEDLEY_BEGIN_C_DECLS extern "C" { 1773 # define HEDLEY_END_C_DECLS } 1774 # define HEDLEY_C_DECL extern "C" 1775 #else 1776 # define HEDLEY_BEGIN_C_DECLS 1777 # define HEDLEY_END_C_DECLS 1778 # define HEDLEY_C_DECL 1779 #endif 1780 1781 #if defined(HEDLEY_STATIC_ASSERT) 1782 # undef HEDLEY_STATIC_ASSERT 1783 #endif 1784 #if \ 1785 !defined(__cplusplus) && ( \ 1786 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ 1787 (HEDLEY_HAS_FEATURE(c_static_assert) && !defined(HEDLEY_INTEL_CL_VERSION)) || \ 1788 HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ 1789 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ 1790 defined(_Static_assert) \ 1791 ) 1792 # define HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) 1793 #elif \ 1794 (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ 1795 HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ 1796 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1797 # define HEDLEY_STATIC_ASSERT(expr, message) HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) 1798 #else 1799 # define HEDLEY_STATIC_ASSERT(expr, message) 1800 #endif 1801 1802 #if defined(HEDLEY_NULL) 1803 # undef HEDLEY_NULL 1804 #endif 1805 #if defined(__cplusplus) 1806 # if __cplusplus >= 201103L 1807 # define HEDLEY_NULL HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) 1808 # elif defined(NULL) 1809 # define HEDLEY_NULL NULL 1810 # else 1811 # define HEDLEY_NULL HEDLEY_STATIC_CAST(void*, 0) 1812 # endif 1813 #elif defined(NULL) 1814 # define HEDLEY_NULL NULL 1815 #else 1816 # define HEDLEY_NULL ((void*) 0) 1817 #endif 1818 1819 #if defined(HEDLEY_MESSAGE) 1820 # undef HEDLEY_MESSAGE 1821 #endif 1822 #if HEDLEY_HAS_WARNING("-Wunknown-pragmas") 1823 # define HEDLEY_MESSAGE(msg) \ 1824 HEDLEY_DIAGNOSTIC_PUSH \ 1825 HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ 1826 HEDLEY_PRAGMA(message msg) \ 1827 HEDLEY_DIAGNOSTIC_POP 1828 #elif \ 1829 HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ 1830 HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1831 # define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message msg) 1832 #elif HEDLEY_CRAY_VERSION_CHECK(5,0,0) 1833 # define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(_CRI message msg) 1834 #elif HEDLEY_IAR_VERSION_CHECK(8,0,0) 1835 # define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message(msg)) 1836 #elif HEDLEY_PELLES_VERSION_CHECK(2,0,0) 1837 # define HEDLEY_MESSAGE(msg) HEDLEY_PRAGMA(message(msg)) 1838 #else 1839 # define HEDLEY_MESSAGE(msg) 1840 #endif 1841 1842 #if defined(HEDLEY_WARNING) 1843 # undef HEDLEY_WARNING 1844 #endif 1845 #if HEDLEY_HAS_WARNING("-Wunknown-pragmas") 1846 # define HEDLEY_WARNING(msg) \ 1847 HEDLEY_DIAGNOSTIC_PUSH \ 1848 HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ 1849 HEDLEY_PRAGMA(clang warning msg) \ 1850 HEDLEY_DIAGNOSTIC_POP 1851 #elif \ 1852 HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ 1853 HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ 1854 HEDLEY_INTEL_VERSION_CHECK(13,0,0) 1855 # define HEDLEY_WARNING(msg) HEDLEY_PRAGMA(GCC warning msg) 1856 #elif \ 1857 HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ 1858 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1859 # define HEDLEY_WARNING(msg) HEDLEY_PRAGMA(message(msg)) 1860 #else 1861 # define HEDLEY_WARNING(msg) HEDLEY_MESSAGE(msg) 1862 #endif 1863 1864 #if defined(HEDLEY_REQUIRE) 1865 # undef HEDLEY_REQUIRE 1866 #endif 1867 #if defined(HEDLEY_REQUIRE_MSG) 1868 # undef HEDLEY_REQUIRE_MSG 1869 #endif 1870 #if HEDLEY_HAS_ATTRIBUTE(diagnose_if) 1871 # if HEDLEY_HAS_WARNING("-Wgcc-compat") 1872 # define HEDLEY_REQUIRE(expr) \ 1873 HEDLEY_DIAGNOSTIC_PUSH \ 1874 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ 1875 __attribute__((diagnose_if(!(expr), #expr, "error"))) \ 1876 HEDLEY_DIAGNOSTIC_POP 1877 # define HEDLEY_REQUIRE_MSG(expr,msg) \ 1878 HEDLEY_DIAGNOSTIC_PUSH \ 1879 _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ 1880 __attribute__((diagnose_if(!(expr), msg, "error"))) \ 1881 HEDLEY_DIAGNOSTIC_POP 1882 # else 1883 # define HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) 1884 # define HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) 1885 # endif 1886 #else 1887 # define HEDLEY_REQUIRE(expr) 1888 # define HEDLEY_REQUIRE_MSG(expr,msg) 1889 #endif 1890 1891 #if defined(HEDLEY_FLAGS) 1892 # undef HEDLEY_FLAGS 1893 #endif 1894 #if HEDLEY_HAS_ATTRIBUTE(flag_enum) 1895 # define HEDLEY_FLAGS __attribute__((__flag_enum__)) 1896 #else 1897 # define HEDLEY_FLAGS 1898 #endif 1899 1900 #if defined(HEDLEY_FLAGS_CAST) 1901 # undef HEDLEY_FLAGS_CAST 1902 #endif 1903 #if HEDLEY_INTEL_VERSION_CHECK(19,0,0) 1904 # define HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ 1905 HEDLEY_DIAGNOSTIC_PUSH \ 1906 _Pragma("warning(disable:188)") \ 1907 ((T) (expr)); \ 1908 HEDLEY_DIAGNOSTIC_POP \ 1909 })) 1910 #else 1911 # define HEDLEY_FLAGS_CAST(T, expr) HEDLEY_STATIC_CAST(T, expr) 1912 #endif 1913 1914 #if defined(HEDLEY_EMPTY_BASES) 1915 # undef HEDLEY_EMPTY_BASES 1916 #endif 1917 #if \ 1918 (HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ 1919 HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) 1920 # define HEDLEY_EMPTY_BASES __declspec(empty_bases) 1921 #else 1922 # define HEDLEY_EMPTY_BASES 1923 #endif 1924 1925 /* Remaining macros are deprecated. */ 1926 1927 #if defined(HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) 1928 # undef HEDLEY_GCC_NOT_CLANG_VERSION_CHECK 1929 #endif 1930 #if defined(__clang__) 1931 # define HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) 1932 #else 1933 # define HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) HEDLEY_GCC_VERSION_CHECK(major,minor,patch) 1934 #endif 1935 1936 #if defined(HEDLEY_CLANG_HAS_ATTRIBUTE) 1937 # undef HEDLEY_CLANG_HAS_ATTRIBUTE 1938 #endif 1939 #define HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) HEDLEY_HAS_ATTRIBUTE(attribute) 1940 1941 #if defined(HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) 1942 # undef HEDLEY_CLANG_HAS_CPP_ATTRIBUTE 1943 #endif 1944 #define HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) HEDLEY_HAS_CPP_ATTRIBUTE(attribute) 1945 1946 #if defined(HEDLEY_CLANG_HAS_BUILTIN) 1947 # undef HEDLEY_CLANG_HAS_BUILTIN 1948 #endif 1949 #define HEDLEY_CLANG_HAS_BUILTIN(builtin) HEDLEY_HAS_BUILTIN(builtin) 1950 1951 #if defined(HEDLEY_CLANG_HAS_FEATURE) 1952 # undef HEDLEY_CLANG_HAS_FEATURE 1953 #endif 1954 #define HEDLEY_CLANG_HAS_FEATURE(feature) HEDLEY_HAS_FEATURE(feature) 1955 1956 #if defined(HEDLEY_CLANG_HAS_EXTENSION) 1957 # undef HEDLEY_CLANG_HAS_EXTENSION 1958 #endif 1959 #define HEDLEY_CLANG_HAS_EXTENSION(extension) HEDLEY_HAS_EXTENSION(extension) 1960 1961 #if defined(HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) 1962 # undef HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE 1963 #endif 1964 #define HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) 1965 1966 #if defined(HEDLEY_CLANG_HAS_WARNING) 1967 # undef HEDLEY_CLANG_HAS_WARNING 1968 #endif 1969 #define HEDLEY_CLANG_HAS_WARNING(warning) HEDLEY_HAS_WARNING(warning) 1970 1971 #endif /* !defined(HEDLEY_VERSION) || (HEDLEY_VERSION < X) */ 1972