scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 50be87310cc42377a409547fbb946f2750e5e925
parent f0ee120a741971da6866221aaf4cff034b8d8522
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 16 Nov 2014 12:34:29 -0500

Print parameters with 'P' letter

this change allows to difference beetween variables and parameters.

Diffstat:
cc1/cc1.h | 1+
cc1/code.c | 2++
cc1/decl.c | 1+
cc1/stmt.c | 2+-
4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/cc1/cc1.h b/cc1/cc1.h @@ -65,6 +65,7 @@ struct symbol { bool isregister : 1; bool isdefined : 1; bool isfield : 1; + bool isparameter : 1; } s; union { int i; diff --git a/cc1/code.c b/cc1/code.c @@ -94,6 +94,8 @@ emitvar(Symbol *sym) c = 'R'; else if (sym->s.isfield) c = 'M'; + else if (sym->s.isparameter) + c = 'P'; else c = 'A'; printf("%c%d", c, sym->id); diff --git a/cc1/decl.c b/cc1/decl.c @@ -387,6 +387,7 @@ parameter(void) if ((tp = specifier(&sclass)) == voidtype) return tp; sym = declarator(tp, ID_ACCEPTED, NS_IDEN); + sym->s.isparameter = 1; tp = sym->type; if (tp->op == FTN) error("incorrect function type for a function parameter"); diff --git a/cc1/stmt.c b/cc1/stmt.c @@ -332,8 +332,8 @@ compound(Symbol *lbreak, Symbol *lcont, Caselist *lswitch) } end_compound: - expect('}'); popctx(); + expect('}'); return; }