summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2020-11-11 18:30:36 +0000
committerPhilip Withnall <pwithnall@endlessos.org>2020-11-20 14:40:19 +0000
commit7cdb68713c1863a27ad82d801756ec74097e8e87 (patch)
treeee9776351b2a0d6003c5c1c2c261d17531b4d35e
parente4e88688a0722237effc56cc21438d0c8e82de88 (diff)
downloadglib-7cdb68713c1863a27ad82d801756ec74097e8e87.tar.gz
tests: Drop unnecessary volatile qualifiers from tests
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
-rw-r--r--tests/gobject/performance-threaded.c2
-rw-r--r--tests/gobject/performance.c4
-rw-r--r--tests/onceinit.c16
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)); \