shithub: scc

Download patch

ref: db74516be9356bc40305d3ad683c95ec443a1866
parent: 7aee6a0c93f31167634482a65722f9c7c75d80d3
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Apr 17 21:47:43 EDT 2016

[cc2] Join odefault and casetbl

After the last commit there is not any difference between
these two functions, so they can be joined.

--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -33,7 +33,7 @@
 typedef void parsefun(char *, union tokenop);
 static parsefun type, symbol, getname, unary, binary, ternary, call,
                 parameter, constant, composed, binit, einit,
-                jump, oreturn, loop, assign, ocase, odefault, casetbl;
+                jump, oreturn, loop, assign, ocase, casetbl;
 
 typedef void evalfun(void);
 static evalfun vardecl, beginfun, endfun, endpars, stmt,
@@ -126,7 +126,7 @@
 	['v']   = {     NULL,    jump, .u.op =         OCASE},
 	['s']   = {     NULL,    jump, .u.op =       OSWITCH},
 
-	['f']   = {     NULL,odefault, .u.op =      ODEFAULT},
+	['f']   = {     NULL, casetbl, .u.op =      ODEFAULT},
 	['t']   = {     NULL, casetbl, .u.op =        OTABLE}
 };
 
@@ -356,18 +356,6 @@
 casetbl(char *token, union tokenop u)
 {
 	Node *np, *aux;
-
-	np = newnode();
-	np->op = u.op;
-	eval(strtok(NULL, "\t\n"));
-	np->left = pop();
-	push(np);
-}
-
-static void
-odefault(char *token, union tokenop u)
-{
-	Node *np;
 
 	np = newnode();
 	np->op = u.op;