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 #ifndef __G_VERSION_MACROS_H__
28 #define __G_VERSION_MACROS_H__
30 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
31 #error "Only <glib.h> can be included directly."
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))
103 * A macro that evaluates to the 2.38 version of GLib, in a format
104 * that can be used by the C pre-processor.
108 #define GLIB_VERSION_2_38 (G_ENCODE_VERSION (2, 38))
113 * A macro that evaluates to the 2.40 version of GLib, in a format
114 * that can be used by the C pre-processor.
118 #define GLIB_VERSION_2_40 (G_ENCODE_VERSION (2, 40))
120 /* evaluates to the current stable version; for development cycles,
121 * this means the next stable target
123 #if (GLIB_MINOR_VERSION % 2)
124 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
126 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
129 /* evaluates to the previous stable version */
130 #if (GLIB_MINOR_VERSION % 2)
131 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
133 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
137 * GLIB_VERSION_MIN_REQUIRED:
139 * A macro that should be defined by the user prior to including
141 * The definition should be one of the predefined GLib version
142 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
144 * This macro defines the earliest version of GLib that the package is
145 * required to be able to compile against.
147 * If the compiler is configured to warn about the use of deprecated
148 * functions, then using functions that were deprecated in version
149 * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
150 * using functions deprecated in later releases will not).
154 /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
155 * GLIB_VERSION_X_Y value that we don't know about, it will compare as
156 * 0 in preprocessor tests.
158 #ifndef GLIB_VERSION_MIN_REQUIRED
159 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE)
160 #elif GLIB_VERSION_MIN_REQUIRED == 0
161 # undef GLIB_VERSION_MIN_REQUIRED
162 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2)
166 * GLIB_VERSION_MAX_ALLOWED:
168 * A macro that should be defined by the user prior to including
170 * The definition should be one of the predefined GLib version
171 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
173 * This macro defines the latest version of the GLib API that the
174 * package is allowed to make use of.
176 * If the compiler is configured to warn about the use of deprecated
177 * functions, then using functions added after version
178 * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
180 * Unless you are using GLIB_CHECK_VERSION() or the like to compile
181 * different code depending on the GLib version, then this should be
182 * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
186 #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
187 # undef GLIB_VERSION_MAX_ALLOWED
188 # define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE)
192 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
193 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
195 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
196 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
198 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
199 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
202 /* These macros are used to mark deprecated functions in GLib headers,
203 * and thus have to be exposed in installed headers. But please
204 * do *not* use them in other projects. Instead, use G_DEPRECATED
205 * or define your own wrappers around it.
207 #define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN
209 /* XXX: Every new stable minor release should add a set of macros here */
211 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
212 # define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED
213 # define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f)
215 # define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN
216 # define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN
219 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
220 # define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
222 # define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN
225 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
226 # define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED
227 # define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f)
229 # define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN
230 # define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN
233 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
234 # define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
236 # define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN
239 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
240 # define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED
241 # define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f)
243 # define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN
244 # define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN
247 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
248 # define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
250 # define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN
253 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
254 # define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED
255 # define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f)
257 # define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN
258 # define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN
261 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
262 # define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
264 # define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN
267 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
268 # define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED
269 # define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f)
271 # define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN
272 # define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN
275 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
276 # define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
278 # define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN
281 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
282 # define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED
283 # define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f)
285 # define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN
286 # define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN
289 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
290 # define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
292 # define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN
295 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
296 # define GLIB_DEPRECATED_IN_2_38 GLIB_DEPRECATED
297 # define GLIB_DEPRECATED_IN_2_38_FOR(f) GLIB_DEPRECATED_FOR(f)
299 # define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN
300 # define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN
303 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
304 # define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38)
306 # define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN
309 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
310 # define GLIB_DEPRECATED_IN_2_40 GLIB_DEPRECATED
311 # define GLIB_DEPRECATED_IN_2_40_FOR(f) GLIB_DEPRECATED_FOR(f)
313 # define GLIB_DEPRECATED_IN_2_40 _GLIB_EXTERN
314 # define GLIB_DEPRECATED_IN_2_40_FOR(f) _GLIB_EXTERN
317 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
318 # define GLIB_AVAILABLE_IN_2_40 GLIB_UNAVAILABLE(2, 40)
320 # define GLIB_AVAILABLE_IN_2_40 _GLIB_EXTERN
323 #endif /* __G_VERSION_MACROS_H__ */