From fdf6a793dcf62320ca29f97090272884a2323b90 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 18 Mar 2021 14:46:15 +1100 Subject: [PATCH] gst: don't use volatile to mean atomic volatile is not sufficient to provide atomic guarantees and real atomics should be used instead. GCC 11 has started warning about using volatile with atomic operations. https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719 Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868 Part-of: --- gst/gstatomicqueue.c | 8 ++++---- gst/gstbuffer.c | 14 +++++++------- gst/gstchildproxy.c | 2 +- gst/gstdeviceprovider.c | 2 +- gst/gstelement.c | 2 +- gst/gstinfo.c | 4 ++-- gst/gstparamspecs.c | 4 ++-- gst/gstpluginloader.c | 2 +- gst/gstpoll.c | 8 ++++---- gst/gstpreset.c | 2 +- gst/gstpromise.c | 2 +- gst/gstprotection.c | 2 +- gst/gsttask.c | 2 +- gst/gsturi.c | 2 +- gst/gstvalue.c | 7 +++---- libs/gst/base/gstaggregator.c | 2 +- libs/gst/base/gstbaseparse.c | 2 +- libs/gst/base/gstbasesink.c | 2 +- libs/gst/base/gstbasesrc.c | 10 +++++----- libs/gst/base/gstbasetransform.c | 2 +- libs/gst/base/gstflowcombiner.c | 4 ++-- libs/gst/check/gstconsistencychecker.c | 12 ++++++------ libs/gst/check/gstharness.c | 6 +++--- libs/gst/controller/gsttimedvaluecontrolsource.c | 2 +- libs/gst/net/gstnetaddressmeta.c | 2 +- libs/gst/net/gstnetcontrolmessagemeta.c | 2 +- plugins/elements/gstmultiqueue.c | 4 ++-- plugins/elements/gstqueue2.h | 2 +- plugins/elements/gstvalve.h | 2 +- tests/check/gst/gstcontroller.c | 6 +++--- tests/check/gst/gstmeta.c | 4 ++-- tests/check/gst/gstminiobject.c | 6 +++--- tests/check/gst/gstobject.c | 2 +- tests/check/gst/gstpreset.c | 2 +- tests/check/gst/gstprotection.c | 2 +- tests/check/libs/controller.c | 2 +- tests/examples/controller/control-sources.c | 2 +- 37 files changed, 71 insertions(+), 72 deletions(-) diff --git a/gst/gstatomicqueue.c b/gst/gstatomicqueue.c index a80089c649..a69c0486d4 100644 --- a/gst/gstatomicqueue.c +++ b/gst/gstatomicqueue.c @@ -57,9 +57,9 @@ struct _GstAQueueMem { gint size; gpointer *array; - volatile gint head; - volatile gint tail_write; - volatile gint tail_read; + gint head; + gint tail_write; + gint tail_read; GstAQueueMem *next; GstAQueueMem *free; }; @@ -103,7 +103,7 @@ free_queue_mem (GstAQueueMem * mem) struct _GstAtomicQueue { - volatile gint refcount; + gint refcount; #ifdef LOW_MEM gint num_readers; #endif diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index c520a8b7a6..8048651120 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -172,14 +172,14 @@ static gint64 meta_seq; /* 0 *//* ATOMIC */ /* TODO: use GLib's once https://gitlab.gnome.org/GNOME/glib/issues/1076 lands */ #if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) static inline gint64 -gst_atomic_int64_inc (volatile gint64 * atomic) +gst_atomic_int64_inc (gint64 * atomic) { return __sync_fetch_and_add (atomic, 1); } #elif defined (G_PLATFORM_WIN32) #include static inline gint64 -gst_atomic_int64_inc (volatile gint64 * atomic) +gst_atomic_int64_inc (gint64 * atomic) { return InterlockedExchangeAdd64 (atomic, 1); } @@ -191,7 +191,7 @@ gst_atomic_int64_inc (volatile gint64 * atomic) #define NO_64BIT_ATOMIC_INT_FOR_PLATFORM G_LOCK_DEFINE_STATIC (meta_seq); static inline gint64 -gst_atomic_int64_inc (volatile gint64 * atomic) +gst_atomic_int64_inc (gint64 * atomic) { gint64 ret; @@ -2643,7 +2643,7 @@ static gboolean _gst_parent_buffer_meta_init (GstParentBufferMeta * parent_meta, gpointer params, GstBuffer * buffer) { - static volatile gsize _init; + static gsize _init; if (g_once_init_enter (&_init)) { GST_DEBUG_CATEGORY_INIT (gst_parent_buffer_meta_debug, "parentbuffermeta", @@ -2662,7 +2662,7 @@ _gst_parent_buffer_meta_init (GstParentBufferMeta * parent_meta, GType gst_parent_buffer_meta_api_get_type (void) { - static volatile GType type = 0; + static GType type = 0; static const gchar *tags[] = { NULL }; if (g_once_init_enter (&type)) { @@ -2812,7 +2812,7 @@ static gboolean _gst_reference_timestamp_meta_init (GstReferenceTimestampMeta * meta, gpointer params, GstBuffer * buffer) { - static volatile gsize _init; + static gsize _init; if (g_once_init_enter (&_init)) { GST_DEBUG_CATEGORY_INIT (gst_reference_timestamp_meta_debug, @@ -2833,7 +2833,7 @@ _gst_reference_timestamp_meta_init (GstReferenceTimestampMeta * meta, GType gst_reference_timestamp_meta_api_get_type (void) { - static volatile GType type = 0; + static GType type = 0; static const gchar *tags[] = { NULL }; if (g_once_init_enter (&type)) { diff --git a/gst/gstchildproxy.c b/gst/gstchildproxy.c index 9ac97d3cad..f2b1989799 100644 --- a/gst/gstchildproxy.c +++ b/gst/gstchildproxy.c @@ -560,7 +560,7 @@ gst_child_proxy_base_init (gpointer g_class) GType gst_child_proxy_get_type (void) { - static volatile gsize type = 0; + static gsize type = 0; if (g_once_init_enter (&type)) { GType _type; diff --git a/gst/gstdeviceprovider.c b/gst/gstdeviceprovider.c index 4b4ba76bbb..f6dad78766 100644 --- a/gst/gstdeviceprovider.c +++ b/gst/gstdeviceprovider.c @@ -84,7 +84,7 @@ static gint private_offset = 0; GType gst_device_provider_get_type (void) { - static volatile gsize gst_device_provider_type = 0; + static gsize gst_device_provider_type = 0; if (g_once_init_enter (&gst_device_provider_type)) { GType _type; diff --git a/gst/gstelement.c b/gst/gstelement.c index 584cfd801e..13d586edf9 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -169,7 +169,7 @@ GQuark __gst_elementclass_factory = 0; GType gst_element_get_type (void) { - static volatile gsize gst_element_type = 0; + static gsize gst_element_type = 0; if (g_once_init_enter (&gst_element_type)) { GType _type; diff --git a/gst/gstinfo.c b/gst/gstinfo.c index d788d9b0cf..eea1a219d2 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -302,8 +302,8 @@ static gboolean add_default_log_func = TRUE; #define PRETTY_TAGS_DEFAULT TRUE static gboolean pretty_tags = PRETTY_TAGS_DEFAULT; -static volatile gint G_GNUC_MAY_ALIAS __default_level = GST_LEVEL_DEFAULT; -static volatile gint G_GNUC_MAY_ALIAS __use_color = GST_DEBUG_COLOR_MODE_ON; +static gint G_GNUC_MAY_ALIAS __default_level = GST_LEVEL_DEFAULT; +static gint G_GNUC_MAY_ALIAS __use_color = GST_DEBUG_COLOR_MODE_ON; /* FIXME: export this? */ gboolean diff --git a/gst/gstparamspecs.c b/gst/gstparamspecs.c index 7de51d7baf..39c378ce41 100644 --- a/gst/gstparamspecs.c +++ b/gst/gstparamspecs.c @@ -123,7 +123,7 @@ _gst_param_fraction_values_cmp (GParamSpec * pspec, const GValue * value1, GType gst_param_spec_fraction_get_type (void) { - static volatile GType gst_faction_type = 0; + static GType gst_faction_type = 0; /* register GST_TYPE_PARAM_FRACTION */ if (g_once_init_enter (&gst_faction_type)) { @@ -304,7 +304,7 @@ _gst_param_array_values_cmp (GParamSpec * pspec, const GValue * value1, GType gst_param_spec_array_get_type (void) { - static volatile GType gst_array_type = 0; + static GType gst_array_type = 0; /* register GST_TYPE_PARAM_FRACTION */ if (g_once_init_enter (&gst_array_type)) { diff --git a/gst/gstpluginloader.c b/gst/gstpluginloader.c index d1e404d98e..621b243496 100644 --- a/gst/gstpluginloader.c +++ b/gst/gstpluginloader.c @@ -381,7 +381,7 @@ plugin_loader_create_blacklist_plugin (GstPluginLoader * l, static gboolean gst_plugin_loader_use_usr_bin_arch (void) { - static volatile gsize multiarch = 0; + static gsize multiarch = 0; if (g_once_init_enter (&multiarch)) { gsize res = NO_MULTIARCH; diff --git a/gst/gstpoll.c b/gst/gstpoll.c index bf5fb8b799..f5f10bc5e1 100644 --- a/gst/gstpoll.c +++ b/gst/gstpoll.c @@ -151,11 +151,11 @@ struct _GstPoll #endif gboolean controllable; - volatile gint waiting; - volatile gint control_pending; - volatile gint flushing; + gint waiting; + gint control_pending; + gint flushing; gboolean timer; - volatile gint rebuild; + gint rebuild; }; static gboolean gst_poll_fd_ctl_read_unlocked (GstPoll * set, GstPollFD * fd, diff --git a/gst/gstpreset.c b/gst/gstpreset.c index 9f1b1b143f..bcbce2a223 100644 --- a/gst/gstpreset.c +++ b/gst/gstpreset.c @@ -1322,7 +1322,7 @@ gst_preset_base_init (gpointer g_class) GType gst_preset_get_type (void) { - static volatile gsize type = 0; + static gsize type = 0; if (g_once_init_enter (&type)) { GType _type; diff --git a/gst/gstpromise.c b/gst/gstpromise.c index afcda18a60..322d603ff6 100644 --- a/gst/gstpromise.c +++ b/gst/gstpromise.c @@ -347,7 +347,7 @@ gst_promise_free (GstMiniObject * object) static void gst_promise_init (GstPromise * promise) { - static volatile gsize _init = 0; + static gsize _init = 0; if (g_once_init_enter (&_init)) { GST_DEBUG_CATEGORY_INIT (gst_promise_debug, "gstpromise", 0, "gstpromise"); diff --git a/gst/gstprotection.c b/gst/gstprotection.c index af0434a2b7..b51f31f50a 100644 --- a/gst/gstprotection.c +++ b/gst/gstprotection.c @@ -56,7 +56,7 @@ static const gchar *gst_protection_factory_check (GstElementFactory * fact, GType gst_protection_meta_api_get_type (void) { - static volatile GType type; + static GType type; static const gchar *tags[] = { NULL }; if (g_once_init_enter (&type)) { diff --git a/gst/gsttask.c b/gst/gsttask.c index f8df4268d2..da8182014a 100644 --- a/gst/gsttask.c +++ b/gst/gsttask.c @@ -148,7 +148,7 @@ gst_task_win32_load_library (void) { /* FIXME: Add support for UWP app */ #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - static volatile gsize _init_once = 0; + static gsize _init_once = 0; if (g_once_init_enter (&_init_once)) { kernel32_module = LoadLibraryW (L"kernel32.dll"); if (kernel32_module) { diff --git a/gst/gsturi.c b/gst/gsturi.c index aea1534f8a..10214359b3 100644 --- a/gst/gsturi.c +++ b/gst/gsturi.c @@ -123,7 +123,7 @@ _gst_ascii_strcasestr (const gchar * s, const gchar * find) GType gst_uri_handler_get_type (void) { - static volatile gsize urihandler_type = 0; + static gsize urihandler_type = 0; if (g_once_init_enter (&urihandler_type)) { GType _type; diff --git a/gst/gstvalue.c b/gst/gstvalue.c index 72c7187833..253fe927b3 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -2267,7 +2267,7 @@ static GstValueAbbreviation * _priv_gst_value_get_abbrs (gint * n_abbrs) { static GstValueAbbreviation *abbrs = NULL; - static volatile gsize num = 0; + static gsize num = 0; if (g_once_init_enter (&num)) { /* dynamically generate the array */ @@ -7617,7 +7617,7 @@ GType _gst_ ## type ## _type = 0; \ \ GType gst_ ## type ## _get_type (void) \ { \ - static volatile GType gst_ ## type ## _type = 0; \ + static GType gst_ ## type ## _type = 0; \ \ if (g_once_init_enter (&gst_ ## type ## _type)) { \ GType _type; \ @@ -7947,9 +7947,8 @@ _priv_gst_value_initialize (void) GST_TYPE_FRACTION_RANGE, gst_value_subtract_fraction_range_fraction_range); - /* see bug #317246, #64994, #65041 */ { - volatile GType date_type = G_TYPE_DATE; + GType date_type = G_TYPE_DATE; g_type_name (date_type); } diff --git a/libs/gst/base/gstaggregator.c b/libs/gst/base/gstaggregator.c index 6303f6c78e..44f2b42090 100644 --- a/libs/gst/base/gstaggregator.c +++ b/libs/gst/base/gstaggregator.c @@ -2878,7 +2878,7 @@ gst_aggregator_init (GstAggregator * self, GstAggregatorClass * klass) GType gst_aggregator_get_type (void) { - static volatile gsize type = 0; + static gsize type = 0; if (g_once_init_enter (&type)) { GType _type; diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c index 852b3f63c8..761dd8aac6 100644 --- a/libs/gst/base/gstbaseparse.c +++ b/libs/gst/base/gstbaseparse.c @@ -377,7 +377,7 @@ static void gst_base_parse_init (GstBaseParse * parse, GType gst_base_parse_get_type (void) { - static volatile gsize base_parse_type = 0; + static gsize base_parse_type = 0; if (g_once_init_enter (&base_parse_type)) { static const GTypeInfo base_parse_info = { diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 8bfc49563d..5f02e63904 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -338,7 +338,7 @@ static void gst_base_sink_finalize (GObject * object); GType gst_base_sink_get_type (void) { - static volatile gsize base_sink_type = 0; + static gsize base_sink_type = 0; if (g_once_init_enter (&base_sink_type)) { GType _type; diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index e35a88f77b..0171b07aec 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -238,8 +238,8 @@ struct _GstBaseSrcPrivate GstClockTimeDiff ts_offset; /* OBJECT_LOCK */ gboolean do_timestamp; /* OBJECT_LOCK */ - volatile gint dynamic_size; /* atomic */ - volatile gint automatic_eos; /* atomic */ + gint dynamic_size; /* atomic */ + gint automatic_eos; /* atomic */ /* stream sequence number */ guint32 seqnum; /* STREAM_LOCK */ @@ -247,7 +247,7 @@ struct _GstBaseSrcPrivate /* pending events (TAG, CUSTOM_BOTH, CUSTOM_DOWNSTREAM) to be * pushed in the data stream */ GList *pending_events; /* OBJECT_LOCK */ - volatile gint have_events; /* OBJECT_LOCK */ + gint have_events; /* OBJECT_LOCK */ /* QoS *//* with LOCK */ gdouble proportion; /* OBJECT_LOCK */ @@ -277,7 +277,7 @@ static void gst_base_src_finalize (GObject * object); GType gst_base_src_get_type (void) { - static volatile gsize base_src_type = 0; + static gsize base_src_type = 0; if (g_once_init_enter (&base_src_type)) { GType _type; @@ -442,7 +442,7 @@ gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class) g_cond_init (&basesrc->live_cond); basesrc->num_buffers = DEFAULT_NUM_BUFFERS; basesrc->num_buffers_left = -1; - basesrc->priv->automatic_eos = TRUE; + g_atomic_int_set (&basesrc->priv->automatic_eos, TRUE); basesrc->can_activate_push = TRUE; diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 2df00f9cff..240e7c7d29 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -219,7 +219,7 @@ static GstFlowReturn default_generate_output (GstBaseTransform * trans, GType gst_base_transform_get_type (void) { - static volatile gsize base_transform_type = 0; + static gsize base_transform_type = 0; if (g_once_init_enter (&base_transform_type)) { GType _type; diff --git a/libs/gst/base/gstflowcombiner.c b/libs/gst/base/gstflowcombiner.c index 40c2dbe20b..d353eae4aa 100644 --- a/libs/gst/base/gstflowcombiner.c +++ b/libs/gst/base/gstflowcombiner.c @@ -72,7 +72,7 @@ struct _GstFlowCombiner GQueue pads; GstFlowReturn last_ret; - volatile gint ref_count; + gint ref_count; }; GST_DEBUG_CATEGORY_STATIC (flowcombiner_dbg); @@ -99,7 +99,7 @@ gst_flow_combiner_new (void) g_queue_init (&combiner->pads); combiner->last_ret = GST_FLOW_OK; - combiner->ref_count = 1; + g_atomic_int_set (&combiner->ref_count, 1); /* Make sure debug category is initialised */ gst_flow_combiner_get_type (); diff --git a/libs/gst/check/gstconsistencychecker.c b/libs/gst/check/gstconsistencychecker.c index aff1875edb..08f720e89c 100644 --- a/libs/gst/check/gstconsistencychecker.c +++ b/libs/gst/check/gstconsistencychecker.c @@ -38,12 +38,12 @@ struct _GstStreamConsistency { /* FIXME: do we want to track some states per pad? */ - volatile gboolean flushing; - volatile gboolean segment; - volatile gboolean eos; - volatile gboolean expect_flush; - volatile gboolean saw_serialized_event; - volatile gboolean saw_stream_start; + gboolean flushing; + gboolean segment; + gboolean eos; + gboolean expect_flush; + gboolean saw_serialized_event; + gboolean saw_stream_start; GstObject *parent; GList *pads; }; diff --git a/libs/gst/check/gstharness.c b/libs/gst/check/gstharness.c index 8ff8038bf4..0ad2d36652 100644 --- a/libs/gst/check/gstharness.c +++ b/libs/gst/check/gstharness.c @@ -172,9 +172,9 @@ struct _GstHarnessPrivate GstPad *sink_forward_pad; GstTestClock *testclock; - volatile gint recv_buffers; - volatile gint recv_events; - volatile gint recv_upstream_events; + gint recv_buffers; + gint recv_events; + gint recv_upstream_events; GAsyncQueue *buffer_queue; GAsyncQueue *src_event_queue; diff --git a/libs/gst/controller/gsttimedvaluecontrolsource.c b/libs/gst/controller/gsttimedvaluecontrolsource.c index 1d6c115729..1f9c599952 100644 --- a/libs/gst/controller/gsttimedvaluecontrolsource.c +++ b/libs/gst/controller/gsttimedvaluecontrolsource.c @@ -98,7 +98,7 @@ gst_control_point_copy (GstControlPoint * cp) GType gst_control_point_get_type (void) { - static volatile gsize type_id = 0; + static gsize type_id = 0; if (g_once_init_enter (&type_id)) { GType tmp = diff --git a/libs/gst/net/gstnetaddressmeta.c b/libs/gst/net/gstnetaddressmeta.c index 262c5788fc..9867cac980 100644 --- a/libs/gst/net/gstnetaddressmeta.c +++ b/libs/gst/net/gstnetaddressmeta.c @@ -72,7 +72,7 @@ net_address_meta_free (GstMeta * meta, GstBuffer * buffer) GType gst_net_address_meta_api_get_type (void) { - static volatile GType type; + static GType type; static const gchar *tags[] = { "origin", NULL }; if (g_once_init_enter (&type)) { diff --git a/libs/gst/net/gstnetcontrolmessagemeta.c b/libs/gst/net/gstnetcontrolmessagemeta.c index 4f248345aa..f4d2a2912f 100644 --- a/libs/gst/net/gstnetcontrolmessagemeta.c +++ b/libs/gst/net/gstnetcontrolmessagemeta.c @@ -75,7 +75,7 @@ net_control_message_meta_free (GstMeta * meta, GstBuffer * buffer) GType gst_net_control_message_meta_api_get_type (void) { - static volatile GType type; + static GType type; static const gchar *tags[] = { "origin", NULL }; if (g_once_init_enter (&type)) { diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 98d27aa75e..609298a9ae 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -110,7 +110,7 @@ typedef struct _GstSingleQueue GstSingleQueue; struct _GstSingleQueue { - volatile gint refcount; + gint refcount; /* unique identifier of the queue */ guint id; @@ -3379,7 +3379,7 @@ gst_single_queue_new (GstMultiQueue * mqueue, guint id) } sq = g_new0 (GstSingleQueue, 1); - sq->refcount = 1; + g_atomic_int_set (&sq->refcount, 1); mqueue->nbqueues++; sq->id = temp_id; diff --git a/plugins/elements/gstqueue2.h b/plugins/elements/gstqueue2.h index e71ec3f067..5e8fa9af1b 100644 --- a/plugins/elements/gstqueue2.h +++ b/plugins/elements/gstqueue2.h @@ -164,7 +164,7 @@ struct _GstQueue2 guint64 ring_buffer_max_size; guint8 * ring_buffer; - volatile gint downstream_may_block; + gint downstream_may_block; GstBufferingMode mode; gint64 buffering_left; diff --git a/plugins/elements/gstvalve.h b/plugins/elements/gstvalve.h index eb3c29e74f..e82a1ea726 100644 --- a/plugins/elements/gstvalve.h +++ b/plugins/elements/gstvalve.h @@ -55,7 +55,7 @@ struct _GstValve GstElement parent; /* atomic boolean */ - volatile gint drop; + gint drop; /* Protected by the stream lock */ gboolean discont; diff --git a/tests/check/gst/gstcontroller.c b/tests/check/gst/gstcontroller.c index 936274ded2..04a11e2c69 100644 --- a/tests/check/gst/gstcontroller.c +++ b/tests/check/gst/gstcontroller.c @@ -181,7 +181,7 @@ gst_test_obj_class_init (GstTestObjClass * klass) static GType gst_test_obj_get_type (void) { - static volatile gsize test_obj_type = 0; + static gsize test_obj_type = 0; if (g_once_init_enter (&test_obj_type)) { GType type; @@ -276,7 +276,7 @@ gst_test_control_source_init (GstTestControlSource * self) static GType gst_test_control_source_get_type (void) { - static volatile gsize test_countrol_source_type = 0; + static gsize test_countrol_source_type = 0; if (g_once_init_enter (&test_countrol_source_type)) { GType type; @@ -406,7 +406,7 @@ gst_test_control_binding_class_init (gpointer klass, gpointer class_data) static GType gst_test_control_binding_get_type (void) { - static volatile gsize test_countrol_binding_type = 0; + static gsize test_countrol_binding_type = 0; if (g_once_init_enter (&test_countrol_binding_type)) { GType type; diff --git a/tests/check/gst/gstmeta.c b/tests/check/gst/gstmeta.c index 03af6d7c72..25b470377a 100644 --- a/tests/check/gst/gstmeta.c +++ b/tests/check/gst/gstmeta.c @@ -135,7 +135,7 @@ test_transform_func (GstBuffer * transbuf, GstMeta * meta, static GType gst_meta_test_api_get_type (void) { - static volatile GType type; + static GType type; static const gchar *tags[] = { "timing", NULL }; if (g_once_init_enter (&type)) { @@ -193,7 +193,7 @@ foo_transform_func (GstBuffer * transbuf, GstMeta * meta, static GType gst_meta_foo_api_get_type (void) { - static volatile GType type; + static GType type; static const gchar *tags[] = { NULL }; if (g_once_init_enter (&type)) { diff --git a/tests/check/gst/gstminiobject.c b/tests/check/gst/gstminiobject.c index e2cc14ebb0..93724dc0f1 100644 --- a/tests/check/gst/gstminiobject.c +++ b/tests/check/gst/gstminiobject.c @@ -220,7 +220,7 @@ struct _MyBufferPool { GSList *buffers; - volatile gboolean is_closed; + gboolean is_closed; }; static void my_recycle_buffer_destroy (MyRecycleBuffer * buf); @@ -310,7 +310,7 @@ thread_buffer_producer (MyBufferPool * pool) gst_buffer_unref (buf); } - pool->is_closed = TRUE; + g_atomic_int_set (&pool->is_closed, TRUE); } static void @@ -327,7 +327,7 @@ thread_buffer_consumer (MyBufferPool * pool) THREAD_SWITCH (); } - while (!pool->is_closed); + while (!g_atomic_int_get (&pool->is_closed)); } GST_START_TEST (test_recycle_threaded) diff --git a/tests/check/gst/gstobject.c b/tests/check/gst/gstobject.c index f5faabe795..3d9660a48c 100644 --- a/tests/check/gst/gstobject.c +++ b/tests/check/gst/gstobject.c @@ -48,7 +48,7 @@ struct _GstFakeObjectClass static GType gst_fake_object_get_type (void) { - static volatile gsize fake_object_type = 0; + static gsize fake_object_type = 0; if (g_once_init_enter (&fake_object_type)) { GType type; diff --git a/tests/check/gst/gstpreset.c b/tests/check/gst/gstpreset.c index 808dfb1101..840e886caf 100644 --- a/tests/check/gst/gstpreset.c +++ b/tests/check/gst/gstpreset.c @@ -114,7 +114,7 @@ gst_preset_test_base_init (GstPresetTestClass * klass) static GType gst_preset_test_get_type (void) { - static volatile gsize preset_test_type = 0; + static gsize preset_test_type = 0; if (g_once_init_enter (&preset_test_type)) { GType type; diff --git a/tests/check/gst/gstprotection.c b/tests/check/gst/gstprotection.c index 1669c81c3b..51908e94ec 100644 --- a/tests/check/gst/gstprotection.c +++ b/tests/check/gst/gstprotection.c @@ -96,7 +96,7 @@ gst_protection_test_base_init (GstProtectionTestClass * klass) static GType gst_protection_test_get_type (void) { - static volatile gsize protection_test_type = 0; + static gsize protection_test_type = 0; if (g_once_init_enter (&protection_test_type)) { GType type; diff --git a/tests/check/libs/controller.c b/tests/check/libs/controller.c index 41ae33a1bc..4ada88e992 100644 --- a/tests/check/libs/controller.c +++ b/tests/check/libs/controller.c @@ -240,7 +240,7 @@ gst_test_obj_base_init (GstTestObjClass * klass) static GType gst_test_obj_get_type (void) { - static volatile gsize test_obj_type = 0; + static gsize test_obj_type = 0; if (g_once_init_enter (&test_obj_type)) { GType type; diff --git a/tests/examples/controller/control-sources.c b/tests/examples/controller/control-sources.c index 53229332d3..6c190ff61a 100644 --- a/tests/examples/controller/control-sources.c +++ b/tests/examples/controller/control-sources.c @@ -153,7 +153,7 @@ gst_test_obj_base_init (GstTestObjClass * klass) static GType gst_test_obj_get_type (void) { - static volatile gsize TEST_OBJ_type = 0; + static gsize TEST_OBJ_type = 0; if (g_once_init_enter (&TEST_OBJ_type)) { GType type;