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 703191 - new private macros interact poorly with versioning macros
new private macros interact poorly with versioning macros
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: High critical
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-06-27 13:58 UTC by Colin Walters
Modified: 2013-07-03 13:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Ensure that MAX_ALLOWED keeps working with the type macros (2.74 KB, patch)
2013-06-27 14:17 UTC, Emmanuele Bassi (:ebassi)
accepted-commit_now Details | Review
Ensure that MAX_ALLOWED keeps working with the type macros / v2.0 (2.75 KB, patch)
2013-06-27 17:32 UTC, Emmanuele Bassi (:ebassi)
accepted-commit_now Details | Review

Description Colin Walters 2013-06-27 13:58:42 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.
Comment 1 Emmanuele Bassi (:ebassi) 2013-06-27 14:17:53 UTC
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.
Comment 2 Colin Walters 2013-06-27 14:25:45 UTC
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.
Comment 3 Emmanuele Bassi (:ebassi) 2013-06-27 14:31:26 UTC
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.
Comment 4 Emmanuele Bassi (:ebassi) 2013-06-27 17:32:38 UTC
Created attachment 247929 [details] [review]
Ensure that MAX_ALLOWED keeps working with the type macros / v2.0
Comment 5 Colin Walters 2013-06-27 18:57:16 UTC
Review of attachment 247929 [details] [review]:

Just got a chance to test this, it makes my NM build quiet again.  Code looks good.