1 | /* GLIB - Library of useful routines for C programming |
2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
3 | * |
4 | * SPDX-License-Identifier: LGPL-2.1-or-later |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2.1 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Lesser General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Lesser General Public |
17 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
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 | /** |
39 | * GLIB_VERSION_2_2: |
40 | * |
41 | * A macro that evaluates to the 2.2 version of GLib, in a format |
42 | * that can be used by the C pre-processor. |
43 | * |
44 | * Since: 2.32 |
45 | */ |
46 | #define GLIB_VERSION_2_2 (G_ENCODE_VERSION (2, 2)) |
47 | /** |
48 | * GLIB_VERSION_2_4: |
49 | * |
50 | * A macro that evaluates to the 2.4 version of GLib, in a format |
51 | * that can be used by the C pre-processor. |
52 | * |
53 | * Since: 2.32 |
54 | */ |
55 | #define GLIB_VERSION_2_4 (G_ENCODE_VERSION (2, 4)) |
56 | /** |
57 | * GLIB_VERSION_2_6: |
58 | * |
59 | * A macro that evaluates to the 2.6 version of GLib, in a format |
60 | * that can be used by the C pre-processor. |
61 | * |
62 | * Since: 2.32 |
63 | */ |
64 | #define GLIB_VERSION_2_6 (G_ENCODE_VERSION (2, 6)) |
65 | /** |
66 | * GLIB_VERSION_2_8: |
67 | * |
68 | * A macro that evaluates to the 2.8 version of GLib, in a format |
69 | * that can be used by the C pre-processor. |
70 | * |
71 | * Since: 2.32 |
72 | */ |
73 | #define GLIB_VERSION_2_8 (G_ENCODE_VERSION (2, 8)) |
74 | /** |
75 | * GLIB_VERSION_2_10: |
76 | * |
77 | * A macro that evaluates to the 2.10 version of GLib, in a format |
78 | * that can be used by the C pre-processor. |
79 | * |
80 | * Since: 2.32 |
81 | */ |
82 | #define GLIB_VERSION_2_10 (G_ENCODE_VERSION (2, 10)) |
83 | /** |
84 | * GLIB_VERSION_2_12: |
85 | * |
86 | * A macro that evaluates to the 2.12 version of GLib, in a format |
87 | * that can be used by the C pre-processor. |
88 | * |
89 | * Since: 2.32 |
90 | */ |
91 | #define GLIB_VERSION_2_12 (G_ENCODE_VERSION (2, 12)) |
92 | /** |
93 | * GLIB_VERSION_2_14: |
94 | * |
95 | * A macro that evaluates to the 2.14 version of GLib, in a format |
96 | * that can be used by the C pre-processor. |
97 | * |
98 | * Since: 2.32 |
99 | */ |
100 | #define GLIB_VERSION_2_14 (G_ENCODE_VERSION (2, 14)) |
101 | /** |
102 | * GLIB_VERSION_2_16: |
103 | * |
104 | * A macro that evaluates to the 2.16 version of GLib, in a format |
105 | * that can be used by the C pre-processor. |
106 | * |
107 | * Since: 2.32 |
108 | */ |
109 | #define GLIB_VERSION_2_16 (G_ENCODE_VERSION (2, 16)) |
110 | /** |
111 | * GLIB_VERSION_2_18: |
112 | * |
113 | * A macro that evaluates to the 2.18 version of GLib, in a format |
114 | * that can be used by the C pre-processor. |
115 | * |
116 | * Since: 2.32 |
117 | */ |
118 | #define GLIB_VERSION_2_18 (G_ENCODE_VERSION (2, 18)) |
119 | /** |
120 | * GLIB_VERSION_2_20: |
121 | * |
122 | * A macro that evaluates to the 2.20 version of GLib, in a format |
123 | * that can be used by the C pre-processor. |
124 | * |
125 | * Since: 2.32 |
126 | */ |
127 | #define GLIB_VERSION_2_20 (G_ENCODE_VERSION (2, 20)) |
128 | /** |
129 | * GLIB_VERSION_2_22: |
130 | * |
131 | * A macro that evaluates to the 2.22 version of GLib, in a format |
132 | * that can be used by the C pre-processor. |
133 | * |
134 | * Since: 2.32 |
135 | */ |
136 | #define GLIB_VERSION_2_22 (G_ENCODE_VERSION (2, 22)) |
137 | /** |
138 | * GLIB_VERSION_2_24: |
139 | * |
140 | * A macro that evaluates to the 2.24 version of GLib, in a format |
141 | * that can be used by the C pre-processor. |
142 | * |
143 | * Since: 2.32 |
144 | */ |
145 | #define GLIB_VERSION_2_24 (G_ENCODE_VERSION (2, 24)) |
146 | /** |
147 | * GLIB_VERSION_2_26: |
148 | * |
149 | * A macro that evaluates to the 2.26 version of GLib, in a format |
150 | * that can be used by the C pre-processor. |
151 | * |
152 | * Since: 2.32 |
153 | */ |
154 | #define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26)) |
155 | /** |
156 | * GLIB_VERSION_2_28: |
157 | * |
158 | * A macro that evaluates to the 2.28 version of GLib, in a format |
159 | * that can be used by the C pre-processor. |
160 | * |
161 | * Since: 2.32 |
162 | */ |
163 | #define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28)) |
164 | /** |
165 | * GLIB_VERSION_2_30: |
166 | * |
167 | * A macro that evaluates to the 2.30 version of GLib, in a format |
168 | * that can be used by the C pre-processor. |
169 | * |
170 | * Since: 2.32 |
171 | */ |
172 | #define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30)) |
173 | /** |
174 | * GLIB_VERSION_2_32: |
175 | * |
176 | * A macro that evaluates to the 2.32 version of GLib, in a format |
177 | * that can be used by the C pre-processor. |
178 | * |
179 | * Since: 2.32 |
180 | */ |
181 | #define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32)) |
182 | /** |
183 | * GLIB_VERSION_2_34: |
184 | * |
185 | * A macro that evaluates to the 2.34 version of GLib, in a format |
186 | * that can be used by the C pre-processor. |
187 | * |
188 | * Since: 2.34 |
189 | */ |
190 | #define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34)) |
191 | /** |
192 | * GLIB_VERSION_2_36: |
193 | * |
194 | * A macro that evaluates to the 2.36 version of GLib, in a format |
195 | * that can be used by the C pre-processor. |
196 | * |
197 | * Since: 2.36 |
198 | */ |
199 | #define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36)) |
200 | /** |
201 | * GLIB_VERSION_2_38: |
202 | * |
203 | * A macro that evaluates to the 2.38 version of GLib, in a format |
204 | * that can be used by the C pre-processor. |
205 | * |
206 | * Since: 2.38 |
207 | */ |
208 | #define GLIB_VERSION_2_38 (G_ENCODE_VERSION (2, 38)) |
209 | /** |
210 | * GLIB_VERSION_2_40: |
211 | * |
212 | * A macro that evaluates to the 2.40 version of GLib, in a format |
213 | * that can be used by the C pre-processor. |
214 | * |
215 | * Since: 2.40 |
216 | */ |
217 | #define GLIB_VERSION_2_40 (G_ENCODE_VERSION (2, 40)) |
218 | /** |
219 | * GLIB_VERSION_2_42: |
220 | * |
221 | * A macro that evaluates to the 2.42 version of GLib, in a format |
222 | * that can be used by the C pre-processor. |
223 | * |
224 | * Since: 2.42 |
225 | */ |
226 | #define GLIB_VERSION_2_42 (G_ENCODE_VERSION (2, 42)) |
227 | /** |
228 | * GLIB_VERSION_2_44: |
229 | * |
230 | * A macro that evaluates to the 2.44 version of GLib, in a format |
231 | * that can be used by the C pre-processor. |
232 | * |
233 | * Since: 2.44 |
234 | */ |
235 | #define GLIB_VERSION_2_44 (G_ENCODE_VERSION (2, 44)) |
236 | /** |
237 | * GLIB_VERSION_2_46: |
238 | * |
239 | * A macro that evaluates to the 2.46 version of GLib, in a format |
240 | * that can be used by the C pre-processor. |
241 | * |
242 | * Since: 2.46 |
243 | */ |
244 | #define GLIB_VERSION_2_46 (G_ENCODE_VERSION (2, 46)) |
245 | /** |
246 | * GLIB_VERSION_2_48: |
247 | * |
248 | * A macro that evaluates to the 2.48 version of GLib, in a format |
249 | * that can be used by the C pre-processor. |
250 | * |
251 | * Since: 2.48 |
252 | */ |
253 | #define GLIB_VERSION_2_48 (G_ENCODE_VERSION (2, 48)) |
254 | /** |
255 | * GLIB_VERSION_2_50: |
256 | * |
257 | * A macro that evaluates to the 2.50 version of GLib, in a format |
258 | * that can be used by the C pre-processor. |
259 | * |
260 | * Since: 2.50 |
261 | */ |
262 | #define GLIB_VERSION_2_50 (G_ENCODE_VERSION (2, 50)) |
263 | /** |
264 | * GLIB_VERSION_2_52: |
265 | * |
266 | * A macro that evaluates to the 2.52 version of GLib, in a format |
267 | * that can be used by the C pre-processor. |
268 | * |
269 | * Since: 2.52 |
270 | */ |
271 | #define GLIB_VERSION_2_52 (G_ENCODE_VERSION (2, 52)) |
272 | /** |
273 | * GLIB_VERSION_2_54: |
274 | * |
275 | * A macro that evaluates to the 2.54 version of GLib, in a format |
276 | * that can be used by the C pre-processor. |
277 | * |
278 | * Since: 2.54 |
279 | */ |
280 | #define GLIB_VERSION_2_54 (G_ENCODE_VERSION (2, 54)) |
281 | /** |
282 | * GLIB_VERSION_2_56: |
283 | * |
284 | * A macro that evaluates to the 2.56 version of GLib, in a format |
285 | * that can be used by the C pre-processor. |
286 | * |
287 | * Since: 2.56 |
288 | */ |
289 | #define GLIB_VERSION_2_56 (G_ENCODE_VERSION (2, 56)) |
290 | /** |
291 | * GLIB_VERSION_2_58: |
292 | * |
293 | * A macro that evaluates to the 2.58 version of GLib, in a format |
294 | * that can be used by the C pre-processor. |
295 | * |
296 | * Since: 2.58 |
297 | */ |
298 | #define GLIB_VERSION_2_58 (G_ENCODE_VERSION (2, 58)) |
299 | /** |
300 | * GLIB_VERSION_2_60: |
301 | * |
302 | * A macro that evaluates to the 2.60 version of GLib, in a format |
303 | * that can be used by the C pre-processor. |
304 | * |
305 | * Since: 2.60 |
306 | */ |
307 | #define GLIB_VERSION_2_60 (G_ENCODE_VERSION (2, 60)) |
308 | /** |
309 | * GLIB_VERSION_2_62: |
310 | * |
311 | * A macro that evaluates to the 2.62 version of GLib, in a format |
312 | * that can be used by the C pre-processor. |
313 | * |
314 | * Since: 2.62 |
315 | */ |
316 | #define GLIB_VERSION_2_62 (G_ENCODE_VERSION (2, 62)) |
317 | /** |
318 | * GLIB_VERSION_2_64: |
319 | * |
320 | * A macro that evaluates to the 2.64 version of GLib, in a format |
321 | * that can be used by the C pre-processor. |
322 | * |
323 | * Since: 2.64 |
324 | */ |
325 | #define GLIB_VERSION_2_64 (G_ENCODE_VERSION (2, 64)) |
326 | /** |
327 | * GLIB_VERSION_2_66: |
328 | * |
329 | * A macro that evaluates to the 2.66 version of GLib, in a format |
330 | * that can be used by the C pre-processor. |
331 | * |
332 | * Since: 2.66 |
333 | */ |
334 | #define GLIB_VERSION_2_66 (G_ENCODE_VERSION (2, 66)) |
335 | /** |
336 | * GLIB_VERSION_2_68: |
337 | * |
338 | * A macro that evaluates to the 2.68 version of GLib, in a format |
339 | * that can be used by the C pre-processor. |
340 | * |
341 | * Since: 2.68 |
342 | */ |
343 | #define GLIB_VERSION_2_68 (G_ENCODE_VERSION (2, 68)) |
344 | /** |
345 | * GLIB_VERSION_2_70: |
346 | * |
347 | * A macro that evaluates to the 2.70 version of GLib, in a format |
348 | * that can be used by the C pre-processor. |
349 | * |
350 | * Since: 2.70 |
351 | */ |
352 | #define GLIB_VERSION_2_70 (G_ENCODE_VERSION (2, 70)) |
353 | /** |
354 | * GLIB_VERSION_2_72: |
355 | * |
356 | * A macro that evaluates to the 2.72 version of GLib, in a format |
357 | * that can be used by the C pre-processor. |
358 | * |
359 | * Since: 2.72 |
360 | */ |
361 | #define GLIB_VERSION_2_72 (G_ENCODE_VERSION (2, 72)) |
362 | /** |
363 | * GLIB_VERSION_2_74: |
364 | * |
365 | * A macro that evaluates to the 2.74 version of GLib, in a format |
366 | * that can be used by the C pre-processor. |
367 | * |
368 | * Since: 2.74 |
369 | */ |
370 | #define GLIB_VERSION_2_74 (G_ENCODE_VERSION (2, 74)) |
371 | /** |
372 | * GLIB_VERSION_2_76: |
373 | * |
374 | * A macro that evaluates to the 2.76 version of GLib, in a format |
375 | * that can be used by the C pre-processor. |
376 | * |
377 | * Since: 2.76 |
378 | */ |
379 | #define GLIB_VERSION_2_76 (G_ENCODE_VERSION (2, 76)) |
380 | /** |
381 | * GLIB_VERSION_2_78: |
382 | * |
383 | * A macro that evaluates to the 2.78 version of GLib, in a format |
384 | * that can be used by the C pre-processor. |
385 | * |
386 | * Since: 2.78 |
387 | */ |
388 | #define GLIB_VERSION_2_78 (G_ENCODE_VERSION (2, 78)) |
389 | /** |
390 | * GLIB_VERSION_2_80: |
391 | * |
392 | * A macro that evaluates to the 2.80 version of GLib, in a format |
393 | * that can be used by the C pre-processor. |
394 | * |
395 | * Since: 2.80 |
396 | */ |
397 | #define GLIB_VERSION_2_80 (G_ENCODE_VERSION (2, 80)) |
398 | |
399 | /** |
400 | * GLIB_VERSION_CUR_STABLE: |
401 | * |
402 | * A macro that evaluates to the current stable version of GLib, in a format |
403 | * that can be used by the C pre-processor. |
404 | * |
405 | * During an unstable development cycle, this evaluates to the next stable |
406 | * (unreleased) version which will be the result of the development cycle. |
407 | * |
408 | * Since: 2.32 |
409 | */ |
410 | #if (GLIB_MINOR_VERSION % 2) |
411 | #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1)) |
412 | #else |
413 | #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION)) |
414 | #endif |
415 | |
416 | /** |
417 | * GLIB_VERSION_PREV_STABLE: |
418 | * |
419 | * A macro that evaluates to the previous stable version of GLib, in a format |
420 | * that can be used by the C pre-processor. |
421 | * |
422 | * During an unstable development cycle, this evaluates to the most recent |
423 | * released stable release, which preceded this development cycle. |
424 | * |
425 | * Since: 2.32 |
426 | */ |
427 | #if (GLIB_MINOR_VERSION % 2) |
428 | #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1)) |
429 | #else |
430 | #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2)) |
431 | #endif |
432 | |
433 | /** |
434 | * GLIB_VERSION_MIN_REQUIRED: |
435 | * |
436 | * A macro that should be defined by the user prior to including |
437 | * the glib.h header. |
438 | * The definition should be one of the predefined GLib version |
439 | * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,... |
440 | * |
441 | * This macro defines the earliest version of GLib that the package is |
442 | * required to be able to compile against. |
443 | * |
444 | * If the compiler is configured to warn about the use of deprecated |
445 | * functions, then using functions that were deprecated in version |
446 | * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but |
447 | * using functions deprecated in later releases will not). |
448 | * |
449 | * Since: 2.32 |
450 | */ |
451 | /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future |
452 | * GLIB_VERSION_X_Y value that we don't know about, it will compare as |
453 | * 0 in preprocessor tests. |
454 | */ |
455 | #ifndef GLIB_VERSION_MIN_REQUIRED |
456 | #define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE) |
457 | #elif GLIB_VERSION_MIN_REQUIRED == 0 |
458 | #undef GLIB_VERSION_MIN_REQUIRED |
459 | #define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2) |
460 | #endif |
461 | |
462 | /** |
463 | * GLIB_VERSION_MAX_ALLOWED: |
464 | * |
465 | * A macro that should be defined by the user prior to including |
466 | * the glib.h header. |
467 | * The definition should be one of the predefined GLib version |
468 | * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,... |
469 | * |
470 | * This macro defines the latest version of the GLib API that the |
471 | * package is allowed to make use of. |
472 | * |
473 | * If the compiler is configured to warn about the use of deprecated |
474 | * functions, then using functions added after version |
475 | * %GLIB_VERSION_MAX_ALLOWED will cause warnings. |
476 | * |
477 | * Unless you are using GLIB_CHECK_VERSION() or the like to compile |
478 | * different code depending on the GLib version, then this should be |
479 | * set to the same value as %GLIB_VERSION_MIN_REQUIRED. |
480 | * |
481 | * Since: 2.32 |
482 | */ |
483 | #if !defined(GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0) |
484 | #undef GLIB_VERSION_MAX_ALLOWED |
485 | #define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE) |
486 | #endif |
487 | |
488 | /* sanity checks */ |
489 | #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE |
490 | #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE" |
491 | #endif |
492 | #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED |
493 | #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED" |
494 | #endif |
495 | #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26 |
496 | #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26" |
497 | #endif |
498 | |
499 | #endif /* __G_VERSION_MACROS_H__ */ |
500 | |