shithub: scc

Download patch

ref: 98535eb7cff01fafbf9d3110bf160d622fb461db
parent: a9bd2373374a8a8075761617f62c3b1012ef6f39
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Apr 19 00:41:55 EDT 2016

[cc2] Put type constant in a different enum

This is the last step to clean the main enum of cc2.h.
Enum op has now only constant related to ops used in nodes.

--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -20,10 +20,12 @@
 	SPRIV     = 'Y',
 	SLOCAL    = 'T',
 	SMEMB     = 'M',
+	SCONST    = '#',
+	STRING    = '"',
+	SNONE     = 0
 };
 
-enum op {
-	/* types */
+enum types {
 	ELLIPSIS = 'E',
 	INT8     = 'C',
 	INT16    = 'I',
@@ -42,12 +44,11 @@
 	FLOAT    = 'J',
 	DOUBLE   = 'D',
 	LDOUBLE  = 'H',
-	VOID     = '0',
-	ONAME    = '"',
+	VOID     = '0'
+};
+
+enum op {
 	/* kind of operand */
-	NONE     = 0,
-	CONST    = '#',
-	STRING   = '"',
 	/* operands */
 	OMEM     = 'M',
 	OTMP     = 'T',
@@ -100,8 +101,6 @@
 	ODEFAULT = 'f',
 	OTABLE   = 't',
 	OSWITCH  = 's',
-	OEPARS   = '\\',
-	OSTMT    = '\t'
 };
 
 enum nerrors {
--- a/cc2/code.c
+++ b/cc2/code.c
@@ -22,7 +22,7 @@
         }
 
         new->prev = pc;
-        new->to.kind = new->from2.kind = new->from1.kind = NONE;
+        new->to.kind = new->from2.kind = new->from1.kind = SNONE;
         pc = new;
 }
 
@@ -33,7 +33,7 @@
 	case SREG:
 		addr->u.reg = np->u.reg;
 		break;
-	case CONST:
+	case SCONST:
 		abort();
 		break;
 	case SLABEL: