mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
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:
parent
e4e88688a0
commit
7cdb68713c
@ -52,7 +52,7 @@ static GType liststore_interfaces[6];
|
|||||||
static gpointer
|
static gpointer
|
||||||
register_types (void)
|
register_types (void)
|
||||||
{
|
{
|
||||||
static volatile gsize inited = 0;
|
static gsize inited = 0;
|
||||||
if (g_once_init_enter (&inited))
|
if (g_once_init_enter (&inited))
|
||||||
{
|
{
|
||||||
liststore_interfaces[0] = simple_register_class ("GtkBuildable", G_TYPE_INTERFACE, 0);
|
liststore_interfaces[0] = simple_register_class ("GtkBuildable", G_TYPE_INTERFACE, 0);
|
||||||
|
@ -575,8 +575,8 @@ test_type_check_run (PerformanceTest *test,
|
|||||||
gpointer _data)
|
gpointer _data)
|
||||||
{
|
{
|
||||||
struct TypeCheckTest *data = _data;
|
struct TypeCheckTest *data = _data;
|
||||||
volatile GObject *object = data->object;
|
GObject *object = data->object;
|
||||||
volatile GType type, types[5];
|
GType type, types[5];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
types[0] = test_iface1_get_type ();
|
types[0] = test_iface1_get_type ();
|
||||||
|
@ -25,13 +25,13 @@
|
|||||||
|
|
||||||
static GMutex tmutex;
|
static GMutex tmutex;
|
||||||
static GCond tcond;
|
static GCond tcond;
|
||||||
static volatile int thread_call_count = 0;
|
static int thread_call_count = 0; /* (atomic) */
|
||||||
static char dummy_value = 'x';
|
static char dummy_value = 'x';
|
||||||
|
|
||||||
static void
|
static void
|
||||||
assert_singleton_execution1 (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);
|
int old_seen_execution = g_atomic_int_add (&seen_execution, 1);
|
||||||
if (old_seen_execution != 0)
|
if (old_seen_execution != 0)
|
||||||
g_error ("%s: function executed more than once", G_STRFUNC);
|
g_error ("%s: function executed more than once", G_STRFUNC);
|
||||||
@ -40,7 +40,7 @@ assert_singleton_execution1 (void)
|
|||||||
static void
|
static void
|
||||||
assert_singleton_execution2 (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);
|
int old_seen_execution = g_atomic_int_add (&seen_execution, 1);
|
||||||
if (old_seen_execution != 0)
|
if (old_seen_execution != 0)
|
||||||
g_error ("%s: function executed more than once", G_STRFUNC);
|
g_error ("%s: function executed more than once", G_STRFUNC);
|
||||||
@ -49,7 +49,7 @@ assert_singleton_execution2 (void)
|
|||||||
static void
|
static void
|
||||||
assert_singleton_execution3 (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);
|
int old_seen_execution = g_atomic_int_add (&seen_execution, 1);
|
||||||
if (old_seen_execution != 0)
|
if (old_seen_execution != 0)
|
||||||
g_error ("%s: function executed more than once", G_STRFUNC);
|
g_error ("%s: function executed more than once", G_STRFUNC);
|
||||||
@ -58,7 +58,7 @@ assert_singleton_execution3 (void)
|
|||||||
static void
|
static void
|
||||||
initializer1 (void)
|
initializer1 (void)
|
||||||
{
|
{
|
||||||
static volatile gsize initialized = 0;
|
static gsize initialized = 0;
|
||||||
if (g_once_init_enter (&initialized))
|
if (g_once_init_enter (&initialized))
|
||||||
{
|
{
|
||||||
gsize initval = 42;
|
gsize initval = 42;
|
||||||
@ -70,7 +70,7 @@ initializer1 (void)
|
|||||||
static gpointer
|
static gpointer
|
||||||
initializer2 (void)
|
initializer2 (void)
|
||||||
{
|
{
|
||||||
static volatile gsize initialized = 0;
|
static gsize initialized = 0;
|
||||||
if (g_once_init_enter (&initialized))
|
if (g_once_init_enter (&initialized))
|
||||||
{
|
{
|
||||||
void *pointer_value = &dummy_value;
|
void *pointer_value = &dummy_value;
|
||||||
@ -83,7 +83,7 @@ initializer2 (void)
|
|||||||
static void
|
static void
|
||||||
initializer3 (void)
|
initializer3 (void)
|
||||||
{
|
{
|
||||||
static volatile gsize initialized = 0;
|
static gsize initialized = 0;
|
||||||
if (g_once_init_enter (&initialized))
|
if (g_once_init_enter (&initialized))
|
||||||
{
|
{
|
||||||
gsize initval = 42;
|
gsize initval = 42;
|
||||||
@ -163,7 +163,7 @@ main (int argc,
|
|||||||
static void \
|
static void \
|
||||||
test_initializer_##N (void) \
|
test_initializer_##N (void) \
|
||||||
{ \
|
{ \
|
||||||
static volatile gsize initialized = 0; \
|
static gsize initialized = 0; \
|
||||||
if (g_once_init_enter (&initialized)) \
|
if (g_once_init_enter (&initialized)) \
|
||||||
{ \
|
{ \
|
||||||
g_free (g_strdup_printf ("cpuhog%5d", 1)); \
|
g_free (g_strdup_printf ("cpuhog%5d", 1)); \
|
||||||
|
Loading…
Reference in New Issue
Block a user