GNOME Bugzilla – Bug 319940
Use GLIB macros for GCC extensions
Last modified: 2005-11-21 18:41:04 UTC
I think we should use a sprinkling of the GCC extensions macros in GLIB through our 0.9 API. I don't think any of them actually break API, but I'm not sure. http://rlove.org/log/2005102601 has a decent list of most of the extensions but misses the best one: G_GNUC_NULL_TERMINATED for functions which require a null terminator sentinel parameter. Other interesting ones: G_GNUC_PURE, G_GNUC_MALLOC, G_GNUC_CONST
re: G_GNUC_PURE and G_GNUC_CONST cf. bug #317246, bug #64994, bug #65041 i doubt that we actually have PURE and CONST functions.
_TERMINATED is a 2.8 macro. We can add it to a glib-compat.h however, the current one should: - be moved to glib-compat-private.h - receive an #ifndef _H, so it can be included multiple times and a new one should be created, which will also be installed, since it needs to be public for all others to include the header you want to use it in it would look like this: /* added in GLib 2.8 */ #if !GLIB_CHECK_VERSION (2, 8, 0) #if __GNUC__ >= 4 #define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) #else #define G_GNUC_NULL_TERMINATED #endif #endif
Let's move glib-compat.h to glib-compat-private.h and copy the GLib 2.8 specific pieces to there.
I've munged the headers appropriately, and now we have a G_GNUC_NULL_TERMINATED that we can use.
Sprinkled across the headers, foolios.