fix clang 10 warnings

the typesystem checks in g_atomic_pointer_compare_and_exchange
seem to trigger some false positives with clang 10

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/584>
This commit is contained in:
Jordan Petridis 2020-08-03 16:26:58 +03:00 committed by GStreamer Merge Bot
parent ed90b5dc55
commit c12c7afd06
6 changed files with 17 additions and 15 deletions

View file

@ -929,7 +929,8 @@ gst_caps_get_features (const GstCaps * caps, guint index)
gst_caps_features_set_parent_refcount (features, &GST_CAPS_REFCOUNT (caps)); gst_caps_features_set_parent_refcount (features, &GST_CAPS_REFCOUNT (caps));
storage = gst_caps_get_features_storage_unchecked (caps, index); storage = gst_caps_get_features_storage_unchecked (caps, index);
if (!g_atomic_pointer_compare_and_exchange (storage, NULL, features)) { if (!g_atomic_pointer_compare_and_exchange (storage,
(GstCapsFeatures *) NULL, features)) {
/* Someone did the same we just tried in the meantime */ /* Someone did the same we just tried in the meantime */
gst_caps_features_set_parent_refcount (features, NULL); gst_caps_features_set_parent_refcount (features, NULL);
gst_caps_features_free (features); gst_caps_features_free (features);

View file

@ -292,7 +292,8 @@ gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
* an device provider at the same moment * an device provider at the same moment
*/ */
oclass = GST_DEVICE_PROVIDER_GET_CLASS (device_provider); oclass = GST_DEVICE_PROVIDER_GET_CLASS (device_provider);
if (!g_atomic_pointer_compare_and_exchange (&oclass->factory, NULL, factory)) { if (!g_atomic_pointer_compare_and_exchange (&oclass->factory,
(GstDeviceProviderFactory *) NULL, factory)) {
gst_object_unref (factory); gst_object_unref (factory);
} else { } else {
/* This ref will never be dropped as the class is never destroyed */ /* This ref will never be dropped as the class is never destroyed */
@ -302,8 +303,8 @@ gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
gst_object_ref_sink (device_provider); gst_object_ref_sink (device_provider);
/* We use an atomic to make sure we don't create two in parallel */ /* We use an atomic to make sure we don't create two in parallel */
if (!g_atomic_pointer_compare_and_exchange (&newfactory->provider, NULL, if (!g_atomic_pointer_compare_and_exchange (&newfactory->provider,
device_provider)) { (GstDeviceProvider *) NULL, device_provider)) {
gst_object_unref (device_provider); gst_object_unref (device_provider);
device_provider = g_atomic_pointer_get (&newfactory->provider); device_provider = g_atomic_pointer_get (&newfactory->provider);

View file

@ -381,8 +381,8 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
* an element at the same moment * an element at the same moment
*/ */
oclass = GST_ELEMENT_GET_CLASS (element); oclass = GST_ELEMENT_GET_CLASS (element);
if (!g_atomic_pointer_compare_and_exchange (&oclass->elementfactory, NULL, if (!g_atomic_pointer_compare_and_exchange (&oclass->elementfactory,
factory)) (GstElementFactory *) NULL, factory))
gst_object_unref (factory); gst_object_unref (factory);
else else
/* This ref will never be dropped as the class is never destroyed */ /* This ref will never be dropped as the class is never destroyed */

View file

@ -722,7 +722,7 @@ gst_mini_object_replace (GstMiniObject ** olddata, GstMiniObject * newdata)
*olddata, *olddata ? (*olddata)->refcount : 0, *olddata, *olddata ? (*olddata)->refcount : 0,
newdata, newdata ? newdata->refcount : 0); newdata, newdata ? newdata->refcount : 0);
olddata_val = g_atomic_pointer_get ((gpointer *) olddata); olddata_val = (GstMiniObject *) g_atomic_pointer_get ((gpointer *) olddata);
if (G_UNLIKELY (olddata_val == newdata)) if (G_UNLIKELY (olddata_val == newdata))
return FALSE; return FALSE;
@ -731,7 +731,7 @@ gst_mini_object_replace (GstMiniObject ** olddata, GstMiniObject * newdata)
gst_mini_object_ref (newdata); gst_mini_object_ref (newdata);
while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *) while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
olddata, olddata_val, newdata))) { olddata, (gpointer) olddata_val, newdata))) {
olddata_val = g_atomic_pointer_get ((gpointer *) olddata); olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
if (G_UNLIKELY (olddata_val == newdata)) if (G_UNLIKELY (olddata_val == newdata))
break; break;
@ -764,11 +764,11 @@ gst_mini_object_steal (GstMiniObject ** olddata)
*olddata, *olddata ? (*olddata)->refcount : 0); *olddata, *olddata ? (*olddata)->refcount : 0);
do { do {
olddata_val = g_atomic_pointer_get ((gpointer *) olddata); olddata_val = (GstMiniObject *) g_atomic_pointer_get ((gpointer *) olddata);
if (olddata_val == NULL) if (olddata_val == NULL)
break; break;
} while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *) } while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
olddata, olddata_val, NULL))); olddata, (gpointer) olddata_val, NULL)));
return olddata_val; return olddata_val;
} }
@ -800,11 +800,11 @@ gst_mini_object_take (GstMiniObject ** olddata, GstMiniObject * newdata)
newdata, newdata ? newdata->refcount : 0); newdata, newdata ? newdata->refcount : 0);
do { do {
olddata_val = g_atomic_pointer_get ((gpointer *) olddata); olddata_val = (GstMiniObject *) g_atomic_pointer_get ((gpointer *) olddata);
if (G_UNLIKELY (olddata_val == newdata)) if (G_UNLIKELY (olddata_val == newdata))
break; break;
} while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *) } while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
olddata, olddata_val, newdata))); olddata, (gpointer) olddata_val, newdata)));
if (olddata_val) if (olddata_val)
gst_mini_object_unref (olddata_val); gst_mini_object_unref (olddata_val);

View file

@ -349,7 +349,7 @@ gst_object_replace (GstObject ** oldobj, GstObject * newobj)
newobj ? G_OBJECT (newobj)->ref_count : 0); newobj ? G_OBJECT (newobj)->ref_count : 0);
#endif #endif
oldptr = g_atomic_pointer_get ((gpointer *) oldobj); oldptr = (GstObject *) g_atomic_pointer_get ((gpointer *) oldobj);
if (G_UNLIKELY (oldptr == newobj)) if (G_UNLIKELY (oldptr == newobj))
return FALSE; return FALSE;
@ -358,7 +358,7 @@ gst_object_replace (GstObject ** oldobj, GstObject * newobj)
gst_object_ref (newobj); gst_object_ref (newobj);
while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *) while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
oldobj, oldptr, newobj))) { oldobj, (gpointer) oldptr, newobj))) {
oldptr = g_atomic_pointer_get ((gpointer *) oldobj); oldptr = g_atomic_pointer_get ((gpointer *) oldobj);
if (G_UNLIKELY (oldptr == newobj)) if (G_UNLIKELY (oldptr == newobj))
break; break;

View file

@ -603,7 +603,7 @@ gst_structure_take (GstStructure ** oldstr_ptr, GstStructure * newstr)
return FALSE; return FALSE;
} }
} while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *) } while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *)
oldstr_ptr, oldstr, newstr))); oldstr_ptr, (gpointer) oldstr, newstr)));
if (oldstr) if (oldstr)
gst_structure_free (oldstr); gst_structure_free (oldstr);