Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gdkversionmacros.h
Go to the documentation of this file.
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#pragma once
23
24#include <glib.h>
25
26/* These macros are used to mark deprecated symbols in GLib headers,
27 * and thus have to be exposed in installed headers. But please
28 * do *not* use them in other projects. Instead define your own wrappers
29 * around it.
30 */
31
32#if !defined(GDK_DISABLE_DEPRECATION_WARNINGS) && \
33 (G_GNUC_CHECK_VERSION(4, 6) || \
34 __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
35#define _GDK_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
36#define GDK_DEPRECATED_MACRO _GDK_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol")
37#define GDK_DEPRECATED_MACRO_FOR(f) \
38 _GDK_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Deprecated pre-processor symbol: replace with #f))
39#define GDK_UNAVAILABLE_MACRO(maj,min) \
40 _GDK_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Not available before maj.min))
41#else
42#define GDK_DEPRECATED_MACRO
43#define GDK_DEPRECATED_MACRO_FOR(f)
44#define GDK_UNAVAILABLE_MACRO(maj,min)
45#endif
46
47#if !defined(GDK_DISABLE_DEPRECATION_WARNINGS) && \
48 (G_GNUC_CHECK_VERSION(6, 1) || \
49 (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
50#define GDK_DEPRECATED_ENUMERATOR G_DEPRECATED
51#define GDK_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f)
52#define GDK_UNAVAILABLE_ENUMERATOR(maj,min) G_UNAVAILABLE(maj,min)
53#else
54#define GDK_DEPRECATED_ENUMERATOR
55#define GDK_DEPRECATED_ENUMERATOR_FOR(f)
56#define GDK_UNAVAILABLE_ENUMERATOR(maj,min)
57#endif
58
59#if !defined(GDK_DISABLE_DEPRECATION_WARNINGS) && \
60 (G_GNUC_CHECK_VERSION(3, 1) || \
61 (defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
62#define GDK_DEPRECATED_TYPE G_DEPRECATED
63#define GDK_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR(f)
64#define GDK_UNAVAILABLE_TYPE(maj,min) G_UNAVAILABLE(maj,min)
65#else
66#define GDK_DEPRECATED_TYPE
67#define GDK_DEPRECATED_TYPE_FOR(f)
68#define GDK_UNAVAILABLE_TYPE(maj,min)
69#endif
70
71/**
72 * GDK_MAJOR_VERSION:
73 *
74 * The major version component of the library's version, e.g. "1" for "1.2.3".
75 */
76#define GDK_MAJOR_VERSION (4)
77
78/**
79 * GDK_MINOR_VERSION:
80 *
81 * The minor version component of the library's version, e.g. "2" for "1.2.3".
82 */
83#define GDK_MINOR_VERSION (16)
84
85/**
86 * GDK_MICRO_VERSION:
87 *
88 * The micro version component of the library's version, e.g. "3" for "1.2.3".
89 */
90#define GDK_MICRO_VERSION (12)
91/**
92 * GDK_VERSION_4_0:
93 *
94 * A macro that evaluates to the 4.0 version of GTK, in a format
95 * that can be used by the C pre-processor.
96 *
97 * Since: 4.0
98 */
99#define GDK_VERSION_4_0 (G_ENCODE_VERSION (4, 0))
100/**
101 * GDK_VERSION_4_2:
102 *
103 * A macro that evaluates to the 4.2 version of GTK, in a format
104 * that can be used by the C pre-processor.
105 *
106 * Since: 4.2
107 */
108#define GDK_VERSION_4_2 (G_ENCODE_VERSION (4, 2))
109/**
110 * GDK_VERSION_4_4:
111 *
112 * A macro that evaluates to the 4.4 version of GTK, in a format
113 * that can be used by the C pre-processor.
114 *
115 * Since: 4.4
116 */
117#define GDK_VERSION_4_4 (G_ENCODE_VERSION (4, 4))
118/**
119 * GDK_VERSION_4_6:
120 *
121 * A macro that evaluates to the 4.6 version of GTK, in a format
122 * that can be used by the C pre-processor.
123 *
124 * Since: 4.6
125 */
126#define GDK_VERSION_4_6 (G_ENCODE_VERSION (4, 6))
127/**
128 * GDK_VERSION_4_8:
129 *
130 * A macro that evaluates to the 4.8 version of GTK, in a format
131 * that can be used by the C pre-processor.
132 *
133 * Since: 4.8
134 */
135#define GDK_VERSION_4_8 (G_ENCODE_VERSION (4, 8))
136/**
137 * GDK_VERSION_4_10:
138 *
139 * A macro that evaluates to the 4.10 version of GTK, in a format
140 * that can be used by the C pre-processor.
141 *
142 * Since: 4.10
143 */
144#define GDK_VERSION_4_10 (G_ENCODE_VERSION (4, 10))
145/**
146 * GDK_VERSION_4_12:
147 *
148 * A macro that evaluates to the 4.12 version of GTK, in a format
149 * that can be used by the C pre-processor.
150 *
151 * Since: 4.12
152 */
153#define GDK_VERSION_4_12 (G_ENCODE_VERSION (4, 12))
154/**
155 * GDK_VERSION_4_14:
156 *
157 * A macro that evaluates to the 4.14 version of GTK, in a format
158 * that can be used by the C pre-processor.
159 *
160 * Since: 4.14
161 */
162#define GDK_VERSION_4_14 (G_ENCODE_VERSION (4, 14))
163/**
164 * GDK_VERSION_4_16:
165 *
166 * A macro that evaluates to the 4.16 version of GTK, in a format
167 * that can be used by the C pre-processor.
168 *
169 * Since: 4.16
170 */
171#define GDK_VERSION_4_16 (G_ENCODE_VERSION (4, 16))
172
173/* evaluates to the current stable version; for development cycles,
174 * this means the next stable target, with a hard backstop to the
175 * beginning of the stable series
176 */
177#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
178# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
179#elif G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION) > GDK_VERSION_4_0
180# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
181#else
182# define GDK_VERSION_CUR_STABLE GDK_VERSION_4_0
183#endif
184
185/* evaluates to the previous stable version, with a hard backstop
186 * to the beginning of the stable series
187 */
188#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
189# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
190#elif GDK_MAJOR_VERSION >= 4 && GDK_MINOR_VERSION > 2
191# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
192#else
193# define GDK_VERSION_PREV_STABLE GDK_VERSION_4_0
194#endif
195
196/**
197 * GDK_VERSION_MIN_REQUIRED:
198 *
199 * A macro that should be defined by the user prior to including
200 * the `gdk.h` header.
201 *
202 * The definition should be one of the predefined GDK version
203 * macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
204 *
205 * This macro defines the lower bound for the GDK API to use.
206 *
207 * If a function has been deprecated in a newer version of GDK,
208 * it is possible to use this symbol to avoid the compiler warnings
209 * without disabling warning for every deprecated function.
210 */
211#ifndef GDK_VERSION_MIN_REQUIRED
212# define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_CUR_STABLE)
213#endif
214
215/**
216 * GDK_VERSION_MAX_ALLOWED:
217 *
218 * A macro that should be defined by the user prior to including
219 * the `gdk.h` header.
220 *
221 * The definition should be one of the predefined GDK version
222 * macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
223 *
224 * This macro defines the upper bound for the GDK API to use.
225 *
226 * If a function has been introduced in a newer version of GDK,
227 * it is possible to use this symbol to get compiler warnings when
228 * trying to use that function.
229 */
230#ifndef GDK_VERSION_MAX_ALLOWED
231# if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
232# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
233# else
234# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
235# endif
236#endif
237
238/* sanity checks */
239#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
240# error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
241#endif
242#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_4_0
243# error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
244#endif
245