GNOME Bugzilla – Bug 164706
attributes for va_list functions and NULL terminators
Last modified: 2011-02-18 16:11:07 UTC
On 64bit systems there is difference between 0 and the pointer NULL when used in vararg lists. A single 0 is usual just 32bit and might have the upper 32bit undefined, leading to undefined behaviour on 64bit systems. We fixed several problems for the AMD64 and PPC64 ports for instance. This patch supplies mark ups for varargs functions in glib2 specifying their end "NULL" marker. This is a new feature of the upcoming gcc 4.0. __attribute__((__sentinel__(x))) is applied to such functions, the number x is the number of the position where the marker should be (counted from right, so 0 is right-most, the usual place).
Created attachment 36298 [details] [review] glib-sentinel.patch
I decided to name the macro G_GNUC_NULL_TERMINATED which seems a more speaking name, and the argument to your SENTINEL macros was always 0. 2005-03-08 Matthias Clasen <mclasen@redhat.com> * glib/gmacros.h: Define G_GNUC_NULL_TERMINATED. (#164706, Marc Meissner) * glib/gstrfuncs.h: * glib/gfileutils.h: Use G_GNUC_NULL_TERMINATED where appropriate.
*** Bug 310128 has been marked as a duplicate of this bug. ***