fc9a4910cae51c912f0d1204c429ca6a37faa4f5
[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_MINGW
8 #define _INC_MINGW
9
10 #define _INTEGRAL_MAX_BITS 64
11
12 #ifndef MINGW64
13 #define MINGW64
14 #define MINGW64_VERSION 1.0
15 #define MINGW64_VERSION_MAJOR 1
16 #define MINGW64_VERSION_MINOR 0
17 #define MINGW64_VERSION_STATE "alpha"
18 #endif
19
20 #ifdef _WIN64
21 #ifdef __stdcall
22 #undef __stdcall
23 #endif
24 #define __stdcall
25 #endif
26
27 #ifdef __GNUC__
28 /* These compilers do support __declspec */
29 # if !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(__CYGWIN32__)
30 # define __declspec(x) __attribute__((x))
31 # endif
32 #else
33 # define __attribute__(x) /* nothing */
34 #endif
35
36 #ifdef _MSC_VER
37 #define __restrict__ /* nothing */
38 #endif
39
40 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
41 #define __MINGW_GNUC_PREREQ(major, minor) \
42 (__GNUC__ > (major) \
43 || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
44 #else
45 #define __MINGW_GNUC_PREREQ(major, minor) 0
46 #endif
47
48 #if defined (_MSC_VER)
49 #define __MINGW_MSC_PREREQ(major, minor) ((major * 100 + minor * 10) >= _MSC_VER)
50 #else
51 #define __MINGW_MSC_PREREQ(major, minor) 0
52 #endif
53
54 #define USE___UUIDOF 0
55
56 #ifdef __cplusplus
57 # define __CRT_INLINE inline
58 #elif defined(_MSC_VER)
59 # define __CRT_INLINE __inline
60 #elif defined(__GNUC__)
61 # if ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
62 # define __CRT_INLINE extern inline __attribute__((__always_inline__,__gnu_inline__))
63 # else
64 # define __CRT_INLINE extern __inline__ __attribute__((__always_inline__))
65 # endif
66 #endif
67
68 #ifdef __cplusplus
69 # define __UNUSED_PARAM(x)
70 #else
71 # ifdef __GNUC__
72 # define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
73 # else
74 # define __UNUSED_PARAM(x) x
75 # endif
76 #endif
77
78 #ifdef __cplusplus
79 # define __unaligned
80 #else
81 # ifdef __GNUC__
82 # define __unaligned __attribute((packed))
83 # elif defined(_MSC_VER) && !defined(_M_IA64) && !defined(_M_AMD64)
84 # define __unaligned
85 # else
86 # define __unaligned
87 # endif
88 #endif
89
90 #ifdef __GNUC__
91 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
92 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
93 #elif __MINGW_MSC_PREREQ(12, 0)
94 #define __MINGW_ATTRIB_NORETURN __declspec(noreturn)
95 #define __MINGW_ATTRIB_CONST
96 #else
97 #define __MINGW_ATTRIB_NORETURN
98 #define __MINGW_ATTRIB_CONST
99 #endif
100
101 #if __MINGW_GNUC_PREREQ (3, 0)
102 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
103 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
104 #elif __MINGW_MSC_PREREQ(14, 0)
105 #define __MINGW_ATTRIB_MALLOC __declspec(noalias) __declspec(restrict)
106 #define __MINGW_ATTRIB_PURE
107 #else
108 #define __MINGW_ATTRIB_MALLOC
109 #define __MINGW_ATTRIB_PURE
110 #endif
111
112 /* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
113 variadiac macro facility, because variadic macros cause syntax
114 errors with --traditional-cpp. */
115 #if __MINGW_GNUC_PREREQ (3, 3)
116 #define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
117 #else
118 #define __MINGW_ATTRIB_NONNULL(arg)
119 #endif /* GNUC >= 3.3 */
120
121 #if __MINGW_GNUC_PREREQ (3, 1)
122 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
123 #elif __MINGW_MSC_PREREQ(12, 0)
124 #define __MINGW_ATTRIB_DEPRECATED __declspec(deprecated)
125 #else
126 #define __MINGW_ATTRIB_DEPRECATED
127 #endif
128
129 #if __MINGW_GNUC_PREREQ (3, 3)
130 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
131 #elif __MINGW_MSC_PREREQ(12, 0) && defined (__cplusplus)
132 #define __MINGW_NOTHROW __declspec(nothrow)
133 #else
134 #define __MINGW_NOTHROW
135 #endif
136
137 /* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW. This will
138 allow GCC to optimize away some EH unwind code, at least in DW2 case. */
139
140 #ifndef __MSVCRT_VERSION__
141 /* High byte is the major version, low byte is the minor. */
142 # define __MSVCRT_VERSION__ 0x0700
143 #endif
144
145 //#ifndef WINVER
146 //#define WINVER 0x0502
147 //#endif
148
149 //#ifndef _WIN32_WINNT
150 //#define _WIN32_WINNT 0x502
151 //#endif
152
153 #ifdef __GNUC__
154 #define __int8 char
155 #define __int16 short
156 #define __int32 int
157 #define __int64 long long
158 #ifdef _WIN64
159 typedef int __int128 __attribute__ ((mode (TI)));
160 # endif
161 # define __ptr32
162 # define __ptr64
163 # define __forceinline extern __inline __attribute((always_inline))
164 #endif
165
166 #ifdef __cplusplus
167 #ifndef __nothrow
168 #define __nothrow __declspec(nothrow)
169 #endif
170 #else
171 #ifndef __nothrow
172 #define __nothrow
173 #endif
174 #endif
175
176 #ifdef _WIN64
177 #undef USE_MINGW_SETJMP_TWO_ARGS
178 #define USE_MINGW_SETJMP_TWO_ARGS
179 #endif
180
181 /* Diable deprecation for now! */
182 #define _CRT_SECURE_NO_DEPRECATE
183 #define _CRT_SECURE_NO_DEPRECATE_CORE
184 #ifdef __WINESRC__
185 #define _CRT_NONSTDC_NO_DEPRECATE
186 #endif
187
188 #define __crt_typefix(ctype)
189
190 #ifndef _CRT_UNUSED
191 #define _CRT_UNUSED(x) (void)x
192 #endif
193
194 #endif /* !_INC_MINGW */
195