Deprecation and GSEAL



Hi,

I experimented today with using gcc attributes instead of struct member
renaming, and wanted to open a discussion of this.  I changed GSEAL so
that it looks like this:

#ifndef GSEAL
/* introduce GSEAL() here for all of Gdk and Gtk+ without the need to
modify GLib */
#  ifdef GSEAL_ENABLE
#    if __GNUC__ > 2
#        define GSEAL(ident)      __attribute__ ((deprecated)) ident
#    else
#        define GSEAL(ident)      _g_sealed__ ## ident
#    endif
#  else
#    define GSEAL(ident)      ident
#  endif
#endif /* !GSEAL */


I'm not sure if __GNUC__ > 2 is the right thing to check for, if anyone
knows when the deprecated attribute was introduced then this can be
changed.

So using this, instead of breaking the build entirely I get a warning
such as this:

gtkcalendar.c: In function ‘calendar_arrow_rectangle’:
 gtkcalendar.c:1176: warning: ‘allocation’ is deprecated (declared
at ../gtk/gtkwidget.h:219)


I think this can make it easier to continue working toward gtk+ 3.0.
Would anyone mind if I introduce something like this?

Also, for deprecations that are not struct members, we can consider
using something like __attribute__ ((section ("DEPRECATED"))) on gcc (I
believe MSVC supports something like this as well, not sure about other
compilers).  If I understand this correctly, this could allow us to move
deprecated functions and structs to other sections and would give some
possible performance benefit for applications that don't use them.  Is
this correct?

/ Cody



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]