GNOME Bugzilla – Bug 87979
PATCH: add G_GNUC_DEPRECATED
Last modified: 2011-02-18 15:55:17 UTC
gcc 3.1 added __attribute__((__deprecated__)). This can be applied to typedefs, variables, and functions. I thought it would be useful to have this in glib. That way programmers can use -Wdeprecated to see if their source needs to be updated. This would be particularly useful for gtk, I think. So I wrote the attached patch. It adds this support and marks all the functions that are deprecated (as determined by searching *.h for the word "deprecated"). I haven't written the corresponding Gtk patch. I think it would make sense for this patch to be applied to the next stable release of glib. That way the benefits will be realized as soon as possible.
Created attachment 9821 [details] [review] Patch to add G_GNUC_DEPRECATED
Hmm, how does this interact with GTK_DISABLE_DEPRECATED G_DISABLE_DEPRECATED, etc? (see bug 72760 which asks for a global way to turn them all on). I guess the advantage of -Wdeprecated is that you can turn the warnings on without having to fix things (you'll get miscompilations with GTK_DISABLE_DEPRECATED because of missing prototypes) but on the other hand it is GCC specific, and it is hard to turn on warnings for an entire file since every object would need to be marked individually. (Huge pain for say, gtkclist.c) I don't have any objections to adding the extra attribute (but for 2.2, I want to hold the line in the sand about API additions for 2.0.x) but I'm not sure we'd want to replace our current deprecation mechanism with it.
Thu Nov 21 14:09:44 2002 Owen Taylor <otaylor@redhat.com> * glib/gmacros.h: Add G_GNUC_DEPRECATED. (Tom Tromey, #87969) Didn't actually use it anywhere since we have the other deprecation mechanism, and I don't think using both makes sense.