scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 96b6cc1d8be1ad93af98b570e699ff202378cb4b
parent 9750a1e13aca0b42f79a5254bfe45e1263d2a053
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed,  3 Sep 2014 12:13:23 +0200

Remove printing in external environment

It is better to do this job in functions because it allows us
to can declare local variables and avoid conflict about names.

Diffstat:
Mcc1/decl.c | 5-----
Mcc1/stmt.c | 5+++++
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -544,11 +544,6 @@ extdecl(void) case ';': expect(';'); return; - case '@': - next(); - emitprint(expr()); - expect(';'); - return; default: unexpected(); } diff --git a/cc1/stmt.c b/cc1/stmt.c @@ -338,6 +338,11 @@ stmt(Symbol *lbreak, Symbol *lcont, Caselist *lswitch) case TYPEIDEN: case IDEN: fun = (ahead() == ':') ? Label : stmtexp; break; + case '@': + next(); + emitprint(expr()); + break; + next(); } (*fun)(lbreak, lcont, lswitch); }