if (enable_diagnostic[0] == '1')
{
if (pspec->flags & G_PARAM_DEPRECATED)
- g_warning ("The property %s::%s is deprecated and shouldn't be used "
+ g_warning ("The property %s:%s is deprecated and shouldn't be used "
"anymore. It will be removed in a future version.",
G_OBJECT_TYPE_NAME (object), pspec->name);
}
GValue *return_value,
const GValue *instance_and_params);
static const gchar * type_debug_name (GType type);
+static void node_check_deprecated (const SignalNode *node);
/* --- structures --- */
/* reinitializable portion */
guint test_class_offset : 12;
- guint flags : 8;
+ guint flags : 9;
guint n_params : 8;
GType *param_types; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */
GType return_type; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */
g_hook_list_init (node->emission_hooks, sizeof (SignalHook));
node->emission_hooks->finalize_hook = signal_finalize_hook;
}
+
+ node_check_deprecated (node);
+
hook = g_hook_alloc (node->emission_hooks);
hook->data = hook_data;
hook->func = (gpointer) hook_func;
SIGNAL_LOCK ();
node = LOOKUP_SIGNAL_NODE (signal_id);
+ node_check_deprecated (node);
if (!g_type_is_a (instance_type, node->itype))
g_warning ("%s: type `%s' cannot be overridden for signal id `%u'", G_STRLOC, type_debug_name (instance_type), signal_id);
else
return handler_seq_no;
}
+static void
+node_check_deprecated (const SignalNode *node)
+{
+ static const gchar * g_enable_diagnostic = NULL;
+
+ if (G_UNLIKELY (!g_enable_diagnostic))
+ {
+ g_enable_diagnostic = g_getenv ("G_ENABLE_DIAGNOSTIC");
+ if (!g_enable_diagnostic)
+ g_enable_diagnostic = "0";
+ }
+
+ if (g_enable_diagnostic[0] == '1')
+ {
+ if (node->flags & G_SIGNAL_DEPRECATED)
+ {
+ g_warning ("The signal %s::%s is deprecated and shouldn't be used "
+ "anymore. It will be removed in a future version.",
+ type_debug_name (node->itype), node->name);
+ }
+ }
+}
+
/**
* g_signal_connect_data:
* @instance: the instance to connect to.
{
SignalNode *node = LOOKUP_SIGNAL_NODE (signal_id);
+ node_check_deprecated (node);
+
if (detail && !(node->flags & G_SIGNAL_DETAILED))
g_warning ("%s: signal `%s' does not support details", G_STRLOC, detailed_signal);
else if (!g_type_is_a (itype, node->itype))
* @G_SIGNAL_NO_HOOKS: No emissions hooks are supported for this signal.
* @G_SIGNAL_MUST_COLLECT: Varargs signal emission will always collect the
* arguments, even if there are no signal handlers connected. Since 2.30.
+ * @G_SIGNAL_DEPRECATED: The signal is deprecated and will be removed
+ * in a future version. A warning will be generated if it is connected while
+ * running with G_ENABLE_DIAGNOSTIC=1. Since 2.32.
*
* The signal flags are used to specify a signal's behaviour, the overall
* signal description outlines how especially the RUN flags control the
G_SIGNAL_DETAILED = 1 << 4,
G_SIGNAL_ACTION = 1 << 5,
G_SIGNAL_NO_HOOKS = 1 << 6,
- G_SIGNAL_MUST_COLLECT = 1 << 7
+ G_SIGNAL_MUST_COLLECT = 1 << 7,
+ G_SIGNAL_DEPRECATED = 1 << 8,
} GSignalFlags;
/**
* G_SIGNAL_FLAGS_MASK:
*
* A mask for all #GSignalFlags bits.
*/
-#define G_SIGNAL_FLAGS_MASK 0xff
+#define G_SIGNAL_FLAGS_MASK 0x1ff
/**
* GConnectFlags:
* @G_CONNECT_AFTER: whether the handler should be called before or after the