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))
84 /* evaluates to the current stable version; for development cycles,
85 * this means the next stable target
87 #if (GDK_MINOR_VERSION % 2)
88 #define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
90 #define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
93 /* evaluates to the previous stable version */
94 #if (GDK_MINOR_VERSION % 2)
95 #define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
97 #define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
101 * GDK_VERSION_MIN_REQUIRED:
103 * A macro that should be defined by the user prior to including
105 * The definition should be one of the predefined GDK version
106 * macros: %GDK_VERSION_3_0, %GDK_VERSION_3_2,...
108 * This macro defines the lower bound for the GLib API to use.
110 * If a function has been deprecated in a newer version of GDK,
111 * it is possible to use this symbol to avoid the compiler warnings
112 * without disabling warning for every deprecated function.
116 #ifndef GDK_VERSION_MIN_REQUIRED
117 # define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_PREV_STABLE)
121 * GDK_VERSION_MAX_ALLOWED:
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 upper bound for the GDK API to use.
130 * If a function has been introduced in a newer version of GDK,
131 * it is possible to use this symbol to get compiler warnings when
132 * trying to use that function.
136 #ifndef GDK_VERSION_MAX_ALLOWED
137 # if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
138 # define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
140 # define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
145 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
146 #error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
148 #if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_3_0
149 #error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_3_0"
152 /* XXX: Every new stable minor release should add a set of macros here */
154 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_0
155 # define GDK_DEPRECATED_IN_3_0 GDK_DEPRECATED
156 # define GDK_DEPRECATED_IN_3_0_FOR(f) GDK_DEPRECATED_FOR(f)
158 # define GDK_DEPRECATED_IN_3_0
159 # define GDK_DEPRECATED_IN_3_0_FOR(f)
162 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_0
163 # define GDK_AVAILABLE_IN_3_0 GDK_UNAVAILABLE(3, 0)
165 # define GDK_AVAILABLE_IN_3_0
168 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_2
169 # define GDK_DEPRECATED_IN_3_2 GDK_DEPRECATED
170 # define GDK_DEPRECATED_IN_3_2_FOR(f) GDK_DEPRECATED_FOR(f)
172 # define GDK_DEPRECATED_IN_3_2
173 # define GDK_DEPRECATED_IN_3_2_FOR(f)
176 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_2
177 # define GDK_AVAILABLE_IN_3_2 GDK_UNAVAILABLE(3, 2)
179 # define GDK_AVAILABLE_IN_3_2
182 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_4
183 # define GDK_DEPRECATED_IN_3_4 GDK_DEPRECATED
184 # define GDK_DEPRECATED_IN_3_4_FOR(f) GDK_DEPRECATED_FOR(f)
186 # define GDK_DEPRECATED_IN_3_4
187 # define GDK_DEPRECATED_IN_3_4_FOR(f)
190 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_4
191 # define GDK_AVAILABLE_IN_3_4 GDK_UNAVAILABLE(3, 4)
193 # define GDK_AVAILABLE_IN_3_4
196 #if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_6
197 # define GDK_DEPRECATED_IN_3_6 GDK_DEPRECATED
198 # define GDK_DEPRECATED_IN_3_6_FOR(f) GDK_DEPRECATED_FOR(f)
200 # define GDK_DEPRECATED_IN_3_6
201 # define GDK_DEPRECATED_IN_3_6_FOR(f)
204 #if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_6
205 # define GDK_AVAILABLE_IN_3_6 GDK_UNAVAILABLE(3, 6)
207 # define GDK_AVAILABLE_IN_3_6
210 #endif /* __GDK_VERSION_MACROS_H__ */