makefiles: Rename the SRCDIR, TOPSRCDIR and TOPOBJDIR variables to follow autoconf...
[wine] / include / msvcrt / crtdefs.h
1 /*
2  * CRT definitions
3  *
4  * Copyright 2000 Francois Gouget.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef __WINE_USE_MSVCRT
22 #define __WINE_USE_MSVCRT
23 #endif
24
25 #ifdef __WINE_WINE_PORT_H
26 # error You cannot use both wine/port.h and msvcrt headers
27 #endif
28
29 #if defined(__x86_64__) && !defined(_WIN64)
30 #define _WIN64
31 #endif
32
33 #if !defined(_MSC_VER) && !defined(__int64)
34 # if defined(_WIN64) && !defined(__MINGW64__)
35 #   define __int64 long
36 # else
37 #   define __int64 long long
38 # endif
39 #endif
40
41 #ifndef __stdcall
42 # ifdef __i386__
43 #  ifdef __GNUC__
44 #   ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
45 #    define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
46 #   else
47 #    define __stdcall __attribute__((__stdcall__))
48 #   endif
49 #  elif defined(_MSC_VER)
50     /* Nothing needs to be done. __stdcall already exists */
51 #  else
52 #   error You need to define __stdcall for your compiler
53 #  endif
54 # elif defined(__x86_64__) && defined (__GNUC__)
55 #  define __stdcall __attribute__((ms_abi))
56 # else
57 #  define __stdcall
58 # endif
59 #endif /* __stdcall */
60
61 #ifndef __cdecl
62 # if defined(__i386__) && defined(__GNUC__)
63 #  ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
64 #   define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
65 #  else
66 #   define __cdecl __attribute__((__cdecl__))
67 #  endif
68 # elif defined(__x86_64__) && defined (__GNUC__)
69 #  define __cdecl __attribute__((ms_abi))
70 # elif !defined(_MSC_VER)
71 #  define __cdecl
72 # endif
73 #endif /* __cdecl */
74
75 #ifndef __ms_va_list
76 # if defined(__x86_64__) && defined (__GNUC__)
77 #  define __ms_va_list __builtin_ms_va_list
78 #  define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
79 #  define __ms_va_end(list) __builtin_ms_va_end(list)
80 # else
81 #  define __ms_va_list va_list
82 #  define __ms_va_start(list,arg) va_start(list,arg)
83 #  define __ms_va_end(list) va_end(list)
84 # endif
85 #endif
86
87 #ifndef DECLSPEC_ALIGN
88 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
89 #  define DECLSPEC_ALIGN(x) __declspec(align(x))
90 # elif defined(__GNUC__)
91 #  define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
92 # else
93 #  define DECLSPEC_ALIGN(x)
94 # endif
95 #endif
96
97 #ifndef _MSVCRT_LONG_DEFINED
98 #define _MSVCRT_LONG_DEFINED
99 /* we need 32-bit longs even on 64-bit */
100 typedef int __msvcrt_long;
101 typedef unsigned int __msvcrt_ulong;
102 #endif
103
104 #ifndef _INTPTR_T_DEFINED
105 #ifdef  _WIN64
106 typedef __int64 intptr_t;
107 #else
108 typedef int intptr_t;
109 #endif
110 #define _INTPTR_T_DEFINED
111 #endif
112
113 #ifndef _UINTPTR_T_DEFINED
114 #ifdef  _WIN64
115 typedef unsigned __int64 uintptr_t;
116 #else
117 typedef unsigned int uintptr_t;
118 #endif
119 #define _UINTPTR_T_DEFINED
120 #endif
121
122 #ifndef _PTRDIFF_T_DEFINED
123 #ifdef _WIN64
124 typedef __int64 ptrdiff_t;
125 #else
126 typedef int ptrdiff_t;
127 #endif
128 #define _PTRDIFF_T_DEFINED
129 #endif
130
131 #ifndef _SIZE_T_DEFINED
132 #ifdef _WIN64
133 typedef unsigned __int64 size_t;
134 #else
135 typedef unsigned int size_t;
136 #endif
137 #define _SIZE_T_DEFINED
138 #endif
139
140 #ifndef _TIME32_T_DEFINED
141 typedef __msvcrt_long __time32_t;
142 #define _TIME32_T_DEFINED
143 #endif
144
145 #ifndef _TIME64_T_DEFINED
146 typedef __int64 DECLSPEC_ALIGN(8) __time64_t;
147 #define _TIME64_T_DEFINED
148 #endif
149
150 #ifdef _USE_32BIT_TIME_T
151 # ifdef _WIN64
152 #  error You cannot use 32-bit time_t in Win64
153 # endif
154 #elif !defined(_WIN64)
155 # define _USE_32BIT_TIME_T
156 #endif
157
158 #ifndef _TIME_T_DEFINED
159 #ifdef _USE_32BIT_TIME_T
160 typedef __time32_t time_t;
161 #else
162 typedef __time64_t time_t;
163 #endif
164 #define _TIME_T_DEFINED
165 #endif
166
167 #ifndef _WCHAR_T_DEFINED
168 #ifndef __cplusplus
169 typedef unsigned short wchar_t;
170 #endif
171 #define _WCHAR_T_DEFINED
172 #endif
173
174 #ifndef _WCTYPE_T_DEFINED
175 typedef unsigned short  wint_t;
176 typedef unsigned short  wctype_t;
177 #define _WCTYPE_T_DEFINED
178 #endif
179
180 #ifndef _ERRNO_T_DEFINED
181 typedef int errno_t;
182 #define _ERRNO_T_DEFINED
183 #endif