1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Copyright (C) 2012 Intel Corporation
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __CLUTTER_MACROS_H__
23 #define __CLUTTER_MACROS_H__
24 
25 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
26 #error "Only <clutter/clutter.h> can be included directly."
27 #endif
28 
29 #include <clutter/clutter-version.h>
30 
31 /**
32  * CLUTTER_FLAVOUR:
33  *
34  * GL Windowing system used
35  *
36  * Since: 0.4
37  *
38  * Deprecated: 1.10: The macro evaluates to "deprecated" as Clutter can be
39  *   compiled with multiple windowing system backends. Use the various
40  *   CLUTTER_WINDOWING_* macros to detect the windowing system that Clutter
41  *   is being compiled against, and the type check macros for the
42  *   #ClutterBackend for a run-time check.
43  */
44 #define CLUTTER_FLAVOUR         "deprecated"
45 
46 /**
47  * CLUTTER_COGL:
48  *
49  * Cogl (internal GL abstraction utility library) backend. Can be "gl" or
50  * "gles" currently
51  *
52  * Since: 0.4
53  *
54  * Deprecated: 1.10: The macro evaluates to "deprecated" as Cogl can be
55  *   compiled against multiple GL implementations.
56  */
57 #define CLUTTER_COGL            "deprecated"
58 
59 /**
60  * CLUTTER_STAGE_TYPE:
61  *
62  * The default GObject type for the Clutter stage.
63  *
64  * Since: 0.8
65  *
66  * Deprecated: 1.10: The macro evaluates to "deprecated" as Clutter can
67  *   be compiled against multiple windowing systems. You can use the
68  *   CLUTTER_WINDOWING_* macros for compile-time checks, and the type
69  *   check macros for run-time checks.
70  */
71 #define CLUTTER_STAGE_TYPE      "deprecated"
72 
73 /**
74  * CLUTTER_NO_FPU:
75  *
76  * Set to 1 if Clutter was built without FPU (i.e fixed math), 0 otherwise
77  *
78  * Deprecated: 0.6: This macro is no longer defined (identical code is used
79  *  regardless the presence of FPU).
80  */
81 #define CLUTTER_NO_FPU          (0)
82 
83 /* some structures are meant to be opaque and still be allocated on the stack;
84  * in order to avoid people poking at their internals, we use this macro to
85  * ensure that users don't accidentally access a struct private members.
86  *
87  * we use the CLUTTER_COMPILATION define to allow us easier access, though.
88  */
89 #ifdef CLUTTER_COMPILATION
90 #define CLUTTER_PRIVATE_FIELD(x)        x
91 #else
92 #define CLUTTER_PRIVATE_FIELD(x)        clutter_private_ ## x
93 #endif
94 
95 #ifndef _CLUTTER_EXTERN
96 #define _CLUTTER_EXTERN extern
97 #endif
98 
99 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || \
100   __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)
101 #define _CLUTTER_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
102 #define _CLUTTER_DEPRECATED_MACRO _CLUTTER_GNUC_DO_PRAGMA(GCC warning "Deprecated macro")
103 #define _CLUTTER_DEPRECATED_MACRO_FOR(f) _CLUTTER_GNUC_DO_PRAGMA(GCC warning #f)
104 #else
105 #define _CLUTTER_DEPRECATED_MACRO
106 #define _CLUTTER_DEPRECATED_MACRO_FOR(f)
107 #endif
108 
109 /* these macros are used to mark deprecated functions, and thus have to be
110  * exposed in a public header.
111  *
112  * do *not* use them in other libraries depending on Clutter: use G_DEPRECATED
113  * and G_DEPRECATED_FOR, or use your own wrappers around them.
114  */
115 #ifdef CLUTTER_DISABLE_DEPRECATION_WARNINGS
116 #define CLUTTER_DEPRECATED _CLUTTER_EXTERN
117 #define CLUTTER_DEPRECATED_FOR(f) _CLUTTER_EXTERN
118 #define CLUTTER_UNAVAILABLE(maj,min) _CLUTTER_EXTERN
119 #define CLUTTER_DEPRECATED_MACRO
120 #define CLUTTER_DEPRECATED_MACRO_FOR(f)
121 #else
122 #define CLUTTER_DEPRECATED G_DEPRECATED _CLUTTER_EXTERN
123 #define CLUTTER_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _CLUTTER_EXTERN
124 #define CLUTTER_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _CLUTTER_EXTERN
125 #define CLUTTER_DEPRECATED_MACRO _CLUTTER_DEPRECATED_MACRO
126 #define CLUTTER_DEPRECATED_MACRO_FOR(f) _CLUTTER_DEPRECATED_MACRO_FOR(f)
127 #endif
128 
129 #define CLUTTER_AVAILABLE_IN_ALL _CLUTTER_EXTERN
130 
131 #define CLUTTER_AVAILABLE_IN_MUFFIN _CLUTTER_EXTERN
132 
133 /**
134  * CLUTTER_VERSION_MIN_REQUIRED:
135  *
136  * A macro that should be defined by the user prior to including the
137  * clutter.h header.
138  *
139  * The definition should be one of the predefined Clutter version macros,
140  * such as: %CLUTTER_VERSION_1_0, %CLUTTER_VERSION_1_2, ...
141  *
142  * This macro defines the lower bound for the Clutter API to be used.
143  *
144  * If a function has been deprecated in a newer version of Clutter, it
145  * is possible to use this symbol to avoid the compiler warnings without
146  * disabling warnings for every deprecated function.
147  *
148  * Since: 1.10
149  */
150 #ifndef CLUTTER_VERSION_MIN_REQUIRED
151 # define CLUTTER_VERSION_MIN_REQUIRED   (CLUTTER_VERSION_CUR_STABLE)
152 #endif
153 
154 /**
155  * CLUTTER_VERSION_MAX_ALLOWED:
156  *
157  * A macro that should be define by the user prior to including the
158  * clutter.h header.
159  *
160  * The definition should be one of the predefined Clutter version macros,
161  * such as: %CLUTTER_VERSION_1_0, %CLUTTER_VERSION_1_2, ...
162  *
163  * This macro defines the upper bound for the Clutter API to be used.
164  *
165  * If a function has been introduced in a newer version of Clutter, it
166  * is possible to use this symbol to get compiler warnings when trying
167  * to use that function.
168  *
169  * Since: 1.10
170  */
171 #ifndef CLUTTER_VERSION_MAX_ALLOWED
172 # if CLUTTER_VERSION_MIN_REQUIRED > CLUTTER_VERSION_PREV_STABLE
173 #  define CLUTTER_VERSION_MAX_ALLOWED   CLUTTER_VERSION_MIN_REQUIRED
174 # else
175 #  define CLUTTER_VERSION_MAX_ALLOWED   CLUTTER_VERSION_CUR_STABLE
176 # endif
177 #endif
178 
179 /* sanity checks */
180 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_MIN_REQUIRED
181 # error "CLUTTER_VERSION_MAX_ALLOWED must be >= CLUTTER_VERSION_MIN_REQUIRED"
182 #endif
183 #if CLUTTER_VERSION_MIN_REQUIRED < CLUTTER_VERSION_1_0
184 # error "CLUTTER_VERSION_MIN_REQUIRED must be >= CLUTTER_VERSION_1_0"
185 #endif
186 
187 /* XXX: Every new stable minor release should add a set of macros here */
188 
189 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_0
190 # define CLUTTER_DEPRECATED_IN_1_0              CLUTTER_DEPRECATED
191 # define CLUTTER_DEPRECATED_IN_1_0_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
192 #else
193 # define CLUTTER_DEPRECATED_IN_1_0              _CLUTTER_EXTERN
194 # define CLUTTER_DEPRECATED_IN_1_0_FOR(f)       _CLUTTER_EXTERN
195 #endif
196 
197 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_0
198 # define CLUTTER_AVAILABLE_IN_1_0               CLUTTER_UNAVAILABLE(1, 0)
199 #else
200 # define CLUTTER_AVAILABLE_IN_1_0               _CLUTTER_EXTERN
201 #endif
202 
203 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_2
204 # define CLUTTER_DEPRECATED_IN_1_2              CLUTTER_DEPRECATED
205 # define CLUTTER_DEPRECATED_IN_1_2_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
206 #else
207 # define CLUTTER_DEPRECATED_IN_1_2              _CLUTTER_EXTERN
208 # define CLUTTER_DEPRECATED_IN_1_2_FOR(f)       _CLUTTER_EXTERN
209 #endif
210 
211 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_2
212 # define CLUTTER_AVAILABLE_IN_1_2               CLUTTER_UNAVAILABLE(1, 2)
213 #else
214 # define CLUTTER_AVAILABLE_IN_1_2               _CLUTTER_EXTERN
215 #endif
216 
217 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_4
218 # define CLUTTER_DEPRECATED_IN_1_4              CLUTTER_DEPRECATED
219 # define CLUTTER_DEPRECATED_IN_1_4_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
220 #else
221 # define CLUTTER_DEPRECATED_IN_1_4              _CLUTTER_EXTERN
222 # define CLUTTER_DEPRECATED_IN_1_4_FOR(f)       _CLUTTER_EXTERN
223 #endif
224 
225 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_4
226 # define CLUTTER_AVAILABLE_IN_1_4               CLUTTER_UNAVAILABLE(1, 4)
227 #else
228 # define CLUTTER_AVAILABLE_IN_1_4               _CLUTTER_EXTERN
229 #endif
230 
231 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_6
232 # define CLUTTER_DEPRECATED_IN_1_6              CLUTTER_DEPRECATED
233 # define CLUTTER_DEPRECATED_IN_1_6_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
234 #else
235 # define CLUTTER_DEPRECATED_IN_1_6              _CLUTTER_EXTERN
236 # define CLUTTER_DEPRECATED_IN_1_6_FOR(f)       _CLUTTER_EXTERN
237 #endif
238 
239 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_6
240 # define CLUTTER_AVAILABLE_IN_1_6               CLUTTER_UNAVAILABLE(1, 6)
241 #else
242 # define CLUTTER_AVAILABLE_IN_1_6               _CLUTTER_EXTERN
243 #endif
244 
245 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_8
246 # define CLUTTER_DEPRECATED_IN_1_8              CLUTTER_DEPRECATED
247 # define CLUTTER_DEPRECATED_IN_1_8_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
248 #else
249 # define CLUTTER_DEPRECATED_IN_1_8              _CLUTTER_EXTERN
250 # define CLUTTER_DEPRECATED_IN_1_8_FOR(f)       _CLUTTER_EXTERN
251 #endif
252 
253 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_8
254 # define CLUTTER_AVAILABLE_IN_1_8               CLUTTER_UNAVAILABLE(1, 8)
255 #else
256 # define CLUTTER_AVAILABLE_IN_1_8               _CLUTTER_EXTERN
257 #endif
258 
259 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_10
260 # define CLUTTER_DEPRECATED_IN_1_10             CLUTTER_DEPRECATED
261 # define CLUTTER_DEPRECATED_IN_1_10_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
262 #else
263 # define CLUTTER_DEPRECATED_IN_1_10             _CLUTTER_EXTERN
264 # define CLUTTER_DEPRECATED_IN_1_10_FOR(f)      _CLUTTER_EXTERN
265 #endif
266 
267 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_10
268 # define CLUTTER_AVAILABLE_IN_1_10              CLUTTER_UNAVAILABLE(1, 10)
269 #else
270 # define CLUTTER_AVAILABLE_IN_1_10              _CLUTTER_EXTERN
271 #endif
272 
273 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_12
274 # define CLUTTER_DEPRECATED_IN_1_12             CLUTTER_DEPRECATED
275 # define CLUTTER_DEPRECATED_IN_1_12_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
276 #else
277 # define CLUTTER_DEPRECATED_IN_1_12             _CLUTTER_EXTERN
278 # define CLUTTER_DEPRECATED_IN_1_12_FOR(f)      _CLUTTER_EXTERN
279 #endif
280 
281 #define CLUTTER_DEPRECATED_IN_MUFFIN            CLUTTER_DEPRECATED
282 
283 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_12
284 # define CLUTTER_AVAILABLE_IN_1_12              CLUTTER_UNAVAILABLE(1, 12)
285 #else
286 # define CLUTTER_AVAILABLE_IN_1_12              _CLUTTER_EXTERN
287 #endif
288 
289 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_14
290 # define CLUTTER_DEPRECATED_IN_1_14             CLUTTER_DEPRECATED
291 # define CLUTTER_DEPRECATED_IN_1_14_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
292 #else
293 # define CLUTTER_DEPRECATED_IN_1_14             _CLUTTER_EXTERN
294 # define CLUTTER_DEPRECATED_IN_1_14_FOR(f)      _CLUTTER_EXTERN
295 #endif
296 
297 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_14
298 # define CLUTTER_AVAILABLE_IN_1_14              CLUTTER_UNAVAILABLE(1, 14)
299 #else
300 # define CLUTTER_AVAILABLE_IN_1_14              _CLUTTER_EXTERN
301 #endif
302 
303 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_16
304 # define CLUTTER_DEPRECATED_IN_1_16             CLUTTER_DEPRECATED
305 # define CLUTTER_DEPRECATED_IN_1_16_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
306 #else
307 # define CLUTTER_DEPRECATED_IN_1_16             _CLUTTER_EXTERN
308 # define CLUTTER_DEPRECATED_IN_1_16_FOR(f)      _CLUTTER_EXTERN
309 #endif
310 
311 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_16
312 # define CLUTTER_AVAILABLE_IN_1_16              CLUTTER_UNAVAILABLE(1, 16)
313 #else
314 # define CLUTTER_AVAILABLE_IN_1_16              _CLUTTER_EXTERN
315 #endif
316 
317 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_18
318 # define CLUTTER_DEPRECATED_IN_1_18             CLUTTER_DEPRECATED
319 # define CLUTTER_DEPRECATED_IN_1_18_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
320 #else
321 # define CLUTTER_DEPRECATED_IN_1_18             _CLUTTER_EXTERN
322 # define CLUTTER_DEPRECATED_IN_1_18_FOR(f)      _CLUTTER_EXTERN
323 #endif
324 
325 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_18
326 # define CLUTTER_AVAILABLE_IN_1_18              CLUTTER_UNAVAILABLE(1, 18)
327 #else
328 # define CLUTTER_AVAILABLE_IN_1_18              _CLUTTER_EXTERN
329 #endif
330 
331 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_20
332 # define CLUTTER_DEPRECATED_IN_1_20             CLUTTER_DEPRECATED
333 # define CLUTTER_DEPRECATED_IN_1_20_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
334 #else
335 # define CLUTTER_DEPRECATED_IN_1_20             _CLUTTER_EXTERN
336 # define CLUTTER_DEPRECATED_IN_1_20_FOR(f)      _CLUTTER_EXTERN
337 #endif
338 
339 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_20
340 # define CLUTTER_AVAILABLE_IN_1_20              CLUTTER_UNAVAILABLE(1, 20)
341 #else
342 # define CLUTTER_AVAILABLE_IN_1_20              _CLUTTER_EXTERN
343 #endif
344 
345 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_22
346 # define CLUTTER_DEPRECATED_IN_1_22             CLUTTER_DEPRECATED
347 # define CLUTTER_DEPRECATED_IN_1_22_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
348 #else
349 # define CLUTTER_DEPRECATED_IN_1_22             _CLUTTER_EXTERN
350 # define CLUTTER_DEPRECATED_IN_1_22_FOR(f)      _CLUTTER_EXTERN
351 #endif
352 
353 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_22
354 # define CLUTTER_AVAILABLE_IN_1_22              CLUTTER_UNAVAILABLE(1, 22)
355 #else
356 # define CLUTTER_AVAILABLE_IN_1_22              _CLUTTER_EXTERN
357 #endif
358 
359 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_24
360 # define CLUTTER_DEPRECATED_IN_1_24             CLUTTER_DEPRECATED
361 # define CLUTTER_DEPRECATED_IN_1_24_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
362 # define CLUTTER_MACRO_DEPRECATED_IN_1_24       CLUTTER_DEPRECATED_MACRO
363 # define CLUTTER_MACRO_DEPRECATED_IN_1_24_FOR(f) CLUTTER_DEPRECATED_MACRO_FOR(f)
364 #else
365 # define CLUTTER_DEPRECATED_IN_1_24             _CLUTTER_EXTERN
366 # define CLUTTER_DEPRECATED_IN_1_24_FOR(f)      _CLUTTER_EXTERN
367 # define CLUTTER_MACRO_DEPRECATED_IN_1_24
368 # define CLUTTER_MACRO_DEPRECATED_IN_1_24_FOR(f)
369 #endif
370 
371 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_24
372 # define CLUTTER_AVAILABLE_IN_1_24              CLUTTER_UNAVAILABLE(1, 24)
373 #else
374 # define CLUTTER_AVAILABLE_IN_1_24              _CLUTTER_EXTERN
375 #endif
376 
377 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_26
378 # define CLUTTER_DEPRECATED_IN_1_26             CLUTTER_DEPRECATED
379 # define CLUTTER_DEPRECATED_IN_1_26_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
380 # define CLUTTER_MACRO_DEPRECATED_IN_1_26       CLUTTER_DEPRECATED_MACRO
381 # define CLUTTER_MACRO_DEPRECATED_IN_1_26_FOR(f) CLUTTER_DEPRECATED_MACRO_FOR(f)
382 #else
383 # define CLUTTER_DEPRECATED_IN_1_26             _CLUTTER_EXTERN
384 # define CLUTTER_DEPRECATED_IN_1_26_FOR(f)      _CLUTTER_EXTERN
385 # define CLUTTER_MACRO_DEPRECATED_IN_1_26
386 # define CLUTTER_MACRO_DEPRECATED_IN_1_26_FOR(f)
387 #endif
388 
389 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_26
390 # define CLUTTER_AVAILABLE_IN_1_26              CLUTTER_UNAVAILABLE(1, 26)
391 #else
392 # define CLUTTER_AVAILABLE_IN_1_26              _CLUTTER_EXTERN
393 #endif
394 
395 #endif /* __CLUTTER_MACROS_H__ */
396