GNOME Bugzilla – Bug 644611
deprecate G_CONST_RETURN
Last modified: 2011-06-13 14:00:21 UTC
for several major releases we have had quite a bit of code in glib that makes free use of the 'const' modifier on return types of functions declared in public headers. GVariant is one example among many. i take this as evidence that G_CONST_RETURN is no longer useful.
so i somewhat misunderstood the reason for G_CONST_RETURN. i thought it was something like our G_GNUC_* macros: that 'const' in the return type of a function was not supported by ancient C compilers. after actually reading the doc, it's clear that this is actually meant to be a feature. it seems like a pretty insane feature and i'm not sure what motivated its inclusion in the first place, but it's something that i'd like to see gone... the fact that it's an actual feature that people might use changes the API stability story a bit, though -- we can no longer do a gigantic sed-patch on the glib and gtk sources and say that we're keeping API compatibility in the strictest sense. at the same time, we should just do it anyway.
Created attachment 183260 [details] [review] Remove all uses of G_CONST_RETURN commit f3a9ea512b059daea171b5d8fe90f0f98414bed0 Author: Ryan Lortie <desrt@desrt.ca> Date: Sat Mar 12 21:50:45 2011 -0500 Remove all uses of G_CONST_RETURN Just use 'const'.
Created attachment 183261 [details] [review] Deprecate G_CONST_RETURN commit 844805d70deb04015ae65975a2de7873b68cf637 Author: Ryan Lortie <desrt@desrt.ca> Date: Sat Mar 12 22:04:53 2011 -0500 Deprecate G_CONST_RETURN
I'd say just define to const and see if anyone complains... The big impact should be on C++ projects. Google codesearch suggests that Webkit may be one such target.
Comment on attachment 183260 [details] [review] Remove all uses of G_CONST_RETURN The removal of G_CONST_RETURN from the GLib API is complete (plus some changes to GObject to help it cope). I'm holding off on the actual deprecation until at least Gtk+ is fixed. See bug 652005 for Javier's efforts there.
The docs patch is committed too. All that remains is the addition of #ifndef G_DISABLE_DEPRECATED in the header.
Since all of the blocking bugs got closed, I went ahead and committed the final bit of this. I'm starting a jhbuild now in order to catch any remaining issues.