commit 5abfa5527c796fb26a1e1c1074a603aa64af27bb
parent d5f095d3afb21edf72fe746cf31839b8b11c9e7a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 Sep 2017 08:51:14 +0100
[cc1] Remove use of unsigned in tokens and ops
This was a fossil from other age in the scc development.
These unsigned didn't make any sense, and they should be
int.
Diffstat:
4 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/cc1/cc1.h b/cc1/cc1.h
@@ -383,7 +383,7 @@ extern Type *deftype(Type *tp);
/* types.c */
extern int eqtype(Type *tp1, Type *tp2, int eqflag);
-extern Type *ctype(unsigned type, unsigned sign, unsigned size);
+extern Type *ctype(int type, int sign, int size);
extern Type *mktype(Type *tp, int op, TINT nelem, Type *data[]);
extern Type *duptype(Type *base);
extern struct limits *getlimits(Type *tp);
@@ -413,8 +413,8 @@ extern void decl(void);
/* lex.c */
extern int ahead(void);
-extern unsigned next(void);
-extern void expect(unsigned tok);
+extern int next(void);
+extern void expect(int tok);
extern void discard(void);
extern int addinput(char *fname, Symbol *hide, char *buffer);
extern void delinput(void);
@@ -425,8 +425,8 @@ extern int setloc(char *fname, unsigned line);
/* code.c */
extern void prtree(Node *np);
-extern void emit(unsigned, void *);
-extern Node *node(unsigned op, Type *tp, Node *left, Node *rigth);
+extern void emit(int, void *);
+extern Node *node(int op, Type *tp, Node *left, Node *rigth);
extern Node *varnode(Symbol *sym);
extern Node *constnode(Symbol *sym);
extern Node *sizeofnode(Type *tp);
@@ -472,7 +472,7 @@ extern int valid_va_list(Type *tp);
*/
extern struct yystype yylval;
extern char yytext[];
-extern unsigned yytoken;
+extern int yytoken;
extern unsigned short yylen;
extern int disexpand;
extern unsigned cppctx;
diff --git a/cc1/code.c b/cc1/code.c
@@ -7,17 +7,17 @@ static char sccsid[] = "@(#) ./cc1/code.c";
#include "../inc/scc.h"
#include "cc1.h"
-static void emitbin(unsigned, void *),
- emitcast(unsigned, void *),
- emitsym(unsigned, void *),
- emitexp(unsigned, void *),
- emitsymid(unsigned, void *),
- emittext(unsigned, void *),
- emitfun(unsigned, void *),
- emitdcl(unsigned, void *),
- emitinit(unsigned, void *),
- emittype(unsigned, void *),
- emitbuilt(unsigned, void *);
+static void emitbin(int, void *),
+ emitcast(int, void *),
+ emitsym(int, void *),
+ emitexp(int, void *),
+ emitsymid(int, void *),
+ emittext(int, void *),
+ emitfun(int, void *),
+ emitdcl(int, void *),
+ emitinit(int, void *),
+ emittype(int, void *),
+ emitbuilt(int, void *);
char *optxt[] = {
[OADD] = "+",
@@ -75,7 +75,7 @@ char *optxt[] = {
[OFIELD] = "."
};
-void (*opcode[])(unsigned, void *) = {
+void (*opcode[])(int, void *) = {
[OADD] = emitbin,
[OSUB] = emitbin,
[OMUL] = emitbin,
@@ -176,7 +176,7 @@ prtree(Node *np)
}
void
-emit(unsigned op, void *arg)
+emit(int op, void *arg)
{
extern int failure;
@@ -231,7 +231,7 @@ emitconst(Node *np)
}
static void
-emitsym(unsigned op, void *arg)
+emitsym(int op, void *arg)
{
Node *np = arg;
@@ -263,7 +263,7 @@ emitletter(Type *tp)
}
static void
-emittype(unsigned op, void *arg)
+emittype(int op, void *arg)
{
TINT n;
Symbol **sp;
@@ -390,7 +390,7 @@ emit_expression:
}
static void
-emitinit(unsigned op, void *arg)
+emitinit(int op, void *arg)
{
Node *np = arg;
@@ -400,7 +400,7 @@ emitinit(unsigned op, void *arg)
}
static void
-emitdcl(unsigned op, void *arg)
+emitdcl(int op, void *arg)
{
Symbol *sym = arg;
@@ -422,7 +422,7 @@ emitdcl(unsigned op, void *arg)
}
static void
-emitcast(unsigned op, void *arg)
+emitcast(int op, void *arg)
{
Node *np = arg, *lp = np->left;
@@ -432,7 +432,7 @@ emitcast(unsigned op, void *arg)
}
static void
-emitbin(unsigned op, void *arg)
+emitbin(int op, void *arg)
{
Node *np = arg;
char *s;
@@ -446,7 +446,7 @@ emitbin(unsigned op, void *arg)
}
static void
-emitbuilt(unsigned op, void *arg)
+emitbuilt(int op, void *arg)
{
Node *np = arg;
@@ -458,7 +458,7 @@ emitbuilt(unsigned op, void *arg)
static void
-emitexp(unsigned op, void *arg)
+emitexp(int op, void *arg)
{
Node *np = arg;
@@ -468,7 +468,7 @@ emitexp(unsigned op, void *arg)
}
static void
-emitfun(unsigned op, void *arg)
+emitfun(int op, void *arg)
{
Symbol *sym = arg, **sp;
@@ -481,20 +481,20 @@ emitfun(unsigned op, void *arg)
}
static void
-emittext(unsigned op, void *arg)
+emittext(int op, void *arg)
{
fputs(optxt[op], outfp);
}
static void
-emitsymid(unsigned op, void *arg)
+emitsymid(int op, void *arg)
{
Symbol *sym = arg;
fprintf(outfp, optxt[op], sym->id);
}
Node *
-node(unsigned op, Type *tp, Node *lp, Node *rp)
+node(int op, Type *tp, Node *lp, Node *rp)
{
Node *np;
diff --git a/cc1/lex.c b/cc1/lex.c
@@ -12,7 +12,7 @@ static char sccsid[] = "@(#) ./cc1/lex.c";
#include "../inc/scc.h"
#include "cc1.h"
-unsigned yytoken;
+int yytoken;
struct yystype yylval;
char yytext[STRINGSIZ+3];
unsigned short yylen;
@@ -376,7 +376,7 @@ overflow:
return sym;
}
-static unsigned
+static int
integer(char *s, int base)
{
Type *tp;
@@ -412,7 +412,7 @@ convert:
}
static char *
-digits(unsigned base)
+digits(int base)
{
char *p;
int c;
@@ -439,7 +439,7 @@ end:
return yytext;
}
-static unsigned
+static int
number(void)
{
int base;
@@ -504,7 +504,7 @@ escape(void)
return c;
}
-static unsigned
+static int
character(void)
{
int c;
@@ -528,7 +528,7 @@ character(void)
return CONSTANT;
}
-static unsigned
+static int
string(void)
{
char *bp = yytext;
@@ -559,7 +559,7 @@ string(void)
return STRING;
}
-static unsigned
+static int
iden(void)
{
Symbol *sym;
@@ -583,7 +583,7 @@ iden(void)
return sym->token;
}
-static unsigned
+static int
follow(int expect, int ifyes, int ifno)
{
if (*input->p++ == expect)
@@ -592,7 +592,7 @@ follow(int expect, int ifyes, int ifno)
return ifno;
}
-static unsigned
+static int
minus(void)
{
switch (*input->p++) {
@@ -603,7 +603,7 @@ minus(void)
}
}
-static unsigned
+static int
plus(void)
{
switch (*input->p++) {
@@ -613,7 +613,7 @@ plus(void)
}
}
-static unsigned
+static int
relational(int op, int equal, int shift, int assig)
{
int c;
@@ -626,7 +626,7 @@ relational(int op, int equal, int shift, int assig)
return op;
}
-static unsigned
+static int
logic(int op, int equal, int logic)
{
int c;
@@ -639,7 +639,7 @@ logic(int op, int equal, int logic)
return op;
}
-static unsigned
+static int
dot(void)
{
int c;
@@ -652,10 +652,10 @@ dot(void)
return ELLIPSIS;
}
-static unsigned
+static int
operator(void)
{
- unsigned t;
+ int t;
switch (t = *input->p++) {
case '<': t = relational('<', LE, SHL, SHL_EQ); break;
@@ -714,7 +714,7 @@ return_byte:
return c;
}
-unsigned
+int
next(void)
{
int c;
@@ -743,7 +743,7 @@ next(void)
}
void
-expect(unsigned tok)
+expect(int tok)
{
if (yytoken != tok) {
if (isgraph(tok))
diff --git a/cc1/types.c b/cc1/types.c
@@ -106,7 +106,7 @@ getlimits(Type *tp)
}
Type *
-ctype(unsigned type, unsigned sign, unsigned size)
+ctype(int type, int sign, int size)
{
switch (type) {
case CHAR: