aboutsummaryrefslogtreecommitdiffstats
path: root/inline.c
diff options
context:
space:
mode:
authorChristopher Li <sparse@chrisli.org>2004-08-03 23:52:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:02:36 -0700
commitf439331f2501667d6ff553208010d44034c924f6 (patch)
tree87633059b3ce254aebf007180f3bd6aac1e75027 /inline.c
parent467ba842a51dfdaae9312938fe868792705028a3 (diff)
downloadsparse-f439331f2501667d6ff553208010d44034c924f6.tar.gz
[PATCH] Avoid recursive inline function expansion
Ideally we should probably allocate an error code for recursive expand, so the caller can know that the inline did not expand at all. But the evaluate_symbol_call don't care about that so I just make it reutrn 0.
Diffstat (limited to 'inline.c')
-rw-r--r--inline.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/inline.c b/inline.c
index 6591a5e0..1c40dc3e 100644
--- a/inline.c
+++ b/inline.c
@@ -407,6 +407,10 @@ int inline_function(struct expression *expr, struct symbol *sym)
warn(fn->pos, "marked inline, but without a definition");
return 0;
}
+ if (fn->expanding)
+ return 0;
+ fn->expanding = 1;
+
name_list = fn->arguments;
stmt = alloc_statement(expr->pos, STMT_COMPOUND);
@@ -440,5 +444,6 @@ int inline_function(struct expression *expr, struct symbol *sym)
evaluate_statement(stmt);
+ fn->expanding = 0;
return 1;
}