Merge branch 'gobject-speedup4' into 'main'

Don't inline deprecation warnings

See merge request GNOME/glib!2715
This commit is contained in:
Matthias Clasen 2022-06-06 15:58:09 +00:00
commit b185f6e5d0

View File

@ -1492,16 +1492,13 @@ g_object_thaw_notify (GObject *object)
} }
static void static void
consider_issuing_property_deprecation_warning (const GParamSpec *pspec) maybe_issue_property_deprecation_warning (const GParamSpec *pspec)
{ {
static GHashTable *already_warned_table; static GHashTable *already_warned_table;
static const gchar *enable_diagnostic; static const gchar *enable_diagnostic;
static GMutex already_warned_lock; static GMutex already_warned_lock;
gboolean already; gboolean already;
if (!(pspec->flags & G_PARAM_DEPRECATED))
return;
if (g_once_init_enter (&enable_diagnostic)) if (g_once_init_enter (&enable_diagnostic))
{ {
const gchar *value = g_getenv ("G_ENABLE_DIAGNOSTIC"); const gchar *value = g_getenv ("G_ENABLE_DIAGNOSTIC");
@ -1541,6 +1538,13 @@ consider_issuing_property_deprecation_warning (const GParamSpec *pspec)
g_type_name (pspec->owner_type), pspec->name); g_type_name (pspec->owner_type), pspec->name);
} }
static inline void
consider_issuing_property_deprecation_warning (const GParamSpec *pspec)
{
if (G_UNLIKELY (pspec->flags & G_PARAM_DEPRECATED))
maybe_issue_property_deprecation_warning (pspec);
}
static inline void static inline void
object_get_property (GObject *object, object_get_property (GObject *object,
GParamSpec *pspec, GParamSpec *pspec,
@ -1588,6 +1592,8 @@ object_set_property (GObject *object,
if (redirect) if (redirect)
pspec = redirect; pspec = redirect;
consider_issuing_property_deprecation_warning (pspec);
pclass = G_PARAM_SPEC_GET_CLASS (pspec); pclass = G_PARAM_SPEC_GET_CLASS (pspec);
if (g_value_type_compatible (G_VALUE_TYPE (value), pspec->value_type) && if (g_value_type_compatible (G_VALUE_TYPE (value), pspec->value_type) &&
(pclass->value_validate == NULL || (pclass->value_validate == NULL ||
@ -2017,10 +2023,7 @@ g_object_new_with_custom_constructor (GObjectClass *class,
/* set remaining properties */ /* set remaining properties */
for (i = 0; i < n_params; i++) for (i = 0; i < n_params; i++)
if (!(params[i].pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY))) if (!(params[i].pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)))
{
consider_issuing_property_deprecation_warning (params[i].pspec);
object_set_property (object, params[i].pspec, params[i].value, nqueue); object_set_property (object, params[i].pspec, params[i].value, nqueue);
}
/* If nqueue is non-NULL then we are frozen. Thaw it. */ /* If nqueue is non-NULL then we are frozen. Thaw it. */
if (nqueue) if (nqueue)
@ -2068,7 +2071,6 @@ g_object_new_internal (GObjectClass *class,
for (j = 0; j < n_params; j++) for (j = 0; j < n_params; j++)
if (params[j].pspec == pspec) if (params[j].pspec == pspec)
{ {
consider_issuing_property_deprecation_warning (pspec);
value = params[j].value; value = params[j].value;
break; break;
} }
@ -2094,10 +2096,7 @@ g_object_new_internal (GObjectClass *class,
*/ */
for (i = 0; i < n_params; i++) for (i = 0; i < n_params; i++)
if (!(params[i].pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY))) if (!(params[i].pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)))
{
consider_issuing_property_deprecation_warning (params[i].pspec);
object_set_property (object, params[i].pspec, params[i].value, nqueue); object_set_property (object, params[i].pspec, params[i].value, nqueue);
}
g_object_notify_queue_thaw (object, nqueue); g_object_notify_queue_thaw (object, nqueue);
} }
@ -2515,7 +2514,6 @@ g_object_setv (GObject *object,
if (!g_object_set_is_valid_property (object, pspec, names[i])) if (!g_object_set_is_valid_property (object, pspec, names[i]))
break; break;
consider_issuing_property_deprecation_warning (pspec);
object_set_property (object, pspec, &values[i], nqueue); object_set_property (object, pspec, &values[i], nqueue);
} }
@ -2570,7 +2568,6 @@ g_object_set_valist (GObject *object,
break; break;
} }
consider_issuing_property_deprecation_warning (pspec);
object_set_property (object, pspec, &value, nqueue); object_set_property (object, pspec, &value, nqueue);
/* We open-code g_value_unset() here to avoid the /* We open-code g_value_unset() here to avoid the