GNOME Bugzilla – Bug 624199
parser picks up contents of large macros
Last modified: 2010-07-13 13:13:24 UTC
gmem.h in glib has this macro: # define _G_NEW(struct_type, n_structs, func) \ (struct_type *) (__extension__ ({ \ gsize __n = (gsize) (n_structs); \ gsize __s = sizeof (struct_type); \ gpointer __p; \ if (__s == 1) \ __p = g_##func (__n); \ else if (__builtin_constant_p (__n) && \ (__s == 0 || __n <= G_MAXSIZE / __s)) \ __p = g_##func (__n * __s); \ else \ __p = g_##func##_n (__n, __s); \ __p; \ })) the parser is grabbing: else if (__builtin_constant_p (__n) && (__s == 0 || __n <= G_MAXSIZE / __s)) as if it were a function called "if" that returns "else".
more in gobject too: # define _G_TYPE_CIT(ip, gt) (G_GNUC_EXTENSION ({ \ GTypeInstance *__inst = (GTypeInstance*) ip; GType __t = gt; gboolean __r; \ if (!__inst) \ __r = FALSE; \ else if (__inst->g_class && __inst->g_class->g_type == __t) \ __r = TRUE; \ else \ __r = g_type_check_instance_is_a (__inst, __t); \ __r; \ }))
commit 364ba12a0b147f8b0186c970efeb786e36c2879a Author: Stefan Kost <ensonic@users.sf.net> Date: Tue Jul 13 16:06:28 2010 +0300 scan: correctly skip internal macros. Fixes #624199 If we come across an internal macro (starting with a '_') we still need to read over it to not confuse the macro body with new declarations. Add a test.