mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-16 01:06:15 +01:00
Bug 569633 – Typelib compiler fails with vararg callbacks
2009-02-10 Rober Carr <carrr@rpi.edu> Bug 569633 – Typelib compiler fails with vararg callbacks * girepository/girparser.c: Also filter out callback functions which take vararg arguments. svn path=/trunk/; revision=1095
This commit is contained in:
parent
8c2ef112b7
commit
3490a56ba4
90
girparser.c
90
girparser.c
@ -3040,9 +3040,11 @@ cleanup (GMarkupParseContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
post_filter_varargs_functions (GList *list)
|
post_filter_toplevel_varargs_functions (GList *list,
|
||||||
|
GList **varargs_callbacks_out)
|
||||||
{
|
{
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
GList *varargs_callbacks = *varargs_callbacks_out;
|
||||||
|
|
||||||
iter = list;
|
iter = list;
|
||||||
while (iter)
|
while (iter)
|
||||||
@ -3059,7 +3061,76 @@ post_filter_varargs_functions (GList *list)
|
|||||||
list = g_list_delete_link (list, link);
|
list = g_list_delete_link (list, link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (node->type == G_IR_NODE_CALLBACK)
|
||||||
|
{
|
||||||
|
if (((GIrNodeFunction*)node)->is_varargs)
|
||||||
|
{
|
||||||
|
varargs_callbacks = g_list_append (varargs_callbacks,
|
||||||
|
node);
|
||||||
|
list = g_list_delete_link (list, link);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*varargs_callbacks_out = varargs_callbacks;
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GList *
|
||||||
|
post_filter_varargs_functions (GList *list, GList ** varargs_callbacks_out)
|
||||||
|
{
|
||||||
|
GList *iter;
|
||||||
|
GList *varargs_callbacks;
|
||||||
|
|
||||||
|
list = post_filter_toplevel_varargs_functions (list, varargs_callbacks_out);
|
||||||
|
|
||||||
|
varargs_callbacks = *varargs_callbacks_out;
|
||||||
|
|
||||||
|
iter = list;
|
||||||
|
while (iter)
|
||||||
|
{
|
||||||
|
GList *link = iter;
|
||||||
|
GIrNode *node = iter->data;
|
||||||
|
|
||||||
|
iter = iter->next;
|
||||||
|
|
||||||
|
if (node->type == G_IR_NODE_FUNCTION)
|
||||||
|
{
|
||||||
|
GList *param;
|
||||||
|
gboolean function_done = FALSE;
|
||||||
|
|
||||||
|
for (param = ((GIrNodeFunction *)node)->parameters;
|
||||||
|
param;
|
||||||
|
param = param->next)
|
||||||
|
{
|
||||||
|
GIrNodeParam *node = (GIrNodeParam *)param->data;
|
||||||
|
|
||||||
|
if (function_done)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (node->type->is_interface)
|
||||||
|
{
|
||||||
|
GList *callback;
|
||||||
|
for (callback = varargs_callbacks;
|
||||||
|
callback;
|
||||||
|
callback = callback->next)
|
||||||
|
{
|
||||||
|
if (!strcmp (node->type->interface,
|
||||||
|
((GIrNode *)varargs_callbacks->data)->name))
|
||||||
|
{
|
||||||
|
list = g_list_delete_link (list, link);
|
||||||
|
function_done = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*varargs_callbacks_out = varargs_callbacks;
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3067,8 +3138,10 @@ static void
|
|||||||
post_filter (GIrModule *module)
|
post_filter (GIrModule *module)
|
||||||
{
|
{
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
GList *varargs_callbacks = NULL;
|
||||||
|
|
||||||
module->entries = post_filter_varargs_functions (module->entries);
|
module->entries = post_filter_varargs_functions (module->entries,
|
||||||
|
&varargs_callbacks);
|
||||||
iter = module->entries;
|
iter = module->entries;
|
||||||
while (iter)
|
while (iter)
|
||||||
{
|
{
|
||||||
@ -3080,24 +3153,29 @@ post_filter (GIrModule *module)
|
|||||||
node->type == G_IR_NODE_INTERFACE)
|
node->type == G_IR_NODE_INTERFACE)
|
||||||
{
|
{
|
||||||
GIrNodeInterface *iface = (GIrNodeInterface*)node;
|
GIrNodeInterface *iface = (GIrNodeInterface*)node;
|
||||||
iface->members = post_filter_varargs_functions (iface->members);
|
iface->members = post_filter_varargs_functions (iface->members,
|
||||||
|
&varargs_callbacks);
|
||||||
}
|
}
|
||||||
else if (node->type == G_IR_NODE_BOXED)
|
else if (node->type == G_IR_NODE_BOXED)
|
||||||
{
|
{
|
||||||
GIrNodeBoxed *boxed = (GIrNodeBoxed*)node;
|
GIrNodeBoxed *boxed = (GIrNodeBoxed*)node;
|
||||||
boxed->members = post_filter_varargs_functions (boxed->members);
|
boxed->members = post_filter_varargs_functions (boxed->members,
|
||||||
|
&varargs_callbacks);
|
||||||
}
|
}
|
||||||
else if (node->type == G_IR_NODE_STRUCT)
|
else if (node->type == G_IR_NODE_STRUCT)
|
||||||
{
|
{
|
||||||
GIrNodeStruct *iface = (GIrNodeStruct*)node;
|
GIrNodeStruct *iface = (GIrNodeStruct*)node;
|
||||||
iface->members = post_filter_varargs_functions (iface->members);
|
iface->members = post_filter_varargs_functions (iface->members,
|
||||||
|
&varargs_callbacks);
|
||||||
}
|
}
|
||||||
else if (node->type == G_IR_NODE_UNION)
|
else if (node->type == G_IR_NODE_UNION)
|
||||||
{
|
{
|
||||||
GIrNodeUnion *iface = (GIrNodeUnion*)node;
|
GIrNodeUnion *iface = (GIrNodeUnion*)node;
|
||||||
iface->members = post_filter_varargs_functions (iface->members);
|
iface->members = post_filter_varargs_functions (iface->members,
|
||||||
|
&varargs_callbacks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_list_free (varargs_callbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user