Commits

Yevgen Muntyan  committed da3d22b

Avoid compiler warnings with glib-2.14

  • Participants
  • Parent commits 788211c

Comments (0)

Files changed (1)

File moo/mooutils/mootype-macros.h

 
 #if !GLIB_CHECK_VERSION(2,14,0)
 inline static gboolean
-g_once_init_enter (volatile gsize *value_location)
+_moo_once_init_enter (volatile gsize *value_location)
 {
     return *value_location == 0;
 }
 
 inline static void
-g_once_init_leave (volatile gsize *value_location,
-                   gsize           initialization_value)
+_moo_once_init_leave (volatile gsize *value_location,
+                      gsize           initialization_value)
 {
     *value_location = initialization_value;
 }
+#elif !GLIB_CHECK_VERSION(2,16,0)
+inline static gboolean
+_moo_once_init_enter (volatile gsize *value_location)
+{
+    return g_once_init_enter ((volatile gpointer*) value_location);
+}
+
+inline static void
+_moo_once_init_leave (volatile gsize *value_location,
+                      gsize           initialization_value)
+{
+    g_once_init_leave ((volatile gpointer*) value_location,
+                       (gpointer) initialization_value);
+}
 #endif
 
 #if !GLIB_CHECK_VERSION(2,12,0)
 {                                                                                           \
     static volatile gsize g_define_type_id__volatile;                                       \
                                                                                             \
-    if (g_once_init_enter (&g_define_type_id__volatile))                                    \
+    if (_moo_once_init_enter (&g_define_type_id__volatile))                                 \
     {                                                                                       \
         GType g_define_type_id;                                                             \
         _MOO_REGISTER_TYPE(TypeName,type_name,TYPE_PARENT,0)                                \
         code                                                                                \
-        g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);                  \
+        _moo_once_init_leave (&g_define_type_id__volatile, g_define_type_id);               \
     }                                                                                       \
                                                                                             \
     return g_define_type_id__volatile;                                                      \
 {                                                                                           \
     static volatile gsize g_define_type_id__volatile;                                       \
                                                                                             \
-    if (g_once_init_enter (&g_define_type_id__volatile))                                    \
+    if (_moo_once_init_enter (&g_define_type_id__volatile))                                 \
     {                                                                                       \
         GType g_define_type_id =                                                            \
             g_boxed_type_register_static (#TypeName,                                        \
                                           (GBoxedCopyFunc) copy_func,                       \
                                           (GBoxedFreeFunc) free_func);                      \
-        g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);                  \
+        _moo_once_init_leave (&g_define_type_id__volatile, g_define_type_id);               \
     }                                                                                       \
                                                                                             \
     return g_define_type_id__volatile;                                                      \
 {                                                                                           \
     static volatile gsize g_define_type_id__volatile;                                       \
                                                                                             \
-    if (g_once_init_enter (&g_define_type_id__volatile))                                    \
+    if (_moo_once_init_enter (&g_define_type_id__volatile))                                 \
     {                                                                                       \
         GType g_define_type_id = g_pointer_type_register_static (#TypeName);                \
-        g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);                  \
+        _moo_once_init_leave (&g_define_type_id__volatile, g_define_type_id);               \
     }                                                                                       \
                                                                                             \
     return g_define_type_id__volatile;                                                      \
 {                                                                                           \
     static volatile gsize q_volatile;                                                       \
                                                                                             \
-    if (g_once_init_enter (&q_volatile))                                                    \
+    if (_moo_once_init_enter (&q_volatile))                                                 \
     {                                                                                       \
         GQuark q = g_quark_from_static_string (#QuarkName);                                 \
-        g_once_init_leave (&q_volatile, q);                                                 \
+        _moo_once_init_leave (&q_volatile, q);                                              \
     }                                                                                       \
                                                                                             \
     return q_volatile;                                                                      \