From 6315d5f1db7b1dbda17313e9a60002159904c238 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 13 Jul 2007 19:33:23 -0400 Subject: [PATCH] [PATCH] no such thing as array of functions Signed-off-by: Al Viro --- evaluate.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/evaluate.c b/evaluate.c index db334425..6cba0a37 100644 --- a/evaluate.c +++ b/evaluate.c @@ -2731,9 +2731,20 @@ static struct symbol *evaluate_call(struct expression *expr) sym = ctype = fn->ctype; if (ctype->type == SYM_NODE) ctype = ctype->ctype.base_type; - if (ctype->type == SYM_PTR || ctype->type == SYM_ARRAY) + if (ctype->type == SYM_PTR) ctype = get_base_type(ctype); + if (ctype->type != SYM_FN) { + struct expression *arg; + expression_error(expr, "not a function %s", + show_ident(sym->ident)); + /* do typechecking in arguments */ + FOR_EACH_PTR (arglist, arg) { + evaluate_expression(arg); + } END_FOR_EACH_PTR(arg); + return NULL; + } + examine_fn_arguments(ctype); if (sym->type == SYM_NODE && fn->type == EXPR_PREOP && sym->op && sym->op->args) { @@ -2742,11 +2753,6 @@ static struct symbol *evaluate_call(struct expression *expr) } else { if (!evaluate_arguments(sym, ctype, arglist)) return NULL; - if (ctype->type != SYM_FN) { - expression_error(expr, "not a function %s", - show_ident(sym->ident)); - return NULL; - } args = expression_list_size(expr->args); fnargs = symbol_list_size(ctype->arguments); if (args < fnargs) -- 2.11.4.GIT