diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2014-07-04 18:18:32 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2014-08-15 09:45:41 +0800 |
commit | 94380459c1e33c0f47a7f21a3608d7966aaf9208 (patch) | |
tree | bb539aaae0e903289c62a3407d79b140d33e0f94 /girepository/giversionmacros.h | |
parent | 4bfe7f1da88c6bd73cc51666a13840661ab9edb1 (diff) | |
download | gobject-introspection-94380459c1e33c0f47a7f21a3608d7966aaf9208.tar.gz |
girepository: Add Header for Version Macros
This adds a header to the girepository library, which is then included
either directly or indirectly by the other headers so that all the public
symbols (and the 2 symbols in gitypelib-internal.h used by the tools) are
decorated by a macro, that can later be used to export the symbols and also
to be used to display compile-time warnings for usage of deprecated APIs,
which is like what is now being done in GLib (and GTK+, Clutter, and so
on).
This marks the first step that we begin to stop depending on the .symbols/
.def files to export the symbols.
https://bugzilla.gnome.org/show_bug.cgi?id=732669
Diffstat (limited to 'girepository/giversionmacros.h')
-rw-r--r-- | girepository/giversionmacros.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/girepository/giversionmacros.h b/girepository/giversionmacros.h new file mode 100644 index 00000000..15c88476 --- /dev/null +++ b/girepository/giversionmacros.h @@ -0,0 +1,128 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * GObject introspection: Versioning and export macros + * + * Copyright (C) 2014 Chun-wei Fan + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include <glib.h> + +#ifndef __GIVERSIONMACROS_H__ +#define __GIVERSIONMACROS_H__ + +#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION) +#error "Only <girepository.h> can be included directly." +#endif + +#ifndef _GI_EXTERN +#define _GI_EXTERN extern +#endif + +#define GI_AVAILABLE_IN_ALL _GI_EXTERN + +/* XXX: Every new stable minor release should add a set of macros here + * + * We are using the GLib versions here as the G-I minor versions + * need to be in sync with the GLib minor versions. Api's added + * at or before 1.30 are marked as GI_AVAILABLE_IN_ALL + */ + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32 +# define GI_DEPRECATED_IN_1_32 GLIB_DEPRECATED +# define GI_DEPRECATED_IN_1_32_FOR(f) GLIB_DEPRECATED_FOR(f) +#else +# define GI_DEPRECATED_IN_1_32 _GI_EXTERN +# define GI_DEPRECATED_IN_1_32_FOR(f) _GI_EXTERN +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32 +# define GI_AVAILABLE_IN_1_32 GLIB_UNAVAILABLE(2, 32) +#else +# define GI_AVAILABLE_IN_1_32 _GI_EXTERN +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34 +# define GI_DEPRECATED_IN_1_34 GLIB_DEPRECATED +# define GI_DEPRECATED_IN_1_34_FOR(f) GLIB_DEPRECATED_FOR(f) +#else +# define GI_DEPRECATED_IN_1_34 _GI_EXTERN +# define GI_DEPRECATED_IN_1_34_FOR(f) _GI_EXTERN +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34 +# define GI_AVAILABLE_IN_1_34 GLIB_UNAVAILABLE(2, 34) +#else +# define GI_AVAILABLE_IN_1_34 _GI_EXTERN +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36 +# define GI_DEPRECATED_IN_1_36 GLIB_DEPRECATED +# define GI_DEPRECATED_IN_1_36_FOR(f) GLIB_DEPRECATED_FOR(f) +#else +# define GI_DEPRECATED_IN_1_36 _GI_EXTERN +# define GI_DEPRECATED_IN_1_36_FOR(f) _GI_EXTERN +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36 +# define GI_AVAILABLE_IN_1_36 GLIB_UNAVAILABLE(2, 36) +#else +# define GI_AVAILABLE_IN_1_36 _GI_EXTERN +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38 +# define GI_DEPRECATED_IN_1_38 GLIB_DEPRECATED +# define GI_DEPRECATED_IN_1_38_FOR(f) GLIB_DEPRECATED_FOR(f) +#else +# define GI_DEPRECATED_IN_1_38 _GI_EXTERN +# define GI_DEPRECATED_IN_1_38_FOR(f) _GI_EXTERN +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 +# define GI_AVAILABLE_IN_1_38 GLIB_UNAVAILABLE(2, 38) +#else +# define GI_AVAILABLE_IN_1_38 _GI_EXTERN +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40 +# define GI_DEPRECATED_IN_1_40 GLIB_DEPRECATED +# define GI_DEPRECATED_IN_1_40_FOR(f) GLIB_DEPRECATED_FOR(f) +#else +# define GI_DEPRECATED_IN_1_40 _GI_EXTERN +# define GI_DEPRECATED_IN_1_40_FOR(f) _GI_EXTERN +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40 +# define GI_AVAILABLE_IN_1_40 GLIB_UNAVAILABLE(2, 40) +#else +# define GI_AVAILABLE_IN_1_40 _GI_EXTERN +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42 +# define GI_DEPRECATED_IN_1_42 GLIB_DEPRECATED +# define GI_DEPRECATED_IN_1_42_FOR(f) GLIB_DEPRECATED_FOR(f) +#else +# define GI_DEPRECATED_IN_1_42 _GI_EXTERN +# define GI_DEPRECATED_IN_1_42_FOR(f) _GI_EXTERN +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42 +# define GI_AVAILABLE_IN_1_42 GLIB_UNAVAILABLE(2, 42) +#else +# define GI_AVAILABLE_IN_1_42 _GI_EXTERN +#endif + +#endif /* __GIVERSIONMACROS_H__ */
\ No newline at end of file |