After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749195 - deprecated object warning defaults to enabled
deprecated object warning defaults to enabled
Status: RESOLVED DUPLICATE of bug 733298
Product: glib
Classification: Platform
Component: gobject
2.44.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-05-10 11:31 UTC by Christian Persch
Modified: 2017-11-17 12:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Persch 2015-05-10 11:31:13 UTC
The docs for G_PARAM_DEPRECATED says:

 * @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.

so the warning should be output only when that env var is set. That makes sense, since this warning is only ever useful to developers, and otherwise needlessly pollutes the journal or ~/.xsession-errors.

However, the code defaults to 'enable' if the env var is NOT set:

[gobject/gobject.c:]
static void
consider_issuing_property_deprecation_warning (const GParamSpec *pspec)
{
  static GHashTable *already_warned_table;
  static const gchar *enable_diagnostic;
  static GMutex already_warned_lock;
  gboolean already;

  if (!(pspec->flags & G_PARAM_DEPRECATED))
    return;

  if (g_once_init_enter (&enable_diagnostic))
    {
      const gchar *value = g_getenv ("G_ENABLE_DIAGNOSTIC");

      if (!value)
===>    value = "-";

      g_once_init_leave (&enable_diagnostic, value);
    }

  if (enable_diagnostic[0] == '0')
    return;


The fix is easy: change |value = "-";| with |value = "0";| above.
Comment 1 Philip Withnall 2017-11-17 12:36:14 UTC
Let’s keep all the discussion about deprecation warnings in one place: bug #732184.

(Also, they were turned off by default for properties in commit 3bd1618ea955f950f87bc4e452029c5f0cea35aa, and have remained that way since.)

*** This bug has been marked as a duplicate of bug 733298 ***