diff options
-rw-r--r-- | evaluate.c | 16 | ||||
-rw-r--r-- | expand.c | 19 | ||||
-rw-r--r-- | inline.c | 5 | ||||
-rw-r--r-- | validation/expand/builtin_constant_inline0.c | 1 |
4 files changed, 19 insertions, 22 deletions
@@ -3107,22 +3107,6 @@ static int evaluate_symbol_call(struct expression *expr) if (ctype->op && ctype->op->evaluate) return ctype->op->evaluate(expr); - if (ctype->ctype.modifiers & MOD_INLINE) { - int ret; - struct symbol *curr = current_fn; - - if (ctype->definition) - ctype = ctype->definition; - - current_fn = ctype->ctype.base_type; - - ret = inline_function(expr, ctype); - - /* restore the old function */ - current_fn = curr; - return ret; - } - return 0; } @@ -910,6 +910,25 @@ static int expand_symbol_call(struct expression *expr, int cost) if (fn->type != EXPR_PREOP) return SIDE_EFFECTS; + if (ctype->ctype.modifiers & MOD_INLINE) { + struct symbol *def; + + def = ctype->definition ? ctype->definition : ctype; + if (inline_function(expr, def)) { + struct symbol *fn = def->ctype.base_type; + struct symbol *curr = current_fn; + + current_fn = fn; + evaluate_statement(expr->statement); + current_fn = curr; + + fn->expanding = 1; + cost = expand_expression(expr); + fn->expanding = 0; + return cost; + } + } + if (ctype->op && ctype->op->expand) return ctype->op->expand(expr, cost); @@ -519,8 +519,6 @@ int inline_function(struct expression *expr, struct symbol *sym) if (fn->expanding) return 0; - fn->expanding = 1; - name_list = fn->arguments; expr->type = EXPR_STATEMENT; @@ -558,9 +556,6 @@ int inline_function(struct expression *expr, struct symbol *sym) unset_replace_list(fn_symbol_list); - evaluate_statement(stmt); - - fn->expanding = 0; return 1; } diff --git a/validation/expand/builtin_constant_inline0.c b/validation/expand/builtin_constant_inline0.c index 9e775d5e..a0057f20 100644 --- a/validation/expand/builtin_constant_inline0.c +++ b/validation/expand/builtin_constant_inline0.c @@ -11,7 +11,6 @@ int foo(void) /* * check-name: builtin_constant_inline0 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-start foo: |