scc

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

commit a2e43bb731e42e513878f7ae93255ae329ebbf0c
parent e888ffdaf5a6a7aee73253cc982847e72be0bd94
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 11 Aug 2014 23:38:41 +0200

Add comma operator

Diffstat:
cc2/cc2.h | 1+
cc2/cgen.c | 3+++
cc2/parser.c | 1+
3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -88,6 +88,7 @@ enum nerrors { #define OAND 'y' #define ONEG '_' #define OCPL '~' +#define OCOMMA ',' extern void error(unsigned nerror, ...); extern void genaddable(Node *list[]); diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -124,6 +124,7 @@ xcgen(Node *np) } switch (np->op) { + case OCOMMA: case ONEG: case OCPL: case OOR: case OAND: case OPTR: case OADDR: @@ -200,6 +201,7 @@ xaddable(Node *np) case OPTR: case OADDR: xaddable(lp); break; + case OCOMMA: case OOR: case OAND: case OLT: case OGT: case OGE: case OLE: case OEQ: case ONE: case OINC: @@ -238,3 +240,4 @@ genaddable(Node *list[]) while (np = *list++) xaddable(np); } + diff --git a/cc2/parser.c b/cc2/parser.c @@ -304,6 +304,7 @@ static void (*optbl[])(char *) = { ['o'] = operator, ['_'] = unary, ['~'] = unary, + [','] = operator, ['\177'] = NULL };