aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/evaluate.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-07 21:07:40 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-07 22:02:42 +0200
commitb0bd7d895a023b2ff71231ae7c1c5aee690f8a2a (patch)
treebb25771b3112384795b0316d1899e76320ba67ad /evaluate.c
parent0819ba9b1047fb8cf9d094fedb3d1fb94e7d3bfa (diff)
downloadsparse-dev-b0bd7d895a023b2ff71231ae7c1c5aee690f8a2a.tar.gz
export evaluate_arguments()
evaluate_arguments() is local to evaluate.c but the same functionality is needed for builtins. So, in order to not duplicate this code: *) change slightly its interface to accept the expected types as a list *) make this function extern. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'evaluate.c')
-rw-r--r--evaluate.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/evaluate.c b/evaluate.c
index dddea761..7c63cc60 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -2333,14 +2333,13 @@ static struct symbol *evaluate_alignof(struct expression *expr)
return size_t_ctype;
}
-static int evaluate_arguments(struct symbol *fn, struct expression_list *head)
+int evaluate_arguments(struct symbol_list *argtypes, struct expression_list *head)
{
struct expression *expr;
- struct symbol_list *argument_types = fn->arguments;
struct symbol *argtype;
int i = 1;
- PREPARE_PTR_LIST(argument_types, argtype);
+ PREPARE_PTR_LIST(argtypes, argtype);
FOR_EACH_PTR (head, expr) {
struct expression **p = THIS_ADDRESS(expr);
struct symbol *ctype, *target;
@@ -3149,7 +3148,7 @@ static struct symbol *evaluate_call(struct expression *expr)
if (!sym->op->args(expr))
return NULL;
} else {
- if (!evaluate_arguments(ctype, arglist))
+ if (!evaluate_arguments(ctype->arguments, arglist))
return NULL;
args = expression_list_size(expr->args);
fnargs = symbol_list_size(ctype->arguments);