5 * Mingw specific macros included by ALL include files.
7 * This file is part of the Mingw32 package.
10 * Created by Mumit Khan <khan@xraylith.wisc.edu>
12 * THIS SOFTWARE IS NOT COPYRIGHTED
14 * This source code is offered for use in the public domain. You may
15 * use, modify or distribute it freely.
17 * This code is distributed in the hope that it will be useful but
18 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19 * DISCLAIMED. This includes but is not limited to warranties of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25 #define __MINGW32_VERSION 3.16
26 #define __MINGW32_MAJOR_VERSION 3
27 #define __MINGW32_MINOR_VERSION 16
28 #define __MINGW32_PATCHLEVEL 0
31 #pragma GCC system_header
34 /* These are defined by the user (or the compiler)
35 to specify how identifiers are imported from a DLL.
37 __DECLSPEC_SUPPORTED Defined if dllimport attribute is supported.
38 __MINGW_IMPORT The attribute definition to specify imported
40 _CRTIMP As above. For MS compatibility.
41 __MINGW32_VERSION Runtime version.
42 __MINGW32_MAJOR_VERSION Runtime major version.
43 __MINGW32_MINOR_VERSION Runtime minor version.
44 __MINGW32_BUILD_DATE Runtime build date.
46 Macros to enable MinGW features which deviate from standard MSVC
47 compatible behaviour; these may be specified directly in user code,
48 activated implicitly, (e.g. by specifying _POSIX_C_SOURCE or such),
49 or by inclusion in __MINGW_FEATURES__:
51 __USE_MINGW_ANSI_STDIO Select a more ANSI C99 compatible
52 implementation of printf() and friends.
56 __int64 define to be long long. Using a typedef
57 doesn't work for "unsigned __int64"
59 All headers should include this first, and then use __DECLSPEC_SUPPORTED
60 to choose between the old ``__imp__name'' style or __MINGW_IMPORT
61 style declarations. */
64 /* Manifest definitions identifying the flag bits, controlling activation
65 * of MinGW features, as specified by the user in __MINGW_FEATURES__.
67 #define __MINGW_ANSI_STDIO__ 0x0000000000000001ULL
69 * The following three are not yet formally supported; they are
70 * included here, to document anticipated future usage.
72 #define __MINGW_LC_EXTENSIONS__ 0x0000000000000050ULL
73 #define __MINGW_LC_MESSAGES__ 0x0000000000000010ULL
74 #define __MINGW_LC_ENVVARS__ 0x0000000000000040ULL
76 /* Try to avoid problems with outdated checks for GCC __attribute__ support. */
80 # undef __DECLSPEC_SUPPORTED
81 # ifndef __MINGW_IMPORT
82 # define __MINGW_IMPORT extern
88 # define __cdecl _Pragma("cdecl")
91 # define __stdcall _Pragma("stdcall")
94 # define __int64 long long
100 # define __int16 short
106 # define __small char
109 # define __hyper long long
111 # ifndef __volatile__
112 # define __volatile__ volatile
114 # ifndef __restrict__
115 # define __restrict__ restrict
117 # define NONAMELESSUNION
118 #elif defined(__GNUC__)
120 # ifndef __MINGW_IMPORT
121 /* Note the extern. This is needed to work around GCC's
122 limitations in handling dllimport attribute. */
123 # define __MINGW_IMPORT extern __attribute__ ((__dllimport__))
127 # define _CRTIMP __attribute__ ((dllimport))
132 # define __DECLSPEC_SUPPORTED
133 # else /* __declspec */
134 # undef __DECLSPEC_SUPPORTED
135 # undef __MINGW_IMPORT
139 # endif /* __declspec */
141 * The next two defines can cause problems if user code adds the
142 * __cdecl attribute like so:
143 * void __attribute__ ((__cdecl)) foo(void);
146 # define __cdecl __attribute__ ((__cdecl__))
149 # define __stdcall __attribute__ ((__stdcall__))
152 # define __int64 long long
155 # define __int32 long
158 # define __int16 short
164 # define __small char
167 # define __hyper long long
169 #else /* ! __GNUC__ && ! __PCC__ */
170 # ifndef __MINGW_IMPORT
171 # define __MINGW_IMPORT __declspec(dllimport)
174 # define _CRTIMP __declspec(dllimport)
176 # define __DECLSPEC_SUPPORTED
177 # define __attribute__(x) /* nothing */
180 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
181 #define __MINGW_GNUC_PREREQ(major, minor) \
182 (__GNUC__ > (major) \
183 || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
185 #define __MINGW_GNUC_PREREQ(major, minor) 0
189 # define __CRT_INLINE inline
191 # if __GNUC_STDC_INLINE__
192 # define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
195 /* There isn't any out-of-line version of most of
196 these functions in coredll.dll, so we need this for -O0,
197 or for -fno-inline. This is still problematic if the user
198 tries t o take the address of these functions. We will slowly
199 add out-of-line copies as those cases are found.
200 Note: We can't use static inline here, as most of these functions
201 will be declared elsew here with external linkage, and gcc will
203 # define __CRT_INLINE extern __inline__ __attribute__((__always_inline__))
205 # define __CRT_INLINE
211 # define __UNUSED_PARAM(x)
214 # define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
216 # define __UNUSED_PARAM(x) x
221 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
222 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
224 #define __MINGW_ATTRIB_NORETURN
225 #define __MINGW_ATTRIB_CONST
228 #if __MINGW_GNUC_PREREQ (3, 0)
229 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
230 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
232 #define __MINGW_ATTRIB_MALLOC
233 #define __MINGW_ATTRIB_PURE
236 /* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
237 variadiac macro facility, because variadic macros cause syntax
238 errors with --traditional-cpp. */
239 #if __MINGW_GNUC_PREREQ (3, 3)
240 #define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
242 #define __MINGW_ATTRIB_NONNULL(arg)
243 #endif /* GNUC >= 3.3 */
245 #if defined(UNDER_CE) && defined(__arm__)
246 /* ARM Windows CE is not underscored. */
247 # define __U(SYM) _ ## SYM
248 # define __IMP(S) __imp_ ## S
249 #elif defined(UNDER_CE) && defined(i386)
250 /* i386 Windows CE versions are underscored. */
251 # define __U(SYM) SYM
252 # define __IMP(S) _imp__ ## S
254 /* Desktop i386 Windows versions are underscored. */
255 # define __U(SYM) SYM
256 # define __IMP(S) _imp__ ## S
259 #if __MINGW_GNUC_PREREQ (3, 1)
260 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
262 #define __MINGW_ATTRIB_DEPRECATED
263 #endif /* GNUC >= 3.1 */
265 #if __MINGW_GNUC_PREREQ (3, 3)
266 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
268 #define __MINGW_NOTHROW
269 #endif /* GNUC >= 3.3 */
272 /* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW. This will
273 allow GCC to optimize away some EH unwind code, at least in DW2 case. */
275 #if defined __MSVCRT__ && !defined (__MSVCRT_VERSION__)
276 /* High byte is the major version, low byte is the minor. */
277 # define __MSVCRT_VERSION__ 0x0600
280 /* Activation of MinGW specific extended features:
282 #ifndef __USE_MINGW_ANSI_STDIO
284 * If user didn't specify it explicitly...
286 # if defined __STRICT_ANSI__ || defined _ISOC99_SOURCE \
287 || defined _POSIX_SOURCE || defined _POSIX_C_SOURCE \
288 || defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED \
289 || defined _GNU_SOURCE || defined _BSD_SOURCE \
290 || defined _SVID_SOURCE
292 * but where any of these source code qualifiers are specified,
293 * then assume ANSI I/O standards are preferred over Microsoft's...
295 # define __USE_MINGW_ANSI_STDIO 1
298 * otherwise use whatever __MINGW_FEATURES__ specifies...
300 # define __USE_MINGW_ANSI_STDIO (__MINGW_FEATURES__ & __MINGW_ANSI_STDIO__)
304 #endif /* __MINGW_H */