ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/MinGW/include/_mingw.h
Revision: 1046
Committed: Mon Aug 29 13:19:38 2016 UTC (9 years, 1 month ago) by alloc
Content type: text/x-chdr
File size: 16322 byte(s)
Log Message:
Daodan: Added Windows MinGW and build batch file

File Contents

# Content
1 #ifndef __MINGW_H
2 /*
3 * _mingw.h
4 *
5 * MinGW specific macros included by ALL mingwrt include files; (this file
6 * is part of the MinGW32 runtime library package).
7 *
8 * $Id: _mingw.h.in,v 7daa0459f602 2016/05/03 17:40:54 keithmarshall $
9 *
10 * Written by Mumit Khan <khan@xraylith.wisc.edu>
11 * Copyright (C) 1999, 2001-2011, 2014-2016, MinGW.org Project
12 *
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a
15 * copy of this software and associated documentation files (the "Software"),
16 * to deal in the Software without restriction, including without limitation
17 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 * and/or sell copies of the Software, and to permit persons to whom the
19 * Software is furnished to do so, subject to the following conditions:
20 *
21 * The above copyright notice and this permission notice (including the next
22 * paragraph) shall be included in all copies or substantial portions of the
23 * Software.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31 * DEALINGS IN THE SOFTWARE.
32 *
33 */
34 #define __MINGW_H
35
36 /* In previous versions, __MINGW32_VERSION was expressed as a dotted
37 * numeric pair, representing major.minor; unfortunately, this doesn't
38 * adapt well to the inclusion of a patch-level component, since the
39 * major.minor.patch dotted triplet representation is not valid as a
40 * numeric entity. Thus, for this version, we adopt a representation
41 * which encodes the version as a long integer value, expressing:
42 *
43 * __MINGW32_VERSION = 1,000,000 * major + 1,000 * minor + patch
44 *
45 * DO NOT EDIT these package version assignments manually; they are
46 * derived from the package version specification within configure.ac,
47 * whence they are propagated automatically, at package build time.
48 */
49 #define __MINGW32_VERSION 3022001L
50 #define __MINGW32_MAJOR_VERSION 3
51 #define __MINGW32_MINOR_VERSION 22
52 #define __MINGW32_PATCHLEVEL 1
53
54 #if __GNUC__ >= 3 && ! defined __PCC__
55 #pragma GCC system_header
56 #endif
57
58 #ifndef _MSVCRTVER_H
59 /* Legacy versions of mingwrt use the macro __MSVCRT_VERSION__ to
60 * enable evolving features of different MSVCRT.DLL versions. This
61 * usage is no longer recommended, but the __MSVCRT_VERSION__ macro
62 * remains useful when a non-freely distributable MSVCRxx.DLL is to
63 * be substituted for MSVCRT.DLL; for such usage, the substitute
64 * MSVCRxx.DLL may be identified as specified in...
65 */
66 # include <msvcrtver.h>
67 #endif
68
69 /* A better inference than __MSVCRT_VERSION__, of the capabilities
70 * supported by the operating system default MSVCRT.DLL, is provided
71 * by the Windows API version identification macros.
72 */
73 #include <w32api.h>
74
75 /* The following are defined by the user (or by the compiler), to specify how
76 * identifiers are imported from a DLL. All headers should include this first,
77 * and then use __DECLSPEC_SUPPORTED to choose between the old ``__imp__name''
78 * style or the __MINGW_IMPORT style for declarations.
79 *
80 * __DECLSPEC_SUPPORTED Defined if dllimport attribute is supported.
81 * __MINGW_IMPORT The attribute definition to specify imported
82 * variables/functions.
83 * _CRTIMP As above. For MS compatibility.
84 *
85 * Macros to enable MinGW features which deviate from standard MSVC
86 * compatible behaviour; these may be specified directly in user code,
87 * activated implicitly, (e.g. by specifying _POSIX_C_SOURCE or such),
88 * or by inclusion in __MINGW_FEATURES__:
89 *
90 * __USE_MINGW_ANSI_STDIO Select a more ANSI C99 compatible
91 * implementation of printf() and friends;
92 * (users should not set this directly).
93 *
94 * Other macros:
95 *
96 * __int64 define to be long long. Using a typedef
97 * doesn't work for "unsigned __int64"
98 *
99 *
100 * Manifest definitions for flags to control globbing of the command line
101 * during application start up, (before main() is called). The first pair,
102 * when assigned as bit flags within _CRT_glob, select the globbing algorithm
103 * to be used; (the MINGW algorithm overrides MSCVRT, if both are specified).
104 * Prior to mingwrt-3.21, only the MSVCRT option was supported; this choice
105 * may produce different results, depending on which particular version of
106 * MSVCRT.DLL is in use; (in recent versions, it seems to have become
107 * definitively broken, when globbing within double quotes).
108 */
109 #define __CRT_GLOB_USE_MSVCRT__ 0x0001
110
111 /* From mingwrt-3.21 onward, this should be the preferred choice; it will
112 * produce consistent results, regardless of the MSVCRT.DLL version in use.
113 */
114 #define __CRT_GLOB_USE_MINGW__ 0x0002
115
116 /* When the __CRT_GLOB_USE_MINGW__ flag is set, within _CRT_glob, the
117 * following additional options are also available; they are not enabled
118 * by default, but the user may elect to enable any combination of them,
119 * by setting _CRT_glob to the boolean sum (i.e. logical OR combination)
120 * of __CRT_GLOB_USE_MINGW__ and the desired options.
121 *
122 * __CRT_GLOB_USE_SINGLE_QUOTE__ allows use of single (apostrophe)
123 * quoting characters, analogously to
124 * POSIX usage, as an alternative to
125 * double quotes, for collection of
126 * arguments separated by white space
127 * into a single logical argument.
128 *
129 * __CRT_GLOB_BRACKET_GROUPS__ enable interpretation of bracketed
130 * character groups as POSIX compatible
131 * globbing patterns, matching any one
132 * character which is either included
133 * in, or excluded from the group.
134 *
135 * __CRT_GLOB_CASE_SENSITIVE__ enable case sensitive matching for
136 * globbing patterns; this is default
137 * behaviour for POSIX, but because of
138 * the case insensitive nature of the
139 * MS-Windows file system, it is more
140 * appropriate to use case insensitive
141 * globbing as the MinGW default.
142 *
143 */
144 #define __CRT_GLOB_USE_SINGLE_QUOTE__ 0x0010
145 #define __CRT_GLOB_BRACKET_GROUPS__ 0x0020
146 #define __CRT_GLOB_CASE_SENSITIVE__ 0x0040
147
148 /* The MinGW globbing algorithm uses the ASCII DEL control code as a marker
149 * for globbing characters which were embedded within quoted arguments; (the
150 * quotes are stripped away BEFORE the argument is globbed; the globbing code
151 * treats the marked character as immutable, and strips out the DEL markers,
152 * before storing the resultant argument). The DEL code is mapped to this
153 * function here; DO NOT change it, without rebuilding the runtime.
154 */
155 #define __CRT_GLOB_ESCAPE_CHAR__ (char)(127)
156
157
158 /* Manifest definitions identifying the flag bits, controlling activation
159 * of MinGW features, as specified by the user in __MINGW_FEATURES__.
160 */
161 #define __MINGW_ANSI_STDIO__ 0x0000000000000001ULL
162 /*
163 * The following three are not yet formally supported; they are
164 * included here, to document anticipated future usage.
165 */
166 #define __MINGW_LC_EXTENSIONS__ 0x0000000000000050ULL
167 #define __MINGW_LC_MESSAGES__ 0x0000000000000010ULL
168 #define __MINGW_LC_ENVVARS__ 0x0000000000000040ULL
169
170
171 /* Try to avoid problems with outdated checks for GCC __attribute__ support.
172 */
173 #undef __attribute__
174
175 #if defined (__PCC__)
176 # undef __DECLSPEC_SUPPORTED
177 # ifndef __MINGW_IMPORT
178 # define __MINGW_IMPORT extern
179 # endif
180 # ifndef _CRTIMP
181 # define _CRTIMP
182 # endif
183 # ifndef __cdecl
184 # define __cdecl _Pragma("cdecl")
185 # endif
186 # ifndef __stdcall
187 # define __stdcall _Pragma("stdcall")
188 # endif
189 # ifndef __int64
190 # define __int64 long long
191 # endif
192 # ifndef __int32
193 # define __int32 long
194 # endif
195 # ifndef __int16
196 # define __int16 short
197 # endif
198 # ifndef __int8
199 # define __int8 char
200 # endif
201 # ifndef __small
202 # define __small char
203 # endif
204 # ifndef __hyper
205 # define __hyper long long
206 # endif
207 # ifndef __volatile__
208 # define __volatile__ volatile
209 # endif
210 # ifndef __restrict__
211 # define __restrict__ restrict
212 # endif
213 # define NONAMELESSUNION
214 #elif defined(__GNUC__)
215 # ifdef __declspec
216 # ifndef __MINGW_IMPORT
217 /* Note the extern. This is needed to work around GCC's
218 limitations in handling dllimport attribute. */
219 # define __MINGW_IMPORT extern __attribute__((__dllimport__))
220 # endif
221 # ifndef _CRTIMP
222 # ifdef __USE_CRTIMP
223 # define _CRTIMP __attribute__((dllimport))
224 # else
225 # define _CRTIMP
226 # endif
227 # endif
228 # define __DECLSPEC_SUPPORTED
229 # else /* __declspec */
230 # undef __DECLSPEC_SUPPORTED
231 # undef __MINGW_IMPORT
232 # ifndef _CRTIMP
233 # define _CRTIMP
234 # endif
235 # endif /* __declspec */
236 /*
237 * The next two defines can cause problems if user code adds the
238 * __cdecl attribute like so:
239 * void __attribute__ ((__cdecl)) foo(void);
240 */
241 # ifndef __cdecl
242 # define __cdecl __attribute__((__cdecl__))
243 # endif
244 # ifndef __stdcall
245 # define __stdcall __attribute__((__stdcall__))
246 # endif
247 # ifndef __int64
248 # define __int64 long long
249 # endif
250 # ifndef __int32
251 # define __int32 long
252 # endif
253 # ifndef __int16
254 # define __int16 short
255 # endif
256 # ifndef __int8
257 # define __int8 char
258 # endif
259 # ifndef __small
260 # define __small char
261 # endif
262 # ifndef __hyper
263 # define __hyper long long
264 # endif
265 #else /* ! __GNUC__ && ! __PCC__ */
266 # ifndef __MINGW_IMPORT
267 # define __MINGW_IMPORT __declspec(dllimport)
268 # endif
269 # ifndef _CRTIMP
270 # define _CRTIMP __declspec(dllimport)
271 # endif
272 # define __DECLSPEC_SUPPORTED
273 # define __attribute__(x) /* nothing */
274 #endif
275
276 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
277 #define __MINGW_GNUC_PREREQ(major, minor) \
278 (__GNUC__ > (major) \
279 || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
280 #else
281 #define __MINGW_GNUC_PREREQ(major, minor) 0
282 #endif
283
284 #ifdef __cplusplus
285 # define __CRT_INLINE inline
286 #else
287 # if __GNUC_STDC_INLINE__
288 # define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
289 # else
290 # define __CRT_INLINE extern __inline__
291 # endif
292 #endif
293
294 # ifdef __GNUC__
295 /* A special form of __CRT_INLINE is provided; it will ALWAYS request
296 * inlining when possible. Originally specified as _CRTALIAS, this is
297 * now deprecated in favour of __CRT_ALIAS, for syntactic consistency
298 * with __CRT_INLINE itself.
299 */
300 # define _CRTALIAS __CRT_INLINE __attribute__((__always_inline__))
301 # define __CRT_ALIAS __CRT_INLINE __attribute__((__always_inline__))
302 # else
303 # define _CRTALIAS __CRT_INLINE /* deprecated form */
304 # define __CRT_ALIAS __CRT_INLINE /* preferred form */
305 # endif
306 /*
307 * Each function which is implemented as a __CRT_ALIAS should also be
308 * accompanied by an externally visible interface. The following pair
309 * of macros provide a mechanism for implementing this, either as a stub
310 * redirecting to an alternative external function, or by compilation of
311 * the normally inlined code into free standing object code; each macro
312 * provides a way for us to offer arbitrary hints for use by the build
313 * system, while remaining transparent to the compiler.
314 */
315 #define __JMPSTUB__(__BUILD_HINT__)
316 #define __LIBIMPL__(__BUILD_HINT__)
317
318 #ifdef __cplusplus
319 # define __UNUSED_PARAM(x)
320 #else
321 # ifdef __GNUC__
322 # define __UNUSED_PARAM(x) x __attribute__((__unused__))
323 # else
324 # define __UNUSED_PARAM(x) x
325 # endif
326 #endif
327
328 #ifdef __GNUC__
329 #define __MINGW_ATTRIB_NORETURN __attribute__((__noreturn__))
330 #define __MINGW_ATTRIB_CONST __attribute__((__const__))
331 #else
332 #define __MINGW_ATTRIB_NORETURN
333 #define __MINGW_ATTRIB_CONST
334 #endif
335
336 #if __MINGW_GNUC_PREREQ (3, 0)
337 #define __MINGW_ATTRIB_MALLOC __attribute__((__malloc__))
338 #define __MINGW_ATTRIB_PURE __attribute__((__pure__))
339 #else
340 #define __MINGW_ATTRIB_MALLOC
341 #define __MINGW_ATTRIB_PURE
342 #endif
343
344 /* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
345 variadiac macro facility, because variadic macros cause syntax
346 errors with --traditional-cpp. */
347 #if __MINGW_GNUC_PREREQ (3, 3)
348 #define __MINGW_ATTRIB_NONNULL(arg) __attribute__((__nonnull__(arg)))
349 #else
350 #define __MINGW_ATTRIB_NONNULL(arg)
351 #endif /* GNUC >= 3.3 */
352
353 #if __MINGW_GNUC_PREREQ (3, 1)
354 #define __MINGW_ATTRIB_DEPRECATED __attribute__((__deprecated__))
355 #else
356 #define __MINGW_ATTRIB_DEPRECATED
357 #endif /* GNUC >= 3.1 */
358
359 #if __MINGW_GNUC_PREREQ (3, 3)
360 #define __MINGW_NOTHROW __attribute__((__nothrow__))
361 #else
362 #define __MINGW_NOTHROW
363 #endif /* GNUC >= 3.3 */
364
365
366 /* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW. This will
367 allow GCC to optimize away some EH unwind code, at least in DW2 case. */
368
369 /* Activation of MinGW specific extended features:
370 */
371 #ifndef __USE_MINGW_ANSI_STDIO
372 /* Users should not set this directly; rather, define one (or more)
373 * of the feature test macros (tabulated below), or specify any of the
374 * compiler's command line options, (e.g. -posix, -ansi, or -std=c...),
375 * which cause _POSIX_SOURCE, or __STRICT_ANSI__ to be defined.
376 *
377 * We must check this BEFORE we specifiy any implicit _POSIX_C_SOURCE,
378 * otherwise we would always implicitly choose __USE_MINGW_ANSI_STDIO,
379 * even if none of these selectors are specified explicitly...
380 */
381 # if defined __STRICT_ANSI__ || defined _ISOC99_SOURCE \
382 || defined _POSIX_SOURCE || defined _POSIX_C_SOURCE \
383 || defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED \
384 || defined _GNU_SOURCE || defined _BSD_SOURCE \
385 || defined _SVID_SOURCE
386 /*
387 * but where any of these source code qualifiers are specified,
388 * then assume ANSI I/O standards are preferred over Microsoft's...
389 */
390 # define __USE_MINGW_ANSI_STDIO 1
391 # else
392 /* otherwise use whatever __MINGW_FEATURES__ specifies...
393 */
394 # define __USE_MINGW_ANSI_STDIO (__MINGW_FEATURES__ & __MINGW_ANSI_STDIO__)
395 # endif
396 #endif
397
398 #ifndef _POSIX_C_SOURCE
399 /* Users may define this, either directly or indirectly, to explicitly
400 * enable a particular level of visibility for the subset of those POSIX
401 * features which are supported by MinGW; (notice that this offers no
402 * guarantee that any particular POSIX feature will be supported).
403 */
404 # if defined _XOPEN_SOURCE
405 /* Specifying this is the preferred method for setting _POSIX_C_SOURCE;
406 * (POSIX defines an explicit relationship to _XOPEN_SOURCE). Note that
407 * any such explicit setting will augment the set of features which are
408 * available to any compilation unit, even if it seeks to be strictly
409 * ANSI-C compliant.
410 */
411 # if _XOPEN_SOURCE < 500
412 # define _POSIX_C_SOURCE 1L /* POSIX.1-1990 / SUSv1 */
413
414 # elif _XOPEN_SOURCE < 600
415 # define _POSIX_C_SOURCE 199506L /* POSIX.1-1996 / SUSv2 */
416
417 # elif _XOPEN_SOURCE < 700
418 # define _POSIX_C_SOURCE 200112L /* POSIX.1-2001 / SUSv3 */
419
420 # else
421 # define _POSIX_C_SOURCE 200809L /* POSIX.1-2008 / SUSv4 */
422 # endif
423
424 # elif defined _GNU_SOURCE || defined _BSD_SOURCE || ! defined __STRICT_ANSI__
425 /*
426 * No explicit level of support has been specified; implicitly grant
427 * the most comprehensive level to any compilation unit which requests
428 * either GNU or BSD feature support, or does not seek to be strictly
429 * ANSI-C compliant.
430 */
431 # define _POSIX_C_SOURCE 200809L
432
433 # elif defined _POSIX_SOURCE
434 /* Now formally deprecated by POSIX, some old code may specify this;
435 * it will enable a minimal level of POSIX support, in addition to the
436 * limited feature set enabled for strict ANSI-C conformity.
437 */
438 # define _POSIX_C_SOURCE 1L
439 # endif
440 #endif
441
442 #ifndef _ISOC99_SOURCE
443 /* libmingwex.a provides free-standing implementations for many of the
444 * functions which were introduced in C99; MinGW headers do not expose
445 * prototypes for these, unless this feature test macro is defined, by
446 * the user, or implied by other standards...
447 */
448 # if __STDC_VERSION__ >= 199901L || _POSIX_C_SOURCE >= 200112L
449 # define _ISOC99_SOURCE 1
450 # endif
451 #endif
452
453 #if ! defined _MINGW32_SOURCE_EXTENDED && ! defined __STRICT_ANSI__
454 /*
455 * Enable mingw32 extensions by default, except when __STRICT_ANSI__
456 * conformity mode has been enabled.
457 */
458 # define _MINGW32_SOURCE_EXTENDED 1
459 #endif
460
461 #endif /* __MINGW_H: $RCSfile: _mingw.h.in,v $: end of file */