Add GLib 2.38 version macros
[platform/upstream/glib.git] / glib / gversionmacros.h
1 /* GLIB - Library of useful routines for C programming
2  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GLib Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GLib at ftp://ftp.gtk.org/pub/gtk/.
25  */
26
27 #ifndef __G_VERSION_MACROS_H__
28 #define __G_VERSION_MACROS_H__
29
30 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
31 #error "Only <glib.h> can be included directly."
32 #endif
33
34 /* Version boundaries checks */
35
36 #define G_ENCODE_VERSION(major,minor)   ((major) << 16 | (minor) << 8)
37
38 /* XXX: Every new stable minor release bump should add a macro here */
39
40 /**
41  * GLIB_VERSION_2_26:
42  *
43  * A macro that evaluates to the 2.26 version of GLib, in a format
44  * that can be used by the C pre-processor.
45  *
46  * Since: 2.32
47  */
48 #define GLIB_VERSION_2_26       (G_ENCODE_VERSION (2, 26))
49
50 /**
51  * GLIB_VERSION_2_28:
52  *
53  * A macro that evaluates to the 2.28 version of GLib, in a format
54  * that can be used by the C pre-processor.
55  *
56  * Since: 2.32
57  */
58 #define GLIB_VERSION_2_28       (G_ENCODE_VERSION (2, 28))
59
60 /**
61  * GLIB_VERSION_2_30:
62  *
63  * A macro that evaluates to the 2.30 version of GLib, in a format
64  * that can be used by the C pre-processor.
65  *
66  * Since: 2.32
67  */
68 #define GLIB_VERSION_2_30       (G_ENCODE_VERSION (2, 30))
69
70 /**
71  * GLIB_VERSION_2_32:
72  *
73  * A macro that evaluates to the 2.32 version of GLib, in a format
74  * that can be used by the C pre-processor.
75  *
76  * Since: 2.32
77  */
78 #define GLIB_VERSION_2_32       (G_ENCODE_VERSION (2, 32))
79
80 /**
81  * GLIB_VERSION_2_34:
82  *
83  * A macro that evaluates to the 2.34 version of GLib, in a format
84  * that can be used by the C pre-processor.
85  *
86  * Since: 2.34
87  */
88 #define GLIB_VERSION_2_34       (G_ENCODE_VERSION (2, 34))
89
90 /**
91  * GLIB_VERSION_2_36:
92  *
93  * A macro that evaluates to the 2.36 version of GLib, in a format
94  * that can be used by the C pre-processor.
95  *
96  * Since: 2.36
97  */
98 #define GLIB_VERSION_2_36       (G_ENCODE_VERSION (2, 36))
99
100 /**
101  * GLIB_VERSION_2_38:
102  *
103  * A macro that evaluates to the 2.36 version of GLib, in a format
104  * that can be used by the C pre-processor.
105  *
106  * Since: 2.36
107  */
108 #define GLIB_VERSION_2_38       (G_ENCODE_VERSION (2, 38))
109
110 /* evaluates to the current stable version; for development cycles,
111  * this means the next stable target
112  */
113 #if (GLIB_MINOR_VERSION % 2)
114 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
115 #else
116 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
117 #endif
118
119 /* evaluates to the previous stable version */
120 #if (GLIB_MINOR_VERSION % 2)
121 #define GLIB_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
122 #else
123 #define GLIB_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
124 #endif
125
126 /**
127  * GLIB_VERSION_MIN_REQUIRED:
128  *
129  * A macro that should be defined by the user prior to including
130  * the glib.h header.
131  * The definition should be one of the predefined GLib version
132  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
133  *
134  * This macro defines the earliest version of GLib that the package is
135  * required to be able to compile against.
136  *
137  * If the compiler is configured to warn about the use of deprecated
138  * functions, then using functions that were deprecated in version
139  * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
140  * using functions deprecated in later releases will not).
141  *
142  * Since: 2.32
143  */
144 /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
145  * GLIB_VERSION_X_Y value that we don't know about, it will compare as
146  * 0 in preprocessor tests.
147  */
148 #ifndef GLIB_VERSION_MIN_REQUIRED
149 # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE)
150 #elif GLIB_VERSION_MIN_REQUIRED == 0
151 # undef  GLIB_VERSION_MIN_REQUIRED
152 # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE + 2)
153 #endif
154
155 /**
156  * GLIB_VERSION_MAX_ALLOWED:
157  *
158  * A macro that should be defined by the user prior to including
159  * the glib.h header.
160  * The definition should be one of the predefined GLib version
161  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
162  *
163  * This macro defines the latest version of the GLib API that the
164  * package is allowed to make use of.
165  *
166  * If the compiler is configured to warn about the use of deprecated
167  * functions, then using functions added after version
168  * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
169  *
170  * Unless you are using GLIB_CHECK_VERSION() or the like to compile
171  * different code depending on the GLib version, then this should be
172  * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
173  *
174  * Since: 2.32
175  */
176 #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
177 # undef GLIB_VERSION_MAX_ALLOWED
178 # define GLIB_VERSION_MAX_ALLOWED      (GLIB_VERSION_CUR_STABLE)
179 #endif
180
181 /* sanity checks */
182 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
183 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
184 #endif
185 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
186 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
187 #endif
188 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
189 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
190 #endif
191
192 /* These macros are used to mark deprecated functions in GLib headers,
193  * and thus have to be exposed in installed headers. But please
194  * do *not* use them in other projects. Instead, use G_DEPRECATED
195  * or define your own wrappers around it.
196  */
197 #define GLIB_AVAILABLE_IN_ALL                   _GLIB_EXTERN
198
199 /* XXX: Every new stable minor release should add a set of macros here */
200
201 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
202 # define GLIB_DEPRECATED_IN_2_26                GLIB_DEPRECATED
203 # define GLIB_DEPRECATED_IN_2_26_FOR(f)         GLIB_DEPRECATED_FOR(f)
204 #else
205 # define GLIB_DEPRECATED_IN_2_26                _GLIB_EXTERN
206 # define GLIB_DEPRECATED_IN_2_26_FOR(f)         _GLIB_EXTERN
207 #endif
208
209 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
210 # define GLIB_AVAILABLE_IN_2_26                 GLIB_UNAVAILABLE(2, 26)
211 #else
212 # define GLIB_AVAILABLE_IN_2_26                 _GLIB_EXTERN
213 #endif
214
215 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
216 # define GLIB_DEPRECATED_IN_2_28                GLIB_DEPRECATED
217 # define GLIB_DEPRECATED_IN_2_28_FOR(f)         GLIB_DEPRECATED_FOR(f)
218 #else
219 # define GLIB_DEPRECATED_IN_2_28                _GLIB_EXTERN
220 # define GLIB_DEPRECATED_IN_2_28_FOR(f)         _GLIB_EXTERN
221 #endif
222
223 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
224 # define GLIB_AVAILABLE_IN_2_28                 GLIB_UNAVAILABLE(2, 28)
225 #else
226 # define GLIB_AVAILABLE_IN_2_28                 _GLIB_EXTERN
227 #endif
228
229 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
230 # define GLIB_DEPRECATED_IN_2_30                GLIB_DEPRECATED
231 # define GLIB_DEPRECATED_IN_2_30_FOR(f)         GLIB_DEPRECATED_FOR(f)
232 #else
233 # define GLIB_DEPRECATED_IN_2_30                _GLIB_EXTERN
234 # define GLIB_DEPRECATED_IN_2_30_FOR(f)         _GLIB_EXTERN
235 #endif
236
237 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
238 # define GLIB_AVAILABLE_IN_2_30                 GLIB_UNAVAILABLE(2, 30)
239 #else
240 # define GLIB_AVAILABLE_IN_2_30                 _GLIB_EXTERN
241 #endif
242
243 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
244 # define GLIB_DEPRECATED_IN_2_32                GLIB_DEPRECATED
245 # define GLIB_DEPRECATED_IN_2_32_FOR(f)         GLIB_DEPRECATED_FOR(f)
246 #else
247 # define GLIB_DEPRECATED_IN_2_32                _GLIB_EXTERN
248 # define GLIB_DEPRECATED_IN_2_32_FOR(f)         _GLIB_EXTERN
249 #endif
250
251 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
252 # define GLIB_AVAILABLE_IN_2_32                 GLIB_UNAVAILABLE(2, 32)
253 #else
254 # define GLIB_AVAILABLE_IN_2_32                 _GLIB_EXTERN
255 #endif
256
257 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
258 # define GLIB_DEPRECATED_IN_2_34                GLIB_DEPRECATED
259 # define GLIB_DEPRECATED_IN_2_34_FOR(f)         GLIB_DEPRECATED_FOR(f)
260 #else
261 # define GLIB_DEPRECATED_IN_2_34                _GLIB_EXTERN
262 # define GLIB_DEPRECATED_IN_2_34_FOR(f)         _GLIB_EXTERN
263 #endif
264
265 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
266 # define GLIB_AVAILABLE_IN_2_34                 GLIB_UNAVAILABLE(2, 34)
267 #else
268 # define GLIB_AVAILABLE_IN_2_34                 _GLIB_EXTERN
269 #endif
270
271 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
272 # define GLIB_DEPRECATED_IN_2_36                GLIB_DEPRECATED
273 # define GLIB_DEPRECATED_IN_2_36_FOR(f)         GLIB_DEPRECATED_FOR(f)
274 #else
275 # define GLIB_DEPRECATED_IN_2_36                _GLIB_EXTERN
276 # define GLIB_DEPRECATED_IN_2_36_FOR(f)         _GLIB_EXTERN
277 #endif
278
279 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
280 # define GLIB_AVAILABLE_IN_2_36                 GLIB_UNAVAILABLE(2, 36)
281 #else
282 # define GLIB_AVAILABLE_IN_2_36                 _GLIB_EXTERN
283 #endif
284
285 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
286 # define GLIB_DEPRECATED_IN_2_38                GLIB_DEPRECATED
287 # define GLIB_DEPRECATED_IN_2_38_FOR(f)         GLIB_DEPRECATED_FOR(f)
288 #else
289 # define GLIB_DEPRECATED_IN_2_38                _GLIB_EXTERN
290 # define GLIB_DEPRECATED_IN_2_38_FOR(f)         _GLIB_EXTERN
291 #endif
292
293 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
294 # define GLIB_AVAILABLE_IN_2_38                 GLIB_UNAVAILABLE(2, 38)
295 #else
296 # define GLIB_AVAILABLE_IN_2_38                 _GLIB_EXTERN
297 #endif
298
299 #endif /*  __G_VERSION_MACROS_H__ */