summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glib-2.0/glib-2.0/0011-tests-Drop-unnecessary-volatile-qualifiers-from-test.patch
blob: ea3fd9f6e9d498633a2e27f6f42b49ededc1c1fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
From 7cdb68713c1863a27ad82d801756ec74097e8e87 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Wed, 11 Nov 2020 18:30:36 +0000
Subject: [PATCH 11/29] tests: Drop unnecessary volatile qualifiers from tests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

These variables were already (correctly) accessed atomically. The
`volatile` qualifier doesn’t help with that.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #600
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719]
---
 tests/gobject/performance-threaded.c |  2 +-
 tests/gobject/performance.c          |  4 ++--
 tests/onceinit.c                     | 16 ++++++++--------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tests/gobject/performance-threaded.c b/tests/gobject/performance-threaded.c
index 30ea5bd80..c98541d66 100644
--- a/tests/gobject/performance-threaded.c
+++ b/tests/gobject/performance-threaded.c
@@ -52,7 +52,7 @@ static GType liststore_interfaces[6];
 static gpointer 
 register_types (void)
 {
-  static volatile gsize inited = 0;
+  static gsize inited = 0;
   if (g_once_init_enter (&inited))
     {
       liststore_interfaces[0] = simple_register_class ("GtkBuildable", G_TYPE_INTERFACE, 0);
diff --git a/tests/gobject/performance.c b/tests/gobject/performance.c
index 236ffaed0..163be58b4 100644
--- a/tests/gobject/performance.c
+++ b/tests/gobject/performance.c
@@ -575,8 +575,8 @@ test_type_check_run (PerformanceTest *test,
 		     gpointer _data)
 {
   struct TypeCheckTest *data = _data;
-  volatile GObject *object = data->object;
-  volatile GType type, types[5];
+  GObject *object = data->object;
+  GType type, types[5];
   int i, j;
 
   types[0] = test_iface1_get_type ();
diff --git a/tests/onceinit.c b/tests/onceinit.c
index 89ba6a136..9788efcbd 100644
--- a/tests/onceinit.c
+++ b/tests/onceinit.c
@@ -25,13 +25,13 @@
 
 static GMutex       tmutex;
 static GCond        tcond;
-static volatile int thread_call_count = 0;
+static int thread_call_count = 0;  /* (atomic) */
 static char         dummy_value = 'x';
 
 static void
 assert_singleton_execution1 (void)
 {
-  static volatile int seen_execution = 0;
+  static int seen_execution = 0;  /* (atomic) */
   int old_seen_execution = g_atomic_int_add (&seen_execution, 1);
   if (old_seen_execution != 0)
     g_error ("%s: function executed more than once", G_STRFUNC);
@@ -40,7 +40,7 @@ assert_singleton_execution1 (void)
 static void
 assert_singleton_execution2 (void)
 {
-  static volatile int seen_execution = 0;
+  static int seen_execution = 0;  /* (atomic) */
   int old_seen_execution = g_atomic_int_add (&seen_execution, 1);
   if (old_seen_execution != 0)
     g_error ("%s: function executed more than once", G_STRFUNC);
@@ -49,7 +49,7 @@ assert_singleton_execution2 (void)
 static void
 assert_singleton_execution3 (void)
 {
-  static volatile int seen_execution = 0;
+  static int seen_execution = 0;  /* (atomic) */
   int old_seen_execution = g_atomic_int_add (&seen_execution, 1);
   if (old_seen_execution != 0)
     g_error ("%s: function executed more than once", G_STRFUNC);
@@ -58,7 +58,7 @@ assert_singleton_execution3 (void)
 static void
 initializer1 (void)
 {
-  static volatile gsize initialized = 0;
+  static gsize initialized = 0;
   if (g_once_init_enter (&initialized))
     {
       gsize initval = 42;
@@ -70,7 +70,7 @@ initializer1 (void)
 static gpointer
 initializer2 (void)
 {
-  static volatile gsize initialized = 0;
+  static gsize initialized = 0;
   if (g_once_init_enter (&initialized))
     {
       void *pointer_value = &dummy_value;
@@ -83,7 +83,7 @@ initializer2 (void)
 static void
 initializer3 (void)
 {
-  static volatile gsize initialized = 0;
+  static gsize initialized = 0;
   if (g_once_init_enter (&initialized))
     {
       gsize initval = 42;
@@ -163,7 +163,7 @@ main (int   argc,
       static void                                       \
       test_initializer_##N (void)                       \
       {                                                 \
-        static volatile gsize initialized = 0;          \
+        static gsize initialized = 0;                   \
         if (g_once_init_enter (&initialized))           \
           {                                             \
             g_free (g_strdup_printf ("cpuhog%5d", 1));  \
-- 
2.30.1