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 164706 - attributes for va_list functions and NULL terminators
attributes for va_list functions and NULL terminators
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.6.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
: 310128 (view as bug list)
Depends on:
Blocks: 165682
 
 
Reported: 2005-01-20 15:11 UTC by Marcus Meissner
Modified: 2011-02-18 16:11 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
glib-sentinel.patch (3.01 KB, patch)
2005-01-20 15:12 UTC, Marcus Meissner
none Details | Review

Description Marcus Meissner 2005-01-20 15:11:39 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).
Comment 1 Marcus Meissner 2005-01-20 15:12:10 UTC
Created attachment 36298 [details] [review]
glib-sentinel.patch
Comment 2 Matthias Clasen 2005-03-08 05:42:43 UTC
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.
Comment 3 Bastien Nocera 2005-07-12 14:10:08 UTC
*** Bug 310128 has been marked as a duplicate of this bug. ***