Commit 98249a57 authored by Matthew Waters's avatar Matthew Waters 🐨 Committed by GStreamer Marge Bot
Browse files

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 gstreamer/gst-plugins-good#868

Part-of: <gstreamer/gst-plugins-base!1073>
parent 00a71112
......@@ -660,7 +660,7 @@ gst_gl_effects_filters_descriptors (void)
gboolean
gst_gl_effects_register_filters (GstPlugin * plugin, GstRank rank)
{
static volatile gsize registered = 0;
static gsize registered = 0;
if (g_once_init_enter (&registered)) {
GTypeInfo info = {
......
......@@ -106,7 +106,7 @@ struct _GstGLImageSink
GstBuffer *next_sync;
GstGLSyncMeta *next_sync_meta;
volatile gint to_quit;
gint to_quit;
gboolean keep_aspect_ratio;
gint par_n, par_d;
......
......@@ -80,7 +80,7 @@ gst_opus_enc_bandwidth_get_type (void)
{OPUS_AUTO, "Auto", "auto"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
......@@ -106,7 +106,7 @@ gst_opus_enc_frame_size_get_type (void)
{60, "60", "60"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
......@@ -130,7 +130,7 @@ gst_opus_enc_audio_type_get_type (void)
"restricted-lowdelay"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
......@@ -153,7 +153,7 @@ gst_opus_enc_bitrate_type_get_type (void)
{BITRATE_TYPE_CONSTRAINED_VBR, "Constrained VBR", "constrained-vbr"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
......@@ -819,7 +819,7 @@ gst_opus_enc_sink_event (GstAudioEncoder * benc, GstEvent * event)
static GstCaps *
gst_opus_enc_get_sink_template_caps (void)
{
static volatile gsize init = 0;
static gsize init = 0;
static GstCaps *caps = NULL;
if (g_once_init_enter (&init)) {
......
......@@ -338,7 +338,7 @@ static void gst_audio_decoder_init (GstAudioDecoder * dec,
GType
gst_audio_decoder_get_type (void)
{
static volatile gsize audio_decoder_type = 0;
static gsize audio_decoder_type = 0;
if (g_once_init_enter (&audio_decoder_type)) {
GType _type;
......
......@@ -177,7 +177,7 @@ gst_buffer_add_audio_downmix_meta (GstBuffer * buffer,
GType
gst_audio_downmix_meta_api_get_type (void)
{
static volatile GType type;
static GType type;
static const gchar *tags[] =
{ GST_META_TAG_AUDIO_STR, GST_META_TAG_AUDIO_CHANNELS_STR, NULL };
......@@ -280,7 +280,7 @@ gst_buffer_add_audio_clipping_meta (GstBuffer * buffer,
GType
gst_audio_clipping_meta_api_get_type (void)
{
static volatile GType type;
static GType type;
static const gchar *tags[] =
{ GST_META_TAG_AUDIO_STR, GST_META_TAG_AUDIO_RATE_STR, NULL };
......@@ -463,7 +463,7 @@ gst_buffer_add_audio_meta (GstBuffer * buffer, const GstAudioInfo * info,
GType
gst_audio_meta_api_get_type (void)
{
static volatile GType type;
static GType type;
static const gchar *tags[] = {
GST_META_TAG_AUDIO_STR, GST_META_TAG_AUDIO_CHANNELS_STR,
GST_META_TAG_AUDIO_RATE_STR, NULL
......@@ -505,7 +505,7 @@ gst_audio_meta_get_info (void)
GType
gst_audio_level_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)) {
......
......@@ -66,7 +66,7 @@ gst_stream_volume_class_init (GstStreamVolumeInterface * iface)
GType
gst_stream_volume_get_type (void)
{
static volatile gsize type = 0;
static gsize type = 0;
if (g_once_init_enter (&type)) {
GType tmp;
static const GTypeInfo info = {
......
......@@ -33,7 +33,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT(gst_gl_ca_opengl_layer_debug, "glcaopengllayer",
......
......@@ -74,7 +74,7 @@ static guintptr gst_gl_display_egl_get_handle (GstGLDisplay * display);
static void
init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "gldisplayegl", 0,
......
......@@ -398,7 +398,7 @@ gst_gl_display_gbm_shutdown_gbm (GstGLDisplayGBM * display_gbm)
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
......
......@@ -22,11 +22,11 @@ c_array = ['--fhead',
'--fprod',
"\n/* enumerations from \"@basename@\" */",
'--vhead',
"GType\n@enum_name@_get_type (void)\n{\n static volatile gsize g_define_type_id__volatile = 0;\n if (g_once_init_enter (&g_define_type_id__volatile)) {\n static const G@Type@Value values[] = {",
"GType\n@enum_name@_get_type (void)\n{\n static gsize static_g_define_type_id = 0;\n if (g_once_init_enter (&static_g_define_type_id)) {\n static const G@Type@Value values[] = {",
'--vprod',
" { C_@TYPE@ (@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" },",
'--vtail',
" { 0, NULL, NULL }\n };\n GType g_define_type_id = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);\n }\n return g_define_type_id__volatile;\n}\n"
" { 0, NULL, NULL }\n };\n GType g_define_type_id = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&static_g_define_type_id, g_define_type_id);\n }\n return static_g_define_type_id;\n}\n"
]
cmd = []
......
......@@ -503,7 +503,7 @@ _mem_free (GstAllocator * allocator, GstMemory * memory)
void
gst_gl_base_memory_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_BASE_MEMORY, "glbasememory", 0,
......
......@@ -457,7 +457,7 @@ gst_gl_buffer_allocator_init (GstGLBufferAllocator * allocator)
void
gst_gl_buffer_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
gst_gl_base_memory_init_once ();
......
......@@ -150,7 +150,7 @@ load_self_module (gpointer user_data)
*/
struct ContextShareGroup
{
volatile int refcount;
int refcount;
};
static struct ContextShareGroup *
......@@ -305,7 +305,7 @@ gst_gl_context_class_init (GstGLContextClass * klass)
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_context_debug, "glcontext", 0,
......
......@@ -105,7 +105,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_marker_debug);
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_GET (gst_performance, "GST_PERFORMANCE");
......
......@@ -277,7 +277,7 @@ gst_gl_display_new (void)
{
GstGLDisplay *display = NULL;
const gchar *user_choice, *platform_choice;
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_display_debug, "gldisplay", 0,
......
......@@ -43,7 +43,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glfeature", 0,
......
......@@ -1109,7 +1109,7 @@ gst_gl_memory_get_texture_id (GstGLMemory * gl_mem)
void
gst_gl_memory_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
gst_gl_base_memory_init_once ();
......
......@@ -818,7 +818,7 @@ gst_gl_memory_pbo_upload_transfer (GstGLMemoryPBO * gl_mem)
void
gst_gl_memory_pbo_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
gst_gl_memory_init_once ();
......
......@@ -58,7 +58,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glquery", 0, "glquery element");
......
......@@ -312,7 +312,7 @@ gst_gl_renderbuffer_get_id (GstGLRenderbuffer * gl_mem)
void
gst_gl_renderbuffer_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;
if (g_once_init_enter (&_init)) {
gst_gl_base_memory_init_once ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment