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 9
15 #define __MINGW64_VERSION_MINOR 0
16 #define __MINGW64_VERSION_BUGFIX 0
17 
18 /* This macro holds an monotonic increasing value, which indicates
19    a specific fix/patch is present on trunk.  This value isn't related to
20    minor/major version-macros.  It is increased on demand, if a big
21    fix was applied to trunk.  This macro gets just increased on trunk.  For
22    other branches its value won't be modified.  */
23 
24 #define __MINGW64_VERSION_RC 0
25 
26 #define __MINGW64_VERSION_STR	\
27   __MINGW64_STRINGIFY(__MINGW64_VERSION_MAJOR) \
28   "." \
29   __MINGW64_STRINGIFY(__MINGW64_VERSION_MINOR) \
30   "." \
31   __MINGW64_STRINGIFY(__MINGW64_VERSION_BUGFIX)
32 
33 #define __MINGW64_VERSION_STATE "alpha"
34 
35 /* mingw.org's version macros: these make gcc to define
36    MINGW32_SUPPORTS_MT_EH and to use the _CRT_MT global
37    and the __mingwthr_key_dtor() function from the MinGW
38    CRT in its private gthr-win32.h header. */
39 #define __MINGW32_MAJOR_VERSION 3
40 #define __MINGW32_MINOR_VERSION 11
41 
42 /* Set VC specific compiler target macros.  */
43 #if defined(__x86_64) && defined(_X86_)
44 #  undef _X86_  /* _X86_ is not for __x86_64 */
45 #endif
46 
47 #if defined(_X86_) && !defined(_M_IX86) && !defined(_M_IA64) \
48    && !defined(_M_AMD64) && !defined(__x86_64)
49 #  if defined(__i486__)
50 #    define _M_IX86 400
51 #  elif defined(__i586__)
52 #    define _M_IX86 500
53 #  elif defined(__i686__)
54 #    define _M_IX86 600
55 #  else
56 #    define _M_IX86 300
57 #  endif
58 #endif /* if defined(_X86_) && !defined(_M_IX86) && !defined(_M_IA64) ... */
59 
60 #if defined(__x86_64) && !defined(_M_IX86) && !defined(_M_IA64) \
61    && !defined(_M_AMD64)
62 #  define _M_AMD64 100
63 #  define _M_X64 100
64 #endif
65 
66 #if defined(__ia64__) && !defined(_M_IX86) && !defined(_M_IA64) \
67    && !defined(_M_AMD64) && !defined(_X86_) && !defined(__x86_64)
68 #  define _M_IA64 100
69 #endif
70 
71 #if defined(__arm__) && !defined(_M_ARM) && !defined(_M_ARMT) \
72    && !defined(_M_THUMB)
73 #  define _M_ARM 100
74 #  define _M_ARMT 100
75 #  define _M_THUMB 100
76 #  ifndef _ARM_
77 #    define _ARM_ 1
78 #  endif
79 #  ifndef _M_ARM_NT
80 #    define _M_ARM_NT 1
81 #  endif
82 #endif
83 
84 #if defined(__aarch64__) && !defined(_M_ARM64)
85 #  define _M_ARM64 1
86 #  ifndef _ARM64_
87 #    define _ARM64_ 1
88 #  endif
89 #endif
90 
91 #ifndef _X86_
92    /* MS does not prefix symbols by underscores for 64-bit.  */
93 #  ifndef __MINGW_USE_UNDERSCORE_PREFIX
94      /* As we have to support older gcc version, which are using underscores
95       as symbol prefix for x64, we have to check here for the user label
96       prefix defined by gcc. */
97 #    ifdef __USER_LABEL_PREFIX__
98 #      pragma push_macro ("_")
99 #      undef _
100 #      define _ 1
101 #      if (__USER_LABEL_PREFIX__ + 0) != 0
102 #        define __MINGW_USE_UNDERSCORE_PREFIX 1
103 #      else
104 #        define __MINGW_USE_UNDERSCORE_PREFIX 0
105 #      endif
106 #      undef _
107 #      pragma pop_macro ("_")
108 #    else /* ! __USER_LABEL_PREFIX__ */
109 #      define __MINGW_USE_UNDERSCORE_PREFIX 0
110 #    endif /* __USER_LABEL_PREFIX__ */
111 #  endif
112 #else /* ! ifndef _X86_ */
113    /* For x86 we have always to prefix by underscore.  */
114 #  undef __MINGW_USE_UNDERSCORE_PREFIX
115 #  define __MINGW_USE_UNDERSCORE_PREFIX 1
116 #endif /* ifndef _X86_ */
117 
118 #if __MINGW_USE_UNDERSCORE_PREFIX == 0
119 #  define __MINGW_IMP_SYMBOL(sym) __imp_##sym
120 #  define __MINGW_IMP_LSYMBOL(sym) __imp_##sym
121 #  define __MINGW_USYMBOL(sym) sym
122 #  define __MINGW_LSYMBOL(sym) _##sym
123 #else /* ! if __MINGW_USE_UNDERSCORE_PREFIX == 0 */
124 #  define __MINGW_IMP_SYMBOL(sym) _imp__##sym
125 #  define __MINGW_IMP_LSYMBOL(sym) __imp__##sym
126 #  define __MINGW_USYMBOL(sym) _##sym
127 #  define __MINGW_LSYMBOL(sym) sym
128 #endif /* if __MINGW_USE_UNDERSCORE_PREFIX == 0 */
129 
130 #define __MINGW_ASM_CALL(func) __asm__(__MINGW64_STRINGIFY(__MINGW_USYMBOL(func)))
131 #define __MINGW_ASM_CRT_CALL(func) __asm__(__STRINGIFY(func))
132 
133 #ifndef __PTRDIFF_TYPE__
134 #  ifdef _WIN64
135 #    define __PTRDIFF_TYPE__ long long int
136 #  else
137 #    define __PTRDIFF_TYPE__ long int
138 #  endif
139 #endif
140 
141 #ifndef __SIZE_TYPE__
142 #  ifdef _WIN64
143 #    define __SIZE_TYPE__ long long unsigned int
144 #  else
145 #    define __SIZE_TYPE__ long unsigned int
146 #  endif
147 #endif
148 
149 #ifndef __WCHAR_TYPE__
150 #  define __WCHAR_TYPE__ unsigned short
151 #endif
152 
153 #ifndef __WINT_TYPE__
154 #  define __WINT_TYPE__ unsigned short
155 #endif
156 
157 #undef __MINGW_EXTENSION
158 
159 #ifdef __WIDL__
160 #  define __MINGW_EXTENSION
161 #else
162 #  if defined(__GNUC__) || defined(__GNUG__)
163 #    define __MINGW_EXTENSION __extension__
164 #  else
165 #    define __MINGW_EXTENSION
166 #  endif
167 #endif /* __WIDL__ */
168 
169 /* Special case nameless struct/union.  */
170 #ifndef __C89_NAMELESS
171 #  define __C89_NAMELESS __MINGW_EXTENSION
172 #  define __C89_NAMELESSSTRUCTNAME
173 #  define __C89_NAMELESSSTRUCTNAME1
174 #  define __C89_NAMELESSSTRUCTNAME2
175 #  define __C89_NAMELESSSTRUCTNAME3
176 #  define __C89_NAMELESSSTRUCTNAME4
177 #  define __C89_NAMELESSSTRUCTNAME5
178 #  define __C89_NAMELESSUNIONNAME
179 #  define __C89_NAMELESSUNIONNAME1
180 #  define __C89_NAMELESSUNIONNAME2
181 #  define __C89_NAMELESSUNIONNAME3
182 #  define __C89_NAMELESSUNIONNAME4
183 #  define __C89_NAMELESSUNIONNAME5
184 #  define __C89_NAMELESSUNIONNAME6
185 #  define __C89_NAMELESSUNIONNAME7
186 #  define __C89_NAMELESSUNIONNAME8
187 #endif
188 
189 #ifndef __GNU_EXTENSION
190 #  define __GNU_EXTENSION __MINGW_EXTENSION
191 #endif
192 
193 /* MinGW-w64 has some additional C99 printf/scanf feature support.
194    So we add some helper macros to ease recognition of them.  */
195 #define __MINGW_HAVE_ANSI_C99_PRINTF 1
196 #define __MINGW_HAVE_WIDE_C99_PRINTF 1
197 #define __MINGW_HAVE_ANSI_C99_SCANF 1
198 #define __MINGW_HAVE_WIDE_C99_SCANF 1
199 
200 #ifdef __MINGW_USE_BROKEN_INTERFACE
201 #  define __MINGW_POISON_NAME(__IFACE) __IFACE
202 #else
203 #  define __MINGW_POISON_NAME(__IFACE) \
204      __IFACE##_layout_has_not_been_verified_and_its_declaration_is_most_likely_incorrect
205 #endif
206 
207 #ifndef __MSABI_LONG
208 #  ifndef __LP64__
209 #    define __MSABI_LONG(x) x ## l
210 #  else
211 #    define __MSABI_LONG(x) x
212 #  endif
213 #endif
214 
215 #if __GNUC__
216 #  define __MINGW_GCC_VERSION	(__GNUC__ * 10000 + \
217       __GNUC_MINOR__	* 100	+ \
218       __GNUC_PATCHLEVEL__)
219 #else
220 #  define __MINGW_GCC_VERSION 0
221 #endif
222 
223 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
224 #  define __MINGW_GNUC_PREREQ(major, minor) \
225       (__GNUC__ > (major) \
226       || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
227 #else
228 #  define __MINGW_GNUC_PREREQ(major, minor) 0
229 #endif
230 
231 #if defined (_MSC_VER)
232 #  define __MINGW_MSC_PREREQ(major, minor) \
233       (_MSC_VER >= (major * 100 + minor * 10))
234 #else
235 #  define __MINGW_MSC_PREREQ(major, minor) 0
236 #endif
237 
238 #ifdef __MINGW_MSVC_COMPAT_WARNINGS
239 #  if __MINGW_GNUC_PREREQ (4, 5)
240 #    define __MINGW_ATTRIB_DEPRECATED_STR(X) \
241        __attribute__ ((__deprecated__ (X)))
242 #  else
243 #    define __MINGW_ATTRIB_DEPRECATED_STR(X) \
244        __MINGW_ATTRIB_DEPRECATED
245 #  endif
246 #else
247 #  define __MINGW_ATTRIB_DEPRECATED_STR(X)
248 #endif /* ifdef __MINGW_MSVC_COMPAT_WARNINGS */
249 
250 #define __MINGW_SEC_WARN_STR \
251   "This function or variable may be unsafe, use _CRT_SECURE_NO_WARNINGS to disable deprecation"
252 
253 #define __MINGW_MSVC2005_DEPREC_STR \
254   "This POSIX function is deprecated beginning in Visual C++ 2005, use _CRT_NONSTDC_NO_DEPRECATE to disable deprecation"
255 
256 #if !defined (_CRT_NONSTDC_NO_DEPRECATE)
257 #  define __MINGW_ATTRIB_DEPRECATED_MSVC2005 \
258       __MINGW_ATTRIB_DEPRECATED_STR(__MINGW_MSVC2005_DEPREC_STR)
259 #else
260 #  define __MINGW_ATTRIB_DEPRECATED_MSVC2005
261 #endif
262 
263 #if !defined (_CRT_SECURE_NO_WARNINGS) || (_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES == 0)
264 #  define __MINGW_ATTRIB_DEPRECATED_SEC_WARN \
265       __MINGW_ATTRIB_DEPRECATED_STR(__MINGW_SEC_WARN_STR)
266 #else
267 #  define __MINGW_ATTRIB_DEPRECATED_SEC_WARN
268 #endif
269 
270 #define __MINGW_MS_PRINTF(__format,__args) \
271   __attribute__((__format__(ms_printf, __format,__args)))
272 
273 #define __MINGW_MS_SCANF(__format,__args) \
274   __attribute__((__format__(ms_scanf,  __format,__args)))
275 
276 #define __MINGW_GNU_PRINTF(__format,__args) \
277   __attribute__((__format__(gnu_printf,__format,__args)))
278 
279 #define __MINGW_GNU_SCANF(__format,__args) \
280   __attribute__((__format__(gnu_scanf, __format,__args)))
281 
282 #undef __mingw_ovr
283 #undef __mingw_static_ovr
284 
285 #ifdef __cplusplus
286 #  define __mingw_ovr  inline __cdecl
287 #  define __mingw_static_ovr static __mingw_ovr
288 #elif defined (__GNUC__)
289 #  define __mingw_ovr static \
290       __attribute__ ((__unused__)) __inline__ __cdecl
291 #  define __mingw_static_ovr __mingw_ovr
292 #else
293 #  define __mingw_ovr static __cdecl
294 #  define __mingw_static_ovr __mingw_ovr
295 #endif /* __cplusplus */
296 
297 #if __MINGW_GNUC_PREREQ(4, 3) && !defined(__clang__)
298 #  define __mingw_attribute_artificial \
299      __attribute__((__artificial__))
300 #else
301 #  define __mingw_attribute_artificial
302 #endif
303 
304 #if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 && __MINGW_GNUC_PREREQ(4, 1)
305 #  if _FORTIFY_SOURCE > 1
306 #    define __MINGW_FORTIFY_LEVEL 2
307 #  else
308 #    define __MINGW_FORTIFY_LEVEL 1
309 #  endif
310 #else
311 #  define __MINGW_FORTIFY_LEVEL 0
312 #endif
313 
314 #if __MINGW_FORTIFY_LEVEL > 0
315    /* Calling an function with __attribute__((__warning__("...")))
316       from a system include __inline__ function does not print
317       a warning unless caller has __attribute__((__artificial__)). */
318 #  define __mingw_bos_declare \
319      void __cdecl __chk_fail(void) __attribute__((__noreturn__)); \
320      void __cdecl __mingw_chk_fail_warn(void) __MINGW_ASM_CALL(__chk_fail) \
321      __attribute__((__noreturn__)) \
322      __attribute__((__warning__("Buffer overflow detected")))
323 #  define __mingw_bos(p, maxtype) \
324      __builtin_object_size((p), ((maxtype) > 0) && (__MINGW_FORTIFY_LEVEL > 1))
325 #  define __mingw_bos_known(p) \
326      (__mingw_bos(p, 0) != (size_t)-1)
327 #  define __mingw_bos_cond_chk(c) \
328      (__builtin_expect((c), 1) ? (void)0 : __chk_fail())
329 #  define __mingw_bos_ptr_chk(p, n, maxtype) \
330      __mingw_bos_cond_chk(!__mingw_bos_known(p) || __mingw_bos(p, maxtype) >= (size_t)(n))
331 #  define __mingw_bos_ptr_chk_warn(p, n, maxtype) \
332      (__mingw_bos_known(p) && __builtin_constant_p((n)) && __mingw_bos(p, maxtype) < (size_t)(n) \
333      ? __mingw_chk_fail_warn() : __mingw_bos_ptr_chk(p, n, maxtype))
334 #  define __mingw_bos_ovr __mingw_ovr \
335      __attribute__((__always_inline__)) \
336      __mingw_attribute_artificial
337 #  define __mingw_bos_extern_ovr extern __inline__ __cdecl \
338      __attribute__((__always_inline__, __gnu_inline__)) \
339      __mingw_attribute_artificial
340 #else
341 #  define __mingw_bos_ovr __mingw_ovr
342 #endif /* __MINGW_FORTIFY_LEVEL > 0 */
343 
344 /* If _FORTIFY_SOURCE is enabled, some inline functions may use
345    __builtin_va_arg_pack().  GCC may report an error if the address
346    of such a function is used.  Set _FORTIFY_VA_ARG=0 in this case.  */
347 #if __MINGW_FORTIFY_LEVEL > 0 && __MINGW_GNUC_PREREQ(4, 3) && !defined(__clang__) \
348     && (!defined(_FORTIFY_VA_ARG) || _FORTIFY_VA_ARG > 0)
349 #  define __MINGW_FORTIFY_VA_ARG 1
350 #else
351 #  define __MINGW_FORTIFY_VA_ARG 0
352 #endif
353 
354 /* Enable workaround for ABI incompatibility on affected platforms */
355 #ifndef WIDL_EXPLICIT_AGGREGATE_RETURNS
356 #if defined(__GNUC__) && defined(__cplusplus) && (defined(__x86_64__) || defined(__i386__))
357 #define  WIDL_EXPLICIT_AGGREGATE_RETURNS
358 #endif
359 #endif
360 
361 #endif	/* _INC_CRTDEFS_MACRO */
362