[glib] Add a new _GLIB_EXTERN macro for "extern"
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Add a new _GLIB_EXTERN macro for "extern"
- Date: Sun, 13 Jan 2013 18:17:26 +0000 (UTC)
commit b91c47682749b7e1455305ec5f99d5f950574a36
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Dec 6 13:37:45 2012 -0500
Add a new _GLIB_EXTERN macro for "extern"
This macro simply evaluates the "extern" unless it has been explicitly
defined to something else.
All of the version macros (including the unversioned deprecation markers
and GLIB_AVAILABLE_IN_ALL) now include _GLIB_EXTERN as part of their
definition.
G_INLINE has also been modified to use _GLIB_EXTERN where appropriate.
This macro should never be used outside of the gmacros.h/gversonmacros.h
headers.
The effect of this patch is that "extern" has now been added to all
functions declared in installed headers. Strictly speaking, this is
something we should have had all along...
GLIB_VAR and GOBJECT_VAR have also been modified to use _GLIB_EXTERN on
non-Windows, instead of "extern" which they were using before. The
eventual goal is to use the normal version/deprecation macros on
exported variables and drop GLIB_VAR but we need to see how this will
work on Windows before we go ahead with that.
https://bugzilla.gnome.org/show_bug.cgi?id=688681
glib/gmacros.h | 16 ++++++++++------
glib/gtypes.h | 2 +-
glib/gutils.h | 4 ++--
glib/gversionmacros.h | 38 +++++++++++++++++++-------------------
gobject/gparamspecs.h | 2 +-
5 files changed, 33 insertions(+), 29 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index a50d871..b07eba7 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -324,6 +324,10 @@
#define G_UNAVAILABLE(maj,min)
#endif
+#ifndef _GLIB_EXTERN
+#define _GLIB_EXTERN extern
+#endif
+
/* These macros are used to mark deprecated functions in GLib headers,
* and thus have to be exposed in installed headers. But please
* do *not* use them in other projects. Instead, use G_DEPRECATED
@@ -331,13 +335,13 @@
*/
#ifdef GLIB_DISABLE_DEPRECATION_WARNINGS
-#define GLIB_DEPRECATED
-#define GLIB_DEPRECATED_FOR(f)
-#define GLIB_UNAVAILABLE(maj,min)
+#define GLIB_DEPRECATED _GLIB_EXTERN
+#define GLIB_DEPRECATED_FOR(f) _GLIB_EXTERN
+#define GLIB_UNAVAILABLE(maj,min) _GLIB_EXTERN
#else
-#define GLIB_DEPRECATED G_DEPRECATED
-#define GLIB_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
-#define GLIB_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min)
+#define GLIB_DEPRECATED G_DEPRECATED _GLIB_EXTERN
+#define GLIB_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GLIB_EXTERN
+#define GLIB_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GLIB_EXTERN
#endif
#endif /* __G_MACROS_H__ */
diff --git a/glib/gtypes.h b/glib/gtypes.h
index 593f0be..57829e2 100644
--- a/glib/gtypes.h
+++ b/glib/gtypes.h
@@ -477,7 +477,7 @@ G_END_DECLS
# endif /* !GLIB_COMPILATION */
# endif /* !GLIB_STATIC_COMPILATION */
# else /* !G_PLATFORM_WIN32 */
-# define GLIB_VAR extern
+# define GLIB_VAR _GLIB_EXTERN
# endif /* !G_PLATFORM_WIN32 */
#endif /* GLIB_VAR */
diff --git a/glib/gutils.h b/glib/gutils.h
index 2a9e7c2..8c09b7d 100644
--- a/glib/gutils.h
+++ b/glib/gutils.h
@@ -74,14 +74,14 @@ G_BEGIN_DECLS
# endif
#endif
#ifdef G_IMPLEMENT_INLINES
-# define G_INLINE_FUNC
+# define G_INLINE_FUNC _GLIB_EXTERN
# undef G_CAN_INLINE
#elif defined (__GNUC__)
# define G_INLINE_FUNC static __inline __attribute__ ((unused))
#elif defined (G_CAN_INLINE)
# define G_INLINE_FUNC static inline
#else /* can't inline */
-# define G_INLINE_FUNC
+# define G_INLINE_FUNC _GLIB_EXTERN
#endif /* !G_INLINE_FUNC */
GLIB_AVAILABLE_IN_ALL
diff --git a/glib/gversionmacros.h b/glib/gversionmacros.h
index 21dd754..b294d74 100644
--- a/glib/gversionmacros.h
+++ b/glib/gversionmacros.h
@@ -184,7 +184,7 @@
* do *not* use them in other projects. Instead, use G_DEPRECATED
* or define your own wrappers around it.
*/
-#define GLIB_AVAILABLE_IN_ALL
+#define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN
/* XXX: Every new stable minor release should add a set of macros here */
@@ -192,84 +192,84 @@
# define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED
# define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
-# define GLIB_DEPRECATED_IN_2_26
-# define GLIB_DEPRECATED_IN_2_26_FOR(f)
+# define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
# define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
#else
-# define GLIB_AVAILABLE_IN_2_26
+# define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
# define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED
# define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
-# define GLIB_DEPRECATED_IN_2_28
-# define GLIB_DEPRECATED_IN_2_28_FOR(f)
+# define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
# define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
#else
-# define GLIB_AVAILABLE_IN_2_28
+# define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
# define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED
# define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
-# define GLIB_DEPRECATED_IN_2_30
-# define GLIB_DEPRECATED_IN_2_30_FOR(f)
+# define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
# define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
#else
-# define GLIB_AVAILABLE_IN_2_30
+# define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
# define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED
# define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
-# define GLIB_DEPRECATED_IN_2_32
-# define GLIB_DEPRECATED_IN_2_32_FOR(f)
+# define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
# define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
#else
-# define GLIB_AVAILABLE_IN_2_32
+# define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
# define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED
# define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
-# define GLIB_DEPRECATED_IN_2_34
-# define GLIB_DEPRECATED_IN_2_34_FOR(f)
+# define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
# define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
#else
-# define GLIB_AVAILABLE_IN_2_34
+# define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN
#endif
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
# define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED
# define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f)
#else
-# define GLIB_DEPRECATED_IN_2_36
-# define GLIB_DEPRECATED_IN_2_36_FOR(f)
+# define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN
+# define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN
#endif
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
# define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
#else
-# define GLIB_AVAILABLE_IN_2_36
+# define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN
#endif
#endif /* __G_VERSION_MACROS_H__ */
diff --git a/gobject/gparamspecs.h b/gobject/gparamspecs.h
index 22c6015..b3245a8 100644
--- a/gobject/gparamspecs.h
+++ b/gobject/gparamspecs.h
@@ -1155,7 +1155,7 @@ GParamSpec* g_param_spec_variant (const gchar *name,
# endif /* !GOBJECT_COMPILATION */
# endif /* !GOBJECT_STATIC_COMPILATION */
# else /* !G_PLATFORM_WIN32 */
-# define GOBJECT_VAR extern
+# define GOBJECT_VAR _GLIB_EXTERN
# endif /* !G_PLATFORM_WIN32 */
#endif /* GOBJECT_VAR */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]