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 (22)
29#define GDK_MICRO_VERSION (11)
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/* evaluates to the current stable version; for development cycles,
176 * this means the next stable target
177 */
178#if (GDK_MINOR_VERSION % 2)
179#define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
180#else
181#define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
182#endif
183
184/* evaluates to the previous stable version */
185#if (GDK_MINOR_VERSION % 2)
186#define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
187#else
188#define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
189#endif
190
191/**
192 * GDK_VERSION_MIN_REQUIRED:
193 *
194 * A macro that should be defined by the user prior to including
195 * the gdk.h header.
196 * The definition should be one of the predefined GDK version
197 * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
198 *
199 * This macro defines the lower bound for the GDK API to use.
200 *
201 * If a function has been deprecated in a newer version of GDK,
202 * it is possible to use this symbol to avoid the compiler warnings
203 * without disabling warning for every deprecated function.
204 *
205 * Since: 3.4
206 */
207#ifndef GDK_VERSION_MIN_REQUIRED
208# define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_CUR_STABLE)
209#endif
210
211/**
212 * GDK_VERSION_MAX_ALLOWED:
213 *
214 * A macro that should be defined by the user prior to including
215 * the gdk.h header.
216 * The definition should be one of the predefined GDK version
217 * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
218 *
219 * This macro defines the upper bound for the GDK API to use.
220 *
221 * If a function has been introduced in a newer version of GDK,
222 * it is possible to use this symbol to get compiler warnings when
223 * trying to use that function.
224 *
225 * Since: 3.4
226 */
227#ifndef GDK_VERSION_MAX_ALLOWED
228# if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
229# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
230# else
231# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
232# endif
233#endif
234
235/* sanity checks */
236#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
237#error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
238#endif
239#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_3_0
240#error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_3_0"
241#endif
242
243#define GDK_AVAILABLE_IN_ALL _GDK_EXTERN
244
245/* XXX: Every new stable minor release should add a set of macros here */
246
247#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_0
248# define GDK_DEPRECATED_IN_3_0 GDK_DEPRECATED
249# define GDK_DEPRECATED_IN_3_0_FOR(f) GDK_DEPRECATED_FOR(f)
250#else
251# define GDK_DEPRECATED_IN_3_0 _GDK_EXTERN
252# define GDK_DEPRECATED_IN_3_0_FOR(f) _GDK_EXTERN
253#endif
254
255#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_0
256# define GDK_AVAILABLE_IN_3_0 GDK_UNAVAILABLE(3, 0)
257#else
258# define GDK_AVAILABLE_IN_3_0 _GDK_EXTERN
259#endif
260
261#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_2
262# define GDK_DEPRECATED_IN_3_2 GDK_DEPRECATED
263# define GDK_DEPRECATED_IN_3_2_FOR(f) GDK_DEPRECATED_FOR(f)
264#else
265# define GDK_DEPRECATED_IN_3_2 _GDK_EXTERN
266# define GDK_DEPRECATED_IN_3_2_FOR(f) _GDK_EXTERN
267#endif
268
269#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_2
270# define GDK_AVAILABLE_IN_3_2 GDK_UNAVAILABLE(3, 2)
271#else
272# define GDK_AVAILABLE_IN_3_2 _GDK_EXTERN
273#endif
274
275#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_4
276# define GDK_DEPRECATED_IN_3_4 GDK_DEPRECATED
277# define GDK_DEPRECATED_IN_3_4_FOR(f) GDK_DEPRECATED_FOR(f)
278#else
279# define GDK_DEPRECATED_IN_3_4 _GDK_EXTERN
280# define GDK_DEPRECATED_IN_3_4_FOR(f) _GDK_EXTERN
281#endif
282
283#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_4
284# define GDK_AVAILABLE_IN_3_4 GDK_UNAVAILABLE(3, 4)
285#else
286# define GDK_AVAILABLE_IN_3_4 _GDK_EXTERN
287#endif
288
289#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_6
290# define GDK_DEPRECATED_IN_3_6 GDK_DEPRECATED
291# define GDK_DEPRECATED_IN_3_6_FOR(f) GDK_DEPRECATED_FOR(f)
292#else
293# define GDK_DEPRECATED_IN_3_6 _GDK_EXTERN
294# define GDK_DEPRECATED_IN_3_6_FOR(f) _GDK_EXTERN
295#endif
296
297#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_6
298# define GDK_AVAILABLE_IN_3_6 GDK_UNAVAILABLE(3, 6)
299#else
300# define GDK_AVAILABLE_IN_3_6 _GDK_EXTERN
301#endif
302
303#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_8
304# define GDK_DEPRECATED_IN_3_8 GDK_DEPRECATED
305# define GDK_DEPRECATED_IN_3_8_FOR(f) GDK_DEPRECATED_FOR(f)
306#else
307# define GDK_DEPRECATED_IN_3_8 _GDK_EXTERN
308# define GDK_DEPRECATED_IN_3_8_FOR(f) _GDK_EXTERN
309#endif
310
311#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_8
312# define GDK_AVAILABLE_IN_3_8 GDK_UNAVAILABLE(3, 8)
313#else
314# define GDK_AVAILABLE_IN_3_8 _GDK_EXTERN
315#endif
316
317#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_10
318# define GDK_DEPRECATED_IN_3_10 GDK_DEPRECATED
319# define GDK_DEPRECATED_IN_3_10_FOR(f) GDK_DEPRECATED_FOR(f)
320#else
321# define GDK_DEPRECATED_IN_3_10 _GDK_EXTERN
322# define GDK_DEPRECATED_IN_3_10_FOR(f) _GDK_EXTERN
323#endif
324
325#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_10
326# define GDK_AVAILABLE_IN_3_10 GDK_UNAVAILABLE(3, 10)
327#else
328# define GDK_AVAILABLE_IN_3_10 _GDK_EXTERN
329#endif
330
331#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_12
332# define GDK_DEPRECATED_IN_3_12 GDK_DEPRECATED
333# define GDK_DEPRECATED_IN_3_12_FOR(f) GDK_DEPRECATED_FOR(f)
334#else
335# define GDK_DEPRECATED_IN_3_12 _GDK_EXTERN
336# define GDK_DEPRECATED_IN_3_12_FOR(f) _GDK_EXTERN
337#endif
338
339#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_12
340# define GDK_AVAILABLE_IN_3_12 GDK_UNAVAILABLE(3, 12)
341#else
342# define GDK_AVAILABLE_IN_3_12 _GDK_EXTERN
343#endif
344
345#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_14
346# define GDK_DEPRECATED_IN_3_14 GDK_DEPRECATED
347# define GDK_DEPRECATED_IN_3_14_FOR(f) GDK_DEPRECATED_FOR(f)
348#else
349# define GDK_DEPRECATED_IN_3_14 _GDK_EXTERN
350# define GDK_DEPRECATED_IN_3_14_FOR(f) _GDK_EXTERN
351#endif
352
353#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_14
354# define GDK_AVAILABLE_IN_3_14 GDK_UNAVAILABLE(3, 14)
355#else
356# define GDK_AVAILABLE_IN_3_14 _GDK_EXTERN
357#endif
358
359#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_16
360# define GDK_DEPRECATED_IN_3_16 GDK_DEPRECATED
361# define GDK_DEPRECATED_IN_3_16_FOR(f) GDK_DEPRECATED_FOR(f)
362#else
363# define GDK_DEPRECATED_IN_3_16 _GDK_EXTERN
364# define GDK_DEPRECATED_IN_3_16_FOR(f) _GDK_EXTERN
365#endif
366
367#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_16
368# define GDK_AVAILABLE_IN_3_16 GDK_UNAVAILABLE(3, 16)
369#else
370# define GDK_AVAILABLE_IN_3_16 _GDK_EXTERN
371#endif
372
373#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_18
374# define GDK_DEPRECATED_IN_3_18 GDK_DEPRECATED
375# define GDK_DEPRECATED_IN_3_18_FOR(f) GDK_DEPRECATED_FOR(f)
376#else
377# define GDK_DEPRECATED_IN_3_18 _GDK_EXTERN
378# define GDK_DEPRECATED_IN_3_18_FOR(f) _GDK_EXTERN
379#endif
380
381#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_18
382# define GDK_AVAILABLE_IN_3_18 GDK_UNAVAILABLE(3, 18)
383#else
384# define GDK_AVAILABLE_IN_3_18 _GDK_EXTERN
385#endif
386
387#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_20
388# define GDK_DEPRECATED_IN_3_20 GDK_DEPRECATED
389# define GDK_DEPRECATED_IN_3_20_FOR(f) GDK_DEPRECATED_FOR(f)
390#else
391# define GDK_DEPRECATED_IN_3_20 _GDK_EXTERN
392# define GDK_DEPRECATED_IN_3_20_FOR(f) _GDK_EXTERN
393#endif
394
395#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_20
396# define GDK_AVAILABLE_IN_3_20 GDK_UNAVAILABLE(3, 20)
397#else
398# define GDK_AVAILABLE_IN_3_20 _GDK_EXTERN
399#endif
400
401#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_22
402# define GDK_DEPRECATED_IN_3_22 GDK_DEPRECATED
403# define GDK_DEPRECATED_IN_3_22_FOR(f) GDK_DEPRECATED_FOR(f)
404#else
405# define GDK_DEPRECATED_IN_3_22 _GDK_EXTERN
406# define GDK_DEPRECATED_IN_3_22_FOR(f) _GDK_EXTERN
407#endif
408
409#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_22
410# define GDK_AVAILABLE_IN_3_22 GDK_UNAVAILABLE(3, 22)
411#else
412# define GDK_AVAILABLE_IN_3_22 _GDK_EXTERN
413#endif
414
415#endif /* __GDK_VERSION_MACROS_H__ */
416
417