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, 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."
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 */
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.
46 #define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26))
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.
56 #define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28))
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.
66 #define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
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.
76 #define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
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.
86 #define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34))
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.
96 #define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36))
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.
106 #define GLIB_VERSION_2_38 (G_ENCODE_VERSION (2, 38))
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.
116 #define GLIB_VERSION_2_40 (G_ENCODE_VERSION (2, 40))
118 /* evaluates to the current stable version; for development cycles,
119 * this means the next stable target
121 #if (GLIB_MINOR_VERSION % 2)
122 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
124 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
127 /* evaluates to the previous stable version */
128 #if (GLIB_MINOR_VERSION % 2)
129 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
131 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
135 * GLIB_VERSION_MIN_REQUIRED:
137 * A macro that should be defined by the user prior to including
139 * The definition should be one of the predefined GLib version
140 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
142 * This macro defines the earliest version of GLib that the package is
143 * required to be able to compile against.
145 * If the compiler is configured to warn about the use of deprecated
146 * functions, then using functions that were deprecated in version
147 * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
148 * using functions deprecated in later releases will not).
152 /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
153 * GLIB_VERSION_X_Y value that we don't know about, it will compare as
154 * 0 in preprocessor tests.
156 #ifndef GLIB_VERSION_MIN_REQUIRED
157 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE)
158 #elif GLIB_VERSION_MIN_REQUIRED == 0
159 # undef GLIB_VERSION_MIN_REQUIRED
160 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2)
164 * GLIB_VERSION_MAX_ALLOWED:
166 * A macro that should be defined by the user prior to including
168 * The definition should be one of the predefined GLib version
169 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
171 * This macro defines the latest version of the GLib API that the
172 * package is allowed to make use of.
174 * If the compiler is configured to warn about the use of deprecated
175 * functions, then using functions added after version
176 * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
178 * Unless you are using GLIB_CHECK_VERSION() or the like to compile
179 * different code depending on the GLib version, then this should be
180 * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
184 #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
185 # undef GLIB_VERSION_MAX_ALLOWED
186 # define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE)
190 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
191 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
193 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
194 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
196 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
197 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
200 /* These macros are used to mark deprecated functions in GLib headers,
201 * and thus have to be exposed in installed headers. But please
202 * do *not* use them in other projects. Instead, use G_DEPRECATED
203 * or define your own wrappers around it.
205 #define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN
207 /* XXX: Every new stable minor release should add a set of macros here */
209 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
210 # define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED
211 # define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f)
213 # define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN
214 # define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN
217 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
218 # define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
220 # define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN
223 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
224 # define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED
225 # define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f)
227 # define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN
228 # define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN
231 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
232 # define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
234 # define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN
237 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
238 # define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED
239 # define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f)
241 # define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN
242 # define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN
245 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
246 # define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
248 # define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN
251 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
252 # define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED
253 # define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f)
255 # define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN
256 # define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN
259 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
260 # define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
262 # define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN
265 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
266 # define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED
267 # define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f)
269 # define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN
270 # define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN
273 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
274 # define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
276 # define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN
279 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
280 # define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED
281 # define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f)
283 # define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN
284 # define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN
287 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
288 # define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
290 # define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN
293 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
294 # define GLIB_DEPRECATED_IN_2_38 GLIB_DEPRECATED
295 # define GLIB_DEPRECATED_IN_2_38_FOR(f) GLIB_DEPRECATED_FOR(f)
297 # define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN
298 # define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN
301 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
302 # define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38)
304 # define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN
307 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
308 # define GLIB_DEPRECATED_IN_2_40 GLIB_DEPRECATED
309 # define GLIB_DEPRECATED_IN_2_40_FOR(f) GLIB_DEPRECATED_FOR(f)
311 # define GLIB_DEPRECATED_IN_2_40 _GLIB_EXTERN
312 # define GLIB_DEPRECATED_IN_2_40_FOR(f) _GLIB_EXTERN
315 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
316 # define GLIB_AVAILABLE_IN_2_40 GLIB_UNAVAILABLE(2, 40)
318 # define GLIB_AVAILABLE_IN_2_40 _GLIB_EXTERN
321 #endif /* __G_VERSION_MACROS_H__ */