scc

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

commit c9530dc787725c9184007bc6c1f5c2c6fcc11ccc
parent a0e6b9b6b4c4e454201dc18fd04db414f11cd36e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 13 Mar 2015 08:48:32 +0000

Fix code collision

Some of the upper case letters were causing collisions, but gcc didn't
complaint about it, but ken cc yes. This patch returns the original
values to pointer and long, and use K for registers.

Diffstat:
Mcc1/code.c | 2+-
Mcc2/parser.c | 5+++--
Minc/cc.h | 4++--
3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/cc1/code.c b/cc1/code.c @@ -119,7 +119,7 @@ emitvar(Symbol *sym) else if (sym->isglobal) c = 'G'; else if (sym->isregister) - c = 'R'; + c = 'K'; else if (sym->isfield) c = 'M'; else if (sym->isparameter) diff --git a/cc2/parser.c b/cc2/parser.c @@ -371,10 +371,11 @@ static void (*optbl[])(char *) = { [';'] = increment, ['Y'] = globvar, ['A'] = localvar, + ['K'] = localvar, ['T'] = localvar, ['G'] = globvar, -// ['P'] = paramvar, -// ['L'] = label, + ['P'] = paramvar, + ['L'] = label, ['#'] = immediate, ['@'] = unary, ['a'] = unary, diff --git a/inc/cc.h b/inc/cc.h @@ -30,7 +30,7 @@ typedef unsigned bool; #define L_INT8 'C' #define L_INT16 'I' -#define L_INT32 'L' +#define L_INT32 'W' #define L_INT64 'Q' #define L_UINT8 'M' #define L_UINT16 'N' @@ -38,7 +38,7 @@ typedef unsigned bool; #define L_UINT64 'O' #define L_VOID '0' -#define L_POINTER 'P' +#define L_POINTER 'R' #define L_FUNCTION 'F' #define L_ARRAY 'V' #define L_UNION 'U'