summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-08-25 18:27:38 +0200
committerThomas Haller <thaller@redhat.com>2014-08-25 22:05:23 +0200
commitfb7b08388e9de5440962337e20a823bbf9d019ae (patch)
tree8a9526cb43fc55a1423857da5a1f1a4ab0bcf0dd
parented20177d27f84dcdad31f17f354d30b02fe30a4c (diff)
downloadNetworkManager-fb7b08388e9de5440962337e20a823bbf9d019ae.tar.gz
glib-compat: fix compatibility wrapper for g_type_ensure()
The previous implementaiton of the compatibility wrapper failed with clang when used inside a macro. This seems like a compiler error not to ignore the deprecation. Workaround by refactoring the g_type_ensure() wrapper. Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--include/nm-glib-compat.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h
index c8f1b5f11c..397eabfaca 100644
--- a/include/nm-glib-compat.h
+++ b/include/nm-glib-compat.h
@@ -43,13 +43,21 @@
#include "nm-gvaluearray-compat.h"
-#if !GLIB_CHECK_VERSION(2,34,0)
static inline void
-g_type_ensure (GType type)
+__g_type_ensure (GType type)
{
- if (G_UNLIKELY (type == (GType)-1))
- g_error ("can't happen");
+#if !GLIB_CHECK_VERSION(2,34,0)
+ if (G_UNLIKELY (type == (GType)-1))
+ g_error ("can't happen");
+#else
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ g_type_ensure (type);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
+#endif
}
+#define g_type_ensure __g_type_ensure
+
+#if !GLIB_CHECK_VERSION(2,34,0)
#define g_clear_pointer(pp, destroy) \
G_STMT_START { \
@@ -82,13 +90,6 @@ g_type_ensure (GType type)
* the APIs that we emulate above.
*/
-#define g_type_ensure(t) \
- G_STMT_START { \
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
- g_type_ensure (t); \
- G_GNUC_END_IGNORE_DEPRECATIONS \
- } G_STMT_END
-
#define g_test_expect_message(domain, level, format...) \
G_STMT_START { \
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \