OSDN Git Service

* include/_mingw.h: Fix typo.
[mingw/mingw-org-wsl.git] / include / _mingw.h
1 #ifndef __MINGW_H
2 /*
3  * _mingw.h
4  *
5  * Mingw specific macros included by ALL include files.
6  *
7  * This file is part of the Mingw32 package.
8  *
9  * Contributors:
10  *  Created by Mumit Khan  <khan@xraylith.wisc.edu>
11  *
12  *  THIS SOFTWARE IS NOT COPYRIGHTED
13  *
14  *  This source code is offered for use in the public domain. You may
15  *  use, modify or distribute it freely.
16  *
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.
21  *
22  */
23 #define __MINGW_H
24
25 #define __MINGW_VERSION             4.0
26 #define __MINGW_MAJOR_VERSION       4
27 #define __MINGW_MINOR_VERSION       0
28 #define __MINGW_PATCHLEVEL          0
29
30 // These four macros are deprecated and will be removed in the next major
31 // version release.
32 #define __MINGW32_VERSION           3.20
33 #define __MINGW32_MAJOR_VERSION     3
34 #define __MINGW32_MINOR_VERSION     20
35 #define __MINGW32_PATCHLEVEL        0
36
37 #pragma GCC system_header
38
39 #ifndef __GNUC__
40 #error ERROR: You must use a GNU Compiler.
41 #endif
42
43 #if (__GNUC__ < 3 || !defined(__GNUC_MINOR__) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4 && __GNUC_PATCHLEVEL__ < 5))
44 #error ERROR: You must use a GNU Compiler version >= 3.4.5.
45 #endif
46
47 /* These are defined by the user (or the compiler)
48    to specify how identifiers are imported from a DLL.
49
50    __DECLSPEC_SUPPORTED            Defined if dllimport attribute is supported.
51    __MINGW_IMPORT                  The attribute definition to specify imported
52                                    variables/functions.
53    _CRTIMP                         As above.  For MS compatibility.
54    __MINGW_VERSION                 Runtime version.
55    __MINGW_MAJOR_VERSION           Runtime major version.
56    __MINGW_MINOR_VERSION           Runtime minor version.
57    __MINGW_BUILD_DATE              Runtime build date.
58
59    Macros to enable MinGW features which deviate from standard MSVC
60    compatible behaviour; these may be specified directly in user code,
61    activated implicitly, (e.g. by specifying _POSIX_C_SOURCE or such),
62    or by inclusion in __MINGW_FEATURES__:
63
64    __USE_MINGW_ANSI_STDIO          Select a more ANSI C99 compatible
65                                    implementation of printf() and friends.
66
67    Other macros:
68
69    __int64                         define to be long long.  Using a typedef
70                                    doesn't work for "unsigned __int64"
71
72    All headers should include this first, and then use __DECLSPEC_SUPPORTED
73    to choose between the old ``__imp__name'' style or __MINGW_IMPORT
74    style declarations.  */
75
76
77 /* Manifest definitions identifying the flag bits, controlling activation
78  * of MinGW features, as specified by the user in __MINGW_FEATURES__.
79  */
80 #define __MINGW_ANSI_STDIO__            0x0000000000000001ULL
81 /*
82  * The following three are not yet formally supported; they are
83  * included here, to document anticipated future usage.
84  */
85 #define __MINGW_LC_EXTENSIONS__         0x0000000000000050ULL
86 #define __MINGW_LC_MESSAGES__           0x0000000000000010ULL
87 #define __MINGW_LC_ENVVARS__            0x0000000000000040ULL
88
89 /* Try to avoid problems with outdated checks for GCC __attribute__ support.  */
90 #undef __attribute__
91
92 #ifdef __declspec
93 # ifndef __MINGW_IMPORT
94   /* Note the extern. This is needed to work around GCC's
95      limitations in handling dllimport attribute.  */
96 #  define __MINGW_IMPORT  extern __attribute__ ((__dllimport__))
97 # endif
98 # ifndef _CRTIMP
99 #  ifdef __USE_CRTIMP
100 #   define _CRTIMP  __attribute__ ((dllimport))
101 #  else
102 #   define _CRTIMP
103 #  endif
104 # endif
105 # define __DECLSPEC_SUPPORTED
106 #else /* __declspec */
107 # undef __DECLSPEC_SUPPORTED
108 # undef __MINGW_IMPORT
109 # ifndef _CRTIMP
110 #  define _CRTIMP
111 # endif
112 #endif /* __declspec */
113 /*
114  * The next two defines can cause problems if user code adds the
115  * __cdecl attribute like so:
116  * void __attribute__ ((__cdecl)) foo(void); 
117  */
118 #ifndef __cdecl 
119 # define __cdecl  __attribute__ ((__cdecl__))
120 #endif
121 #ifndef __stdcall
122 # define __stdcall __attribute__ ((__stdcall__))
123 #endif
124 #ifndef __int64
125 # define __int64 long long
126 #endif
127 #ifndef __int32
128 # define __int32 long
129 #endif
130 #ifndef __int16
131 # define __int16 short
132 #endif
133 #ifndef __int8
134 # define __int8 char
135 #endif
136 #ifndef __small
137 # define __small char
138 #endif
139 #ifndef __hyper
140 # define __hyper long long
141 #endif
142
143 #define __MINGW_GNUC_PREREQ(major, minor) \
144   (__GNUC__ > (major) \
145    || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
146
147 #ifdef __cplusplus
148 # define __CRT_INLINE inline
149 #else
150 # if __GNUC_STDC_INLINE__
151 #  define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
152 # else
153 #  define __CRT_INLINE extern __inline__
154 # endif
155 #endif
156
157 #define _CRTALIAS __CRT_INLINE __attribute__ ((__always_inline__))
158
159 #ifdef __cplusplus
160 # define __UNUSED_PARAM(x)
161 #else
162 # define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
163 #endif
164
165 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
166 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
167 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
168 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
169 #define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
170 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
171 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
172
173
174 /* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW.  This will
175 allow GCC to optimize away some EH unwind code, at least in DW2 case.  */
176
177 #ifndef __MSVCRT_VERSION__
178 /*  High byte is the major version, low byte is the minor. */
179 # define __MSVCRT_VERSION__ 0x0600
180 #endif
181
182 /* Activation of MinGW specific extended features:
183  */
184 #ifndef __USE_MINGW_ANSI_STDIO
185 /*
186  * If user didn't specify it explicitly...
187  */
188 # if   defined __STRICT_ANSI__  ||  defined _ISOC99_SOURCE \
189    ||  defined _POSIX_SOURCE    ||  defined _POSIX_C_SOURCE \
190    ||  defined _XOPEN_SOURCE    ||  defined _XOPEN_SOURCE_EXTENDED \
191    ||  defined _GNU_SOURCE      ||  defined _BSD_SOURCE \
192    ||  defined _SVID_SOURCE
193    /*
194     * but where any of these source code qualifiers are specified,
195     * then assume ANSI I/O standards are preferred over Microsoft's...
196     */
197 #  define __USE_MINGW_ANSI_STDIO    1
198 # else
199    /*
200     * otherwise use whatever __MINGW_FEATURES__ specifies...
201     */
202 #  define __USE_MINGW_ANSI_STDIO    (__MINGW_FEATURES__ & __MINGW_ANSI_STDIO__)
203 # endif
204 #endif
205
206 struct threadlocalinfostruct;
207 struct threadmbinfostruct;
208 typedef struct threadlocalinfostruct *pthreadlocinfo;
209 typedef struct threadmbcinfostruct *pthreadmbcinfo;
210
211 typedef struct localeinfo_struct {
212   pthreadlocinfo locinfo;
213   pthreadmbcinfo mbcinfo;
214 } _locale_tstruct, *_locale_t;
215
216 #endif /* __MINGW_H */