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@)
33 #ifdef GDK_DISABLE_DEPRECATION_WARNINGS
34 #define GDK_DEPRECATED
35 #define GDK_DEPRECATED_FOR(f)
36 #define GDK_UNAVAILABLE(maj,min)
38 #define GDK_DEPRECATED G_DEPRECATED
39 #define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
40 #define GDK_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min)
43 /* XXX: Every new stable minor release bump should add a macro here */
48 * A macro that evaluates to the 3.0 version of GDK, in a format
49 * that can be used by the C pre-processor.
53 #define GDK_VERSION_3_0 (G_ENCODE_VERSION (3, 0))
58 * A macro that evaluates to the 3.2 version of GDK, in a format
59 * that can be used by the C pre-processor.
63 #define GDK_VERSION_3_2 (G_ENCODE_VERSION (3, 2))
68 * A macro that evaluates to the 3.4 version of GDK, in a format
69 * that can be used by the C pre-processor.
73 #define GDK_VERSION_3_4 (G_ENCODE_VERSION (3, 4))
76 /* evaluates to the current stable version; for development cycles,
77 * this means the next stable target
79 #if (GDK_MINOR_VERSION % 2)
80 #define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
82 #define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
85 /* evaluates to the previous stable version */
86 #if (GDK_MINOR_VERSION % 2)
87 #define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
89 #define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
93 * GDK_VERSION_MIN_REQUIRED:
95 * A macro that should be defined by the user prior to including
97 * The definition should be one of the predefined GDK version
98 * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
100 * This macro defines the lower bound for the GLib API to use.
102 * If a function has been deprecated in a newer version of GDK,
103 * it is possible to use this symbol to avoid the compiler warnings
104 * without disabling warning for every deprecated function.
108 #ifndef GDK_VERSION_MIN_REQUIRED
109 # define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_PREV_STABLE)
113 * GDK_VERSION_MAX_ALLOWED:
115 * A macro that should be defined by the user prior to including
117 * The definition should be one of the predefined GDK version
118 * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
120 * This macro defines the upper bound for the GDK API to use.
122 * If a function has been introduced in a newer version of GDK,
123 * it is possible to use this symbol to get compiler warnings when
124 * trying to use that function.
128 #ifndef GDK_VERSION_MAX_ALLOWED
129 # if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
130 # define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
132 # define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
137 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
138 #error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
140 #if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_3_0
141 #error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_3_0"
144 /* XXX: Every new stable minor release should add a set of macros here */
146 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_0
147 # define GDK_DEPRECATED_IN_3_0 GDK_DEPRECATED
148 # define GDK_DEPRECATED_IN_3_0_FOR(f) GDK_DEPRECATED_FOR(f)
150 # define GDK_DEPRECATED_IN_3_0
151 # define GDK_DEPRECATED_IN_3_0_FOR(f)
154 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_0
155 # define GDK_AVAILABLE_IN_3_0 GDK_UNAVAILABLE(3, 0)
157 # define GDK_AVAILABLE_IN_3_0
160 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_2
161 # define GDK_DEPRECATED_IN_3_2 GDK_DEPRECATED
162 # define GDK_DEPRECATED_IN_3_2_FOR(f) GDK_DEPRECATED_FOR(f)
164 # define GDK_DEPRECATED_IN_3_2
165 # define GDK_DEPRECATED_IN_3_2_FOR(f)
168 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_2
169 # define GDK_AVAILABLE_IN_3_2 GDK_UNAVAILABLE(3, 2)
171 # define GDK_AVAILABLE_IN_3_2
174 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_4
175 # define GDK_DEPRECATED_IN_3_4 GDK_DEPRECATED
176 # define GDK_DEPRECATED_IN_3_4_FOR(f) GDK_DEPRECATED_FOR(f)
178 # define GDK_DEPRECATED_IN_3_4
179 # define GDK_DEPRECATED_IN_3_4_FOR(f)
182 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_4
183 # define GDK_AVAILABLE_IN_3_4 GDK_UNAVAILABLE(3, 4)
185 # define GDK_AVAILABLE_IN_3_4
188 #endif /* __GDK_VERSION_MACROS_H__ */