Fix:support_libc:Reverted accidential change
[profile/ivi/navit.git] / navit / navit / support / libc / _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 __MINGW32_VERSION           3.16
26 #define __MINGW32_MAJOR_VERSION     3
27 #define __MINGW32_MINOR_VERSION     16
28 #define __MINGW32_PATCHLEVEL        0
29
30 #if __GNUC__ >= 3
31 #pragma GCC system_header
32 #endif
33
34 /* These are defined by the user (or the compiler)
35    to specify how identifiers are imported from a DLL.
36
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.
45
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__:
50
51    __USE_MINGW_ANSI_STDIO          Select a more ANSI C99 compatible
52                                    implementation of printf() and friends.
53
54    Other macros:
55
56    __int64                         define to be long long.  Using a typedef
57                                    doesn't work for "unsigned __int64"
58
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.  */
62
63
64 /* Manifest definitions identifying the flag bits, controlling activation
65  * of MinGW features, as specified by the user in __MINGW_FEATURES__.
66  */
67 #define __MINGW_ANSI_STDIO__            0x0000000000000001ULL
68 /*
69  * The following three are not yet formally supported; they are
70  * included here, to document anticipated future usage.
71  */
72 #define __MINGW_LC_EXTENSIONS__         0x0000000000000050ULL
73 #define __MINGW_LC_MESSAGES__           0x0000000000000010ULL
74 #define __MINGW_LC_ENVVARS__            0x0000000000000040ULL
75
76 /* Try to avoid problems with outdated checks for GCC __attribute__ support.  */
77 #undef __attribute__
78
79 #if defined (__PCC__)
80 #  undef __DECLSPEC_SUPPORTED
81 # ifndef __MINGW_IMPORT
82 #  define __MINGW_IMPORT extern
83 # endif
84 # ifndef _CRTIMP
85 #  define _CRTIMP
86 # endif
87 # ifndef __cdecl 
88 #  define __cdecl  _Pragma("cdecl")
89 # endif
90 # ifndef __stdcall
91 #  define __stdcall _Pragma("stdcall")
92 # endif
93 # ifndef __int64
94 #  define __int64 long long
95 # endif
96 # ifndef __int32
97 #  define __int32 long
98 # endif
99 # ifndef __int16
100 #  define __int16 short
101 # endif
102 # ifndef __int8
103 #  define __int8 char
104 # endif
105 # ifndef __small
106 #  define __small char
107 # endif
108 # ifndef __hyper
109 #  define __hyper long long
110 # endif
111 # ifndef __volatile__
112 #  define __volatile__ volatile
113 # endif
114 # ifndef __restrict__
115 #  define __restrict__ restrict
116 # endif
117 # define NONAMELESSUNION
118 #elif defined(__GNUC__)
119 # ifdef __declspec
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__))
124 #  endif
125 #  ifndef _CRTIMP
126 #   ifdef __USE_CRTIMP
127 #    define _CRTIMP  __attribute__ ((dllimport))
128 #   else
129 #    define _CRTIMP
130 #   endif
131 #  endif
132 #  define __DECLSPEC_SUPPORTED
133 # else /* __declspec */
134 #  undef __DECLSPEC_SUPPORTED
135 #  undef __MINGW_IMPORT
136 #  ifndef _CRTIMP
137 #   define _CRTIMP
138 #  endif
139 # endif /* __declspec */
140 /*
141  * The next two defines can cause problems if user code adds the
142  * __cdecl attribute like so:
143  * void __attribute__ ((__cdecl)) foo(void); 
144  */
145 # ifndef __cdecl 
146 #  define __cdecl  __attribute__ ((__cdecl__))
147 # endif
148 # ifndef __stdcall
149 #  define __stdcall __attribute__ ((__stdcall__))
150 # endif
151 # ifndef __int64
152 #  define __int64 long long
153 # endif
154 # ifndef __int32
155 #  define __int32 long
156 # endif
157 # ifndef __int16
158 #  define __int16 short
159 # endif
160 # ifndef __int8
161 #  define __int8 char
162 # endif
163 # ifndef __small
164 #  define __small char
165 # endif
166 # ifndef __hyper
167 #  define __hyper long long
168 # endif
169 #else /* ! __GNUC__ && ! __PCC__ */
170 # ifndef __MINGW_IMPORT
171 #  define __MINGW_IMPORT  __declspec(dllimport)
172 # endif
173 # ifndef _CRTIMP
174 #  define _CRTIMP  __declspec(dllimport)
175 # endif
176 # define __DECLSPEC_SUPPORTED
177 # define __attribute__(x) /* nothing */
178 #endif
179
180 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
181 #define __MINGW_GNUC_PREREQ(major, minor) \
182   (__GNUC__ > (major) \
183    || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
184 #else
185 #define __MINGW_GNUC_PREREQ(major, minor)  0
186 #endif
187
188 #ifdef __cplusplus
189 # define __CRT_INLINE inline
190 #else
191 # if __GNUC_STDC_INLINE__
192 #  define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
193 # else
194 #  ifdef __COREDLL__
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
202       barf on that.  */
203 #   define __CRT_INLINE extern __inline__ __attribute__((__always_inline__))
204 #  else
205 #   define __CRT_INLINE
206 #  endif
207 # endif
208 #endif
209
210 #ifdef __cplusplus
211 # define __UNUSED_PARAM(x)
212 #else
213 # ifdef __GNUC__
214 #  define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
215 # else
216 #  define __UNUSED_PARAM(x) x
217 # endif
218 #endif
219
220 #ifdef __GNUC__
221 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
222 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
223 #else
224 #define __MINGW_ATTRIB_NORETURN
225 #define __MINGW_ATTRIB_CONST
226 #endif
227
228 #if __MINGW_GNUC_PREREQ (3, 0)
229 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
230 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
231 #else
232 #define __MINGW_ATTRIB_MALLOC
233 #define __MINGW_ATTRIB_PURE
234 #endif
235
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)))
241 #else
242 #define __MINGW_ATTRIB_NONNULL(arg)
243 #endif /* GNUC >= 3.3 */
244
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
253 #else
254 /* Desktop i386 Windows versions are underscored.  */
255 # define __U(SYM) SYM
256 # define __IMP(S) _imp__ ## S
257 #endif
258
259 #if  __MINGW_GNUC_PREREQ (3, 1)
260 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
261 #else
262 #define __MINGW_ATTRIB_DEPRECATED
263 #endif /* GNUC >= 3.1 */
264  
265 #if  __MINGW_GNUC_PREREQ (3, 3)
266 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
267 #else
268 #define __MINGW_NOTHROW
269 #endif /* GNUC >= 3.3 */
270
271
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.  */
274
275 #if defined __MSVCRT__ && !defined (__MSVCRT_VERSION__)
276 /*  High byte is the major version, low byte is the minor. */
277 # define __MSVCRT_VERSION__ 0x0600
278 #endif
279
280 /* Activation of MinGW specific extended features:
281  */
282 #ifndef __USE_MINGW_ANSI_STDIO
283 /*
284  * If user didn't specify it explicitly...
285  */
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
291    /*
292     * but where any of these source code qualifiers are specified,
293     * then assume ANSI I/O standards are preferred over Microsoft's...
294     */
295 #  define __USE_MINGW_ANSI_STDIO    1
296 # else
297    /*
298     * otherwise use whatever __MINGW_FEATURES__ specifies...
299     */
300 #  define __USE_MINGW_ANSI_STDIO    (__MINGW_FEATURES__ & __MINGW_ANSI_STDIO__)
301 # endif
302 #endif
303
304 #endif /* __MINGW_H */