- Merge aicom-network-fixes up to r36740
[reactos.git] / reactos / include / crt / _mingw.h
1 /*
2 * _mingw.h
3 *
4 * Mingw specific macros included by ALL include files.
5 *
6 * This file is part of the Mingw32 package.
7 *
8 * Contributors:
9 * Created by Mumit Khan <khan@xraylith.wisc.edu>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23 #ifndef __MINGW_H
24 #define __MINGW_H
25
26 #if __GNUC__ >= 3
27 #pragma GCC system_header
28 #endif
29
30 /* These are defined by the user (or the compiler)
31 to specify how identifiers are imported from a DLL.
32
33 __DECLSPEC_SUPPORTED Defined if dllimport attribute is supported.
34 __MINGW_IMPORT The attribute definition to specify imported
35 variables/functions.
36 _CRTIMP As above. For MS compatibility.
37 __MINGW32_VERSION Runtime version.
38 __MINGW32_MAJOR_VERSION Runtime major version.
39 __MINGW32_MINOR_VERSION Runtime minor version.
40 __MINGW32_BUILD_DATE Runtime build date.
41
42 Other macros:
43
44 __int64 define to be long long. Using a typedef doesn't
45 work for "unsigned __int64"
46
47 All headers should include this first, and then use __DECLSPEC_SUPPORTED
48 to choose between the old ``__imp__name'' style or __MINGW_IMPORT
49 style declarations. */
50
51 /* Try to avoid problems with outdated checks for GCC __attribute__ support. */
52 #undef __attribute__
53
54 #ifndef __GNUC__
55 # ifndef __MINGW_IMPORT
56 # define __MINGW_IMPORT __declspec(dllimport)
57 # endif
58 # ifndef _CRTIMP
59 # define _CRTIMP __declspec(dllimport)
60 # endif
61 # define __DECLSPEC_SUPPORTED
62 # define __attribute__(x) /* nothing */
63 #else /* __GNUC__ */
64 # ifdef __declspec
65 # ifndef __MINGW_IMPORT
66 /* Note the extern. This is needed to work around GCC's
67 limitations in handling dllimport attribute. */
68 # define __MINGW_IMPORT extern __attribute__ ((__dllimport__))
69 # endif
70 # ifndef _CRTIMP
71 # ifdef __USE_CRTIMP
72 # define _CRTIMP __attribute__ ((dllimport))
73 # else
74 # define _CRTIMP
75 # endif
76 # endif
77 # define __DECLSPEC_SUPPORTED
78 # else /* __declspec */
79 # undef __DECLSPEC_SUPPORTED
80 # undef __MINGW_IMPORT
81 # ifndef _CRTIMP
82 # define _CRTIMP
83 # endif
84 # endif /* __declspec */
85 # ifndef __cdecl
86 # define __cdecl __attribute__ ((__cdecl__))
87 # endif
88 # ifndef __stdcall
89 # define __stdcall __attribute__ ((__stdcall__))
90 # endif
91 # ifndef __int64
92 # define __int64 long long
93 # endif
94 # ifndef __int32
95 # define __int32 long
96 # endif
97 # ifndef __int16
98 # define __int16 short
99 # endif
100 # ifndef __int8
101 # define __int8 char
102 # endif
103 # ifndef __small
104 # define __small char
105 # endif
106 # ifndef __hyper
107 # define __hyper long long
108 # endif
109 #endif /* __GNUC__ */
110
111 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
112 #define __MINGW_GNUC_PREREQ(major, minor) \
113 (__GNUC__ > (major) \
114 || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
115 #else
116 #define __MINGW_GNUC_PREREQ(major, minor) 0
117 #endif
118
119 #ifdef __cplusplus
120 # define __CRT_INLINE inline
121 #else
122 # if __GNUC_STDC_INLINE__
123 # define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
124 # else
125 # define __CRT_INLINE extern __inline__
126 # endif
127 #endif
128
129 #ifdef __cplusplus
130 # define __UNUSED_PARAM(x)
131 #else
132 # ifdef __GNUC__
133 # define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
134 # else
135 # define __UNUSED_PARAM(x) x
136 # endif
137 #endif
138
139 #ifdef __GNUC__
140 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
141 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
142 #else
143 #define __MINGW_ATTRIB_NORETURN
144 #define __MINGW_ATTRIB_CONST
145 #endif
146
147 #if __MINGW_GNUC_PREREQ (3, 0)
148 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
149 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
150 #else
151 #define __MINGW_ATTRIB_MALLOC
152 #define __MINGW_ATTRIB_PURE
153 #endif
154
155 /* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
156 variadiac macro facility, because variadic macros cause syntax
157 errors with --traditional-cpp. */
158 #if __MINGW_GNUC_PREREQ (3, 3)
159 #define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
160 #else
161 #define __MINGW_ATTRIB_NONNULL(arg)
162 #endif /* GNUC >= 3.3 */
163
164 #if __MINGW_GNUC_PREREQ (3, 1)
165 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
166 #else
167 #define __MINGW_ATTRIB_DEPRECATED
168 #endif /* GNUC >= 3.1 */
169
170 #if __MINGW_GNUC_PREREQ (3, 3)
171 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
172 #else
173 #define __MINGW_NOTHROW
174 #endif /* GNUC >= 3.3 */
175
176 #ifndef __MSVCRT_VERSION__
177 /* High byte is the major version, low byte is the minor. */
178 # define __MSVCRT_VERSION__ 0x0600
179 #endif
180
181 #ifndef _SIZE_T_DEFINED
182 #define _SIZE_T_DEFINED
183 #undef size_t
184 #ifdef _WIN64
185 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
186 typedef unsigned int size_t __attribute__ ((mode (DI)));
187 #else
188 typedef unsigned __int64 size_t;
189 #endif
190 #else
191 typedef unsigned int size_t;
192 #endif
193 #endif
194
195 #define __MINGW32_VERSION 3.13
196 #define __MINGW32_MAJOR_VERSION 3
197 #define __MINGW32_MINOR_VERSION 13
198
199 #endif /* __MINGW_H */