Imported Upstream version 2.50.2
[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, see <http://www.gnu.org/licenses/>.
16  */
17
18 /*
19  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GLib Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GLib at ftp://ftp.gtk.org/pub/gtk/.
23  */
24
25 #ifndef __G_VERSION_MACROS_H__
26 #define __G_VERSION_MACROS_H__
27
28 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
29 #error "Only <glib.h> can be included directly."
30 #endif
31
32 /* Version boundaries checks */
33
34 #define G_ENCODE_VERSION(major,minor)   ((major) << 16 | (minor) << 8)
35
36 /* XXX: Every new stable minor release bump should add a macro here */
37
38 /**
39  * GLIB_VERSION_2_26:
40  *
41  * A macro that evaluates to the 2.26 version of GLib, in a format
42  * that can be used by the C pre-processor.
43  *
44  * Since: 2.32
45  */
46 #define GLIB_VERSION_2_26       (G_ENCODE_VERSION (2, 26))
47
48 /**
49  * GLIB_VERSION_2_28:
50  *
51  * A macro that evaluates to the 2.28 version of GLib, in a format
52  * that can be used by the C pre-processor.
53  *
54  * Since: 2.32
55  */
56 #define GLIB_VERSION_2_28       (G_ENCODE_VERSION (2, 28))
57
58 /**
59  * GLIB_VERSION_2_30:
60  *
61  * A macro that evaluates to the 2.30 version of GLib, in a format
62  * that can be used by the C pre-processor.
63  *
64  * Since: 2.32
65  */
66 #define GLIB_VERSION_2_30       (G_ENCODE_VERSION (2, 30))
67
68 /**
69  * GLIB_VERSION_2_32:
70  *
71  * A macro that evaluates to the 2.32 version of GLib, in a format
72  * that can be used by the C pre-processor.
73  *
74  * Since: 2.32
75  */
76 #define GLIB_VERSION_2_32       (G_ENCODE_VERSION (2, 32))
77
78 /**
79  * GLIB_VERSION_2_34:
80  *
81  * A macro that evaluates to the 2.34 version of GLib, in a format
82  * that can be used by the C pre-processor.
83  *
84  * Since: 2.34
85  */
86 #define GLIB_VERSION_2_34       (G_ENCODE_VERSION (2, 34))
87
88 /**
89  * GLIB_VERSION_2_36:
90  *
91  * A macro that evaluates to the 2.36 version of GLib, in a format
92  * that can be used by the C pre-processor.
93  *
94  * Since: 2.36
95  */
96 #define GLIB_VERSION_2_36       (G_ENCODE_VERSION (2, 36))
97
98 /**
99  * GLIB_VERSION_2_38:
100  *
101  * A macro that evaluates to the 2.38 version of GLib, in a format
102  * that can be used by the C pre-processor.
103  *
104  * Since: 2.38
105  */
106 #define GLIB_VERSION_2_38       (G_ENCODE_VERSION (2, 38))
107
108 /**
109  * GLIB_VERSION_2_40:
110  *
111  * A macro that evaluates to the 2.40 version of GLib, in a format
112  * that can be used by the C pre-processor.
113  *
114  * Since: 2.40
115  */
116 #define GLIB_VERSION_2_40       (G_ENCODE_VERSION (2, 40))
117
118 /**
119  * GLIB_VERSION_2_42:
120  *
121  * A macro that evaluates to the 2.42 version of GLib, in a format
122  * that can be used by the C pre-processor.
123  *
124  * Since: 2.42
125  */
126 #define GLIB_VERSION_2_42       (G_ENCODE_VERSION (2, 42))
127
128 /**
129  * GLIB_VERSION_2_44:
130  *
131  * A macro that evaluates to the 2.44 version of GLib, in a format
132  * that can be used by the C pre-processor.
133  *
134  * Since: 2.44
135  */
136 #define GLIB_VERSION_2_44       (G_ENCODE_VERSION (2, 44))
137
138 /**
139  * GLIB_VERSION_2_46:
140  *
141  * A macro that evaluates to the 2.46 version of GLib, in a format
142  * that can be used by the C pre-processor.
143  *
144  * Since: 2.46
145  */
146 #define GLIB_VERSION_2_46       (G_ENCODE_VERSION (2, 46))
147
148 /**
149  * GLIB_VERSION_2_48:
150  *
151  * A macro that evaluates to the 2.48 version of GLib, in a format
152  * that can be used by the C pre-processor.
153  *
154  * Since: 2.48
155  */
156 #define GLIB_VERSION_2_48       (G_ENCODE_VERSION (2, 48))
157
158 /**
159  * GLIB_VERSION_2_50:
160  *
161  * A macro that evaluates to the 2.50 version of GLib, in a format
162  * that can be used by the C pre-processor.
163  *
164  * Since: 2.50
165  */
166 #define GLIB_VERSION_2_50       (G_ENCODE_VERSION (2, 50))
167
168 /* evaluates to the current stable version; for development cycles,
169  * this means the next stable target
170  */
171 #if (GLIB_MINOR_VERSION % 2)
172 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
173 #else
174 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
175 #endif
176
177 /* evaluates to the previous stable version */
178 #if (GLIB_MINOR_VERSION % 2)
179 #define GLIB_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
180 #else
181 #define GLIB_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
182 #endif
183
184 /**
185  * GLIB_VERSION_MIN_REQUIRED:
186  *
187  * A macro that should be defined by the user prior to including
188  * the glib.h header.
189  * The definition should be one of the predefined GLib version
190  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
191  *
192  * This macro defines the earliest version of GLib that the package is
193  * required to be able to compile against.
194  *
195  * If the compiler is configured to warn about the use of deprecated
196  * functions, then using functions that were deprecated in version
197  * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
198  * using functions deprecated in later releases will not).
199  *
200  * Since: 2.32
201  */
202 /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
203  * GLIB_VERSION_X_Y value that we don't know about, it will compare as
204  * 0 in preprocessor tests.
205  */
206 #ifndef GLIB_VERSION_MIN_REQUIRED
207 # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE)
208 #elif GLIB_VERSION_MIN_REQUIRED == 0
209 # undef  GLIB_VERSION_MIN_REQUIRED
210 # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE + 2)
211 #endif
212
213 /**
214  * GLIB_VERSION_MAX_ALLOWED:
215  *
216  * A macro that should be defined by the user prior to including
217  * the glib.h header.
218  * The definition should be one of the predefined GLib version
219  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
220  *
221  * This macro defines the latest version of the GLib API that the
222  * package is allowed to make use of.
223  *
224  * If the compiler is configured to warn about the use of deprecated
225  * functions, then using functions added after version
226  * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
227  *
228  * Unless you are using GLIB_CHECK_VERSION() or the like to compile
229  * different code depending on the GLib version, then this should be
230  * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
231  *
232  * Since: 2.32
233  */
234 #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
235 # undef GLIB_VERSION_MAX_ALLOWED
236 # define GLIB_VERSION_MAX_ALLOWED      (GLIB_VERSION_CUR_STABLE)
237 #endif
238
239 /* sanity checks */
240 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
241 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
242 #endif
243 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
244 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
245 #endif
246 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
247 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
248 #endif
249
250 /* These macros are used to mark deprecated functions in GLib headers,
251  * and thus have to be exposed in installed headers. But please
252  * do *not* use them in other projects. Instead, use G_DEPRECATED
253  * or define your own wrappers around it.
254  */
255 #define GLIB_AVAILABLE_IN_ALL                   _GLIB_EXTERN
256
257 /* XXX: Every new stable minor release should add a set of macros here */
258
259 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
260 # define GLIB_DEPRECATED_IN_2_26                GLIB_DEPRECATED
261 # define GLIB_DEPRECATED_IN_2_26_FOR(f)         GLIB_DEPRECATED_FOR(f)
262 #else
263 # define GLIB_DEPRECATED_IN_2_26                _GLIB_EXTERN
264 # define GLIB_DEPRECATED_IN_2_26_FOR(f)         _GLIB_EXTERN
265 #endif
266
267 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
268 # define GLIB_AVAILABLE_IN_2_26                 GLIB_UNAVAILABLE(2, 26)
269 #else
270 # define GLIB_AVAILABLE_IN_2_26                 _GLIB_EXTERN
271 #endif
272
273 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
274 # define GLIB_DEPRECATED_IN_2_28                GLIB_DEPRECATED
275 # define GLIB_DEPRECATED_IN_2_28_FOR(f)         GLIB_DEPRECATED_FOR(f)
276 #else
277 # define GLIB_DEPRECATED_IN_2_28                _GLIB_EXTERN
278 # define GLIB_DEPRECATED_IN_2_28_FOR(f)         _GLIB_EXTERN
279 #endif
280
281 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
282 # define GLIB_AVAILABLE_IN_2_28                 GLIB_UNAVAILABLE(2, 28)
283 #else
284 # define GLIB_AVAILABLE_IN_2_28                 _GLIB_EXTERN
285 #endif
286
287 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
288 # define GLIB_DEPRECATED_IN_2_30                GLIB_DEPRECATED
289 # define GLIB_DEPRECATED_IN_2_30_FOR(f)         GLIB_DEPRECATED_FOR(f)
290 #else
291 # define GLIB_DEPRECATED_IN_2_30                _GLIB_EXTERN
292 # define GLIB_DEPRECATED_IN_2_30_FOR(f)         _GLIB_EXTERN
293 #endif
294
295 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
296 # define GLIB_AVAILABLE_IN_2_30                 GLIB_UNAVAILABLE(2, 30)
297 #else
298 # define GLIB_AVAILABLE_IN_2_30                 _GLIB_EXTERN
299 #endif
300
301 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
302 # define GLIB_DEPRECATED_IN_2_32                GLIB_DEPRECATED
303 # define GLIB_DEPRECATED_IN_2_32_FOR(f)         GLIB_DEPRECATED_FOR(f)
304 #else
305 # define GLIB_DEPRECATED_IN_2_32                _GLIB_EXTERN
306 # define GLIB_DEPRECATED_IN_2_32_FOR(f)         _GLIB_EXTERN
307 #endif
308
309 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
310 # define GLIB_AVAILABLE_IN_2_32                 GLIB_UNAVAILABLE(2, 32)
311 #else
312 # define GLIB_AVAILABLE_IN_2_32                 _GLIB_EXTERN
313 #endif
314
315 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
316 # define GLIB_DEPRECATED_IN_2_34                GLIB_DEPRECATED
317 # define GLIB_DEPRECATED_IN_2_34_FOR(f)         GLIB_DEPRECATED_FOR(f)
318 #else
319 # define GLIB_DEPRECATED_IN_2_34                _GLIB_EXTERN
320 # define GLIB_DEPRECATED_IN_2_34_FOR(f)         _GLIB_EXTERN
321 #endif
322
323 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
324 # define GLIB_AVAILABLE_IN_2_34                 GLIB_UNAVAILABLE(2, 34)
325 #else
326 # define GLIB_AVAILABLE_IN_2_34                 _GLIB_EXTERN
327 #endif
328
329 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
330 # define GLIB_DEPRECATED_IN_2_36                GLIB_DEPRECATED
331 # define GLIB_DEPRECATED_IN_2_36_FOR(f)         GLIB_DEPRECATED_FOR(f)
332 #else
333 # define GLIB_DEPRECATED_IN_2_36                _GLIB_EXTERN
334 # define GLIB_DEPRECATED_IN_2_36_FOR(f)         _GLIB_EXTERN
335 #endif
336
337 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
338 # define GLIB_AVAILABLE_IN_2_36                 GLIB_UNAVAILABLE(2, 36)
339 #else
340 # define GLIB_AVAILABLE_IN_2_36                 _GLIB_EXTERN
341 #endif
342
343 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
344 # define GLIB_DEPRECATED_IN_2_38                GLIB_DEPRECATED
345 # define GLIB_DEPRECATED_IN_2_38_FOR(f)         GLIB_DEPRECATED_FOR(f)
346 #else
347 # define GLIB_DEPRECATED_IN_2_38                _GLIB_EXTERN
348 # define GLIB_DEPRECATED_IN_2_38_FOR(f)         _GLIB_EXTERN
349 #endif
350
351 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
352 # define GLIB_AVAILABLE_IN_2_38                 GLIB_UNAVAILABLE(2, 38)
353 #else
354 # define GLIB_AVAILABLE_IN_2_38                 _GLIB_EXTERN
355 #endif
356
357 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
358 # define GLIB_DEPRECATED_IN_2_40                GLIB_DEPRECATED
359 # define GLIB_DEPRECATED_IN_2_40_FOR(f)         GLIB_DEPRECATED_FOR(f)
360 #else
361 # define GLIB_DEPRECATED_IN_2_40                _GLIB_EXTERN
362 # define GLIB_DEPRECATED_IN_2_40_FOR(f)         _GLIB_EXTERN
363 #endif
364
365 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
366 # define GLIB_AVAILABLE_IN_2_40                 GLIB_UNAVAILABLE(2, 40)
367 #else
368 # define GLIB_AVAILABLE_IN_2_40                 _GLIB_EXTERN
369 #endif
370
371 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42
372 # define GLIB_DEPRECATED_IN_2_42                GLIB_DEPRECATED
373 # define GLIB_DEPRECATED_IN_2_42_FOR(f)         GLIB_DEPRECATED_FOR(f)
374 #else
375 # define GLIB_DEPRECATED_IN_2_42                _GLIB_EXTERN
376 # define GLIB_DEPRECATED_IN_2_42_FOR(f)         _GLIB_EXTERN
377 #endif
378
379 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42
380 # define GLIB_AVAILABLE_IN_2_42                 GLIB_UNAVAILABLE(2, 42)
381 #else
382 # define GLIB_AVAILABLE_IN_2_42                 _GLIB_EXTERN
383 #endif
384
385 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44
386 # define GLIB_DEPRECATED_IN_2_44                GLIB_DEPRECATED
387 # define GLIB_DEPRECATED_IN_2_44_FOR(f)         GLIB_DEPRECATED_FOR(f)
388 #else
389 # define GLIB_DEPRECATED_IN_2_44                _GLIB_EXTERN
390 # define GLIB_DEPRECATED_IN_2_44_FOR(f)         _GLIB_EXTERN
391 #endif
392
393 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44
394 # define GLIB_AVAILABLE_IN_2_44                 GLIB_UNAVAILABLE(2, 44)
395 #else
396 # define GLIB_AVAILABLE_IN_2_44                 _GLIB_EXTERN
397 #endif
398
399 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46
400 # define GLIB_DEPRECATED_IN_2_46                GLIB_DEPRECATED
401 # define GLIB_DEPRECATED_IN_2_46_FOR(f)         GLIB_DEPRECATED_FOR(f)
402 #else
403 # define GLIB_DEPRECATED_IN_2_46                _GLIB_EXTERN
404 # define GLIB_DEPRECATED_IN_2_46_FOR(f)         _GLIB_EXTERN
405 #endif
406
407 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46
408 # define GLIB_AVAILABLE_IN_2_46                 GLIB_UNAVAILABLE(2, 46)
409 #else
410 # define GLIB_AVAILABLE_IN_2_46                 _GLIB_EXTERN
411 #endif
412
413 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_48
414 # define GLIB_DEPRECATED_IN_2_48                GLIB_DEPRECATED
415 # define GLIB_DEPRECATED_IN_2_48_FOR(f)         GLIB_DEPRECATED_FOR(f)
416 #else
417 # define GLIB_DEPRECATED_IN_2_48                _GLIB_EXTERN
418 # define GLIB_DEPRECATED_IN_2_48_FOR(f)         _GLIB_EXTERN
419 #endif
420
421 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_48
422 # define GLIB_AVAILABLE_IN_2_48                 GLIB_UNAVAILABLE(2, 48)
423 #else
424 # define GLIB_AVAILABLE_IN_2_48                 _GLIB_EXTERN
425 #endif
426
427 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_50
428 # define GLIB_DEPRECATED_IN_2_50                GLIB_DEPRECATED
429 # define GLIB_DEPRECATED_IN_2_50_FOR(f)         GLIB_DEPRECATED_FOR(f)
430 #else
431 # define GLIB_DEPRECATED_IN_2_50                _GLIB_EXTERN
432 # define GLIB_DEPRECATED_IN_2_50_FOR(f)         _GLIB_EXTERN
433 #endif
434
435 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_50
436 # define GLIB_AVAILABLE_IN_2_50                 GLIB_UNAVAILABLE(2, 50)
437 #else
438 # define GLIB_AVAILABLE_IN_2_50                 _GLIB_EXTERN
439 #endif
440
441 #endif /*  __G_VERSION_MACROS_H__ */