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 (__GTK_CSS_H_INSIDE__) && !defined (GTK_COMPILATION) && !defined (GTK_CSS_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/**
28 * GDK_MAJOR_VERSION:
29 *
30 * The major version component of the library's version, e.g. "1" for "1.2.3".
31 */
32#define GDK_MAJOR_VERSION (4)
33
34/**
35 * GDK_MINOR_VERSION:
36 *
37 * The minor version component of the library's version, e.g. "2" for "1.2.3".
38 */
39#define GDK_MINOR_VERSION (6)
40
41/**
42 * GDK_MICRO_VERSION:
43 *
44 * The micro version component of the library's version, e.g. "3" for "1.2.3".
45 */
46#define GDK_MICRO_VERSION (7)
47
48#ifndef _GDK_EXTERN
49#define _GDK_EXTERN extern
50#endif
51
52/**
53 * GDK_DISABLE_DEPRECATION_WARNINGS:
54 *
55 * A macro that should be defined before including the `gdk.h` header.
56 *
57 * If this symbol is defined, no compiler warnings will be produced for
58 * uses of deprecated GDK and GTK APIs.
59 */
60
61#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
62#define GDK_DEPRECATED _GDK_EXTERN
63#define GDK_DEPRECATED_FOR(f) _GDK_EXTERN
64#define GDK_UNAVAILABLE(maj,min) _GDK_EXTERN
65#else
66#define GDK_DEPRECATED G_DEPRECATED _GDK_EXTERN
67#define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GDK_EXTERN
68#define GDK_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GDK_EXTERN
69#endif
70
71/* XXX: Every new stable minor release bump should add a macro here */
72
73/**
74 * GDK_VERSION_4_0:
75 *
76 * A macro that evaluates to the 4.0 version of GDK, in a format
77 * that can be used by the C pre-processor.
78 */
79#define GDK_VERSION_4_0 (G_ENCODE_VERSION (4, 0))
80
81/**
82 * GDK_VERSION_4_2:
83 *
84 * A macro that evaluates to the 4.2 version of GDK, in a format
85 * that can be used by the C pre-processor.
86 *
87 * Since: 4.2
88 */
89#define GDK_VERSION_4_2 (G_ENCODE_VERSION (4, 2))
90
91/**
92 * GDK_VERSION_4_4:
93 *
94 * A macro that evaluates to the 4.4 version of GDK, in a format
95 * that can be used by the C pre-processor.
96 *
97 * Since: 4.4
98 */
99#define GDK_VERSION_4_4 (G_ENCODE_VERSION (4, 4))
100
101/**
102 * GDK_VERSION_4_6:
103 *
104 * A macro that evaluates to the 4.6 version of GDK, in a format
105 * that can be used by the C pre-processor.
106 *
107 * Since: 4.6
108 */
109#define GDK_VERSION_4_6 (G_ENCODE_VERSION (4, 6))
110
111
112/* evaluates to the current stable version; for development cycles,
113 * this means the next stable target, with a hard backstop to the
114 * beginning of the stable series
115 */
116#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
117# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
118#elif G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION) > GDK_VERSION_4_0
119# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
120#else
121# define GDK_VERSION_CUR_STABLE GDK_VERSION_4_0
122#endif
123
124/* evaluates to the previous stable version, with a hard backstop
125 * to the beginning of the stable series
126 */
127#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
128# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
129#elif GDK_MAJOR_VERSION >= 4 && GDK_MINOR_VERSION > 2
130# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
131#else
132# define GDK_VERSION_PREV_STABLE GDK_VERSION_4_0
133#endif
134
135/**
136 * GDK_VERSION_MIN_REQUIRED:
137 *
138 * A macro that should be defined by the user prior to including
139 * the `gdk.h` header.
140 *
141 * The definition should be one of the predefined GDK version
142 * macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
143 *
144 * This macro defines the lower bound for the GDK API to use.
145 *
146 * If a function has been deprecated in a newer version of GDK,
147 * it is possible to use this symbol to avoid the compiler warnings
148 * without disabling warning for every deprecated function.
149 */
150#ifndef GDK_VERSION_MIN_REQUIRED
151# define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_CUR_STABLE)
152#endif
153
154/**
155 * GDK_VERSION_MAX_ALLOWED:
156 *
157 * A macro that should be defined by the user prior to including
158 * the `gdk.h` header.
159 *
160 * The definition should be one of the predefined GDK version
161 * macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
162 *
163 * This macro defines the upper bound for the GDK API to use.
164 *
165 * If a function has been introduced in a newer version of GDK,
166 * it is possible to use this symbol to get compiler warnings when
167 * trying to use that function.
168 */
169#ifndef GDK_VERSION_MAX_ALLOWED
170# if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
171# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
172# else
173# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
174# endif
175#endif
176
177/* sanity checks */
178#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
179# error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
180#endif
181#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_4_0
182# error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
183#endif
184
185#define GDK_AVAILABLE_IN_ALL _GDK_EXTERN
186
187/* XXX: Every new stable minor release should add a set of macros here */
188
189/* This is not really necessary for 4.0, since there can't be an
190 * earlier version, and there are no deprecated symbols. We just
191 * include it for completeness, and because it's easier to copy
192 * this stanza every time a new development cycle starts.
193 */
194#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_0
195# define GDK_AVAILABLE_IN_4_0 GDK_UNAVAILABLE(4, 0)
196#else
197# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
198#endif
199
200#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_0
201# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
202# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
203#else
204# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
205# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
206#endif
207
208
209#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_2
210# define GDK_AVAILABLE_IN_4_2 GDK_UNAVAILABLE(4, 2)
211#else
212# define GDK_AVAILABLE_IN_4_2 _GDK_EXTERN
213#endif
214
215#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_2
216# define GDK_DEPRECATED_IN_4_2 GDK_DEPRECATED
217# define GDK_DEPRECATED_IN_4_2_FOR(f) GDK_DEPRECATED_FOR(f)
218#else
219# define GDK_DEPRECATED_IN_4_2 _GDK_EXTERN
220# define GDK_DEPRECATED_IN_4_2_FOR(f) _GDK_EXTERN
221#endif
222
223
224#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_4
225# define GDK_AVAILABLE_IN_4_4 GDK_UNAVAILABLE(4, 4)
226#else
227# define GDK_AVAILABLE_IN_4_4 _GDK_EXTERN
228#endif
229
230#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_4
231# define GDK_DEPRECATED_IN_4_4 GDK_DEPRECATED
232# define GDK_DEPRECATED_IN_4_4_FOR(f) GDK_DEPRECATED_FOR(f)
233#else
234# define GDK_DEPRECATED_IN_4_4 _GDK_EXTERN
235# define GDK_DEPRECATED_IN_4_4_FOR(f) _GDK_EXTERN
236#endif
237
238#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_6
239# define GDK_AVAILABLE_IN_4_6 GDK_UNAVAILABLE(4, 6)
240#else
241# define GDK_AVAILABLE_IN_4_6 _GDK_EXTERN
242#endif
243
244#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_6
245# define GDK_DEPRECATED_IN_4_6 GDK_DEPRECATED
246# define GDK_DEPRECATED_IN_4_6_FOR(f) GDK_DEPRECATED_FOR(f)
247#else
248# define GDK_DEPRECATED_IN_4_6 _GDK_EXTERN
249# define GDK_DEPRECATED_IN_4_6_FOR(f) _GDK_EXTERN
250#endif
251
252#endif /* __GDK_VERSION_MACROS_H__ */
253

source code of gtk/build/gdk/gdkversionmacros.h