GObjectClass *class = g_type_class_peek (pspec->owner_type);
guint param_id = PARAM_SPEC_PARAM_ID (pspec);
GParamSpec *redirect;
+ static gchar* enable_diagnostic = NULL;
redirect = g_param_spec_get_redirect_target (pspec);
if (redirect)
pspec = redirect;
+ if (G_UNLIKELY (!enable_diagnostic))
+ {
+ enable_diagnostic = g_getenv ("G_ENABLE_DIAGNOSTIC");
+ if (!enable_diagnostic)
+ enable_diagnostic = "0";
+ }
+
+ if (enable_diagnostic[0] == '1')
+ {
+ if (pspec->flags & G_PARAM_DEPRECATED)
+ 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);
+ }
+
/* provide a copy to work from, convert (if necessary) and validate */
g_value_init (&tmp_value, pspec->value_type);
if (!g_value_transform (value, &tmp_value))
* unmodified for the lifetime of the parameter.
* Since 2.8
* @G_PARAM_PRIVATE: internal
+ * @G_PARAM_DEPRECATED: the parameter is deprecated and will be removed
+ * in a future version. A warning will be generated if it is used
+ * while running with G_ENABLE_DIAGNOSTIC=1.
+ * Since: 2.26
*
* Through the #GParamFlags flag values, certain aspects of parameters
* can be configured.
G_PARAM_PRIVATE = G_PARAM_STATIC_NAME,
#endif
G_PARAM_STATIC_NICK = 1 << 6,
- G_PARAM_STATIC_BLURB = 1 << 7
+ G_PARAM_STATIC_BLURB = 1 << 7,
+ /* User defined flags go up to 30 */
+ G_PARAM_DEPRECATED = 1 << 31
} GParamFlags;
/**
* G_PARAM_READWRITE:
* G_PARAM_USER_SHIFT:
*
* Minimum shift count to be used for user defined flags, to be stored in
- * #GParamSpec.flags.
+ * #GParamSpec.flags. The maximum allowed is 30 + G_PARAM_USER_SHIFT.
*/
#define G_PARAM_USER_SHIFT (8)
-
/* --- typedefs & structures --- */
typedef struct _GParamSpec GParamSpec;
typedef struct _GParamSpecClass GParamSpecClass;