* c-exp.y (DOTDOTDOT): New token.

(func_mod, exp): Use parameter_typelist.
	(parameter_typelist): New production.
	(tokentab3): Add "..." token.
	* eval.c (make_params): Handle varargs.
	* gdbtypes.c (lookup_function_type_with_arguments): Handle
	varargs.
testsuite
	* gdb.base/whatis.exp: Add test.
This commit is contained in:
Tom Tromey 2012-07-06 14:48:48 +00:00
parent 71918a863f
commit a6fb9c08a9
7 changed files with 49 additions and 6 deletions

View file

@ -463,7 +463,8 @@ lookup_function_type (struct type *type)
}
/* Given a type TYPE and argument types, return the appropriate
function type. */
function type. If the final type in PARAM_TYPES is NULL, make a
varargs function. */
struct type *
lookup_function_type_with_arguments (struct type *type,
@ -473,6 +474,12 @@ lookup_function_type_with_arguments (struct type *type,
struct type *fn = make_function_type (type, (struct type **) 0);
int i;
if (nparams > 0 && param_types[nparams - 1] == NULL)
{
--nparams;
TYPE_VARARGS (fn) = 1;
}
TYPE_NFIELDS (fn) = nparams;
TYPE_FIELDS (fn) = TYPE_ZALLOC (fn, nparams * sizeof (struct field));
for (i = 0; i < nparams; ++i)