Add support for g_auto[s]list(Type)
[glib.git] / glib / gversionmacros.h
blobdf6585c2faccf09596f4e45cda2939a760d9ce2a
1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.1 of the License, or (at your option) any later version.
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.
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/>.
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/.
25 #ifndef __G_VERSION_MACROS_H__
26 #define __G_VERSION_MACROS_H__
28 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
29 #error "Only <glib.h> can be included directly."
30 #endif
32 /* Version boundaries checks */
34 #define G_ENCODE_VERSION(major,minor) ((major) << 16 | (minor) << 8)
36 /* XXX: Every new stable minor release bump should add a macro here */
38 /**
39 * GLIB_VERSION_2_26:
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.
44 * Since: 2.32
46 #define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26))
48 /**
49 * GLIB_VERSION_2_28:
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.
54 * Since: 2.32
56 #define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28))
58 /**
59 * GLIB_VERSION_2_30:
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.
64 * Since: 2.32
66 #define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
68 /**
69 * GLIB_VERSION_2_32:
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.
74 * Since: 2.32
76 #define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
78 /**
79 * GLIB_VERSION_2_34:
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.
84 * Since: 2.34
86 #define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34))
88 /**
89 * GLIB_VERSION_2_36:
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.
94 * Since: 2.36
96 #define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36))
98 /**
99 * GLIB_VERSION_2_38:
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.
104 * Since: 2.38
106 #define GLIB_VERSION_2_38 (G_ENCODE_VERSION (2, 38))
109 * GLIB_VERSION_2_40:
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.
114 * Since: 2.40
116 #define GLIB_VERSION_2_40 (G_ENCODE_VERSION (2, 40))
119 * GLIB_VERSION_2_42:
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.
124 * Since: 2.42
126 #define GLIB_VERSION_2_42 (G_ENCODE_VERSION (2, 42))
129 * GLIB_VERSION_2_44:
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.
134 * Since: 2.44
136 #define GLIB_VERSION_2_44 (G_ENCODE_VERSION (2, 44))
139 * GLIB_VERSION_2_46:
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.
144 * Since: 2.46
146 #define GLIB_VERSION_2_46 (G_ENCODE_VERSION (2, 46))
149 * GLIB_VERSION_2_48:
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.
154 * Since: 2.48
156 #define GLIB_VERSION_2_48 (G_ENCODE_VERSION (2, 48))
159 * GLIB_VERSION_2_50:
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.
164 * Since: 2.50
166 #define GLIB_VERSION_2_50 (G_ENCODE_VERSION (2, 50))
169 * GLIB_VERSION_2_52:
171 * A macro that evaluates to the 2.52 version of GLib, in a format
172 * that can be used by the C pre-processor.
174 * Since: 2.52
176 #define GLIB_VERSION_2_52 (G_ENCODE_VERSION (2, 52))
179 * GLIB_VERSION_2_54:
181 * A macro that evaluates to the 2.54 version of GLib, in a format
182 * that can be used by the C pre-processor.
184 * Since: 2.54
186 #define GLIB_VERSION_2_54 (G_ENCODE_VERSION (2, 54))
189 * GLIB_VERSION_2_56:
191 * A macro that evaluates to the 2.56 version of GLib, in a format
192 * that can be used by the C pre-processor.
194 * Since: 2.56
196 #define GLIB_VERSION_2_56 (G_ENCODE_VERSION (2, 56))
198 /* evaluates to the current stable version; for development cycles,
199 * this means the next stable target
201 #if (GLIB_MINOR_VERSION % 2)
202 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
203 #else
204 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
205 #endif
207 /* evaluates to the previous stable version */
208 #if (GLIB_MINOR_VERSION % 2)
209 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
210 #else
211 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
212 #endif
215 * GLIB_VERSION_MIN_REQUIRED:
217 * A macro that should be defined by the user prior to including
218 * the glib.h header.
219 * The definition should be one of the predefined GLib version
220 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
222 * This macro defines the earliest version of GLib that the package is
223 * required to be able to compile against.
225 * If the compiler is configured to warn about the use of deprecated
226 * functions, then using functions that were deprecated in version
227 * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
228 * using functions deprecated in later releases will not).
230 * Since: 2.32
232 /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
233 * GLIB_VERSION_X_Y value that we don't know about, it will compare as
234 * 0 in preprocessor tests.
236 #ifndef GLIB_VERSION_MIN_REQUIRED
237 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE)
238 #elif GLIB_VERSION_MIN_REQUIRED == 0
239 # undef GLIB_VERSION_MIN_REQUIRED
240 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2)
241 #endif
244 * GLIB_VERSION_MAX_ALLOWED:
246 * A macro that should be defined by the user prior to including
247 * the glib.h header.
248 * The definition should be one of the predefined GLib version
249 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
251 * This macro defines the latest version of the GLib API that the
252 * package is allowed to make use of.
254 * If the compiler is configured to warn about the use of deprecated
255 * functions, then using functions added after version
256 * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
258 * Unless you are using GLIB_CHECK_VERSION() or the like to compile
259 * different code depending on the GLib version, then this should be
260 * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
262 * Since: 2.32
264 #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
265 # undef GLIB_VERSION_MAX_ALLOWED
266 # define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE)
267 #endif
269 /* sanity checks */
270 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
271 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
272 #endif
273 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
274 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
275 #endif
276 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
277 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
278 #endif
280 /* These macros are used to mark deprecated functions in GLib headers,
281 * and thus have to be exposed in installed headers. But please
282 * do *not* use them in other projects. Instead, use G_DEPRECATED
283 * or define your own wrappers around it.
285 #define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN
287 /* XXX: Every new stable minor release should add a set of macros here */
289 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
290 # define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED
291 # define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f)
292 #else
293 # define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN
294 # define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN
295 #endif
297 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
298 # define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
299 #else
300 # define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN
301 #endif
303 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
304 # define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED
305 # define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f)
306 #else
307 # define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN
308 # define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN
309 #endif
311 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
312 # define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
313 #else
314 # define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN
315 #endif
317 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
318 # define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED
319 # define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f)
320 #else
321 # define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN
322 # define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN
323 #endif
325 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
326 # define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
327 #else
328 # define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN
329 #endif
331 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
332 # define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED
333 # define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f)
334 #else
335 # define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN
336 # define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN
337 #endif
339 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
340 # define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
341 #else
342 # define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN
343 #endif
345 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
346 # define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED
347 # define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f)
348 #else
349 # define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN
350 # define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN
351 #endif
353 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
354 # define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
355 #else
356 # define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN
357 #endif
359 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
360 # define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED
361 # define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f)
362 #else
363 # define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN
364 # define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN
365 #endif
367 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
368 # define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
369 #else
370 # define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN
371 #endif
373 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
374 # define GLIB_DEPRECATED_IN_2_38 GLIB_DEPRECATED
375 # define GLIB_DEPRECATED_IN_2_38_FOR(f) GLIB_DEPRECATED_FOR(f)
376 #else
377 # define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN
378 # define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN
379 #endif
381 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
382 # define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38)
383 #else
384 # define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN
385 #endif
387 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
388 # define GLIB_DEPRECATED_IN_2_40 GLIB_DEPRECATED
389 # define GLIB_DEPRECATED_IN_2_40_FOR(f) GLIB_DEPRECATED_FOR(f)
390 #else
391 # define GLIB_DEPRECATED_IN_2_40 _GLIB_EXTERN
392 # define GLIB_DEPRECATED_IN_2_40_FOR(f) _GLIB_EXTERN
393 #endif
395 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
396 # define GLIB_AVAILABLE_IN_2_40 GLIB_UNAVAILABLE(2, 40)
397 #else
398 # define GLIB_AVAILABLE_IN_2_40 _GLIB_EXTERN
399 #endif
401 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42
402 # define GLIB_DEPRECATED_IN_2_42 GLIB_DEPRECATED
403 # define GLIB_DEPRECATED_IN_2_42_FOR(f) GLIB_DEPRECATED_FOR(f)
404 #else
405 # define GLIB_DEPRECATED_IN_2_42 _GLIB_EXTERN
406 # define GLIB_DEPRECATED_IN_2_42_FOR(f) _GLIB_EXTERN
407 #endif
409 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42
410 # define GLIB_AVAILABLE_IN_2_42 GLIB_UNAVAILABLE(2, 42)
411 #else
412 # define GLIB_AVAILABLE_IN_2_42 _GLIB_EXTERN
413 #endif
415 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44
416 # define GLIB_DEPRECATED_IN_2_44 GLIB_DEPRECATED
417 # define GLIB_DEPRECATED_IN_2_44_FOR(f) GLIB_DEPRECATED_FOR(f)
418 #else
419 # define GLIB_DEPRECATED_IN_2_44 _GLIB_EXTERN
420 # define GLIB_DEPRECATED_IN_2_44_FOR(f) _GLIB_EXTERN
421 #endif
423 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44
424 # define GLIB_AVAILABLE_IN_2_44 GLIB_UNAVAILABLE(2, 44)
425 #else
426 # define GLIB_AVAILABLE_IN_2_44 _GLIB_EXTERN
427 #endif
429 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46
430 # define GLIB_DEPRECATED_IN_2_46 GLIB_DEPRECATED
431 # define GLIB_DEPRECATED_IN_2_46_FOR(f) GLIB_DEPRECATED_FOR(f)
432 #else
433 # define GLIB_DEPRECATED_IN_2_46 _GLIB_EXTERN
434 # define GLIB_DEPRECATED_IN_2_46_FOR(f) _GLIB_EXTERN
435 #endif
437 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46
438 # define GLIB_AVAILABLE_IN_2_46 GLIB_UNAVAILABLE(2, 46)
439 #else
440 # define GLIB_AVAILABLE_IN_2_46 _GLIB_EXTERN
441 #endif
443 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_48
444 # define GLIB_DEPRECATED_IN_2_48 GLIB_DEPRECATED
445 # define GLIB_DEPRECATED_IN_2_48_FOR(f) GLIB_DEPRECATED_FOR(f)
446 #else
447 # define GLIB_DEPRECATED_IN_2_48 _GLIB_EXTERN
448 # define GLIB_DEPRECATED_IN_2_48_FOR(f) _GLIB_EXTERN
449 #endif
451 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_48
452 # define GLIB_AVAILABLE_IN_2_48 GLIB_UNAVAILABLE(2, 48)
453 #else
454 # define GLIB_AVAILABLE_IN_2_48 _GLIB_EXTERN
455 #endif
457 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_50
458 # define GLIB_DEPRECATED_IN_2_50 GLIB_DEPRECATED
459 # define GLIB_DEPRECATED_IN_2_50_FOR(f) GLIB_DEPRECATED_FOR(f)
460 #else
461 # define GLIB_DEPRECATED_IN_2_50 _GLIB_EXTERN
462 # define GLIB_DEPRECATED_IN_2_50_FOR(f) _GLIB_EXTERN
463 #endif
465 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_50
466 # define GLIB_AVAILABLE_IN_2_50 GLIB_UNAVAILABLE(2, 50)
467 #else
468 # define GLIB_AVAILABLE_IN_2_50 _GLIB_EXTERN
469 #endif
471 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_52
472 # define GLIB_DEPRECATED_IN_2_52 GLIB_DEPRECATED
473 # define GLIB_DEPRECATED_IN_2_52_FOR(f) GLIB_DEPRECATED_FOR(f)
474 #else
475 # define GLIB_DEPRECATED_IN_2_52 _GLIB_EXTERN
476 # define GLIB_DEPRECATED_IN_2_52_FOR(f) _GLIB_EXTERN
477 #endif
479 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_52
480 # define GLIB_AVAILABLE_IN_2_52 GLIB_UNAVAILABLE(2, 52)
481 #else
482 # define GLIB_AVAILABLE_IN_2_52 _GLIB_EXTERN
483 #endif
485 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_54
486 # define GLIB_DEPRECATED_IN_2_54 GLIB_DEPRECATED
487 # define GLIB_DEPRECATED_IN_2_54_FOR(f) GLIB_DEPRECATED_FOR(f)
488 #else
489 # define GLIB_DEPRECATED_IN_2_54 _GLIB_EXTERN
490 # define GLIB_DEPRECATED_IN_2_54_FOR(f) _GLIB_EXTERN
491 #endif
493 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_54
494 # define GLIB_AVAILABLE_IN_2_54 GLIB_UNAVAILABLE(2, 54)
495 #else
496 # define GLIB_AVAILABLE_IN_2_54 _GLIB_EXTERN
497 #endif
499 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_56
500 # define GLIB_DEPRECATED_IN_2_56 GLIB_DEPRECATED
501 # define GLIB_DEPRECATED_IN_2_56_FOR(f) GLIB_DEPRECATED_FOR(f)
502 #else
503 # define GLIB_DEPRECATED_IN_2_56 _GLIB_EXTERN
504 # define GLIB_DEPRECATED_IN_2_56_FOR(f) _GLIB_EXTERN
505 #endif
507 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_56
508 # define GLIB_AVAILABLE_IN_2_56 GLIB_UNAVAILABLE(2, 56)
509 #else
510 # define GLIB_AVAILABLE_IN_2_56 _GLIB_EXTERN
511 #endif
513 #endif /* __G_VERSION_MACROS_H__ */