[libgudev] gudev: Fix compilation warning



commit 1bcf1e7d8d77b56e669758531dc9a48a15c42ecb
Author: lindevel <lindevel0 gmail com>
Date:   Wed Jul 21 17:06:04 2021 +0300

    gudev: Fix compilation warning
    
    Currently, the volative qualification is not needed here,
    it is a historical artifact
    
    Compiler output:
    In file included from /usr/include/glib-2.0/glib/gthread.h:32,
                     from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                     from /usr/include/glib-2.0/glib.h:32,
                     from /usr/include/glib-2.0/gobject/gbinding.h:28,
                     from /usr/include/glib-2.0/glib-object.h:22,
                     from ../gudev/gudevenums.h:14,
                     from ../gudev/gudev.h:11,
                     from gudev/gudevenumtypes.c:4:
    gudev/gudevenumtypes.c: In function 'g_udev_device_type_get_type':
    /usr/include/glib-2.0/glib/gatomic.h:117:5: warning: argument 2 of '__atomic_load' discards 'volatile' 
qualifier [-Wincompatible-pointer-types]
      117 |     __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
          |     ^~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gthread.h:260:7: note: in expansion of macro 'g_atomic_pointer_get'
      260 |     (!g_atomic_pointer_get (location) &&                             \
          |       ^~~~~~~~~~~~~~~~~~~~
    gudev/gudevenumtypes.c:11:7: note: in expansion of macro 'g_once_init_enter'
       11 |   if (g_once_init_enter (&g_define_type_id__volatile))
          |       ^~~~~~~~~~~~~~~~~

 gudev/gudevenumtypes.c.template | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gudev/gudevenumtypes.c.template b/gudev/gudevenumtypes.c.template
index 4918f7e..c8d5977 100644
--- a/gudev/gudevenumtypes.c.template
+++ b/gudev/gudevenumtypes.c.template
@@ -11,9 +11,9 @@
 GType
 @enum_name@_get_type (void)
 {
-  static volatile gsize g_define_type_id__volatile = 0;
+  static gsize static_g_define_type_id = 0;
 
-  if (g_once_init_enter (&g_define_type_id__volatile))
+  if (g_once_init_enter (&static_g_define_type_id))
     {
       static const G@Type@Value values[] = {
 /*** END value-header ***/
@@ -27,10 +27,10 @@ GType
       };
       GType g_define_type_id =
         g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
-      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+      g_once_init_leave (&static_g_define_type_id, g_define_type_id);
     }
 
-  return g_define_type_id__volatile;
+  return static_g_define_type_id;
 }
 
 /*** END value-tail ***/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]