19d58a07ee915557a46a39aef69e2478cb1fe80a
[platform/upstream/glib.git] / glib / gversionmacros.h
1 /* GLIB - Library of useful routines for C programming
2  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 /*
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/.
25  */
26
27 #ifndef __G_VERSION_MACROS_H__
28 #define __G_VERSION_MACROS_H__
29
30 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
31 #error "Only <glib.h> can be included directly."
32 #endif
33
34 /* Version boundaries checks */
35
36 #define G_ENCODE_VERSION(major,minor)   ((major) << 16 | (minor) << 8)
37
38 /* XXX: Every new stable minor release bump should add a macro here */
39
40 /**
41  * GLIB_VERSION_2_26:
42  *
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.
45  *
46  * Since: 2.32
47  */
48 #define GLIB_VERSION_2_26       (G_ENCODE_VERSION (2, 26))
49
50 /**
51  * GLIB_VERSION_2_28:
52  *
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.
55  *
56  * Since: 2.32
57  */
58 #define GLIB_VERSION_2_28       (G_ENCODE_VERSION (2, 28))
59
60 /**
61  * GLIB_VERSION_2_30:
62  *
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.
65  *
66  * Since: 2.32
67  */
68 #define GLIB_VERSION_2_30       (G_ENCODE_VERSION (2, 30))
69
70 /**
71  * GLIB_VERSION_2_32:
72  *
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.
75  *
76  * Since: 2.32
77  */
78 #define GLIB_VERSION_2_32       (G_ENCODE_VERSION (2, 32))
79
80 /**
81  * GLIB_VERSION_2_34:
82  *
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.
85  *
86  * Since: 2.34
87  */
88 #define GLIB_VERSION_2_34       (G_ENCODE_VERSION (2, 34))
89
90 /**
91  * GLIB_VERSION_2_36:
92  *
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.
95  *
96  * Since: 2.36
97  */
98 #define GLIB_VERSION_2_36       (G_ENCODE_VERSION (2, 36))
99
100 /**
101  * GLIB_VERSION_2_38:
102  *
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.
105  *
106  * Since: 2.38
107  */
108 #define GLIB_VERSION_2_38       (G_ENCODE_VERSION (2, 38))
109
110 /**
111  * GLIB_VERSION_2_40:
112  *
113  * A macro that evaluates to the 2.38 version of GLib, in a format
114  * that can be used by the C pre-processor.
115  *
116  * Since: 2.40
117  */
118 #define GLIB_VERSION_2_40       (G_ENCODE_VERSION (2, 40))
119
120 /* evaluates to the current stable version; for development cycles,
121  * this means the next stable target
122  */
123 #if (GLIB_MINOR_VERSION % 2)
124 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
125 #else
126 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
127 #endif
128
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))
132 #else
133 #define GLIB_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
134 #endif
135
136 /**
137  * GLIB_VERSION_MIN_REQUIRED:
138  *
139  * A macro that should be defined by the user prior to including
140  * the glib.h header.
141  * The definition should be one of the predefined GLib version
142  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
143  *
144  * This macro defines the earliest version of GLib that the package is
145  * required to be able to compile against.
146  *
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).
151  *
152  * Since: 2.32
153  */
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.
157  */
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)
163 #endif
164
165 /**
166  * GLIB_VERSION_MAX_ALLOWED:
167  *
168  * A macro that should be defined by the user prior to including
169  * the glib.h header.
170  * The definition should be one of the predefined GLib version
171  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
172  *
173  * This macro defines the latest version of the GLib API that the
174  * package is allowed to make use of.
175  *
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.
179  *
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.
183  *
184  * Since: 2.32
185  */
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)
189 #endif
190
191 /* sanity checks */
192 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
193 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
194 #endif
195 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
196 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
197 #endif
198 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
199 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
200 #endif
201
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.
206  */
207 #define GLIB_AVAILABLE_IN_ALL                   _GLIB_EXTERN
208
209 /* XXX: Every new stable minor release should add a set of macros here */
210
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)
214 #else
215 # define GLIB_DEPRECATED_IN_2_26                _GLIB_EXTERN
216 # define GLIB_DEPRECATED_IN_2_26_FOR(f)         _GLIB_EXTERN
217 #endif
218
219 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
220 # define GLIB_AVAILABLE_IN_2_26                 GLIB_UNAVAILABLE(2, 26)
221 #else
222 # define GLIB_AVAILABLE_IN_2_26                 _GLIB_EXTERN
223 #endif
224
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)
228 #else
229 # define GLIB_DEPRECATED_IN_2_28                _GLIB_EXTERN
230 # define GLIB_DEPRECATED_IN_2_28_FOR(f)         _GLIB_EXTERN
231 #endif
232
233 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
234 # define GLIB_AVAILABLE_IN_2_28                 GLIB_UNAVAILABLE(2, 28)
235 #else
236 # define GLIB_AVAILABLE_IN_2_28                 _GLIB_EXTERN
237 #endif
238
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)
242 #else
243 # define GLIB_DEPRECATED_IN_2_30                _GLIB_EXTERN
244 # define GLIB_DEPRECATED_IN_2_30_FOR(f)         _GLIB_EXTERN
245 #endif
246
247 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
248 # define GLIB_AVAILABLE_IN_2_30                 GLIB_UNAVAILABLE(2, 30)
249 #else
250 # define GLIB_AVAILABLE_IN_2_30                 _GLIB_EXTERN
251 #endif
252
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)
256 #else
257 # define GLIB_DEPRECATED_IN_2_32                _GLIB_EXTERN
258 # define GLIB_DEPRECATED_IN_2_32_FOR(f)         _GLIB_EXTERN
259 #endif
260
261 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
262 # define GLIB_AVAILABLE_IN_2_32                 GLIB_UNAVAILABLE(2, 32)
263 #else
264 # define GLIB_AVAILABLE_IN_2_32                 _GLIB_EXTERN
265 #endif
266
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)
270 #else
271 # define GLIB_DEPRECATED_IN_2_34                _GLIB_EXTERN
272 # define GLIB_DEPRECATED_IN_2_34_FOR(f)         _GLIB_EXTERN
273 #endif
274
275 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
276 # define GLIB_AVAILABLE_IN_2_34                 GLIB_UNAVAILABLE(2, 34)
277 #else
278 # define GLIB_AVAILABLE_IN_2_34                 _GLIB_EXTERN
279 #endif
280
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)
284 #else
285 # define GLIB_DEPRECATED_IN_2_36                _GLIB_EXTERN
286 # define GLIB_DEPRECATED_IN_2_36_FOR(f)         _GLIB_EXTERN
287 #endif
288
289 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
290 # define GLIB_AVAILABLE_IN_2_36                 GLIB_UNAVAILABLE(2, 36)
291 #else
292 # define GLIB_AVAILABLE_IN_2_36                 _GLIB_EXTERN
293 #endif
294
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)
298 #else
299 # define GLIB_DEPRECATED_IN_2_38                _GLIB_EXTERN
300 # define GLIB_DEPRECATED_IN_2_38_FOR(f)         _GLIB_EXTERN
301 #endif
302
303 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
304 # define GLIB_AVAILABLE_IN_2_38                 GLIB_UNAVAILABLE(2, 38)
305 #else
306 # define GLIB_AVAILABLE_IN_2_38                 _GLIB_EXTERN
307 #endif
308
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)
312 #else
313 # define GLIB_DEPRECATED_IN_2_40                _GLIB_EXTERN
314 # define GLIB_DEPRECATED_IN_2_40_FOR(f)         _GLIB_EXTERN
315 #endif
316
317 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
318 # define GLIB_AVAILABLE_IN_2_40                 GLIB_UNAVAILABLE(2, 40)
319 #else
320 # define GLIB_AVAILABLE_IN_2_40                 _GLIB_EXTERN
321 #endif
322
323 #endif /*  __G_VERSION_MACROS_H__ */