Add a 'these are private' note for the version macros
[platform/upstream/glib.git] / glib / gversionmacros.h
1 /* GLIB - Library of useful routines for C programming
2  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
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/.
25  */
26
27 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
28 #error "Only <glib.h> can be included directly."
29 #endif
30
31 #ifndef __G_VERSION_MACROS_H__
32 #define __G_VERSION_MACROS_H__
33
34 /* Version boundaries checks */
35
36 #define G_ENCODE_VERSION(major,minor)   ((major) << 16 | (minor) << 8)
37
38 /* XXX: Every new stable minor release bump should add a macro here */
39
40 /**
41  * GLIB_VERSION_2_26:
42  *
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.
45  *
46  * Since: 2.32
47  */
48 #define GLIB_VERSION_2_26       (G_ENCODE_VERSION (2, 26))
49
50 /**
51  * GLIB_VERSION_2_28:
52  *
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.
55  *
56  * Since: 2.32
57  */
58 #define GLIB_VERSION_2_28       (G_ENCODE_VERSION (2, 28))
59
60 /**
61  * GLIB_VERSION_2_30:
62  *
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.
65  *
66  * Since: 2.32
67  */
68 #define GLIB_VERSION_2_30       (G_ENCODE_VERSION (2, 30))
69
70 /**
71  * GLIB_VERSION_2_32:
72  *
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.
75  *
76  * Since: 2.32
77  */
78 #define GLIB_VERSION_2_32       (G_ENCODE_VERSION (2, 32))
79
80 /* evaluates to the current stable version; for development cycles,
81  * this means the next stable target
82  */
83 #if (GLIB_MINOR_VERSION % 2)
84 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
85 #else
86 #define GLIB_VERSION_CUR_STABLE         (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
87 #endif
88
89 /* evaluates to the previous stable version */
90 #if (GLIB_MINOR_VERSION % 2)
91 #define GLIB_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
92 #else
93 #define GLIB_VERSION_PREV_STABLE        (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
94 #endif
95
96 /**
97  * GLIB_VERSION_MIN_REQUIRED:
98  *
99  * A macro that should be defined by the user prior to including
100  * the glib.h header.
101  * The definition should be one of the predefined GLib version
102  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
103  *
104  * This macro defines the lower bound for the GLib API to use.
105  *
106  * If a function has been deprecated in a newer version of GLib,
107  * it is possible to use this symbol to avoid the compiler warnings
108  * without disabling warning for every deprecated function.
109  *
110  * Since: 2.32
111  */
112 #ifndef GLIB_VERSION_MIN_REQUIRED
113 # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_PREV_STABLE)
114 #endif
115
116 /**
117  * GLIB_VERSION_MAX_ALLOWED:
118  *
119  * A macro that should be defined by the user prior to including
120  * the glib.h header.
121  * The definition should be one of the predefined GLib version
122  * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
123  *
124  * This macro defines the upper bound for the GLib API to use.
125  *
126  * If a function has been introduced in a newer version of GLib,
127  * it is possible to use this symbol to get compiler warnings when
128  * trying to use that function.
129  *
130  * Since: 2.32
131  */
132 #ifndef GLIB_VERSION_MAX_ALLOWED
133 # if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_PREV_STABLE
134 #  define GLIB_VERSION_MAX_ALLOWED      GLIB_VERSION_MIN_REQUIRED
135 # else
136 #  define GLIB_VERSION_MAX_ALLOWED      GLIB_VERSION_CUR_STABLE
137 # endif
138 #endif
139
140 /* sanity checks */
141 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
142 #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
143 #endif
144 #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
145 #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
146 #endif
147
148 /* These macros are used to mark deprecated functions in GLib headers,
149  * and thus have to be exposed in installed headers. But please
150  * do *not* use them in other projects. Instead, use G_DEPRECATED
151  * or define your own wrappers around it.
152  */
153
154 /* XXX: Every new stable minor release should add a set of macros here */
155
156 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
157 # define GLIB_DEPRECATED_IN_2_26                GLIB_DEPRECATED
158 # define GLIB_DEPRECATED_IN_2_26_FOR(f)         GLIB_DEPRECATED_FOR(f)
159 #else
160 # define GLIB_DEPRECATED_IN_2_26
161 # define GLIB_DEPRECATED_IN_2_26_FOR(f)
162 #endif
163
164 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
165 # define GLIB_AVAILABLE_IN_2_26                 GLIB_UNAVAILABLE(2, 26)
166 #else
167 # define GLIB_AVAILABLE_IN_2_26
168 #endif
169
170 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
171 # define GLIB_DEPRECATED_IN_2_28                GLIB_DEPRECATED
172 # define GLIB_DEPRECATED_IN_2_28_FOR(f)         GLIB_DEPRECATED_FOR(f)
173 #else
174 # define GLIB_DEPRECATED_IN_2_28
175 # define GLIB_DEPRECATED_IN_2_28_FOR(f)
176 #endif
177
178 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
179 # define GLIB_AVAILABLE_IN_2_28                 GLIB_UNAVAILABLE(2, 28)
180 #else
181 # define GLIB_AVAILABLE_IN_2_28
182 #endif
183
184 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
185 # define GLIB_DEPRECATED_IN_2_30                GLIB_DEPRECATED
186 # define GLIB_DEPRECATED_IN_2_30_FOR(f)         GLIB_DEPRECATED_FOR(f)
187 #else
188 # define GLIB_DEPRECATED_IN_2_30
189 # define GLIB_DEPRECATED_IN_2_30_FOR(f)
190 #endif
191
192 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
193 # define GLIB_AVAILABLE_IN_2_30                 GLIB_UNAVAILABLE(2, 30)
194 #else
195 # define GLIB_AVAILABLE_IN_2_30
196 #endif
197
198 #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
199 # define GLIB_DEPRECATED_IN_2_32                GLIB_DEPRECATED
200 # define GLIB_DEPRECATED_IN_2_32_FOR(f)         GLIB_DEPRECATED_FOR(f)
201 #else
202 # define GLIB_DEPRECATED_IN_2_32
203 # define GLIB_DEPRECATED_IN_2_32_FOR(f)
204 #endif
205
206 #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
207 # define GLIB_AVAILABLE_IN_2_32                 GLIB_UNAVAILABLE(2, 32)
208 #else
209 # define GLIB_AVAILABLE_IN_2_32
210 #endif
211
212 #endif /*  __G_VERSION_MACROS_H__ */