From e115b3ef26727ba961bec2e39b382e7bd18fc3b6 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 16 Nov 2017 23:22:10 +0000 Subject: [PATCH] sym: allow auto variables to be assigned expressions Nice trivial change. Fixing statics is a different ball game alas. --- Applications/SmallC/sym.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Applications/SmallC/sym.c b/Applications/SmallC/sym.c index 50744aaf..9b896a61 100644 --- a/Applications/SmallC/sym.c +++ b/Applications/SmallC/sym.c @@ -292,7 +292,12 @@ void declare_local(int typ, int stclass, int otag) { break; } } - stkp = gen_defer_modify_stack(stkp - k); + if (match("=")) { + gen_modify_stack(stkp); + expression(0); + gen_push(0); + } else + stkp = gen_defer_modify_stack(stkp - k); add_local(sname, j, typ, stkp, AUTO); break; } -- 2.34.1