Start anew
[git/jnareb-git.git] / mingw / include / _mingw.h
blob81e81b8ec2288aadac271ea489d4d3d49d085d97
1 /*
2 * _mingw.h
4 * Mingw specific macros included by ALL include files.
6 * This file is part of the Mingw32 package.
8 * Contributors:
9 * Created by Mumit Khan <khan@xraylith.wisc.edu>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 #ifndef __MINGW_H
24 #define __MINGW_H
27 /* These are defined by the user (or the compiler)
28 to specify how identifiers are imported from a DLL.
30 __DECLSPEC_SUPPORTED Defined if dllimport attribute is supported.
31 __MINGW_IMPORT The attribute definition to specify imported
32 variables/functions.
33 _CRTIMP As above. For MS compatibility.
34 __MINGW32_VERSION Runtime version.
35 __MINGW32_MAJOR_VERSION Runtime major version.
36 __MINGW32_MINOR_VERSION Runtime minor version.
37 __MINGW32_BUILD_DATE Runtime build date.
39 Other macros:
41 __int64 define to be long long. Using a typedef doesn't
42 work for "unsigned __int64"
44 All headers should include this first, and then use __DECLSPEC_SUPPORTED
45 to choose between the old ``__imp__name'' style or __MINGW_IMPORT
46 style declarations. */
48 /* Try to avoid problems with outdated checks for GCC __attribute__ support. */
49 #undef __attribute__
51 #ifndef __GNUC__
52 # ifndef __MINGW_IMPORT
53 # define __MINGW_IMPORT __declspec(dllimport)
54 # endif
55 # ifndef _CRTIMP
56 # define _CRTIMP __declspec(dllimport)
57 # endif
58 # define __DECLSPEC_SUPPORTED
59 # define __attribute__(x) /* nothing */
60 #else /* __GNUC__ */
61 # ifdef __declspec
62 # ifndef __MINGW_IMPORT
63 /* Note the extern. This is needed to work around GCC's
64 limitations in handling dllimport attribute. */
65 # define __MINGW_IMPORT extern __attribute__ ((__dllimport__))
66 # endif
67 # ifndef _CRTIMP
68 # ifdef __USE_CRTIMP
69 # define _CRTIMP __attribute__ ((dllimport))
70 # else
71 # define _CRTIMP
72 # endif
73 # endif
74 # define __DECLSPEC_SUPPORTED
75 # else /* __declspec */
76 # undef __DECLSPEC_SUPPORTED
77 # undef __MINGW_IMPORT
78 # ifndef _CRTIMP
79 # define _CRTIMP
80 # endif
81 # endif /* __declspec */
82 # ifndef __cdecl
83 # define __cdecl __attribute__ ((__cdecl__))
84 # endif
85 # ifndef __stdcall
86 # define __stdcall __attribute__ ((__stdcall__))
87 # endif
88 # ifndef __int64
89 # define __int64 long long
90 # endif
91 # ifndef __int32
92 # define __int32 long
93 # endif
94 # ifndef __int16
95 # define __int16 short
96 # endif
97 # ifndef __int8
98 # define __int8 char
99 # endif
100 # ifndef __small
101 # define __small char
102 # endif
103 # ifndef __hyper
104 # define __hyper long long
105 # endif
106 #endif /* __GNUC__ */
108 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
109 #define __MINGW_GNUC_PREREQ(major, minor) \
110 (__GNUC__ > (major) \
111 || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
112 #else
113 #define __MINGW_GNUC_PREREQ(major, minor) 0
114 #endif
116 #ifdef __cplusplus
117 # define __CRT_INLINE inline
118 #else
119 # if __GNUC_STDC_INLINE__
120 # define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
121 # else
122 # define __CRT_INLINE extern __inline__
123 # endif
124 #endif
126 #ifdef __cplusplus
127 # define __UNUSED_PARAM(x)
128 #else
129 # ifdef __GNUC__
130 # define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
131 # else
132 # define __UNUSED_PARAM(x) x
133 # endif
134 #endif
136 #ifdef __GNUC__
137 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
138 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
139 #else
140 #define __MINGW_ATTRIB_NORETURN
141 #define __MINGW_ATTRIB_CONST
142 #endif
144 #if __MINGW_GNUC_PREREQ (3, 0)
145 #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
146 #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
147 #else
148 #define __MINGW_ATTRIB_MALLOC
149 #define __MINGW_ATTRIB_PURE
150 #endif
152 /* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
153 variadiac macro facility, because variadic macros cause syntax
154 errors with --traditional-cpp. */
155 #if __MINGW_GNUC_PREREQ (3, 3)
156 #define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
157 #else
158 #define __MINGW_ATTRIB_NONNULL(arg)
159 #endif /* GNUC >= 3.3 */
161 #if __MINGW_GNUC_PREREQ (3, 1)
162 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
163 #else
164 #define __MINGW_ATTRIB_DEPRECATED
165 #endif /* GNUC >= 3.1 */
167 #ifndef __MSVCRT_VERSION__
168 /* High byte is the major version, low byte is the minor. */
169 # define __MSVCRT_VERSION__ 0x0600
170 #endif
172 #define __MINGW32_VERSION 3.12
173 #define __MINGW32_MAJOR_VERSION 3
174 #define __MINGW32_MINOR_VERSION 12
176 #endif /* __MINGW_H */