Update tcl to version 8.5.13
[msysgit.git] / mingw / include / _mingw.h
blob22da4c9537d83cc2126863b1e7167079559dd57a
1 #ifndef __MINGW_H
2 /*
3 * _mingw.h
5 * Mingw specific macros included by ALL include files.
7 * This file is part of the Mingw32 package.
9 * Contributors:
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.
23 #define __MINGW_H
25 #define __MINGW32_VERSION 3.15.2
26 #define __MINGW32_MAJOR_VERSION 3
27 #define __MINGW32_MINOR_VERSION 15
28 #define __MINGW32_PATCHLEVEL 2
30 #if __GNUC__ >= 3
31 #pragma GCC system_header
32 #endif
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
39 variables/functions.
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.
54 Other macros:
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. */
77 #undef __attribute__
79 #ifndef __GNUC__
80 # ifndef __MINGW_IMPORT
81 # define __MINGW_IMPORT __declspec(dllimport)
82 # endif
83 # ifndef _CRTIMP
84 # define _CRTIMP __declspec(dllimport)
85 # endif
86 # define __DECLSPEC_SUPPORTED
87 # define __attribute__(x) /* nothing */
88 #else /* __GNUC__ */
89 # ifdef __declspec
90 # ifndef __MINGW_IMPORT
91 /* Note the extern. This is needed to work around GCC's
92 limitations in handling dllimport attribute. */
93 # define __MINGW_IMPORT extern __attribute__ ((__dllimport__))
94 # endif
95 # ifndef _CRTIMP
96 # ifdef __USE_CRTIMP
97 # define _CRTIMP __attribute__ ((dllimport))
98 # else
99 # define _CRTIMP
100 # endif
101 # endif
102 # define __DECLSPEC_SUPPORTED
103 # else /* __declspec */
104 # undef __DECLSPEC_SUPPORTED
105 # undef __MINGW_IMPORT
106 # ifndef _CRTIMP
107 # define _CRTIMP
108 # endif
109 # endif /* __declspec */
112 The next two defines can cause problems if user code adds the __cdecl attribute
113 like so:
114 void __attribute__ ((__cdecl)) foo(void);
116 # ifndef __cdecl
117 # define __cdecl __attribute__ ((__cdecl__))
118 # endif
119 # ifndef __stdcall
120 # define __stdcall __attribute__ ((__stdcall__))
121 # endif
122 # ifndef __int64
123 # define __int64 long long
124 # endif
125 # ifndef __int32
126 # define __int32 long
127 # endif
128 # ifndef __int16
129 # define __int16 short
130 # endif
131 # ifndef __int8
132 # define __int8 char
133 # endif
134 # ifndef __small
135 # define __small char
136 # endif
137 # ifndef __hyper
138 # define __hyper long long
139 # endif
140 #endif /* __GNUC__ */
142 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
143 #define __MINGW_GNUC_PREREQ(major, minor) \
144 (__GNUC__ > (major) \
145 || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
146 #else
147 #define __MINGW_GNUC_PREREQ(major, minor) 0
148 #endif
150 #ifdef __cplusplus
151 # define __CRT_INLINE inline
152 #else
153 # if __GNUC_STDC_INLINE__
154 # define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
155 # else
156 # define __CRT_INLINE extern __inline__
157 # endif
158 #endif
160 #ifdef __cplusplus
161 # define __UNUSED_PARAM(x)
162 #else
163 # ifdef __GNUC__
164 # define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
165 # else
166 # define __UNUSED_PARAM(x) x
167 # endif
168 #endif
170 #ifdef __GNUC__
171 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
172 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
173 #else
174 #define __MINGW_ATTRIB_NORETURN
175 #define __MINGW_ATTRIB_CONST
176 #endif
178 #if __MINGW_GNUC_PREREQ (3, 0)
179 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
180 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
181 #else
182 #define __MINGW_ATTRIB_MALLOC
183 #define __MINGW_ATTRIB_PURE
184 #endif
186 /* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
187 variadiac macro facility, because variadic macros cause syntax
188 errors with --traditional-cpp. */
189 #if __MINGW_GNUC_PREREQ (3, 3)
190 #define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
191 #else
192 #define __MINGW_ATTRIB_NONNULL(arg)
193 #endif /* GNUC >= 3.3 */
195 #if __MINGW_GNUC_PREREQ (3, 1)
196 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
197 #else
198 #define __MINGW_ATTRIB_DEPRECATED
199 #endif /* GNUC >= 3.1 */
201 #if __MINGW_GNUC_PREREQ (3, 3)
202 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
203 #else
204 #define __MINGW_NOTHROW
205 #endif /* GNUC >= 3.3 */
208 /* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW. This will
209 allow GCC to optimize away some EH unwind code, at least in DW2 case. */
211 #ifndef __MSVCRT_VERSION__
212 /* High byte is the major version, low byte is the minor. */
213 # define __MSVCRT_VERSION__ 0x0600
214 #endif
216 /* Activation of MinGW specific extended features:
218 #ifndef __USE_MINGW_ANSI_STDIO
220 * If user didn't specify it explicitly...
222 # if defined __STRICT_ANSI__ || defined _ISOC99_SOURCE \
223 || defined _POSIX_SOURCE || defined _POSIX_C_SOURCE \
224 || defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED \
225 || defined _GNU_SOURCE || defined _BSD_SOURCE \
226 || defined _SVID_SOURCE
228 * but where any of these source code qualifiers are specified,
229 * then assume ANSI I/O standards are preferred over Microsoft's...
231 # define __USE_MINGW_ANSI_STDIO 1
232 # else
234 * otherwise use whatever __MINGW_FEATURES__ specifies...
236 # define __USE_MINGW_ANSI_STDIO (__MINGW_FEATURES__ & __MINGW_ANSI_STDIO__)
237 # endif
238 #endif
240 #endif /* __MINGW_H */