Deprecated GSlice config API
[glib.git] / glib / gversionmacros.h
blobed8a5ce9cc97c209abccde85a9c3280f4648f705
1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
27 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
28 #error "Only <glib.h> can be included directly."
29 #endif
31 #ifndef __G_VERSION_MACROS_H__
32 #define __G_VERSION_MACROS_H__
34 /* Version boundaries checks */
36 #define G_ENCODE_VERSION(major,minor) ((major) << 16 | (minor) << 8)
38 /* XXX: Every new stable minor release bump should add a macro here */
40 /**
41 * GLIB_VERSION_2_26:
43 * A macro that evaluates to the 2.26 version of GLib, in a format
44 * that can be used by the C pre-processor.
46 * Since: 2.32
48 #define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26))
50 /**
51 * GLIB_VERSION_2_28:
53 * A macro that evaluates to the 2.28 version of GLib, in a format
54 * that can be used by the C pre-processor.
56 * Since: 2.32
58 #define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28))
60 /**
61 * GLIB_VERSION_2_30:
63 * A macro that evaluates to the 2.30 version of GLib, in a format
64 * that can be used by the C pre-processor.
66 * Since: 2.32
68 #define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
70 /**
71 * GLIB_VERSION_2_32:
73 * A macro that evaluates to the 2.32 version of GLib, in a format
74 * that can be used by the C pre-processor.
76 * Since: 2.32
78 #define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
80 /**
81 * GLIB_VERSION_2_34:
83 * A macro that evaluates to the 2.34 version of GLib, in a format
84 * that can be used by the C pre-processor.
86 * Since: 2.34
88 #define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34))
90 /* evaluates to the current stable version; for development cycles,
91 * this means the next stable target
93 #if (GLIB_MINOR_VERSION % 2)
94 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
95 #else
96 #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
97 #endif
99 /* evaluates to the previous stable version */
100 #if (GLIB_MINOR_VERSION % 2)
101 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
102 #else
103 #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
104 #endif
107 * GLIB_VERSION_MIN_REQUIRED:
109 * A macro that should be defined by the user prior to including
110 * the glib.h header.
111 * The definition should be one of the predefined GLib version
112 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
114 * This macro defines the earliest version of GLib that the package is
115 * required to be able to compile against.
117 * If the compiler is configured to warn about the use of deprecated
118 * functions, then using functions that were deprecated in version
119 * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
120 * using functions deprecated in later releases will not).
122 * Since: 2.32
124 /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
125 * GLIB_VERSION_X_Y value that we don't know about, it will compare as
126 * 0 in preprocessor tests.
128 #ifndef GLIB_VERSION_MIN_REQUIRED
129 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE)
130 #elif GLIB_VERSION_MIN_REQUIRED == 0
131 # undef GLIB_VERSION_MIN_REQUIRED
132 # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2)
133 #endif
136 * GLIB_VERSION_MAX_ALLOWED:
138 * A macro that should be defined by the user prior to including
139 * the glib.h header.
140 * The definition should be one of the predefined GLib version
141 * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
143 * This macro defines the latest version of the GLib API that the
144 * package is allowed to make use of.
146 * If the compiler is configured to warn about the use of deprecated
147 * functions, then using functions added after version
148 * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
150 * Unless you are using GLIB_CHECK_VERSION() or the like to compile
151 * different code depending on the GLib version, then this should be
152 * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
154 * Since: 2.32
156 #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
157 # undef GLIB_VERSION_MAX_ALLOWED
158 # define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE)
159 #endif
161 /* sanity checks */
162 #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
163 #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
164 #endif
165 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
166 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
167 #endif
168 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
169 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
170 #endif
172 /* These macros are used to mark deprecated functions in GLib headers,
173 * and thus have to be exposed in installed headers. But please
174 * do *not* use them in other projects. Instead, use G_DEPRECATED
175 * or define your own wrappers around it.
178 /* XXX: Every new stable minor release should add a set of macros here */
180 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
181 # define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED
182 # define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f)
183 #else
184 # define GLIB_DEPRECATED_IN_2_26
185 # define GLIB_DEPRECATED_IN_2_26_FOR(f)
186 #endif
188 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
189 # define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
190 #else
191 # define GLIB_AVAILABLE_IN_2_26
192 #endif
194 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
195 # define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED
196 # define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f)
197 #else
198 # define GLIB_DEPRECATED_IN_2_28
199 # define GLIB_DEPRECATED_IN_2_28_FOR(f)
200 #endif
202 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
203 # define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
204 #else
205 # define GLIB_AVAILABLE_IN_2_28
206 #endif
208 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
209 # define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED
210 # define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f)
211 #else
212 # define GLIB_DEPRECATED_IN_2_30
213 # define GLIB_DEPRECATED_IN_2_30_FOR(f)
214 #endif
216 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
217 # define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
218 #else
219 # define GLIB_AVAILABLE_IN_2_30
220 #endif
222 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
223 # define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED
224 # define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f)
225 #else
226 # define GLIB_DEPRECATED_IN_2_32
227 # define GLIB_DEPRECATED_IN_2_32_FOR(f)
228 #endif
230 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
231 # define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
232 #else
233 # define GLIB_AVAILABLE_IN_2_32
234 #endif
236 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
237 # define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED
238 # define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f)
239 #else
240 # define GLIB_DEPRECATED_IN_2_34
241 # define GLIB_DEPRECATED_IN_2_34_FOR(f)
242 #endif
244 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
245 # define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
246 #else
247 # define GLIB_AVAILABLE_IN_2_34
248 #endif
250 #endif /* __G_VERSION_MACROS_H__ */