mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-15 20:25:12 +01:00
Bug 531900 – Use __builtin_offsetof for G_STRUCT_OFFSET if building
with gcc 4.0 or newer * glib/gmacros.h: Use __builtin_offsetof for G_STRUCT_OFFSET if building with gcc 4.0 or newer. svn path=/trunk/; revision=6996
This commit is contained in:
parent
a689811a41
commit
8013b215cd
@ -1,3 +1,11 @@
|
||||
2008-06-11 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
Bug 531900 – Use __builtin_offsetof for G_STRUCT_OFFSET if building
|
||||
with gcc 4.0 or newer
|
||||
|
||||
* glib/gmacros.h: Use __builtin_offsetof for G_STRUCT_OFFSET if
|
||||
building with gcc 4.0 or newer.
|
||||
|
||||
2008-06-11 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gmain.c
|
||||
|
@ -209,8 +209,15 @@
|
||||
/* Provide convenience macros for handling structure
|
||||
* fields through their offsets.
|
||||
*/
|
||||
#define G_STRUCT_OFFSET(struct_type, member) \
|
||||
((glong) ((guint8*) &((struct_type*) 0)->member))
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define G_STRUCT_OFFSET(struct_type, member) \
|
||||
((glong) __builtin_offsetof (struct_type, member))
|
||||
#else
|
||||
# define G_STRUCT_OFFSET(struct_type, member) \
|
||||
((glong) ((guint8*) &((struct_type*) 0)->member))
|
||||
#endif
|
||||
|
||||
#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \
|
||||
((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset)))
|
||||
#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user