From e314d62968dfb4ae82c70dbe68d9d4ec929deb7e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 9 Jul 2012 14:20:52 +0000 Subject: * c-exp.y (check_parameter_typelist): New function. (parameter_typelist): Call it. * eval.c (make_params): Handle '(void)' case. * gdbtypes.c (lookup_function_type_with_arguments): Handle '(void)' case. testsuite * gdb.base/whatis.exp: Add error checks for improper 'void' uses. * gdb.base/callfuncs.exp: Add cast-based test. * gdb.base/callfuncs.c (voidfunc): New function. --- gdb/eval.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'gdb/eval.c') diff --git a/gdb/eval.c b/gdb/eval.c index 13f997f..7d3a8b9 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -769,11 +769,23 @@ make_params (int num_types, struct type **param_types) TYPE_CODE (type) = TYPE_CODE_METHOD; TYPE_VPTR_FIELDNO (type) = -1; TYPE_CHAIN (type) = type; - if (num_types > 0 && param_types[num_types - 1] == NULL) + if (num_types > 0) { - --num_types; - TYPE_VARARGS (type) = 1; + if (param_types[num_types - 1] == NULL) + { + --num_types; + TYPE_VARARGS (type) = 1; + } + else if (TYPE_CODE (check_typedef (param_types[num_types - 1])) + == TYPE_CODE_VOID) + { + --num_types; + /* Caller should have ensured this. */ + gdb_assert (num_types == 0); + TYPE_PROTOTYPED (type) = 1; + } } + TYPE_NFIELDS (type) = num_types; TYPE_FIELDS (type) = (struct field *) TYPE_ZALLOC (type, sizeof (struct field) * num_types); -- cgit v1.1