blob: ea3fd9f6e9d498633a2e27f6f42b49ededc1c1fa [file] [log] [blame]
Andrew Geissler95ac1b82021-03-31 14:34:31 -05001From 7cdb68713c1863a27ad82d801756ec74097e8e87 Mon Sep 17 00:00:00 2001
2From: Philip Withnall <pwithnall@endlessos.org>
3Date: Wed, 11 Nov 2020 18:30:36 +0000
4Subject: [PATCH 11/29] tests: Drop unnecessary volatile qualifiers from tests
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9These variables were already (correctly) accessed atomically. The
10`volatile` qualifier doesnt help with that.
11
12Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
13
14Helps: #600
15Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719]
16---
17 tests/gobject/performance-threaded.c | 2 +-
18 tests/gobject/performance.c | 4 ++--
19 tests/onceinit.c | 16 ++++++++--------
20 3 files changed, 11 insertions(+), 11 deletions(-)
21
22diff --git a/tests/gobject/performance-threaded.c b/tests/gobject/performance-threaded.c
23index 30ea5bd80..c98541d66 100644
24--- a/tests/gobject/performance-threaded.c
25+++ b/tests/gobject/performance-threaded.c
26@@ -52,7 +52,7 @@ static GType liststore_interfaces[6];
27 static gpointer
28 register_types (void)
29 {
30- static volatile gsize inited = 0;
31+ static gsize inited = 0;
32 if (g_once_init_enter (&inited))
33 {
34 liststore_interfaces[0] = simple_register_class ("GtkBuildable", G_TYPE_INTERFACE, 0);
35diff --git a/tests/gobject/performance.c b/tests/gobject/performance.c
36index 236ffaed0..163be58b4 100644
37--- a/tests/gobject/performance.c
38+++ b/tests/gobject/performance.c
39@@ -575,8 +575,8 @@ test_type_check_run (PerformanceTest *test,
40 gpointer _data)
41 {
42 struct TypeCheckTest *data = _data;
43- volatile GObject *object = data->object;
44- volatile GType type, types[5];
45+ GObject *object = data->object;
46+ GType type, types[5];
47 int i, j;
48
49 types[0] = test_iface1_get_type ();
50diff --git a/tests/onceinit.c b/tests/onceinit.c
51index 89ba6a136..9788efcbd 100644
52--- a/tests/onceinit.c
53+++ b/tests/onceinit.c
54@@ -25,13 +25,13 @@
55
56 static GMutex tmutex;
57 static GCond tcond;
58-static volatile int thread_call_count = 0;
59+static int thread_call_count = 0; /* (atomic) */
60 static char dummy_value = 'x';
61
62 static void
63 assert_singleton_execution1 (void)
64 {
65- static volatile int seen_execution = 0;
66+ static int seen_execution = 0; /* (atomic) */
67 int old_seen_execution = g_atomic_int_add (&seen_execution, 1);
68 if (old_seen_execution != 0)
69 g_error ("%s: function executed more than once", G_STRFUNC);
70@@ -40,7 +40,7 @@ assert_singleton_execution1 (void)
71 static void
72 assert_singleton_execution2 (void)
73 {
74- static volatile int seen_execution = 0;
75+ static int seen_execution = 0; /* (atomic) */
76 int old_seen_execution = g_atomic_int_add (&seen_execution, 1);
77 if (old_seen_execution != 0)
78 g_error ("%s: function executed more than once", G_STRFUNC);
79@@ -49,7 +49,7 @@ assert_singleton_execution2 (void)
80 static void
81 assert_singleton_execution3 (void)
82 {
83- static volatile int seen_execution = 0;
84+ static int seen_execution = 0; /* (atomic) */
85 int old_seen_execution = g_atomic_int_add (&seen_execution, 1);
86 if (old_seen_execution != 0)
87 g_error ("%s: function executed more than once", G_STRFUNC);
88@@ -58,7 +58,7 @@ assert_singleton_execution3 (void)
89 static void
90 initializer1 (void)
91 {
92- static volatile gsize initialized = 0;
93+ static gsize initialized = 0;
94 if (g_once_init_enter (&initialized))
95 {
96 gsize initval = 42;
97@@ -70,7 +70,7 @@ initializer1 (void)
98 static gpointer
99 initializer2 (void)
100 {
101- static volatile gsize initialized = 0;
102+ static gsize initialized = 0;
103 if (g_once_init_enter (&initialized))
104 {
105 void *pointer_value = &dummy_value;
106@@ -83,7 +83,7 @@ initializer2 (void)
107 static void
108 initializer3 (void)
109 {
110- static volatile gsize initialized = 0;
111+ static gsize initialized = 0;
112 if (g_once_init_enter (&initialized))
113 {
114 gsize initval = 42;
115@@ -163,7 +163,7 @@ main (int argc,
116 static void \
117 test_initializer_##N (void) \
118 { \
119- static volatile gsize initialized = 0; \
120+ static gsize initialized = 0; \
121 if (g_once_init_enter (&initialized)) \
122 { \
123 g_free (g_strdup_printf ("cpuhog%5d", 1)); \
124--
1252.30.1
126