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