- Sync with trunk up to r46941.
[reactos.git] / include / crt / crtdefs.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 #include <_mingw.h>
7
8 #ifndef _INC_CRTDEFS
9 #define _INC_CRTDEFS
10
11 #ifdef _USE_32BIT_TIME_T
12 #ifdef _WIN64
13 #error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64
14 #undef _USE_32BIT_TIME_T
15 #endif
16 #else
17 #if _INTEGRAL_MAX_BITS < 64
18 #define _USE_32BIT_TIME_T
19 #endif
20 #endif
21
22 /* Disable non-ANSI C definitions if compiling with __STDC__ */
23 //HACK: Disabled
24 //#if __STDC__
25 //#define NO_OLDNAMES
26 //#endif
27
28
29 /** Properties ***************************************************************/
30
31 #undef _CRT_PACKING
32 #define _CRT_PACKING 8
33 #pragma pack(push,_CRT_PACKING)
34
35 #ifndef _CRT_STRINGIZE
36 #define __CRT_STRINGIZE(_Value) #_Value
37 #define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
38 #endif
39
40 #ifndef _CRT_WIDE
41 #define __CRT_WIDE(_String) L ## _String
42 #define _CRT_WIDE(_String) __CRT_WIDE(_String)
43 #endif
44
45 #ifndef _W64
46 #if !defined(_midl) && defined(_X86_) && _MSC_VER >= 1300
47 #define _W64 __w64
48 #else
49 #define _W64
50 #endif
51 #endif
52
53 #ifndef _CRTIMP
54 #ifdef CRTDLL /* Defined for ntdll, crtdll, msvcrt, etc */
55 #define _CRTIMP __declspec(dllexport)
56 #elif defined(_DLL)
57 #define _CRTIMP __declspec(dllimport)
58 #else /* !CRTDLL && !_DLL */
59 #define _CRTIMP
60 #endif /* CRTDLL || _DLL */
61 #endif /* !_CRTIMP */
62
63 //#define _CRT_ALTERNATIVE_INLINES
64
65 #ifndef _CRTIMP_ALT
66 #ifdef _DLL
67 #ifdef _CRT_ALTERNATIVE_INLINES
68 #define _CRTIMP_ALT
69 #else
70 #define _CRTIMP_ALT _CRTIMP
71 #define _CRT_ALTERNATIVE_IMPORTED
72 #endif
73 #else
74 #define _CRTIMP_ALT
75 #endif
76 #endif
77
78 #ifndef _CRTDATA
79 #ifdef _M_CEE_PURE
80 #define _CRTDATA(x) x
81 #else
82 #define _CRTDATA(x) _CRTIMP x
83 #endif
84 #endif
85
86 #ifndef _CRTIMP2
87 #define _CRTIMP2 _CRTIMP
88 #endif
89
90 #ifndef _CRTIMP_PURE
91 #define _CRTIMP_PURE _CRTIMP
92 #endif
93
94 #ifndef _CRTIMP_ALTERNATIVE
95 #define _CRTIMP_ALTERNATIVE _CRTIMP
96 #define _CRT_ALTERNATIVE_IMPORTED
97 #endif
98
99 #ifndef _CRTIMP_NOIA64
100 #ifdef __ia64__
101 #define _CRTIMP_NOIA64
102 #else
103 #define _CRTIMP_NOIA64 _CRTIMP
104 #endif
105 #endif
106
107 #ifndef _MRTIMP2
108 #define _MRTIMP2 _CRTIMP
109 #endif
110
111 #ifndef _MCRTIMP
112 #define _MCRTIMP _CRTIMP
113 #endif
114
115 #ifndef _PGLOBAL
116 #define _PGLOBAL
117 #endif
118
119 #ifndef _AGLOBAL
120 #define _AGLOBAL
121 #endif
122
123 #ifndef _CONST_RETURN
124 #define _CONST_RETURN
125 #endif
126
127 #ifndef UNALIGNED
128 #if defined(__ia64__) || defined(__x86_64)
129 #define UNALIGNED __unaligned
130 #else
131 #define UNALIGNED
132 #endif
133 #endif
134
135 #ifndef _CRT_ALIGN
136 #define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
137 #endif
138
139 #ifndef _CRTNOALIAS
140 #define _CRTNOALIAS
141 #endif
142
143 #ifndef _CRTRESTRICT
144 #define _CRTRESTRICT
145 #endif
146
147 #ifndef __CRTDECL
148 #define __CRTDECL __cdecl
149 #endif
150
151 #ifndef _CRT_UNUSED
152 #define _CRT_UNUSED(x) (void)x
153 #endif
154
155 #ifndef _CONST_RETURN
156 #ifdef __cplusplus
157 #define _CONST_RETURN const
158 #define _CRT_CONST_CORRECT_OVERLOADS
159 #else
160 #define _CONST_RETURN
161 #endif
162 #endif
163
164 #define __crt_typefix(ctype)
165
166
167 /** Deprecated ***************************************************************/
168
169 #ifdef __GNUC__
170 #define _CRT_DEPRECATE_TEXT(_Text) __attribute__ ((deprecated))
171 #elif defined(_MSC_VER)
172 #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
173 #else
174 #define _CRT_DEPRECATE_TEXT(_Text)
175 #endif
176
177 #ifndef __STDC_WANT_SECURE_LIB__
178 #define __STDC_WANT_SECURE_LIB__ 1
179 #endif
180
181 #ifndef _CRT_INSECURE_DEPRECATE
182 # ifdef _CRT_SECURE_NO_DEPRECATE
183 # define _CRT_INSECURE_DEPRECATE(_Replacement)
184 # else
185 # define _CRT_INSECURE_DEPRECATE(_Replacement) \
186 _CRT_DEPRECATE_TEXT("This may be unsafe, Try " #_Replacement " instead!")
187 # endif
188 #endif
189
190 #ifndef _CRT_INSECURE_DEPRECATE_CORE
191 # ifdef _CRT_SECURE_NO_DEPRECATE_CORE
192 # define _CRT_INSECURE_DEPRECATE_CORE(_Replacement)
193 # else
194 # define _CRT_INSECURE_DEPRECATE_CORE(_Replacement) \
195 _CRT_DEPRECATE_TEXT("This may be unsafe, Try " #_Replacement " instead! Enable _CRT_SECURE_NO_DEPRECATE to avoid thie warning.")
196 # endif
197 #endif
198
199 #ifndef _CRT_NONSTDC_DEPRECATE
200 # ifdef _CRT_NONSTDC_NO_DEPRECATE
201 # define _CRT_NONSTDC_DEPRECATE(_Replacement)
202 # else
203 # define _CRT_NONSTDC_DEPRECATE(_Replacement) \
204 _CRT_DEPRECATE_TEXT("Deprecated POSIX name, Try " #_Replacement " instead!")
205 # endif
206 #endif
207
208 #ifndef _CRT_INSECURE_DEPRECATE_MEMORY
209 #define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
210 #endif
211
212 #ifndef _CRT_INSECURE_DEPRECATE_GLOBALS
213 #define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)
214 #endif
215
216 #ifndef _CRT_MANAGED_HEAP_DEPRECATE
217 #define _CRT_MANAGED_HEAP_DEPRECATE
218 #endif
219
220 #ifndef _CRT_OBSOLETE
221 #define _CRT_OBSOLETE(_NewItem)
222 #endif
223
224
225 /** Constants ****************************************************************/
226
227 #define _ARGMAX 100
228
229 #ifndef _TRUNCATE
230 #define _TRUNCATE ((size_t)-1)
231 #endif
232
233 #define __STDC_SECURE_LIB__ 200411L
234 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
235 #define _SECURECRT_FILL_BUFFER_PATTERN 0xFD
236
237
238 /** Type definitions *********************************************************/
239
240 #ifdef __cplusplus
241 extern "C" {
242 #endif
243
244 #ifndef _SIZE_T_DEFINED
245 #define _SIZE_T_DEFINED
246 #undef size_t
247 #ifdef _WIN64
248 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
249 typedef unsigned int size_t __attribute__ ((mode (DI)));
250 #else
251 __MINGW_EXTENSION typedef unsigned __int64 size_t;
252 #endif
253 #else
254 typedef unsigned int size_t;
255 #endif
256 #endif
257
258 #ifndef _INTPTR_T_DEFINED
259 #define _INTPTR_T_DEFINED
260 #ifndef __intptr_t_defined
261 #define __intptr_t_defined
262 #undef intptr_t
263 #ifdef _WIN64
264 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
265 typedef int intptr_t __attribute__ ((mode (DI)));
266 #else
267 __MINGW_EXTENSION typedef __int64 intptr_t;
268 #endif
269 #else
270 typedef int intptr_t;
271 #endif
272 #endif
273 #endif
274
275 #ifndef _UINTPTR_T_DEFINED
276 #define _UINTPTR_T_DEFINED
277 #ifndef __uintptr_t_defined
278 #define __uintptr_t_defined
279 #undef uintptr_t
280 #ifdef _WIN64
281 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
282 typedef unsigned int uintptr_t __attribute__ ((mode (DI)));
283 #else
284 __MINGW_EXTENSION typedef unsigned __int64 uintptr_t;
285 #endif
286 #else
287 typedef unsigned int uintptr_t;
288 #endif
289 #endif
290 #endif
291
292 #ifndef _PTRDIFF_T_DEFINED
293 #define _PTRDIFF_T_DEFINED
294 #ifndef _PTRDIFF_T_
295 #undef ptrdiff_t
296 #ifdef _WIN64
297 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
298 typedef int ptrdiff_t __attribute__ ((mode (DI)));
299 #else
300 __MINGW_EXTENSION typedef __int64 ptrdiff_t;
301 #endif
302 #else
303 typedef int ptrdiff_t;
304 #endif
305 #endif
306 #endif
307
308 #ifndef _WCHAR_T_DEFINED
309 #define _WCHAR_T_DEFINED
310 #ifndef __cplusplus
311 typedef unsigned short wchar_t;
312 #endif
313 #endif
314
315 #ifndef _WCTYPE_T_DEFINED
316 #define _WCTYPE_T_DEFINED
317 typedef unsigned short wint_t;
318 typedef unsigned short wctype_t;
319 #endif
320
321 #ifndef _ERRCODE_DEFINED
322 #define _ERRCODE_DEFINED
323 typedef int errcode;
324 typedef int errno_t;
325 #endif
326
327 #ifndef _TIME32_T_DEFINED
328 #define _TIME32_T_DEFINED
329 typedef long __time32_t;
330 #endif
331
332 #ifndef _TIME64_T_DEFINED
333 #define _TIME64_T_DEFINED
334 #if _INTEGRAL_MAX_BITS >= 64
335 __MINGW_EXTENSION typedef __int64 __time64_t;
336 #endif
337 #endif
338
339 #ifndef _TIME_T_DEFINED
340 #define _TIME_T_DEFINED
341 #ifdef _USE_32BIT_TIME_T
342 typedef __time32_t time_t;
343 #else
344 typedef __time64_t time_t;
345 #endif
346 #endif
347
348 struct threadlocaleinfostruct;
349 typedef struct threadlocaleinfostruct *pthreadlocinfo;
350
351 struct threadmbcinfostruct;
352 typedef struct threadmbcinfostruct *pthreadmbcinfo;
353
354 struct __lc_time_data;
355
356 typedef struct localeinfo_struct {
357 pthreadlocinfo locinfo;
358 pthreadmbcinfo mbcinfo;
359 } _locale_tstruct,*_locale_t;
360
361 #ifndef _TAGLC_ID_DEFINED
362 #define _TAGLC_ID_DEFINED
363 typedef struct tagLC_ID {
364 unsigned short wLanguage;
365 unsigned short wCountry;
366 unsigned short wCodePage;
367 } LC_ID,*LPLC_ID;
368 #endif
369
370 #ifndef _THREADLOCALEINFO
371 #define _THREADLOCALEINFO
372 typedef struct threadlocaleinfostruct {
373 int refcount;
374 unsigned int lc_codepage;
375 unsigned int lc_collate_cp;
376 unsigned long lc_handle[6];
377 LC_ID lc_id[6];
378 struct {
379 char *locale;
380 wchar_t *wlocale;
381 int *refcount;
382 int *wrefcount;
383 } lc_category[6];
384 int lc_clike;
385 int mb_cur_max;
386 int *lconv_intl_refcount;
387 int *lconv_num_refcount;
388 int *lconv_mon_refcount;
389 struct lconv *lconv;
390 int *ctype1_refcount;
391 unsigned short *ctype1;
392 const unsigned short *pctype;
393 const unsigned char *pclmap;
394 const unsigned char *pcumap;
395 struct __lc_time_data *lc_time_curr;
396 } threadlocinfo;
397 #endif
398
399
400 #ifdef __cplusplus
401 }
402 #endif
403
404 #pragma pack(pop)
405
406 #endif /* !_INC_CRTDEFS */