mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-07 00:31:11 +00:00
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>
This commit is contained in:
parent
ed20177d27
commit
fb7b08388e
|
@ -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 \
|
||||
|
|
Loading…
Reference in a new issue