scc

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

commit 8cd212d516410eb5c3403fc3d3c6e60387dd7d38
parent ed35dc21b1f81f2f44a35af09ad19210ee6bfd8a
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
Date:   Mon, 18 Apr 2016 01:47:43 +0200

[cc2] Join odefault and casetbl

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

Diffstat:
Mcc2/parser.c | 16++--------------
1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/cc2/parser.c b/cc2/parser.c @@ -33,7 +33,7 @@ union tokenop { 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 @@ static struct decoc { ['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} }; @@ -365,18 +365,6 @@ casetbl(char *token, union tokenop u) } static void -odefault(char *token, union tokenop u) -{ - Node *np; - - np = newnode(); - np->op = u.op; - eval(strtok(NULL, "\t\n")); - np->left = pop(); - push(np); -} - -static void loop(char *token, union tokenop u) { Node *np;