Home | History | Annotate | Download | only in include
      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_CRTDEFS_MACRO
      8 #define _INC_CRTDEFS_MACRO
      9 
     10 #define __STRINGIFY(x) #x
     11 #define __MINGW64_STRINGIFY(x) \
     12   __STRINGIFY(x)
     13 
     14 #define __MINGW64_VERSION_MAJOR 5
     15 #define __MINGW64_VERSION_MINOR 0
     16 
     17 /* This macro holds an monotonic increasing value, which indicates
     18    a specific fix/patch is present on trunk.  This value isn't related to
     19    minor/major version-macros.  It is increased on demand, if a big
     20    fix was applied to trunk.  This macro gets just increased on trunk.  For
     21    other branches its value won't be modified.  */
     22 
     23 #define __MINGW64_VERSION_RC 0
     24 
     25 #define __MINGW64_VERSION_STR	\
     26   __MINGW64_STRINGIFY(__MINGW64_VERSION_MAJOR) \
     27   "." \
     28   __MINGW64_STRINGIFY(__MINGW64_VERSION_MINOR)
     29 
     30 #define __MINGW64_VERSION_STATE "alpha"
     31 
     32 /* mingw.org's version macros: these make gcc to define
     33    MINGW32_SUPPORTS_MT_EH and to use the _CRT_MT global
     34    and the __mingwthr_key_dtor() function from the MinGW
     35    CRT in its private gthr-win32.h header. */
     36 #define __MINGW32_MAJOR_VERSION 3
     37 #define __MINGW32_MINOR_VERSION 11
     38 
     39 /* Set VC specific compiler target macros.  */
     40 #if defined(__x86_64) && defined(_X86_)
     41 #  undef _X86_  /* _X86_ is not for __x86_64 */
     42 #endif
     43 
     44 #if defined(_X86_) && !defined(_M_IX86) && !defined(_M_IA64) \
     45    && !defined(_M_AMD64) && !defined(__x86_64)
     46 #  if defined(__i486__)
     47 #    define _M_IX86 400
     48 #  elif defined(__i586__)
     49 #    define _M_IX86 500
     50 #  else
     51      /* This gives wrong (600 instead of 300) value if -march=i386 is specified
     52       but we cannot check for__i386__ as it is defined for all 32-bit CPUs. */
     53 #    define _M_IX86 600
     54 #  endif
     55 #endif /* if defined(_X86_) && !defined(_M_IX86) && !defined(_M_IA64) ... */
     56 
     57 #if defined(__x86_64) && !defined(_M_IX86) && !defined(_M_IA64) \
     58    && !defined(_M_AMD64)
     59 #  define _M_AMD64 100
     60 #  define _M_X64 100
     61 #endif
     62 
     63 #if defined(__ia64__) && !defined(_M_IX86) && !defined(_M_IA64) \
     64    && !defined(_M_AMD64) && !defined(_X86_) && !defined(__x86_64)
     65 #  define _M_IA64 100
     66 #endif
     67 
     68 #if defined(__arm__) && !defined(_M_ARM) && !defined(_M_ARMT) \
     69    && !defined(_M_THUMB)
     70 #  define _M_ARM 100
     71 #  define _M_ARMT 100
     72 #  define _M_THUMB 100
     73 #  ifndef _ARM_
     74 #    define _ARM_ 1
     75 #  endif
     76 #  ifndef _M_ARM_NT
     77 #    define _M_ARM_NT 1
     78 #  endif
     79 #endif
     80 
     81 #ifndef _X86_
     82    /* MS does not prefix symbols by underscores for 64-bit.  */
     83 #  ifndef __MINGW_USE_UNDERSCORE_PREFIX
     84      /* As we have to support older gcc version, which are using underscores
     85       as symbol prefix for x64, we have to check here for the user label
     86       prefix defined by gcc. */
     87 #    ifdef __USER_LABEL_PREFIX__
     88 #      pragma push_macro ("_")
     89 #      undef _
     90 #      define _ 1
     91 #      if (__USER_LABEL_PREFIX__ + 0) != 0
     92 #        define __MINGW_USE_UNDERSCORE_PREFIX 1
     93 #      else
     94 #        define __MINGW_USE_UNDERSCORE_PREFIX 0
     95 #      endif
     96 #      undef _
     97 #      pragma pop_macro ("_")
     98 #    else /* ! __USER_LABEL_PREFIX__ */
     99 #      define __MINGW_USE_UNDERSCORE_PREFIX 0
    100 #    endif /* __USER_LABEL_PREFIX__ */
    101 #  endif
    102 #else /* ! ifndef _X86_ */
    103    /* For x86 we have always to prefix by underscore.  */
    104 #  undef __MINGW_USE_UNDERSCORE_PREFIX
    105 #  define __MINGW_USE_UNDERSCORE_PREFIX 1
    106 #endif /* ifndef _X86_ */
    107 
    108 #if __MINGW_USE_UNDERSCORE_PREFIX == 0
    109 #  define __MINGW_IMP_SYMBOL(sym) __imp_##sym
    110 #  define __MINGW_IMP_LSYMBOL(sym) __imp_##sym
    111 #  define __MINGW_USYMBOL(sym) sym
    112 #  define __MINGW_LSYMBOL(sym) _##sym
    113 #else /* ! if __MINGW_USE_UNDERSCORE_PREFIX == 0 */
    114 #  define __MINGW_IMP_SYMBOL(sym) _imp__##sym
    115 #  define __MINGW_IMP_LSYMBOL(sym) __imp__##sym
    116 #  define __MINGW_USYMBOL(sym) _##sym
    117 #  define __MINGW_LSYMBOL(sym) sym
    118 #endif /* if __MINGW_USE_UNDERSCORE_PREFIX == 0 */
    119 
    120 #ifndef __PTRDIFF_TYPE__
    121 #  ifdef _WIN64
    122 #    define __PTRDIFF_TYPE__ long long int
    123 #  else
    124 #    define __PTRDIFF_TYPE__ long int
    125 #  endif
    126 #endif
    127 
    128 #ifndef __SIZE_TYPE__
    129 #  ifdef _WIN64
    130 #    define __SIZE_TYPE__ long long unsigned int
    131 #  else
    132 #    define __SIZE_TYPE__ long unsigned int
    133 #  endif
    134 #endif
    135 
    136 #ifndef __WCHAR_TYPE__
    137 #  define __WCHAR_TYPE__ unsigned short
    138 #endif
    139 
    140 #ifndef __WINT_TYPE__
    141 #  define __WINT_TYPE__ unsigned short
    142 #endif
    143 
    144 #undef __MINGW_EXTENSION
    145 
    146 #ifdef __WIDL__
    147 #  define __MINGW_EXTENSION
    148 #else
    149 #  if defined(__GNUC__) || defined(__GNUG__)
    150 #    define __MINGW_EXTENSION __extension__
    151 #  else
    152 #    define __MINGW_EXTENSION
    153 #  endif
    154 #endif /* __WIDL__ */
    155 
    156 /* Special case nameless struct/union.  */
    157 #ifndef __C89_NAMELESS
    158 #  define __C89_NAMELESS __MINGW_EXTENSION
    159 #  define __C89_NAMELESSSTRUCTNAME
    160 #  define __C89_NAMELESSSTRUCTNAME1
    161 #  define __C89_NAMELESSSTRUCTNAME2
    162 #  define __C89_NAMELESSSTRUCTNAME3
    163 #  define __C89_NAMELESSSTRUCTNAME4
    164 #  define __C89_NAMELESSSTRUCTNAME5
    165 #  define __C89_NAMELESSUNIONNAME
    166 #  define __C89_NAMELESSUNIONNAME1
    167 #  define __C89_NAMELESSUNIONNAME2
    168 #  define __C89_NAMELESSUNIONNAME3
    169 #  define __C89_NAMELESSUNIONNAME4
    170 #  define __C89_NAMELESSUNIONNAME5
    171 #  define __C89_NAMELESSUNIONNAME6
    172 #  define __C89_NAMELESSUNIONNAME7
    173 #  define __C89_NAMELESSUNIONNAME8
    174 #endif
    175 
    176 #ifndef __GNU_EXTENSION
    177 #  define __GNU_EXTENSION __MINGW_EXTENSION
    178 #endif
    179 
    180 /* MinGW-w64 has some additional C99 printf/scanf feature support.
    181    So we add some helper macros to ease recognition of them.  */
    182 #define __MINGW_HAVE_ANSI_C99_PRINTF 1
    183 #define __MINGW_HAVE_WIDE_C99_PRINTF 1
    184 #define __MINGW_HAVE_ANSI_C99_SCANF 1
    185 #define __MINGW_HAVE_WIDE_C99_SCANF 1
    186 
    187 #ifdef __MINGW_USE_BROKEN_INTERFACE
    188 #  define __MINGW_POISON_NAME(__IFACE) __IFACE
    189 #else
    190 #  define __MINGW_POISON_NAME(__IFACE) \
    191      __IFACE##_layout_has_not_been_verified_and_its_declaration_is_most_likely_incorrect
    192 #endif
    193 
    194 #ifndef __MSABI_LONG
    195 #  ifndef __LP64__
    196 #    define __MSABI_LONG(x) x ## l
    197 #  else
    198 #    define __MSABI_LONG(x) x
    199 #  endif
    200 #endif
    201 
    202 #if __GNUC__
    203 #  define __MINGW_GCC_VERSION	(__GNUC__ * 10000 + \
    204       __GNUC_MINOR__	* 100	+ \
    205       __GNUC_PATCHLEVEL__)
    206 #else
    207 #  define __MINGW_GCC_VERSION 0
    208 #endif
    209 
    210 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
    211 #  define __MINGW_GNUC_PREREQ(major, minor) \
    212       (__GNUC__ > (major) \
    213       || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
    214 #else
    215 #  define __MINGW_GNUC_PREREQ(major, minor) 0
    216 #endif
    217 
    218 #if defined (_MSC_VER)
    219 #  define __MINGW_MSC_PREREQ(major, minor) \
    220       (_MSC_VER >= (major * 100 + minor * 10))
    221 #else
    222 #  define __MINGW_MSC_PREREQ(major, minor) 0
    223 #endif
    224 
    225 #ifdef __MINGW_MSVC_COMPAT_WARNINGS
    226 #  if __MINGW_GNUC_PREREQ (4, 5)
    227 #    define __MINGW_ATTRIB_DEPRECATED_STR(X) \
    228        __attribute__ ((__deprecated__ (X)))
    229 #  else
    230 #    define __MINGW_ATTRIB_DEPRECATED_STR(X) \
    231        __MINGW_ATTRIB_DEPRECATED
    232 #  endif
    233 #else
    234 #  define __MINGW_ATTRIB_DEPRECATED_STR(X)
    235 #endif /* ifdef __MINGW_MSVC_COMPAT_WARNINGS */
    236 
    237 #define __MINGW_SEC_WARN_STR \
    238   "This function or variable may be unsafe, use _CRT_SECURE_NO_WARNINGS to disable deprecation"
    239 
    240 #define __MINGW_MSVC2005_DEPREC_STR \
    241   "This POSIX function is deprecated beginning in Visual C++ 2005, use _CRT_NONSTDC_NO_DEPRECATE to disable deprecation"
    242 
    243 #if !defined (_CRT_NONSTDC_NO_DEPRECATE)
    244 #  define __MINGW_ATTRIB_DEPRECATED_MSVC2005 \
    245       __MINGW_ATTRIB_DEPRECATED_STR(__MINGW_MSVC2005_DEPREC_STR)
    246 #else
    247 #  define __MINGW_ATTRIB_DEPRECATED_MSVC2005
    248 #endif
    249 
    250 #if !defined (_CRT_SECURE_NO_WARNINGS) || (_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES == 0)
    251 #  define __MINGW_ATTRIB_DEPRECATED_SEC_WARN \
    252       __MINGW_ATTRIB_DEPRECATED_STR(__MINGW_SEC_WARN_STR)
    253 #else
    254 #  define __MINGW_ATTRIB_DEPRECATED_SEC_WARN
    255 #endif
    256 
    257 #define __MINGW_MS_PRINTF(__format,__args) \
    258   __attribute__((__format__(ms_printf, __format,__args)))
    259 
    260 #define __MINGW_MS_SCANF(__format,__args) \
    261   __attribute__((__format__(ms_scanf,  __format,__args)))
    262 
    263 #define __MINGW_GNU_PRINTF(__format,__args) \
    264   __attribute__((__format__(gnu_printf,__format,__args)))
    265 
    266 #define __MINGW_GNU_SCANF(__format,__args) \
    267   __attribute__((__format__(gnu_scanf, __format,__args)))
    268 
    269 #undef __mingw_ovr
    270 
    271 #ifdef __cplusplus
    272 #  define __mingw_ovr  inline __cdecl
    273 #elif defined (__GNUC__)
    274 #  define __mingw_ovr static \
    275       __attribute__ ((__unused__)) __inline__ __cdecl
    276 #else
    277 #  define __mingw_ovr static __cdecl
    278 #endif /* __cplusplus */
    279 
    280 #endif	/* _INC_CRTDEFS_MACRO */
    281