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
This commit is contained in:
Philip Withnall 2020-11-11 18:30:36 +00:00
parent e4e88688a0
commit 7cdb68713c
3 changed files with 11 additions and 11 deletions

View File

@ -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);

View File

@ -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 ();

View File

@ -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)); \