[glib: 17/30] gmessages: Drop unnecessary volatile qualifiers from macro variables




commit eee7e3c6688f2f1ee9beed5d6d209973c1df387e
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Nov 11 19:14:25 2020 +0000

    gmessages: Drop unnecessary volatile qualifiers from macro variables
    
    It’s not necessary and provides no thread safety guarantees.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #600

 glib/gmessages.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glib/gmessages.h b/glib/gmessages.h
index 6a28443b4..2e3650baf 100644
--- a/glib/gmessages.h
+++ b/glib/gmessages.h
@@ -478,7 +478,7 @@ g_debug (const gchar *format,
 #if defined(G_HAVE_ISO_VARARGS) && !G_ANALYZER_ANALYZING
 #define g_warning_once(...) \
   G_STMT_START { \
-    static volatile int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0; \
+    static int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0;  /* (atomic) */ \
     if (g_atomic_int_compare_and_exchange (&G_PASTE (_GWarningOnceBoolean, __LINE__), \
                                            0, 1)) \
       g_warning (__VA_ARGS__); \
@@ -487,7 +487,7 @@ g_debug (const gchar *format,
 #elif defined(G_HAVE_GNUC_VARARGS)  && !G_ANALYZER_ANALYZING
 #define g_warning_once(format...) \
   G_STMT_START { \
-    static volatile int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0; \
+    static int G_PASTE (_GWarningOnceBoolean, __LINE__) = 0;  /* (atomic) */ \
     if (g_atomic_int_compare_and_exchange (&G_PASTE (_GWarningOnceBoolean, __LINE__), \
                                            0, 1)) \
       g_warning (format); \


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