shithub: scc

Download patch

ref: 50be87310cc42377a409547fbb946f2750e5e925
parent: f0ee120a741971da6866221aaf4cff034b8d8522
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Nov 16 07:34:29 EST 2014

Print parameters with 'P' letter

this change allows to difference beetween variables and parameters.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -65,6 +65,7 @@
 		bool isregister : 1;
 		bool isdefined : 1;
 		bool isfield : 1;
+		bool isparameter : 1;
 	} s;
 	union {
 		int i;
--- a/cc1/code.c
+++ b/cc1/code.c
@@ -94,6 +94,8 @@
 		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);
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -387,6 +387,7 @@
 	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");
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -332,8 +332,8 @@
 	}
 
 end_compound:
-	expect('}');
 	popctx();
+	expect('}');
 	return;
 }