Fix explorer build a bit more.
[reactos.git] / reactos / include / crt / _mingw.h
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6
7 #ifndef _INC_CRTDEFS
8 #define _INC_CRTDEFS
9
10 #ifndef MINGW64
11 #define MINGW64
12 #define MINGW64_VERSION 1.0
13 #define MINGW64_VERSION_MAJOR 1
14 #define MINGW64_VERSION_MINOR 0
15 #define MINGW64_VERSION_STATE "alpha"
16 #endif
17
18 #ifndef __GNUC__
19 # ifndef __MINGW_IMPORT
20 # define __MINGW_IMPORT __declspec(dllimport)
21 # endif
22 # ifndef _CRTIMP
23 # define _CRTIMP __declspec(dllimport)
24 # endif
25 # define __DECLSPEC_SUPPORTED
26 # define __attribute__(x) /* nothing */
27 #else /* __GNUC__ */
28 # ifdef __declspec
29 # ifndef __MINGW_IMPORT
30 /* Note the extern. This is needed to work around GCC's
31 limitations in handling dllimport attribute. */
32 # define __MINGW_IMPORT extern __attribute__ ((__dllimport__))
33 # endif
34 # ifndef _CRTIMP
35 # ifdef __USE_CRTIMP
36 # define _CRTIMP __attribute__ ((dllimport))
37 # else
38 # define _CRTIMP
39 # endif
40 # endif
41 # define __DECLSPEC_SUPPORTED
42 # else /* __declspec */
43 # undef __DECLSPEC_SUPPORTED
44 # undef __MINGW_IMPORT
45 # ifndef _CRTIMP
46 # define _CRTIMP
47 # endif
48 # endif /* __declspec */
49 # ifndef __cdecl
50 # define __cdecl __attribute__ ((__cdecl__))
51 # endif
52 # ifndef __stdcall
53 # define __stdcall __attribute__ ((__stdcall__))
54 # endif
55
56 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
57 #define __MINGW_GNUC_PREREQ(major, minor) \
58 (__GNUC__ > (major) \
59 || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
60 #else
61 #define __MINGW_GNUC_PREREQ(major, minor) 0
62 #endif
63
64 #define USE___UUIDOF 0
65
66 #ifdef __cplusplus
67 # define __CRT_INLINE inline
68 #else
69 # if ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
70 # define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
71 # else
72 # define __CRT_INLINE extern __inline__
73 # endif
74 #endif
75
76 #ifdef __cplusplus
77 # define __UNUSED_PARAM(x)
78 #else
79 # ifdef __GNUC__
80 # define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
81 # else
82 # define __UNUSED_PARAM(x) x
83 # endif
84 #endif
85
86 #ifdef __GNUC__
87 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
88 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
89 #else
90 #define __MINGW_ATTRIB_NORETURN
91 #define __MINGW_ATTRIB_CONST
92 #endif
93
94 #if __MINGW_GNUC_PREREQ (3, 0)
95 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
96 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
97 #else
98 #define __MINGW_ATTRIB_MALLOC
99 #define __MINGW_ATTRIB_PURE
100 #endif
101
102 /* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
103 variadiac macro facility, because variadic macros cause syntax
104 errors with --traditional-cpp. */
105 #if __MINGW_GNUC_PREREQ (3, 3)
106 #define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
107 #else
108 #define __MINGW_ATTRIB_NONNULL(arg)
109 #endif /* GNUC >= 3.3 */
110
111 #if __MINGW_GNUC_PREREQ (3, 1)
112 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
113 #else
114 #define __MINGW_ATTRIB_DEPRECATED
115 #endif /* GNUC >= 3.1 */
116
117 #if __MINGW_GNUC_PREREQ (3, 3)
118 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
119 #else
120 #define __MINGW_NOTHROW
121 #endif /* GNUC >= 3.3 */
122
123 #ifndef __MSVCRT_VERSION__
124 /* High byte is the major version, low byte is the minor. */
125 # define __MSVCRT_VERSION__ 0x0700
126 #endif
127
128
129 //#ifndef WINVER
130 //#define WINVER 0x0502
131 //#endif
132
133 #ifndef _WIN32_WINNT
134 #define _WIN32_WINNT 0x502
135 #endif
136
137 #ifndef _INT128_DEFINED
138 #define _INT128_DEFINED
139 #ifdef __GNUC__
140 #define __int8 char
141 #define __int16 short
142 #define __int32 int
143 #define __int64 long long
144 #ifdef _WIN64
145
146 typedef int __int128 __attribute__ ((mode (TI)));
147
148 #endif
149
150 #define __ptr32
151 #define __ptr64
152 #define __unaligned __attribute ((packed))
153 #define __forceinline extern __inline
154 #endif
155 #endif
156
157 #ifndef _WIN32
158 #error Only Win32 target is supported!
159 #endif
160
161 #if defined (__i386__)
162 #define _ATTRIBUTES
163 #else
164 #define _ATTRIBUTES shared
165 #endif
166
167 #ifdef __cplusplus
168 #ifndef __nothrow
169 #define __nothrow __declspec(nothrow)
170 #endif
171 #else
172 #ifndef __nothrow
173 #define __nothrow
174 #endif
175 #endif
176
177 #undef _CRT_PACKING
178 #define _CRT_PACKING 8
179
180 #ifdef _WIN64
181 #undef USE_MINGW_SETJMP_TWO_ARGS
182 #define USE_MINGW_SETJMP_TWO_ARGS
183 #endif
184
185 #pragma pack(push,_CRT_PACKING)
186
187 #include <vadefs.h>
188
189 #ifdef __cplusplus
190 extern "C" {
191 #endif
192
193 #ifndef _CRT_STRINGIZE
194 #define __CRT_STRINGIZE(_Value) #_Value
195 #define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
196 #endif
197
198 #ifndef _CRT_WIDE
199 #define __CRT_WIDE(_String) L ## _String
200 #define _CRT_WIDE(_String) __CRT_WIDE(_String)
201 #endif
202
203 #ifndef _W64
204 #define _W64
205 #endif
206
207 #ifndef _CRTIMP_NOIA64
208 #ifdef __ia64__
209 #define _CRTIMP_NOIA64
210 #else
211 #define _CRTIMP_NOIA64 _CRTIMP
212 #endif
213 #endif
214
215 #ifndef _CRTIMP2
216 #define _CRTIMP2 _CRTIMP
217 #endif
218
219 #ifndef _CRTIMP_ALTERNATIVE
220 #define _CRTIMP_ALTERNATIVE _CRTIMP
221 #define _CRT_ALTERNATIVE_IMPORTED
222 #endif
223
224 #ifndef _MRTIMP2
225 #define _MRTIMP2 _CRTIMP
226 #endif
227
228 #ifndef _DLL
229 #define _DLL
230 #endif
231
232 #ifndef _MT
233 #define _MT
234 #endif
235
236 #ifndef _MCRTIMP
237 #define _MCRTIMP _CRTIMP
238 #endif
239
240 #ifndef _CRTIMP_PURE
241 #define _CRTIMP_PURE _CRTIMP
242 #endif
243
244 #ifndef _PGLOBAL
245 #define _PGLOBAL
246 #endif
247
248 #ifndef _AGLOBAL
249 #define _AGLOBAL
250 #endif
251
252 #define __STDC_SECURE_LIB__ 200411L
253 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
254 #define _SECURECRT_FILL_BUFFER_PATTERN 0xFD
255 #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated)
256
257 #ifndef _CRT_INSECURE_DEPRECATE_MEMORY
258 #define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
259 #endif
260 #ifndef _CRT_INSECURE_DEPRECATE_GLOBALS
261 #define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)
262 #endif
263 #ifndef _CRT_MANAGED_HEAP_DEPRECATE
264 #define _CRT_MANAGED_HEAP_DEPRECATE
265 #endif
266
267 #ifndef _CRT_OBSOLETE
268 #define _CRT_OBSOLETE(_NewItem)
269 #endif
270
271 #ifndef _SIZE_T_DEFINED
272 #define _SIZE_T_DEFINED
273 #undef size_t
274 #ifdef _WIN64
275 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
276 typedef unsigned int size_t __attribute__ ((mode (DI)));
277 #else
278 typedef unsigned __int64 size_t;
279 #endif
280 #else
281 typedef unsigned int size_t;
282 #endif
283 #endif
284
285 #ifndef _SSIZE_T_DEFINED
286 #define _SSIZE_T_DEFINED
287 #undef ssize_t
288 #ifdef _WIN64
289 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
290 typedef int ssize_t __attribute__ ((mode (DI)));
291 #else
292 typedef __int64 ssize_t;
293 #endif
294 #else
295 typedef int ssize_t;
296 #endif
297 #endif
298
299 #ifndef _INTPTR_T_DEFINED
300 #define _INTPTR_T_DEFINED
301 #ifndef __intptr_t_defined
302 #define __intptr_t_defined
303 #undef intptr_t
304 #ifdef _WIN64
305 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
306 typedef int intptr_t __attribute__ ((mode (DI)));
307 #else
308 typedef __int64 intptr_t;
309 #endif
310 #else
311 typedef int intptr_t;
312 #endif
313 #endif
314 #endif
315
316 #ifndef _UINTPTR_T_DEFINED
317 #define _UINTPTR_T_DEFINED
318 #ifndef __uintptr_t_defined
319 #define __uintptr_t_defined
320 #undef uintptr_t
321 #ifdef _WIN64
322 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
323 typedef unsigned int uintptr_t __attribute__ ((mode (DI)));
324 #else
325 typedef unsigned __int64 uintptr_t;
326 #endif
327 #else
328 typedef unsigned int uintptr_t;
329 #endif
330 #endif
331 #endif
332
333 #ifndef _PTRDIFF_T_DEFINED
334 #define _PTRDIFF_T_DEFINED
335 #ifndef _PTRDIFF_T_
336 #undef ptrdiff_t
337 #ifdef _WIN64
338 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
339 typedef int ptrdiff_t __attribute__ ((mode (DI)));
340 #else
341 typedef __int64 ptrdiff_t;
342 #endif
343 #else
344 typedef int ptrdiff_t;
345 #endif
346 #endif
347 #endif
348
349 #ifndef _WCHAR_T_DEFINED
350 #define _WCHAR_T_DEFINED
351 #ifndef __cplusplus
352 typedef unsigned short wchar_t;
353 #endif
354 #endif
355
356 #ifndef _WCTYPE_T_DEFINED
357 #define _WCTYPE_T_DEFINED
358 typedef unsigned short wint_t;
359 typedef unsigned short wctype_t;
360 #endif
361
362 #ifndef __GNUC_VA_LIST
363 #define __GNUC_VA_LIST
364 typedef __builtin_va_list __gnuc_va_list;
365 #endif
366
367 #ifndef _VA_LIST_DEFINED
368 #define _VA_LIST_DEFINED
369 typedef __gnuc_va_list va_list;
370 #endif
371
372 #ifdef _USE_32BIT_TIME_T
373 #ifdef _WIN64
374 #error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64
375 #undef _USE_32BIT_TIME_T
376 #endif
377 #else
378 #if _INTEGRAL_MAX_BITS < 64
379 #define _USE_32BIT_TIME_T
380 #endif
381 #endif
382
383 #ifndef _ERRCODE_DEFINED
384 #define _ERRCODE_DEFINED
385 typedef int errcode;
386 typedef int errno_t;
387 #endif
388
389 #ifndef _TIME32_T_DEFINED
390 #define _TIME32_T_DEFINED
391 typedef long __time32_t;
392 #endif
393
394 #ifndef _TIME64_T_DEFINED
395 #define _TIME64_T_DEFINED
396 typedef __int64 __time64_t;
397 #endif
398
399 #ifndef _TIME_T_DEFINED
400 #define _TIME_T_DEFINED
401 #ifdef _USE_32BIT_TIME_T
402 typedef __time32_t time_t;
403 #else
404 typedef __time64_t time_t;
405 #endif
406 #endif
407
408 #ifndef _CONST_RETURN
409 #define _CONST_RETURN
410 #endif
411
412 #ifndef __CRT_UNALIGNED
413 #define __CRT_UNALIGNED
414 #endif
415
416 #ifndef UNALIGNED
417 #if defined(__ia64__) || defined(__x86_64)
418 #define UNALIGNED __CRT_UNALIGNED
419 #else
420 #define UNALIGNED
421 #endif
422 #endif
423
424 #ifndef _CRT_ALIGN
425 #define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
426 #endif
427
428 #ifndef _CRTNOALIAS
429 #define _CRTNOALIAS
430 #endif
431
432 #ifndef _CRTRESTRICT
433 #define _CRTRESTRICT
434 #endif
435
436 #ifndef __CRTDECL
437 #define __CRTDECL __cdecl
438 #endif
439
440 #define _ARGMAX 100
441
442 #ifndef _TRUNCATE
443 #define _TRUNCATE ((size_t)-1)
444 #endif
445 struct threadlocaleinfostruct;
446 struct threadmbcinfostruct;
447 typedef struct threadlocaleinfostruct *pthreadlocinfo;
448 typedef struct threadmbcinfostruct *pthreadmbcinfo;
449 struct __lc_time_data;
450
451 typedef struct localeinfo_struct {
452 pthreadlocinfo locinfo;
453 pthreadmbcinfo mbcinfo;
454 } _locale_tstruct,*_locale_t;
455
456 #ifndef _TAGLC_ID_DEFINED
457 #define _TAGLC_ID_DEFINED
458 typedef struct tagLC_ID {
459 unsigned short wLanguage;
460 unsigned short wCountry;
461 unsigned short wCodePage;
462 } LC_ID,*LPLC_ID;
463 #endif
464
465 #ifndef _THREADLOCALEINFO
466 #define _THREADLOCALEINFO
467 typedef struct threadlocaleinfostruct {
468 int refcount;
469 unsigned int lc_codepage;
470 unsigned int lc_collate_cp;
471 unsigned long lc_handle[6];
472 LC_ID lc_id[6];
473 struct {
474 char *locale;
475 wchar_t *wlocale;
476 int *refcount;
477 int *wrefcount;
478 } lc_category[6];
479 int lc_clike;
480 int mb_cur_max;
481 int *lconv_intl_refcount;
482 int *lconv_num_refcount;
483 int *lconv_mon_refcount;
484 struct lconv *lconv;
485 int *ctype1_refcount;
486 unsigned short *ctype1;
487 const unsigned short *pctype;
488 const unsigned char *pclmap;
489 const unsigned char *pcumap;
490 struct __lc_time_data *lc_time_curr;
491 } threadlocinfo;
492 #endif
493
494 #ifdef __cplusplus
495 }
496 #endif
497
498 #define __crt_typefix(ctype)
499
500 #ifndef _CRT_UNUSED
501 #define _CRT_UNUSED(x) (void)x
502 #endif
503
504 #pragma pack(pop)
505 #endif
506
507 #endif