1/* gdkversionmacros.h - version boundaries checks
2 * Copyright (C) 2012 Red Hat, Inc.
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, see <http://www.gnu.org/licenses/>.
16 */
17
18#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
19#error "Only <gdk/gdk.h> can be included directly."
20#endif
21
22#ifndef __GDK_VERSION_MACROS_H__
23#define __GDK_VERSION_MACROS_H__
24
25#include <glib.h>
26
27#define GDK_MAJOR_VERSION (3)
28#define GDK_MINOR_VERSION (24)
29#define GDK_MICRO_VERSION (5)
30
31#ifndef _GDK_EXTERN
32#define _GDK_EXTERN extern
33#endif
34
35/**
36 * GDK_DISABLE_DEPRECATION_WARNINGS:
37 *
38 * A macro that should be defined before including the gdk.h header.
39 * If it is defined, no compiler warnings will be produced for uses
40 * of deprecated GDK and GTK+ APIs.
41 */
42
43#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
44#define GDK_DEPRECATED _GDK_EXTERN
45#define GDK_DEPRECATED_FOR(f) _GDK_EXTERN
46#define GDK_UNAVAILABLE(maj,min) _GDK_EXTERN
47#else
48#define GDK_DEPRECATED G_DEPRECATED _GDK_EXTERN
49#define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GDK_EXTERN
50#define GDK_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GDK_EXTERN
51#endif
52
53/* XXX: Every new stable minor release bump should add a macro here */
54
55/**
56 * GDK_VERSION_3_0:
57 *
58 * A macro that evaluates to the 3.0 version of GDK, in a format
59 * that can be used by the C pre-processor.
60 *
61 * Since: 3.4
62 */
63#define GDK_VERSION_3_0 (G_ENCODE_VERSION (3, 0))
64
65/**
66 * GDK_VERSION_3_2:
67 *
68 * A macro that evaluates to the 3.2 version of GDK, in a format
69 * that can be used by the C pre-processor.
70 *
71 * Since: 3.4
72 */
73#define GDK_VERSION_3_2 (G_ENCODE_VERSION (3, 2))
74
75/**
76 * GDK_VERSION_3_4:
77 *
78 * A macro that evaluates to the 3.4 version of GDK, in a format
79 * that can be used by the C pre-processor.
80 *
81 * Since: 3.4
82 */
83#define GDK_VERSION_3_4 (G_ENCODE_VERSION (3, 4))
84
85/**
86 * GDK_VERSION_3_6:
87 *
88 * A macro that evaluates to the 3.6 version of GDK, in a format
89 * that can be used by the C pre-processor.
90 *
91 * Since: 3.6
92 */
93#define GDK_VERSION_3_6 (G_ENCODE_VERSION (3, 6))
94
95/**
96 * GDK_VERSION_3_8:
97 *
98 * A macro that evaluates to the 3.8 version of GDK, in a format
99 * that can be used by the C pre-processor.
100 *
101 * Since: 3.8
102 */
103#define GDK_VERSION_3_8 (G_ENCODE_VERSION (3, 8))
104
105/**
106 * GDK_VERSION_3_10:
107 *
108 * A macro that evaluates to the 3.10 version of GDK, in a format
109 * that can be used by the C pre-processor.
110 *
111 * Since: 3.10
112 */
113#define GDK_VERSION_3_10 (G_ENCODE_VERSION (3, 10))
114
115/**
116 * GDK_VERSION_3_12:
117 *
118 * A macro that evaluates to the 3.12 version of GDK, in a format
119 * that can be used by the C pre-processor.
120 *
121 * Since: 3.12
122 */
123#define GDK_VERSION_3_12 (G_ENCODE_VERSION (3, 12))
124
125/**
126 * GDK_VERSION_3_14:
127 *
128 * A macro that evaluates to the 3.14 version of GDK, in a format
129 * that can be used by the C pre-processor.
130 *
131 * Since: 3.14
132 */
133#define GDK_VERSION_3_14 (G_ENCODE_VERSION (3, 14))
134
135/**
136 * GDK_VERSION_3_16:
137 *
138 * A macro that evaluates to the 3.16 version of GDK, in a format
139 * that can be used by the C pre-processor.
140 *
141 * Since: 3.16
142 */
143#define GDK_VERSION_3_16 (G_ENCODE_VERSION (3, 16))
144
145/**
146 * GDK_VERSION_3_18:
147 *
148 * A macro that evaluates to the 3.18 version of GDK, in a format
149 * that can be used by the C pre-processor.
150 *
151 * Since: 3.18
152 */
153#define GDK_VERSION_3_18 (G_ENCODE_VERSION (3, 18))
154
155/**
156 * GDK_VERSION_3_20:
157 *
158 * A macro that evaluates to the 3.20 version of GDK, in a format
159 * that can be used by the C pre-processor.
160 *
161 * Since: 3.18
162 */
163#define GDK_VERSION_3_20 (G_ENCODE_VERSION (3, 20))
164
165/**
166 * GDK_VERSION_3_22:
167 *
168 * A macro that evaluates to the 3.22 version of GDK, in a format
169 * that can be used by the C pre-processor.
170 *
171 * Since: 3.20
172 */
173#define GDK_VERSION_3_22 (G_ENCODE_VERSION (3, 22))
174
175/**
176 * GDK_VERSION_3_24:
177 *
178 * A macro that evaluates to the 3.24 version of GDK, in a format
179 * that can be used by the C pre-processor.
180 *
181 * Since: 3.24
182 */
183#define GDK_VERSION_3_24 (G_ENCODE_VERSION (3, 24))
184
185/* evaluates to the current stable version; for development cycles,
186 * this means the next stable target
187 */
188#if (GDK_MINOR_VERSION % 2)
189#define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
190#else
191#define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
192#endif
193
194/* evaluates to the previous stable version */
195#if (GDK_MINOR_VERSION % 2)
196#define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
197#else
198#define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
199#endif
200
201/**
202 * GDK_VERSION_MIN_REQUIRED:
203 *
204 * A macro that should be defined by the user prior to including
205 * the gdk.h header.
206 * The definition should be one of the predefined GDK version
207 * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
208 *
209 * This macro defines the lower bound for the GDK API to use.
210 *
211 * If a function has been deprecated in a newer version of GDK,
212 * it is possible to use this symbol to avoid the compiler warnings
213 * without disabling warning for every deprecated function.
214 *
215 * Since: 3.4
216 */
217#ifndef GDK_VERSION_MIN_REQUIRED
218# define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_CUR_STABLE)
219#endif
220
221/**
222 * GDK_VERSION_MAX_ALLOWED:
223 *
224 * A macro that should be defined by the user prior to including
225 * the gdk.h header.
226 * The definition should be one of the predefined GDK version
227 * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
228 *
229 * This macro defines the upper bound for the GDK API to use.
230 *
231 * If a function has been introduced in a newer version of GDK,
232 * it is possible to use this symbol to get compiler warnings when
233 * trying to use that function.
234 *
235 * Since: 3.4
236 */
237#ifndef GDK_VERSION_MAX_ALLOWED
238# if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
239# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
240# else
241# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
242# endif
243#endif
244
245/* sanity checks */
246#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
247#error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
248#endif
249#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_3_0
250#error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_3_0"
251#endif
252
253#define GDK_AVAILABLE_IN_ALL _GDK_EXTERN
254
255/* XXX: Every new stable minor release should add a set of macros here */
256
257#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_0
258# define GDK_DEPRECATED_IN_3_0 GDK_DEPRECATED
259# define GDK_DEPRECATED_IN_3_0_FOR(f) GDK_DEPRECATED_FOR(f)
260#else
261# define GDK_DEPRECATED_IN_3_0 _GDK_EXTERN
262# define GDK_DEPRECATED_IN_3_0_FOR(f) _GDK_EXTERN
263#endif
264
265#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_0
266# define GDK_AVAILABLE_IN_3_0 GDK_UNAVAILABLE(3, 0)
267#else
268# define GDK_AVAILABLE_IN_3_0 _GDK_EXTERN
269#endif
270
271#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_2
272# define GDK_DEPRECATED_IN_3_2 GDK_DEPRECATED
273# define GDK_DEPRECATED_IN_3_2_FOR(f) GDK_DEPRECATED_FOR(f)
274#else
275# define GDK_DEPRECATED_IN_3_2 _GDK_EXTERN
276# define GDK_DEPRECATED_IN_3_2_FOR(f) _GDK_EXTERN
277#endif
278
279#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_2
280# define GDK_AVAILABLE_IN_3_2 GDK_UNAVAILABLE(3, 2)
281#else
282# define GDK_AVAILABLE_IN_3_2 _GDK_EXTERN
283#endif
284
285#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_4
286# define GDK_DEPRECATED_IN_3_4 GDK_DEPRECATED
287# define GDK_DEPRECATED_IN_3_4_FOR(f) GDK_DEPRECATED_FOR(f)
288#else
289# define GDK_DEPRECATED_IN_3_4 _GDK_EXTERN
290# define GDK_DEPRECATED_IN_3_4_FOR(f) _GDK_EXTERN
291#endif
292
293#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_4
294# define GDK_AVAILABLE_IN_3_4 GDK_UNAVAILABLE(3, 4)
295#else
296# define GDK_AVAILABLE_IN_3_4 _GDK_EXTERN
297#endif
298
299#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_6
300# define GDK_DEPRECATED_IN_3_6 GDK_DEPRECATED
301# define GDK_DEPRECATED_IN_3_6_FOR(f) GDK_DEPRECATED_FOR(f)
302#else
303# define GDK_DEPRECATED_IN_3_6 _GDK_EXTERN
304# define GDK_DEPRECATED_IN_3_6_FOR(f) _GDK_EXTERN
305#endif
306
307#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_6
308# define GDK_AVAILABLE_IN_3_6 GDK_UNAVAILABLE(3, 6)
309#else
310# define GDK_AVAILABLE_IN_3_6 _GDK_EXTERN
311#endif
312
313#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_8
314# define GDK_DEPRECATED_IN_3_8 GDK_DEPRECATED
315# define GDK_DEPRECATED_IN_3_8_FOR(f) GDK_DEPRECATED_FOR(f)
316#else
317# define GDK_DEPRECATED_IN_3_8 _GDK_EXTERN
318# define GDK_DEPRECATED_IN_3_8_FOR(f) _GDK_EXTERN
319#endif
320
321#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_8
322# define GDK_AVAILABLE_IN_3_8 GDK_UNAVAILABLE(3, 8)
323#else
324# define GDK_AVAILABLE_IN_3_8 _GDK_EXTERN
325#endif
326
327#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_10
328# define GDK_DEPRECATED_IN_3_10 GDK_DEPRECATED
329# define GDK_DEPRECATED_IN_3_10_FOR(f) GDK_DEPRECATED_FOR(f)
330#else
331# define GDK_DEPRECATED_IN_3_10 _GDK_EXTERN
332# define GDK_DEPRECATED_IN_3_10_FOR(f) _GDK_EXTERN
333#endif
334
335#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_10
336# define GDK_AVAILABLE_IN_3_10 GDK_UNAVAILABLE(3, 10)
337#else
338# define GDK_AVAILABLE_IN_3_10 _GDK_EXTERN
339#endif
340
341#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_12
342# define GDK_DEPRECATED_IN_3_12 GDK_DEPRECATED
343# define GDK_DEPRECATED_IN_3_12_FOR(f) GDK_DEPRECATED_FOR(f)
344#else
345# define GDK_DEPRECATED_IN_3_12 _GDK_EXTERN
346# define GDK_DEPRECATED_IN_3_12_FOR(f) _GDK_EXTERN
347#endif
348
349#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_12
350# define GDK_AVAILABLE_IN_3_12 GDK_UNAVAILABLE(3, 12)
351#else
352# define GDK_AVAILABLE_IN_3_12 _GDK_EXTERN
353#endif
354
355#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_14
356# define GDK_DEPRECATED_IN_3_14 GDK_DEPRECATED
357# define GDK_DEPRECATED_IN_3_14_FOR(f) GDK_DEPRECATED_FOR(f)
358#else
359# define GDK_DEPRECATED_IN_3_14 _GDK_EXTERN
360# define GDK_DEPRECATED_IN_3_14_FOR(f) _GDK_EXTERN
361#endif
362
363#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_14
364# define GDK_AVAILABLE_IN_3_14 GDK_UNAVAILABLE(3, 14)
365#else
366# define GDK_AVAILABLE_IN_3_14 _GDK_EXTERN
367#endif
368
369#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_16
370# define GDK_DEPRECATED_IN_3_16 GDK_DEPRECATED
371# define GDK_DEPRECATED_IN_3_16_FOR(f) GDK_DEPRECATED_FOR(f)
372#else
373# define GDK_DEPRECATED_IN_3_16 _GDK_EXTERN
374# define GDK_DEPRECATED_IN_3_16_FOR(f) _GDK_EXTERN
375#endif
376
377#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_16
378# define GDK_AVAILABLE_IN_3_16 GDK_UNAVAILABLE(3, 16)
379#else
380# define GDK_AVAILABLE_IN_3_16 _GDK_EXTERN
381#endif
382
383#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_18
384# define GDK_DEPRECATED_IN_3_18 GDK_DEPRECATED
385# define GDK_DEPRECATED_IN_3_18_FOR(f) GDK_DEPRECATED_FOR(f)
386#else
387# define GDK_DEPRECATED_IN_3_18 _GDK_EXTERN
388# define GDK_DEPRECATED_IN_3_18_FOR(f) _GDK_EXTERN
389#endif
390
391#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_18
392# define GDK_AVAILABLE_IN_3_18 GDK_UNAVAILABLE(3, 18)
393#else
394# define GDK_AVAILABLE_IN_3_18 _GDK_EXTERN
395#endif
396
397#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_20
398# define GDK_DEPRECATED_IN_3_20 GDK_DEPRECATED
399# define GDK_DEPRECATED_IN_3_20_FOR(f) GDK_DEPRECATED_FOR(f)
400#else
401# define GDK_DEPRECATED_IN_3_20 _GDK_EXTERN
402# define GDK_DEPRECATED_IN_3_20_FOR(f) _GDK_EXTERN
403#endif
404
405#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_20
406# define GDK_AVAILABLE_IN_3_20 GDK_UNAVAILABLE(3, 20)
407#else
408# define GDK_AVAILABLE_IN_3_20 _GDK_EXTERN
409#endif
410
411#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_22
412# define GDK_DEPRECATED_IN_3_22 GDK_DEPRECATED
413# define GDK_DEPRECATED_IN_3_22_FOR(f) GDK_DEPRECATED_FOR(f)
414#else
415# define GDK_DEPRECATED_IN_3_22 _GDK_EXTERN
416# define GDK_DEPRECATED_IN_3_22_FOR(f) _GDK_EXTERN
417#endif
418
419#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_22
420# define GDK_AVAILABLE_IN_3_22 GDK_UNAVAILABLE(3, 22)
421#else
422# define GDK_AVAILABLE_IN_3_22 _GDK_EXTERN
423#endif
424
425#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_24
426# define GDK_DEPRECATED_IN_3_24 GDK_DEPRECATED
427# define GDK_DEPRECATED_IN_3_24_FOR(f) GDK_DEPRECATED_FOR(f)
428#else
429# define GDK_DEPRECATED_IN_3_24 _GDK_EXTERN
430# define GDK_DEPRECATED_IN_3_24_FOR(f) _GDK_EXTERN
431#endif
432
433#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_24
434# define GDK_AVAILABLE_IN_3_24 GDK_UNAVAILABLE(3, 24)
435#else
436# define GDK_AVAILABLE_IN_3_24 _GDK_EXTERN
437#endif
438
439#endif /* __GDK_VERSION_MACROS_H__ */
440
441