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 644611 - deprecate G_CONST_RETURN
deprecate G_CONST_RETURN
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on: 652005 652202 652205 652211 652213 652214
Blocks:
 
 
Reported: 2011-03-13 02:15 UTC by Allison Karlitskaya (desrt)
Modified: 2011-06-13 14:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Remove all uses of G_CONST_RETURN (38.38 KB, patch)
2011-03-13 03:05 UTC, Allison Karlitskaya (desrt)
committed Details | Review
Deprecate G_CONST_RETURN (1.30 KB, patch)
2011-03-13 03:05 UTC, Allison Karlitskaya (desrt)
none Details | Review

Description Allison Karlitskaya (desrt) 2011-03-13 02:15:17 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.
Comment 1 Allison Karlitskaya (desrt) 2011-03-13 02:45:43 UTC
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.
Comment 2 Allison Karlitskaya (desrt) 2011-03-13 03:05:38 UTC
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'.
Comment 3 Allison Karlitskaya (desrt) 2011-03-13 03:05:56 UTC
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
Comment 4 Behdad Esfahbod 2011-03-13 04:38:07 UTC
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 5 Allison Karlitskaya (desrt) 2011-06-09 15:17:27 UTC
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.
Comment 6 Allison Karlitskaya (desrt) 2011-06-09 15:42:21 UTC
The docs patch is committed too.  All that remains is the addition of #ifndef G_DISABLE_DEPRECATED in the header.
Comment 7 Allison Karlitskaya (desrt) 2011-06-13 14:00:21 UTC
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.