summaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-09 14:20:48 +0000
committerTom Tromey <tromey@redhat.com>2012-07-09 14:20:48 +0000
commitf73e194501a969c66208d4c0dccbeab487b20719 (patch)
treea9a7570edb14ba5052b58606757cb179847b17b7 /gdb/eval.c
parent3f13479af4ae1943886ca66b239de2b211ad43f4 (diff)
downloadgdb-f73e194501a969c66208d4c0dccbeab487b20719.tar.gz
* 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.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 13f997f5b12..7d3a8b96e36 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);