Bug 59971 - g_type_init deprecated in GLib 2.35.1
Summary: g_type_init deprecated in GLib 2.35.1
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-28 13:49 UTC by Colin Watson
Modified: 2013-02-22 14:37 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Guard deprecated g_type_init calls (1.72 KB, patch)
2013-01-28 13:49 UTC, Colin Watson
Details | Splinter Review
Don't warn for functions deprecated since GLib 2.26 (976 bytes, patch)
2013-02-18 14:33 UTC, Simon McVittie
Details | Splinter Review
Include config.h as the first thing in every .c file (1.69 KB, patch)
2013-02-18 14:34 UTC, Simon McVittie
Details | Splinter Review

Description Colin Watson 2013-01-28 13:49:20 UTC
Created attachment 73774 [details] [review]
Guard deprecated g_type_init calls

g_type_init was deprecated in GLib 2.35.1.  In order to compile cleanly with -Werror, guard these with a suitable #if.
Comment 1 Simon McVittie 2013-01-28 15:13:15 UTC
Comment on attachment 73774 [details] [review]
Guard deprecated g_type_init calls

Review of attachment 73774 [details] [review]:
-----------------------------------------------------------------

I don't think distributions should really be compiling with -Werror, but it'd be good to get rid of these warnings.

I'd really prefer to add these to configure.ac

AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_26], [Ignore post-2.26 deprecations])
AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_26], [Prevent post-2.26 APIs])

and then ensure that every .c file, or at least the ones that include any GLib headers, includes config.h as its first non-comment line.

We currently only depend on GLib 2.24, although that might be wrong, but GLIB_VERSION_2_24 doesn't exist. If the PKG_CHECK_MODULES check is a lie and we actually need a newer GLib, feel free to increase the dependency as far as needed, up to a maximum of 2.32 (Debian 7).
Comment 2 Simon McVittie 2013-02-18 14:33:55 UTC
Created attachment 75044 [details] [review]
Don't warn for functions deprecated since GLib 2.26

Also warn if we inadvertently use a function introduced since then.
Comment 3 Simon McVittie 2013-02-18 14:34:19 UTC
Created attachment 75045 [details] [review]
Include config.h as the first thing in every .c file

...except for CheckForAbstractSockets.c, which runs before config.h is
generated, and sd-daemon.c, which is externally-maintained.
Comment 4 Colin Walters 2013-02-19 17:55:52 UTC
Comment on attachment 75044 [details] [review]
Don't warn for functions deprecated since GLib 2.26

Review of attachment 75044 [details] [review]:
-----------------------------------------------------------------

Hm, I'd never thought of using AC_DEFINE in that way; I've always put those defines in Makefile.am under AM_CPPFLAGS or equivalent.

But this works.  Both patches look good to me.
Comment 5 Colin Walters 2013-02-19 17:56:07 UTC
Comment on attachment 75045 [details] [review]
Include config.h as the first thing in every .c file

Review of attachment 75045 [details] [review]:
-----------------------------------------------------------------

Looks good.
Comment 6 Simon McVittie 2013-02-22 14:37:11 UTC
(In reply to comment #4)
> But this works.  Both patches look good to me.

Fixed in git for 1.7.0, thanks.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.