zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

_mingw.h (19371B) - Raw


      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 
      7 #ifndef _INC__MINGW_H
      8 #define _INC__MINGW_H
      9 
     10 #include "_mingw_mac.h"
     11 #include "_mingw_secapi.h"
     12 
     13 /* Include _cygwin.h if we're building a Cygwin application. */
     14 #ifdef __CYGWIN__
     15 #include "_cygwin.h"
     16 #endif
     17 
     18 /* Target specific macro replacement for type "long".  In the Windows API,
     19    the type long is always 32 bit, even if the target is 64 bit (LLP64).
     20    On 64 bit Cygwin, the type long is 64 bit (LP64).  So, to get the right
     21    sized definitions and declarations, all usage of type long in the Windows
     22    headers have to be replaced by the below defined macro __LONG32. */
     23 #ifndef __LP64__	/* 32 bit target, 64 bit Mingw target */
     24 #define __LONG32 long
     25 #else			/* 64 bit Cygwin target */
     26 #define __LONG32 int
     27 #endif
     28 
     29 /* C/C++ specific language defines.  */
     30 #ifndef __GNUC__
     31 # ifndef __MINGW_IMPORT
     32 #  define __MINGW_IMPORT  __declspec(dllimport)
     33 # endif
     34 # ifndef _CRTIMP
     35 #  define _CRTIMP  __declspec(dllimport)
     36 # endif
     37 # define __DECLSPEC_SUPPORTED
     38 # define __attribute__(x) /* nothing */
     39 #else /* __GNUC__ */
     40 # ifdef __declspec
     41 #  ifndef __MINGW_IMPORT
     42 /* Note the extern. This is needed to work around GCC's
     43 limitations in handling dllimport attribute.  */
     44 #   define __MINGW_IMPORT  extern __attribute__ ((__dllimport__))
     45 #  endif
     46 #  ifndef _CRTIMP
     47 #    undef __USE_CRTIMP
     48 #    if !defined (_CRTBLD) && !defined (_SYSCRT)
     49 #      define __USE_CRTIMP 1
     50 #    endif
     51 #    ifdef __USE_CRTIMP
     52 #      define _CRTIMP  __attribute__ ((__dllimport__))
     53 #    else
     54 #      define _CRTIMP
     55 #    endif
     56 #  endif
     57 #  define __DECLSPEC_SUPPORTED
     58 # else /* __declspec */
     59 #  undef __DECLSPEC_SUPPORTED
     60 #  undef __MINGW_IMPORT
     61 #  ifndef _CRTIMP
     62 #   define _CRTIMP
     63 #  endif
     64 # endif /* __declspec */
     65 #endif /* __GNUC__ */
     66 
     67 #ifdef _MSC_VER
     68 #define USE___UUIDOF	1
     69 #else
     70 #define USE___UUIDOF	0
     71 #endif
     72 
     73 #if !defined(_MSC_VER) && !defined(_inline)
     74 #define _inline __inline
     75 #endif
     76 
     77 #ifdef __cplusplus
     78 # define __CRT_INLINE inline
     79 #elif defined(_MSC_VER)
     80 # define __CRT_INLINE __inline
     81 #else
     82 # if ((__MINGW_GNUC_PREREQ(4, 3) || defined(__clang__)) && __STDC_VERSION__ >= 199901L)
     83 #  define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
     84 # else
     85 #  define __CRT_INLINE extern __inline__
     86 # endif
     87 #endif
     88 
     89 #if !defined(__MINGW_INTRIN_INLINE) && defined(__GNUC__)
     90 #define __MINGW_INTRIN_INLINE extern __inline__ __attribute__((__always_inline__,__gnu_inline__))
     91 #endif
     92 
     93 #ifndef __CYGWIN__
     94 #ifdef __NO_INLINE__
     95 #undef __CRT__NO_INLINE
     96 #define __CRT__NO_INLINE 1
     97 #endif
     98 #endif
     99 
    100 /* Recent MSVC supports C++14 but it doesn't define __cplusplus accordingly.  */
    101 #define __MINGW_CXX11_CONSTEXPR
    102 #define __MINGW_CXX14_CONSTEXPR
    103 #ifdef __cplusplus
    104 # if __cplusplus >= 201103L || defined(_MSC_VER)
    105 #  undef __MINGW_CXX11_CONSTEXPR
    106 #  define __MINGW_CXX11_CONSTEXPR  constexpr
    107 # endif
    108 # if __cplusplus >= 201402L || defined(_MSC_VER)
    109 #  undef __MINGW_CXX14_CONSTEXPR
    110 #  define __MINGW_CXX14_CONSTEXPR  constexpr
    111 # endif
    112 #endif
    113 
    114 #ifdef __cplusplus
    115 # define __UNUSED_PARAM(x)
    116 #else
    117 # ifdef __GNUC__
    118 #  define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
    119 # else
    120 #  define __UNUSED_PARAM(x) x
    121 # endif
    122 #endif
    123 
    124 #ifndef __GNUC__
    125 # ifdef _MSC_VER
    126 #  define __restrict__  __restrict
    127 # else
    128 #  define __restrict__	/* nothing */
    129 # endif
    130 #endif /* !__GNUC__ */
    131 
    132 #if __MINGW_GNUC_PREREQ (3,1) && !defined __GNUG__
    133 # define __restrict_arr __restrict
    134 #elif defined(_MSC_VER)
    135 # define __restrict_arr __restrict
    136 #else
    137 # ifdef __GNUC__
    138 #  define __restrict_arr        /* Not supported in old GCC.  */
    139 # else
    140 #  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
    141 #   define __restrict_arr       restrict
    142 #  else
    143 #   define __restrict_arr       /* Not supported.  */
    144 #  endif
    145 # endif
    146 #endif
    147 
    148 #ifdef __GNUC__
    149 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
    150 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
    151 #elif __MINGW_MSC_PREREQ(12, 0)
    152 #define __MINGW_ATTRIB_NORETURN __declspec(noreturn)
    153 #define __MINGW_ATTRIB_CONST
    154 #else
    155 #define __MINGW_ATTRIB_NORETURN
    156 #define __MINGW_ATTRIB_CONST
    157 #endif
    158 
    159 #if __MINGW_GNUC_PREREQ (3, 0)
    160 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
    161 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
    162 #elif __MINGW_MSC_PREREQ(14, 0)
    163 #define __MINGW_ATTRIB_MALLOC __declspec(noalias) __declspec(restrict)
    164 #define __MINGW_ATTRIB_PURE
    165 #else
    166 #define __MINGW_ATTRIB_MALLOC
    167 #define __MINGW_ATTRIB_PURE
    168 #endif
    169 
    170 /* Attribute `nonnull' was valid as of gcc 3.3.  We don't use GCC's
    171    variadiac macro facility, because variadic macros cause syntax
    172    errors with  --traditional-cpp.  */
    173 #if  __MINGW_GNUC_PREREQ (3, 3)
    174 #define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
    175 #else
    176 #define __MINGW_ATTRIB_NONNULL(arg)
    177 #endif /* GNUC >= 3.3 */
    178 
    179 #ifdef __GNUC__
    180 #define __MINGW_ATTRIB_UNUSED __attribute__ ((__unused__))
    181 #else
    182 #define __MINGW_ATTRIB_UNUSED
    183 #endif /* ATTRIBUTE_UNUSED */
    184 
    185 #if  __MINGW_GNUC_PREREQ (3, 1)
    186 #define __MINGW_ATTRIB_USED __attribute__ ((__used__))
    187 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
    188 #if __MINGW_GNUC_PREREQ (4, 5) || defined (__clang__)
    189 #define __MINGW_ATTRIB_DEPRECATED_MSG(x) __attribute__ ((__deprecated__(x)))
    190 #endif
    191 #elif __MINGW_MSC_PREREQ(12, 0)
    192 #define __MINGW_ATTRIB_USED
    193 #define __MINGW_ATTRIB_DEPRECATED __declspec(deprecated)
    194 #else
    195 #define __MINGW_ATTRIB_USED __MINGW_ATTRIB_UNUSED
    196 #define __MINGW_ATTRIB_DEPRECATED
    197 #endif /* GNUC >= 3.1 */
    198 
    199 #ifndef __MINGW_ATTRIB_DEPRECATED_MSG
    200 #define __MINGW_ATTRIB_DEPRECATED_MSG(x) __MINGW_ATTRIB_DEPRECATED
    201 #endif
    202 
    203 #if  __MINGW_GNUC_PREREQ (3, 3)
    204 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
    205 #elif __MINGW_MSC_PREREQ(12, 0) && defined (__cplusplus)
    206 #define __MINGW_NOTHROW __declspec(nothrow)
    207 #else
    208 #define __MINGW_NOTHROW
    209 #endif
    210 
    211 #if __MINGW_GNUC_PREREQ (4, 4)
    212 #define __MINGW_ATTRIB_NO_OPTIMIZE __attribute__((__optimize__ ("0")))
    213 #else
    214 #define __MINGW_ATTRIB_NO_OPTIMIZE
    215 #endif
    216 
    217 #if __MINGW_GNUC_PREREQ (4, 4)
    218 #define __MINGW_PRAGMA_PARAM(x) _Pragma (#x)
    219 #elif __MINGW_MSC_PREREQ (13, 1)
    220 #define __MINGW_PRAGMA_PARAM(x) __pragma (x)
    221 #else
    222 #define __MINGW_PRAGMA_PARAM(x)
    223 #endif
    224 
    225 #define __MINGW_BROKEN_INTERFACE(x) \
    226   __MINGW_PRAGMA_PARAM(message ("Interface " _CRT_STRINGIZE(x) \
    227   " has unverified layout."))
    228 
    229 #ifndef __MSVCRT_VERSION__
    230 /*  High byte is the major version, low byte is the minor. */
    231 # if defined(__CRTDLL__)
    232 #  define __MSVCRT_VERSION__ 0x00
    233 # elif defined(_UCRT)
    234 #  define __MSVCRT_VERSION__ 0xE00
    235 # else
    236 #  define __MSVCRT_VERSION__ 0xE00
    237 # endif
    238 #endif
    239 
    240 #if !defined(__CRTDLL__) && __MSVCRT_VERSION__ == 0x00
    241 #define __CRTDLL__
    242 #endif
    243 
    244 #if !defined(_UCRT) && ((__MSVCRT_VERSION__ >= 0x1400) || (__MSVCRT_VERSION__ >= 0xE00 && __MSVCRT_VERSION__ < 0x1000))
    245 /* Allow both 0x1400 and 0xE00 to identify UCRT */
    246 #define _UCRT
    247 #endif
    248 
    249 #ifdef _UCRT
    250 #  define __MINGW_UCRT_ASM_CALL(func) __MINGW_ASM_CALL(func)
    251 #else
    252 #  define __MINGW_UCRT_ASM_CALL(func)
    253 #endif
    254 
    255 #ifndef _WIN32_WINNT
    256 #define _WIN32_WINNT 0xa00
    257 #endif
    258 
    259 #ifndef _INT128_DEFINED
    260 #define _INT128_DEFINED
    261 #ifdef __GNUC__
    262 #define __int8 char
    263 #define __int16 short
    264 #define __int32 int
    265 #define __int64 long long
    266 #ifdef _WIN64
    267 #if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) && \
    268     !defined(__SIZEOF_INT128__) /* clang >= 3.1 has __int128 but no size macro */
    269 #define __SIZEOF_INT128__ 16
    270 #endif
    271 #ifndef __SIZEOF_INT128__
    272 typedef int __int128 __attribute__ ((__mode__ (TI)));
    273 #endif
    274 #endif
    275 #endif /* __GNUC__ */
    276 #endif /* _INT128_DEFINED */
    277 
    278 #ifdef __GNUC__
    279 #define __ptr32
    280 #define __ptr64
    281 #ifndef __unaligned
    282 #define __unaligned
    283 #endif
    284 #ifndef __w64
    285 #define __w64
    286 #endif
    287 #ifdef __cplusplus
    288 #define __forceinline inline __attribute__((__always_inline__))
    289 #else
    290 #define __forceinline extern __inline__ __attribute__((__always_inline__,__gnu_inline__))
    291 #endif /* __cplusplus */
    292 #endif /* __GNUC__ */
    293 
    294 #if !defined(_WIN32) && !defined(__CYGWIN__)
    295 #error Only Win32 target is supported!
    296 #endif
    297 
    298 #ifndef __nothrow
    299 #ifdef __cplusplus
    300 #define __nothrow __MINGW_NOTHROW
    301 #else
    302 #define __nothrow
    303 #endif
    304 #endif /* __nothrow */
    305 
    306 #include <vadefs.h>	/* other headers depend on this include */
    307 
    308 #ifndef _CRT_STRINGIZE
    309 #define __CRT_STRINGIZE(_Value) #_Value
    310 #define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
    311 #endif /* _CRT_STRINGIZE */
    312 
    313 #ifndef _CRT_WIDE
    314 #define __CRT_WIDE(_String) L ## _String
    315 #define _CRT_WIDE(_String) __CRT_WIDE(_String)
    316 #endif /* _CRT_WIDE */
    317 
    318 #ifndef _W64
    319 #define _W64
    320 #endif
    321 
    322 #ifndef _CRTIMP_NOIA64
    323 #ifdef __ia64__
    324 #define _CRTIMP_NOIA64
    325 #else
    326 #define _CRTIMP_NOIA64 _CRTIMP
    327 #endif
    328 #endif /* _CRTIMP_NOIA64 */
    329 
    330 #ifndef _CRTIMP2
    331 #define _CRTIMP2 _CRTIMP
    332 #endif
    333 
    334 #ifndef _CRTIMP_ALTERNATIVE
    335 #define _CRTIMP_ALTERNATIVE _CRTIMP
    336 #define _CRT_ALTERNATIVE_IMPORTED
    337 #endif /* _CRTIMP_ALTERNATIVE */
    338 
    339 #ifndef _MRTIMP2
    340 #define _MRTIMP2  _CRTIMP
    341 #endif
    342 
    343 /* We have to define _DLL for gcc based mingw version. This define is set
    344    by VC, when DLL-based runtime is used. So, gcc based runtime just have
    345    DLL-base runtime, therefore this define has to be set.
    346    As our headers are possibly used by windows compiler having a static
    347    C-runtime, we make this definition gnu compiler specific here.  */
    348 #if !defined (_DLL) && defined (__GNUC__)
    349 #define _DLL
    350 #endif
    351 
    352 #ifndef _MT
    353 #define _MT
    354 #endif
    355 
    356 #ifndef _MCRTIMP
    357 #define _MCRTIMP _CRTIMP
    358 #endif
    359 
    360 #ifndef _CRTIMP_PURE
    361 #define _CRTIMP_PURE _CRTIMP
    362 #endif
    363 
    364 #ifndef _PGLOBAL
    365 #define _PGLOBAL
    366 #endif
    367 
    368 #ifndef _AGLOBAL
    369 #define _AGLOBAL
    370 #endif
    371 
    372 #define _SECURECRT_FILL_BUFFER_PATTERN 0xFD
    373 #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated)
    374 
    375 #ifndef _CRT_INSECURE_DEPRECATE_MEMORY
    376 #define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
    377 #endif
    378 
    379 #ifndef _CRT_INSECURE_DEPRECATE_GLOBALS
    380 #define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)
    381 #endif
    382 
    383 #ifndef _CRT_MANAGED_HEAP_DEPRECATE
    384 #define _CRT_MANAGED_HEAP_DEPRECATE
    385 #endif
    386 
    387 #ifndef _CRT_OBSOLETE
    388 #define _CRT_OBSOLETE(_NewItem)
    389 #endif
    390 
    391 #ifndef __WIDL__
    392 
    393 #if defined (_WIN32) && !defined (_WIN64) && !defined (__MINGW_USE_VC2005_COMPAT) && !defined (_UCRT) && !(defined (_TIME_BITS) && _TIME_BITS == 64)
    394 #ifndef _USE_32BIT_TIME_T
    395 #define _USE_32BIT_TIME_T
    396 #endif
    397 #endif
    398 
    399 #ifndef _CONST_RETURN
    400 #define _CONST_RETURN
    401 #endif
    402 
    403 #ifndef UNALIGNED
    404 #if defined(__ia64__) || defined(__x86_64__)
    405 #define UNALIGNED __unaligned
    406 #else
    407 #define UNALIGNED
    408 #endif
    409 #endif /* UNALIGNED */
    410 
    411 #ifndef _CRT_ALIGN
    412 #ifdef  _MSC_VER
    413 #define _CRT_ALIGN(x) __declspec(align(x))
    414 #else /* __GNUC__ */
    415 #define _CRT_ALIGN(x) __attribute__ ((__aligned__ (x)))
    416 #endif
    417 #endif /* _CRT_ALIGN */
    418 
    419 #endif /* __WIDL__ */
    420 
    421 #ifndef __CRTDECL
    422 #define __CRTDECL __cdecl
    423 #endif
    424 
    425 #define _ARGMAX 100
    426 
    427 #ifndef _TRUNCATE
    428 #define _TRUNCATE ((size_t)-1)
    429 #endif
    430 
    431 #ifndef _CRT_UNUSED
    432 #define _CRT_UNUSED(x) (void)x
    433 #endif
    434 
    435 /* MSVC defines _NATIVE_NULLPTR_SUPPORTED when nullptr is supported. We emulate it here for GCC. */
    436 #if __MINGW_GNUC_PREREQ(4, 6)
    437 #if defined(__GNUC__) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
    438 #define _NATIVE_NULLPTR_SUPPORTED
    439 #endif
    440 #endif
    441 
    442 /* We are activating __USE_MINGW_ANSI_STDIO for various define indicators.
    443  * printf ll modifier (unsupported by msvcrt.dll) is required by C99 and C++11 standards. */
    444 #if (defined (_POSIX) || defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) \
    445      || defined (_ISOC99_SOURCE) \
    446      || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && __MSVCRT_VERSION__ < 0xE00) \
    447      || (defined (__cplusplus) && __cplusplus >= 201103L && __MSVCRT_VERSION__ < 0xE00) \
    448      || defined (_XOPEN_SOURCE) || defined (_XOPEN_SOURCE_EXTENDED) \
    449      || defined (_GNU_SOURCE) \
    450      || defined (_SVID_SOURCE)) \
    451     && !defined(__USE_MINGW_ANSI_STDIO)
    452 /* Enable __USE_MINGW_ANSI_STDIO if user did _not_ specify it explicitly... */
    453 #  define __USE_MINGW_ANSI_STDIO			1
    454 #endif
    455 
    456 /* We are defining __USE_MINGW_ANSI_STDIO as 0 or 1 */
    457 #if !defined(__USE_MINGW_ANSI_STDIO)
    458 #define __USE_MINGW_ANSI_STDIO 0      /* was not defined so it should be 0 */
    459 #elif (__USE_MINGW_ANSI_STDIO + 0) != 0 || (1 - __USE_MINGW_ANSI_STDIO - 1) == 2
    460 #define __USE_MINGW_ANSI_STDIO 1      /* was defined as nonzero or empty so it should be 1 */
    461 #else
    462 #define __USE_MINGW_ANSI_STDIO 0      /* was defined as (int)zero and non-empty so it should be 0 */
    463 #endif
    464 
    465 /* _dowildcard is an int that controls the globbing of the command line.
    466  * The MinGW32 (mingw.org) runtime calls it _CRT_glob, so we are adding
    467  * a compatibility definition here:  you can use either of _CRT_glob or
    468  * _dowildcard .
    469  * If _dowildcard is non-zero, the command line will be globbed:  *.*
    470  * will be expanded to be all files in the startup directory.
    471  * In the mingw-w64 library a _dowildcard variable is defined as being
    472  * 0, therefore command line globbing is DISABLED by default. To turn it
    473  * on and to leave wildcard command line processing MS's globbing code,
    474  * include a line in one of your source modules defining _dowildcard and
    475  * setting it to -1, like so:
    476  * int _dowildcard = -1;
    477  */
    478 #undef  _CRT_glob
    479 #define _CRT_glob _dowildcard
    480 
    481 
    482 #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
    483 #define NONAMELESSUNION		1
    484 #endif
    485 #if defined(NONAMELESSSTRUCT) && \
    486    !defined(NONAMELESSUNION)
    487 #define NONAMELESSUNION		1
    488 #endif
    489 #if defined(NONAMELESSUNION)  && \
    490    !defined(NONAMELESSSTRUCT)
    491 #define NONAMELESSSTRUCT	1
    492 #endif
    493 
    494 #ifndef __ANONYMOUS_DEFINED
    495 #define __ANONYMOUS_DEFINED
    496 #define _ANONYMOUS_UNION  __MINGW_EXTENSION
    497 #define _ANONYMOUS_STRUCT __MINGW_EXTENSION
    498 #ifndef NONAMELESSUNION
    499 #define _UNION_NAME(x)
    500 #define _STRUCT_NAME(x)
    501 #else /* NONAMELESSUNION */
    502 #define _UNION_NAME(x)  x
    503 #define _STRUCT_NAME(x) x
    504 #endif
    505 #endif	/* __ANONYMOUS_DEFINED */
    506 
    507 #ifndef DUMMYUNIONNAME
    508 # ifdef NONAMELESSUNION
    509 #  define DUMMYUNIONNAME  u
    510 #  define DUMMYUNIONNAME1 u1	/* Wine uses this variant */
    511 #  define DUMMYUNIONNAME2 u2
    512 #  define DUMMYUNIONNAME3 u3
    513 #  define DUMMYUNIONNAME4 u4
    514 #  define DUMMYUNIONNAME5 u5
    515 #  define DUMMYUNIONNAME6 u6
    516 #  define DUMMYUNIONNAME7 u7
    517 #  define DUMMYUNIONNAME8 u8
    518 #  define DUMMYUNIONNAME9 u9
    519 # else /* NONAMELESSUNION */
    520 #  define DUMMYUNIONNAME
    521 #  define DUMMYUNIONNAME1	/* Wine uses this variant */
    522 #  define DUMMYUNIONNAME2
    523 #  define DUMMYUNIONNAME3
    524 #  define DUMMYUNIONNAME4
    525 #  define DUMMYUNIONNAME5
    526 #  define DUMMYUNIONNAME6
    527 #  define DUMMYUNIONNAME7
    528 #  define DUMMYUNIONNAME8
    529 #  define DUMMYUNIONNAME9
    530 # endif
    531 #endif	/* DUMMYUNIONNAME */
    532 
    533 #ifndef DUMMYSTRUCTNAME
    534 # ifdef NONAMELESSUNION
    535 #  define DUMMYSTRUCTNAME  s
    536 #  define DUMMYSTRUCTNAME1 s1	/* Wine uses this variant */
    537 #  define DUMMYSTRUCTNAME2 s2
    538 #  define DUMMYSTRUCTNAME3 s3
    539 #  define DUMMYSTRUCTNAME4 s4
    540 #  define DUMMYSTRUCTNAME5 s5
    541 # else
    542 #  define DUMMYSTRUCTNAME
    543 #  define DUMMYSTRUCTNAME1	/* Wine uses this variant */
    544 #  define DUMMYSTRUCTNAME2
    545 #  define DUMMYSTRUCTNAME3
    546 #  define DUMMYSTRUCTNAME4
    547 #  define DUMMYSTRUCTNAME5
    548 # endif
    549 #endif /* DUMMYSTRUCTNAME */
    550 
    551 
    552 /* Macros for __uuidof template-based emulation */
    553 #if defined(__cplusplus) && (USE___UUIDOF == 0)
    554 
    555 #if __cpp_constexpr >= 200704l && __cpp_inline_variables >= 201606L
    556 #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)    \
    557     extern "C++" {                                               \
    558     template<> struct __mingw_uuidof_s<type> {                   \
    559         static constexpr IID __uuid_inst = {                     \
    560             l,w1,w2, {b1,b2,b3,b4,b5,b6,b7,b8}                   \
    561         };                                                       \
    562     };                                                           \
    563     template<> constexpr const GUID &__mingw_uuidof<type>() {    \
    564         return __mingw_uuidof_s<type>::__uuid_inst;              \
    565     }                                                            \
    566     template<> constexpr const GUID &__mingw_uuidof<type*>() {   \
    567         return  __mingw_uuidof_s<type>::__uuid_inst;             \
    568     }                                                            \
    569     }
    570 #else
    571 #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)           \
    572     extern "C++" {                                                      \
    573     template<> inline const GUID &__mingw_uuidof<type>() {              \
    574         static const IID __uuid_inst = {l,w1,w2, {b1,b2,b3,b4,b5,b6,b7,b8}}; \
    575         return __uuid_inst;                                             \
    576     }                                                                   \
    577     template<> inline const GUID &__mingw_uuidof<type*>() {             \
    578         return __mingw_uuidof<type>();                                  \
    579     }                                                                   \
    580     }
    581 #endif
    582 
    583 #define __uuidof(type) __mingw_uuidof<__typeof(type)>()
    584 
    585 #else
    586 
    587 #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
    588 
    589 #endif
    590 
    591 #ifdef __cplusplus
    592 extern "C" {
    593 #endif
    594 
    595 
    596 #ifdef __MINGW_INTRIN_INLINE
    597 
    598 #ifdef __has_builtin
    599 #define __MINGW_DEBUGBREAK_IMPL !__has_builtin(__debugbreak)
    600 #else
    601 #define __MINGW_DEBUGBREAK_IMPL 1
    602 #endif
    603 #if __MINGW_DEBUGBREAK_IMPL == 1
    604 void __cdecl __debugbreak(void);
    605 __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void)
    606 {
    607 #if defined(__aarch64__) || defined(__arm64ec__)
    608   __asm__ __volatile__("brk #0xf000");
    609 #elif defined(__i386__) || defined(__x86_64__)
    610   __asm__ __volatile__("int {$}3":);
    611 #elif defined(__arm__)
    612   __asm__ __volatile__("udf #0xfe");
    613 #else
    614   __asm__ __volatile__("unimplemented");
    615 #endif
    616 }
    617 #endif /* __MINGW_DEBUGBREAK_IMPL == 1 */
    618 
    619 #ifdef __has_builtin
    620 #define __MINGW_FASTFAIL_IMPL !__has_builtin(__fastfail)
    621 #else
    622 #define __MINGW_FASTFAIL_IMPL 1
    623 #endif
    624 #if __MINGW_FASTFAIL_IMPL == 1
    625 void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int code);
    626 __MINGW_INTRIN_INLINE void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int code)
    627 {
    628 #if defined(__aarch64__) || defined(__arm64ec__)
    629   register unsigned int w0 __asm__("w0") = code;
    630   __asm__ __volatile__("brk #0xf003"::"r"(w0));
    631 #elif defined(__i386__) || defined(__x86_64__)
    632   __asm__ __volatile__("int {$}0x29"::"c"(code));
    633 #elif defined(__arm__)
    634   register unsigned int r0 __asm__("r0") = code;
    635   __asm__ __volatile__("udf #0xfb"::"r"(r0));
    636 #else
    637   __asm__ __volatile__("unimplemented");
    638 #endif
    639   __builtin_unreachable();
    640 }
    641 #endif /* __MINGW_FASTFAIL_IMPL == 1 */
    642 
    643 #ifdef __has_builtin
    644 #define __MINGW_PREFETCH_IMPL !__has_builtin(__prefetch)
    645 #else
    646 #define __MINGW_PREFETCH_IMPL 1
    647 #endif
    648 #if __MINGW_PREFETCH_IMPL == 1
    649 #if defined(__arm__) || defined(__aarch64__) || defined(__arm64ec__)
    650 void __cdecl __prefetch(const void *addr);
    651 __MINGW_INTRIN_INLINE void __cdecl __prefetch(const void *addr)
    652 {
    653 #if defined(__arm__)
    654   __asm__ __volatile__("pld [%0]"::"r"(addr));
    655 #elif defined(__aarch64__) || defined(__arm64ec__)
    656   __asm__ __volatile__("prfm pldl1keep, [%0]"::"r"(addr));
    657 #endif
    658 }
    659 #endif /* defined(__arm__) || defined(__aarch64__) */
    660 #endif /* __MINGW_PREFETCH_IMPL == 1 */
    661 
    662 #endif /* defined(__MINGW_INTRIN_INLINE) */
    663 
    664 /* mingw-w64 specific functions: */
    665 const char *__mingw_get_crt_info (void);
    666 
    667 #ifdef __cplusplus
    668 }
    669 #endif
    670 
    671 #endif /* _INC__MINGW_H */
    672 
    673 #ifndef MINGW_SDK_INIT
    674 #define MINGW_SDK_INIT
    675 
    676 /* for backward compatibility */
    677 #ifndef MINGW_HAS_SECURE_API
    678 #define MINGW_HAS_SECURE_API 1
    679 #endif
    680 
    681 #define __STDC_SECURE_LIB__ 200411L
    682 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
    683 
    684 #ifndef __WIDL__
    685 #include "sdks/_mingw_ddk.h"
    686 #endif
    687 
    688 #endif /* MINGW_SDK_INIT */