| 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 |
| |