1 /* gdkversionmacros.h - version boundaries checks
2 * Copyright (C) 2012 Red Hat, Inc.
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.
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.
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.
20 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
21 #error "Only <gdk/gdk.h> can be included directly."
24 #ifndef __GDK_VERSION_MACROS_H__
25 #define __GDK_VERSION_MACROS_H__
29 #define GDK_MAJOR_VERSION (@GTK_MAJOR_VERSION@)
30 #define GDK_MINOR_VERSION (@GTK_MINOR_VERSION@)
31 #define GDK_MICRO_VERSION (@GTK_MICRO_VERSION@)
34 * GDK_DISABLE_DEPRECATION_WARNINGS:
36 * A macro that should be defined before including the gdk.h header.
37 * If it is defined, no compiler warnings will be produced for uses
38 * of deprecated GDK and GTK+ APIs.
41 #ifdef GDK_DISABLE_DEPRECATION_WARNINGS
42 #define GDK_DEPRECATED
43 #define GDK_DEPRECATED_FOR(f)
44 #define GDK_UNAVAILABLE(maj,min)
46 #define GDK_DEPRECATED G_DEPRECATED
47 #define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
48 #define GDK_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min)
51 /* XXX: Every new stable minor release bump should add a macro here */
56 * A macro that evaluates to the 3.0 version of GDK, in a format
57 * that can be used by the C pre-processor.
61 #define GDK_VERSION_3_0 (G_ENCODE_VERSION (3, 0))
66 * A macro that evaluates to the 3.2 version of GDK, in a format
67 * that can be used by the C pre-processor.
71 #define GDK_VERSION_3_2 (G_ENCODE_VERSION (3, 2))
76 * A macro that evaluates to the 3.4 version of GDK, in a format
77 * that can be used by the C pre-processor.
81 #define GDK_VERSION_3_4 (G_ENCODE_VERSION (3, 4))
86 * A macro that evaluates to the 3.6 version of GDK, in a format
87 * that can be used by the C pre-processor.
91 #define GDK_VERSION_3_6 (G_ENCODE_VERSION (3, 6))
96 * A macro that evaluates to the 3.8 version of GDK, in a format
97 * that can be used by the C pre-processor.
101 #define GDK_VERSION_3_8 (G_ENCODE_VERSION (3, 8))
104 /* evaluates to the current stable version; for development cycles,
105 * this means the next stable target
107 #if (GDK_MINOR_VERSION % 2)
108 #define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
110 #define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
113 /* evaluates to the previous stable version */
114 #if (GDK_MINOR_VERSION % 2)
115 #define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
117 #define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
121 * GDK_VERSION_MIN_REQUIRED:
123 * A macro that should be defined by the user prior to including
125 * The definition should be one of the predefined GDK version
126 * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
128 * This macro defines the lower bound for the GDK API to use.
130 * If a function has been deprecated in a newer version of GDK,
131 * it is possible to use this symbol to avoid the compiler warnings
132 * without disabling warning for every deprecated function.
136 #ifndef GDK_VERSION_MIN_REQUIRED
137 # define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_CUR_STABLE)
141 * GDK_VERSION_MAX_ALLOWED:
143 * A macro that should be defined by the user prior to including
145 * The definition should be one of the predefined GDK version
146 * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
148 * This macro defines the upper bound for the GDK API to use.
150 * If a function has been introduced in a newer version of GDK,
151 * it is possible to use this symbol to get compiler warnings when
152 * trying to use that function.
156 #ifndef GDK_VERSION_MAX_ALLOWED
157 # if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
158 # define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
160 # define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
165 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
166 #error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
168 #if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_3_0
169 #error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_3_0"
172 /* XXX: Every new stable minor release should add a set of macros here */
174 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_0
175 # define GDK_DEPRECATED_IN_3_0 GDK_DEPRECATED
176 # define GDK_DEPRECATED_IN_3_0_FOR(f) GDK_DEPRECATED_FOR(f)
178 # define GDK_DEPRECATED_IN_3_0
179 # define GDK_DEPRECATED_IN_3_0_FOR(f)
182 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_0
183 # define GDK_AVAILABLE_IN_3_0 GDK_UNAVAILABLE(3, 0)
185 # define GDK_AVAILABLE_IN_3_0
188 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_2
189 # define GDK_DEPRECATED_IN_3_2 GDK_DEPRECATED
190 # define GDK_DEPRECATED_IN_3_2_FOR(f) GDK_DEPRECATED_FOR(f)
192 # define GDK_DEPRECATED_IN_3_2
193 # define GDK_DEPRECATED_IN_3_2_FOR(f)
196 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_2
197 # define GDK_AVAILABLE_IN_3_2 GDK_UNAVAILABLE(3, 2)
199 # define GDK_AVAILABLE_IN_3_2
202 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_4
203 # define GDK_DEPRECATED_IN_3_4 GDK_DEPRECATED
204 # define GDK_DEPRECATED_IN_3_4_FOR(f) GDK_DEPRECATED_FOR(f)
206 # define GDK_DEPRECATED_IN_3_4
207 # define GDK_DEPRECATED_IN_3_4_FOR(f)
210 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_4
211 # define GDK_AVAILABLE_IN_3_4 GDK_UNAVAILABLE(3, 4)
213 # define GDK_AVAILABLE_IN_3_4
216 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_6
217 # define GDK_DEPRECATED_IN_3_6 GDK_DEPRECATED
218 # define GDK_DEPRECATED_IN_3_6_FOR(f) GDK_DEPRECATED_FOR(f)
220 # define GDK_DEPRECATED_IN_3_6
221 # define GDK_DEPRECATED_IN_3_6_FOR(f)
224 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_6
225 # define GDK_AVAILABLE_IN_3_6 GDK_UNAVAILABLE(3, 6)
227 # define GDK_AVAILABLE_IN_3_6
230 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_8
231 # define GDK_DEPRECATED_IN_3_8 GDK_DEPRECATED
232 # define GDK_DEPRECATED_IN_3_8_FOR(f) GDK_DEPRECATED_FOR(f)
234 # define GDK_DEPRECATED_IN_3_8
235 # define GDK_DEPRECATED_IN_3_8_FOR(f)
238 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_8
239 # define GDK_AVAILABLE_IN_3_8 GDK_UNAVAILABLE(3, 8)
241 # define GDK_AVAILABLE_IN_3_8
244 #endif /* __GDK_VERSION_MACROS_H__ */