GIcon: add g_icon_[de]serialize()
[glib.git] / glib / gversionmacros.h
blobb591534f2f9ed3274c604d4d9484b272898f4f38
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."
32 #endif
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 */
40 /**
41 * GLIB_VERSION_2_26:
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.
46 * Since: 2.32
48 #define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26))
50 /**
51 * GLIB_VERSION_2_28:
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.
56 * Since: 2.32
58 #define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28))
60 /**
61 * GLIB_VERSION_2_30:
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.
66 * Since: 2.32
68 #define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
70 /**
71 * GLIB_VERSION_2_32:
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.
76 * Since: 2.32
78 #define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
80 /**
81 * GLIB_VERSION_2_34:
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.
86 * Since: 2.34
88 #define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34))
90 /**
91 * GLIB_VERSION_2_36:
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.
96 * Since: 2.36
98 #define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36))
101 * GLIB_VERSION_2_38:
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.
106 * Since: 2.38
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))
115 #else
116 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
117 #endif
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))
122 #else
123 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
124 #endif
127 * GLIB_VERSION_MIN_REQUIRED:
129 * A macro that should be defined by the user prior to including
130 * the glib.h header.
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).
142 * Since: 2.32
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)
153 #endif
156 * GLIB_VERSION_MAX_ALLOWED:
158 * A macro that should be defined by the user prior to including
159 * the glib.h header.
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.
174 * Since: 2.32
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)
179 #endif
181 /* sanity checks */
182 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
183 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
184 #endif
185 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
186 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
187 #endif
188 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
189 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
190 #endif
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)
204 #else
205 # define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN
206 # define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN
207 #endif
209 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
210 # define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
211 #else
212 # define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN
213 #endif
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)
218 #else
219 # define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN
220 # define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN
221 #endif
223 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
224 # define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
225 #else
226 # define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN
227 #endif
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)
232 #else
233 # define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN
234 # define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN
235 #endif
237 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
238 # define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
239 #else
240 # define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN
241 #endif
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)
246 #else
247 # define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN
248 # define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN
249 #endif
251 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
252 # define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
253 #else
254 # define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN
255 #endif
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)
260 #else
261 # define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN
262 # define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN
263 #endif
265 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
266 # define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
267 #else
268 # define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN
269 #endif
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)
274 #else
275 # define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN
276 # define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN
277 #endif
279 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
280 # define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
281 #else
282 # define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN
283 #endif
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)
288 #else
289 # define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN
290 # define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN
291 #endif
293 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
294 # define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38)
295 #else
296 # define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN
297 #endif
299 #endif /* __G_VERSION_MACROS_H__ */