ReactOS 0.4.16-dev-297-gc569aee
_mingw.h
Go to the documentation of this file.
1
7#ifndef _INC_MINGW
8#define _INC_MINGW
9
10#ifndef _INTEGRAL_MAX_BITS
11#define _INTEGRAL_MAX_BITS 64
12#endif
13
14#ifndef MINGW64
15#define MINGW64
16#define MINGW64_VERSION 1.0
17#define MINGW64_VERSION_MAJOR 1
18#define MINGW64_VERSION_MINOR 0
19#define MINGW64_VERSION_STATE "alpha"
20#endif
21
22#ifdef _WIN64
23#ifdef __stdcall
24#undef __stdcall
25#endif
26#define __stdcall
27#endif
28
29#ifdef __GNUC__
30 /* These compilers do support __declspec */
31# if !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(__CYGWIN32__)
32# define __declspec(x) __attribute__((x))
33# endif
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) (_MSC_VER >= (major * 100 + minor * 10))
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 defined(__clang__) || ( __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
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#ifdef __GNUC__
122#define __MINGW_ATTRIB_UNUSED __attribute__ ((__unused__))
123#else
124#define __MINGW_ATTRIB_UNUSED
125#endif /* ATTRIBUTE_UNUSED */
126
127#if __MINGW_GNUC_PREREQ (3, 1)
128#define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
129#elif __MINGW_MSC_PREREQ(12, 0)
130#define __MINGW_ATTRIB_DEPRECATED __declspec(deprecated)
131#else
132#define __MINGW_ATTRIB_DEPRECATED
133#endif
134
135#if __MINGW_GNUC_PREREQ (3, 1)
136#define __MINGW_ATTRIB_DEPRECATED_SEC_WARN //__attribute__ ((__deprecated__))
137#elif __MINGW_MSC_PREREQ(12, 0)
138#define __MINGW_ATTRIB_DEPRECATED_SEC_WARN //__declspec(deprecated)
139#else
140#define __MINGW_ATTRIB_DEPRECATED_SEC_WARN
141#endif
142
143#if __MINGW_GNUC_PREREQ (3, 1)
144#define __MINGW_ATTRIB_DEPRECATED_MSVC2005 //__attribute__ ((__deprecated__))
145#elif __MINGW_MSC_PREREQ(12, 0)
146#define __MINGW_ATTRIB_DEPRECATED_MSVC2005 //__declspec(deprecated)
147#else
148#define __MINGW_ATTRIB_DEPRECATED_MSVC2005
149#endif
150
151#if __MINGW_GNUC_PREREQ (3, 3)
152#define __MINGW_NOTHROW __attribute__ ((__nothrow__))
153#elif __MINGW_MSC_PREREQ(12, 0) && defined (__cplusplus)
154#define __MINGW_NOTHROW __declspec(nothrow)
155#else
156#define __MINGW_NOTHROW
157#endif
158
159/* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW. This will
160allow GCC to optimize away some EH unwind code, at least in DW2 case. */
161
162#ifndef __MINGW_EXTENSION
163#if defined(__GNUC__) || defined(__GNUG__)
164#define __MINGW_EXTENSION __extension__
165#else
166#define __MINGW_EXTENSION
167#endif
168#endif
169
170#ifndef __MSVCRT_VERSION__
171/* High byte is the major version, low byte is the minor. */
172# define __MSVCRT_VERSION__ 0x0700
173#endif
174
175//#ifndef WINVER
176//#define WINVER 0x0502
177//#endif
178
179//#ifndef _WIN32_WINNT
180//#define _WIN32_WINNT 0x502
181//#endif
182
183#ifdef __GNUC__
184#define __int8 char
185#define __int16 short
186#define __int32 int
187#define __int64 long long
188# define __ptr32
189# define __ptr64
190# ifdef __cplusplus
191# define __forceinline inline __attribute__((__always_inline__))
192# else
193# if (( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L) || defined(__clang__))
194# define __forceinline extern inline __attribute__((__always_inline__,__gnu_inline__))
195# else
196# define __forceinline extern __inline__ __attribute__((__always_inline__))
197# endif
198# endif
199#endif
200
201#ifdef __cplusplus
202#ifndef __nothrow
203#define __nothrow __declspec(nothrow)
204#endif
205#else
206#ifndef __nothrow
207#define __nothrow
208#endif
209#endif
210
211#if defined(_WIN64) && !defined(_MSC_VER)
212#undef USE_MINGW_SETJMP_TWO_ARGS
213#define USE_MINGW_SETJMP_TWO_ARGS
214#endif
215
216/* Disable deprecation for now! */
217#define _CRT_SECURE_NO_DEPRECATE
218#define _CRT_SECURE_NO_DEPRECATE_CORE
219
220#define __crt_typefix(ctype)
221
222#ifndef _CRT_UNUSED
223#define _CRT_UNUSED(x) (void)x
224#endif
225
226#if defined(_MSC_VER) && !defined(__clang__)
227#define ATTRIB_NORETURN
228#define _DECLSPEC_INTRIN_TYPE __declspec(intrin_type)
229#else
230#define ATTRIB_NORETURN DECLSPEC_NORETURN
231#define _DECLSPEC_INTRIN_TYPE
232#endif
233
234/* Define to a function attribute for Microsoft hotpatch assembly prefix. */
235#ifndef DECLSPEC_HOTPATCH
236#if defined(_MSC_VER) || defined(__clang__)
237/* FIXME: http://llvm.org/bugs/show_bug.cgi?id=20888 */
238#define DECLSPEC_HOTPATCH
239#else
240#define DECLSPEC_HOTPATCH __attribute__((__ms_hook_prologue__))
241#endif
242#endif /* DECLSPEC_HOTPATCH */
243
244#ifndef __INTRIN_INLINE
245# define __INTRIN_INLINE extern __inline__ __attribute__((__always_inline__,__gnu_inline__,artificial))
246#endif
247
248#ifndef HAS_BUILTIN
249# ifdef __clang__
250# define HAS_BUILTIN(x) __has_builtin(x)
251# else
252# define HAS_BUILTIN(x) 0
253# endif
254#endif
255
256#ifdef __cplusplus
257# define __mingw_ovr inline __cdecl
258#elif defined (__GNUC__)
259# define __mingw_ovr static \
260 __attribute__ ((__unused__)) __inline__ __cdecl
261#else
262# define __mingw_ovr static __cdecl
263#endif /* __cplusplus */
264
265#if defined(__cplusplus) && !defined(_MSC_VER)
266#define __nullptr nullptr
267#endif
268
269#include "_mingw_mac.h"
270
271#endif /* !_INC_MINGW */
272