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))
110 /* evaluates to the current stable version; for development cycles,
111 * this means the next stable target
113 #if (GLIB_MINOR_VERSION % 2)
114 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
116 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
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))
123 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
127 * GLIB_VERSION_MIN_REQUIRED:
129 * A macro that should be defined by the user prior to including
131 * The definition should be one of the predefined GLib version
132 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
134 * This macro defines the earliest version of GLib that the package is
135 * required to be able to compile against.
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).
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.
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)
156 * GLIB_VERSION_MAX_ALLOWED:
158 * A macro that should be defined by the user prior to including
160 * The definition should be one of the predefined GLib version
161 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
163 * This macro defines the latest version of the GLib API that the
164 * package is allowed to make use of.
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.
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.
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)
182 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
183 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
185 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
186 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
188 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
189 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
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.
197 #define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN
199 /* XXX: Every new stable minor release should add a set of macros here */
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)
205 # define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN
206 # define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN
209 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
210 # define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
212 # define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN
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)
219 # define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN
220 # define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN
223 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
224 # define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
226 # define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN
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)
233 # define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN
234 # define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN
237 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
238 # define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
240 # define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN
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)
247 # define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN
248 # define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN
251 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
252 # define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
254 # define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN
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)
261 # define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN
262 # define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN
265 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
266 # define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
268 # define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN
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)
275 # define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN
276 # define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN
279 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
280 # define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
282 # define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN
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)
289 # define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN
290 # define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN
293 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
294 # define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38)
296 # define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN
299 #endif /* __G_VERSION_MACROS_H__ */