Move single-include guards inside include guards
[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 /* evaluates to the current stable version; for development cycles,
101  * this means the next stable target
102  */
103 #if (GLIB_MINOR_VERSION % 2)
104 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
105 #else
106 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
107 #endif
108
109 /* evaluates to the previous stable version */
110 #if (GLIB_MINOR_VERSION % 2)
111 #define GLIB_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
112 #else
113 #define GLIB_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
114 #endif
115
116 /**
117  * GLIB_VERSION_MIN_REQUIRED:
118  *
119  * A macro that should be defined by the user prior to including
120  * the glib.h header.
121  * The definition should be one of the predefined GLib version
122  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
123  *
124  * This macro defines the earliest version of GLib that the package is
125  * required to be able to compile against.
126  *
127  * If the compiler is configured to warn about the use of deprecated
128  * functions, then using functions that were deprecated in version
129  * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
130  * using functions deprecated in later releases will not).
131  *
132  * Since: 2.32
133  */
134 /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
135  * GLIB_VERSION_X_Y value that we don't know about, it will compare as
136  * 0 in preprocessor tests.
137  */
138 #ifndef GLIB_VERSION_MIN_REQUIRED
139 # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE)
140 #elif GLIB_VERSION_MIN_REQUIRED == 0
141 # undef  GLIB_VERSION_MIN_REQUIRED
142 # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE + 2)
143 #endif
144
145 /**
146  * GLIB_VERSION_MAX_ALLOWED:
147  *
148  * A macro that should be defined by the user prior to including
149  * the glib.h header.
150  * The definition should be one of the predefined GLib version
151  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
152  *
153  * This macro defines the latest version of the GLib API that the
154  * package is allowed to make use of.
155  *
156  * If the compiler is configured to warn about the use of deprecated
157  * functions, then using functions added after version
158  * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
159  *
160  * Unless you are using GLIB_CHECK_VERSION() or the like to compile
161  * different code depending on the GLib version, then this should be
162  * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
163  *
164  * Since: 2.32
165  */
166 #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
167 # undef GLIB_VERSION_MAX_ALLOWED
168 # define GLIB_VERSION_MAX_ALLOWED      (GLIB_VERSION_CUR_STABLE)
169 #endif
170
171 /* sanity checks */
172 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
173 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
174 #endif
175 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
176 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
177 #endif
178 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
179 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
180 #endif
181
182 /* These macros are used to mark deprecated functions in GLib headers,
183  * and thus have to be exposed in installed headers. But please
184  * do *not* use them in other projects. Instead, use G_DEPRECATED
185  * or define your own wrappers around it.
186  */
187
188 /* XXX: Every new stable minor release should add a set of macros here */
189
190 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
191 # define GLIB_DEPRECATED_IN_2_26                GLIB_DEPRECATED
192 # define GLIB_DEPRECATED_IN_2_26_FOR(f)         GLIB_DEPRECATED_FOR(f)
193 #else
194 # define GLIB_DEPRECATED_IN_2_26
195 # define GLIB_DEPRECATED_IN_2_26_FOR(f)
196 #endif
197
198 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
199 # define GLIB_AVAILABLE_IN_2_26                 GLIB_UNAVAILABLE(2, 26)
200 #else
201 # define GLIB_AVAILABLE_IN_2_26
202 #endif
203
204 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
205 # define GLIB_DEPRECATED_IN_2_28                GLIB_DEPRECATED
206 # define GLIB_DEPRECATED_IN_2_28_FOR(f)         GLIB_DEPRECATED_FOR(f)
207 #else
208 # define GLIB_DEPRECATED_IN_2_28
209 # define GLIB_DEPRECATED_IN_2_28_FOR(f)
210 #endif
211
212 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
213 # define GLIB_AVAILABLE_IN_2_28                 GLIB_UNAVAILABLE(2, 28)
214 #else
215 # define GLIB_AVAILABLE_IN_2_28
216 #endif
217
218 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
219 # define GLIB_DEPRECATED_IN_2_30                GLIB_DEPRECATED
220 # define GLIB_DEPRECATED_IN_2_30_FOR(f)         GLIB_DEPRECATED_FOR(f)
221 #else
222 # define GLIB_DEPRECATED_IN_2_30
223 # define GLIB_DEPRECATED_IN_2_30_FOR(f)
224 #endif
225
226 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
227 # define GLIB_AVAILABLE_IN_2_30                 GLIB_UNAVAILABLE(2, 30)
228 #else
229 # define GLIB_AVAILABLE_IN_2_30
230 #endif
231
232 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
233 # define GLIB_DEPRECATED_IN_2_32                GLIB_DEPRECATED
234 # define GLIB_DEPRECATED_IN_2_32_FOR(f)         GLIB_DEPRECATED_FOR(f)
235 #else
236 # define GLIB_DEPRECATED_IN_2_32
237 # define GLIB_DEPRECATED_IN_2_32_FOR(f)
238 #endif
239
240 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
241 # define GLIB_AVAILABLE_IN_2_32                 GLIB_UNAVAILABLE(2, 32)
242 #else
243 # define GLIB_AVAILABLE_IN_2_32
244 #endif
245
246 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
247 # define GLIB_DEPRECATED_IN_2_34                GLIB_DEPRECATED
248 # define GLIB_DEPRECATED_IN_2_34_FOR(f)         GLIB_DEPRECATED_FOR(f)
249 #else
250 # define GLIB_DEPRECATED_IN_2_34
251 # define GLIB_DEPRECATED_IN_2_34_FOR(f)
252 #endif
253
254 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
255 # define GLIB_AVAILABLE_IN_2_34                 GLIB_UNAVAILABLE(2, 34)
256 #else
257 # define GLIB_AVAILABLE_IN_2_34
258 #endif
259
260 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
261 # define GLIB_DEPRECATED_IN_2_36                GLIB_DEPRECATED
262 # define GLIB_DEPRECATED_IN_2_36_FOR(f)         GLIB_DEPRECATED_FOR(f)
263 #else
264 # define GLIB_DEPRECATED_IN_2_36
265 # define GLIB_DEPRECATED_IN_2_36_FOR(f)
266 #endif
267
268 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
269 # define GLIB_AVAILABLE_IN_2_36                 GLIB_UNAVAILABLE(2, 36)
270 #else
271 # define GLIB_AVAILABLE_IN_2_36
272 #endif
273
274 #endif /*  __G_VERSION_MACROS_H__ */