GNOME Bugzilla – Bug 703191
new private macros interact poorly with versioning macros
Last modified: 2013-07-03 13:38:30 UTC
As seen from a NetworkManager build with glib git master in the buildroot: ../../../../src/platform/tests/../nm-fake-platform.c: In function 'nm_fake_platform_class_intern_init': ../../../../src/platform/tests/../nm-fake-platform.c:52:1: warning: 'g_type_class_adjust_private_offset' is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:1294): Not available before 2.38 [-Wdeprecated-declarations] This injects a runtime dependency on 2.38; one of the nice things about the new GLib versioning stuff is it makes it easy to have a new version in the buildroot, but ensure you're targeting an old one. One thing I've wanted for a bit is to enhance GLIB_CHECK_VERSION to actually respect the requested version. In other words, GLIB_CHECK_VERSION(2, 38, 0) should return 0 if GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36.
Created attachment 247906 [details] [review] Ensure that MAX_ALLOWED keeps working with the type macros When using the GLIB_VERSION_MAX_ALLOWED macro to define the upper bound of allowed API the G_DEFINE_TYPE_EXTENDED starts warning about the newly added g_type_class_adjust_private_offset() function; this effectively introduces a run-time dependency on GLib 2.38 even if we don't use its API explicitly.
Review of attachment 247906 [details] [review]: ::: gobject/gtype.h @@ +1658,3 @@ + type_name##_class_init ((TypeName##Class*) klass); \ +} +#endif /* GLIB_CHECK_VERSION (2, 37, 3) */ Most often when I've seen #endif /* comment */, the comment string matches the #if. Were you intending to do that? I guess it's what we want the conditional to be after we change the semantics of GLIB_CHECK_VERSION though. Other than this very minor comment, this patch looks right on the surface to me, but it's some hairy macro-fu.
yes, that was me being dump; I started with a GLIB_CHECK_VERSION then I realized that we could just use GLIB_VERSION_MAX_ALLOWED. to be fair, this is mostly proof-of-concept, as I haven't really tested it.
Created attachment 247929 [details] [review] Ensure that MAX_ALLOWED keeps working with the type macros / v2.0
Review of attachment 247929 [details] [review]: Just got a chance to test this, it makes my NM build quiet again. Code looks good.
https://git.gnome.org/browse/glib/commit/?id=a4c352cd99738095ba34e04a86a2ffa9cc659cfe