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 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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
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/.
27 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
28 #error "Only <glib.h> can be included directly."
31 #ifndef __G_VERSION_MACROS_H__
32 #define __G_VERSION_MACROS_H__
34 /* Version boundaries checks */
36 #define G_ENCODE_VERSION(major,minor) ((major) << 16 | (minor) << 8)
38 /* XXX: Every new stable minor release bump should add a macro here */
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.
48 #define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26))
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.
58 #define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28))
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.
68 #define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
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.
78 #define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
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.
88 #define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34))
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.
98 #define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36))
100 /* evaluates to the current stable version; for development cycles,
101 * this means the next stable target
103 #if (GLIB_MINOR_VERSION % 2)
104 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
106 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
109 /* evaluates to the previous stable version */
110 #if (GLIB_MINOR_VERSION % 2)
111 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
113 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
117 * GLIB_VERSION_MIN_REQUIRED:
119 * A macro that should be defined by the user prior to including
121 * The definition should be one of the predefined GLib version
122 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
124 * This macro defines the earliest version of GLib that the package is
125 * required to be able to compile against.
127 * If the compiler is configured to warn about the use of deprecated
128 * functions, then using functions that were deprecated in version
129 * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
130 * using functions deprecated in later releases will not).
134 /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
135 * GLIB_VERSION_X_Y value that we don't know about, it will compare as
136 * 0 in preprocessor tests.
138 #ifndef GLIB_VERSION_MIN_REQUIRED
139 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE)
140 #elif GLIB_VERSION_MIN_REQUIRED == 0
141 # undef GLIB_VERSION_MIN_REQUIRED
142 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2)
146 * GLIB_VERSION_MAX_ALLOWED:
148 * A macro that should be defined by the user prior to including
150 * The definition should be one of the predefined GLib version
151 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
153 * This macro defines the latest version of the GLib API that the
154 * package is allowed to make use of.
156 * If the compiler is configured to warn about the use of deprecated
157 * functions, then using functions added after version
158 * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
160 * Unless you are using GLIB_CHECK_VERSION() or the like to compile
161 * different code depending on the GLib version, then this should be
162 * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
166 #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
167 # undef GLIB_VERSION_MAX_ALLOWED
168 # define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE)
172 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
173 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
175 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
176 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
178 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
179 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
182 /* These macros are used to mark deprecated functions in GLib headers,
183 * and thus have to be exposed in installed headers. But please
184 * do *not* use them in other projects. Instead, use G_DEPRECATED
185 * or define your own wrappers around it.
188 /* XXX: Every new stable minor release should add a set of macros here */
190 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
191 # define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED
192 # define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f)
194 # define GLIB_DEPRECATED_IN_2_26
195 # define GLIB_DEPRECATED_IN_2_26_FOR(f)
198 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
199 # define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
201 # define GLIB_AVAILABLE_IN_2_26
204 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
205 # define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED
206 # define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f)
208 # define GLIB_DEPRECATED_IN_2_28
209 # define GLIB_DEPRECATED_IN_2_28_FOR(f)
212 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
213 # define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
215 # define GLIB_AVAILABLE_IN_2_28
218 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
219 # define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED
220 # define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f)
222 # define GLIB_DEPRECATED_IN_2_30
223 # define GLIB_DEPRECATED_IN_2_30_FOR(f)
226 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
227 # define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
229 # define GLIB_AVAILABLE_IN_2_30
232 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
233 # define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED
234 # define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f)
236 # define GLIB_DEPRECATED_IN_2_32
237 # define GLIB_DEPRECATED_IN_2_32_FOR(f)
240 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
241 # define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
243 # define GLIB_AVAILABLE_IN_2_32
246 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
247 # define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED
248 # define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f)
250 # define GLIB_DEPRECATED_IN_2_34
251 # define GLIB_DEPRECATED_IN_2_34_FOR(f)
254 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
255 # define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
257 # define GLIB_AVAILABLE_IN_2_34
260 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
261 # define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED
262 # define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f)
264 # define GLIB_DEPRECATED_IN_2_36
265 # define GLIB_DEPRECATED_IN_2_36_FOR(f)
268 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
269 # define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
271 # define GLIB_AVAILABLE_IN_2_36
274 #endif /* __G_VERSION_MACROS_H__ */