Fix functions of the form "name(void)"

This commit is contained in:
Michael R Sweet 2005-10-07 03:41:07 +00:00
parent ebf38e0fb5
commit 8406ab7c2c
2 changed files with 39 additions and 9 deletions

View File

@ -363,6 +363,11 @@ add_variable(mxml_node_t *parent, /* I - Parent node */
*bufptr; /* Pointer into buffer */
#ifdef DEBUG
fprintf(stderr, "add_variable(parent=%p, name=\"%s\", type=%p)\n",
parent, name, type);
#endif /* DEBUG */
/*
* Range check input...
*/
@ -932,8 +937,16 @@ scan_file(const char *filename, /* I - Filename */
if (function && type && !parens)
{
variable = add_variable(function, "argument", type);
type = NULL;
/*
* Check for "void" argument...
*/
if (type->child && type->child->next)
variable = add_variable(function, "argument", type);
else
mxmlDelete(type);
type = NULL;
}
if (parens > 0)
@ -1557,17 +1570,23 @@ scan_file(const char *filename, /* I - Filename */
* Argument definition...
*/
mxmlNewText(type, type->child != NULL &&
type->last_child->value.text.string[0] != '(' &&
type->last_child->value.text.string[0] != '*',
buffer);
if (strcmp(buffer, "void"))
{
mxmlNewText(type, type->child != NULL &&
type->last_child->value.text.string[0] != '(' &&
type->last_child->value.text.string[0] != '*',
buffer);
#ifdef DEBUG
fprintf(stderr, "Argument: <<<< %s >>>\n", buffer);
fprintf(stderr, "Argument: <<<< %s >>>\n", buffer);
#endif /* DEBUG */
variable = add_variable(function, "argument", type);
type = NULL;
variable = add_variable(function, "argument", type);
}
else
mxmlDelete(type);
type = NULL;
}
else if (type->child && !function && (ch == ';' || ch == ','))
{

View File

@ -74,3 +74,14 @@ foo_default_int(int one, /* I - Integer */
return (2);
}
/*
* 'foo_void_func()' - Function taking no arguments.
*/
void
foo_void_func(void)
{
puts("foo_void_func()");
}