commit 423f75f011f84fbc1ae9b439e34860f1d09d583f Author: Roberto E. Vargas Caballero <k...@shike2.com> AuthorDate: Wed Aug 5 22:15:27 2015 +0200 Commit: Roberto E. Vargas Caballero <k...@shike2.com> CommitDate: Wed Aug 5 22:15:27 2015 +0200
Fix type in several declarations diff --git a/cc1/code.c b/cc1/code.c index e0488cb..573f03a 100644 --- a/cc1/code.c +++ b/cc1/code.c @@ -175,7 +175,7 @@ emitconst(Node *np) switch (BTYPE(np)) { case INT: - printf("#%c%x", np->type->letter, sym->u.i); + printf("#%c%X", np->type->letter, sym->u.i); break; case ARY: /* diff --git a/cc1/decl.c b/cc1/decl.c index 453a4b2..3c782fa 100644 --- a/cc1/decl.c +++ b/cc1/decl.c @@ -14,7 +14,7 @@ struct dcldata { unsigned char op; unsigned short nelem; - unsigned ndcl; + unsigned char ndcl; void *data; }; @@ -140,7 +140,7 @@ declarator(Type *tp, unsigned ns) static Type *structdcl(void), *enumdcl(void); static Type * -specifier(unsigned *sclass) +specifier(int *sclass) { Type *tp = NULL; unsigned spec, qlf, sign, type, cls, size; diff --git a/cc1/stmt.c b/cc1/stmt.c index 4b34e3a..47db215 100644 --- a/cc1/stmt.c +++ b/cc1/stmt.c @@ -341,8 +341,7 @@ compound(Symbol *lbreak, Symbol *lcont, Caselist *lswitch) static void stmt(Symbol *lbreak, Symbol *lcont, Caselist *lswitch) { - void (*fun)(Symbol *lbreak, Symbol *lcont, Caselist *lswitch); - Node *np; + void (*fun)(Symbol *, Symbol *, Caselist *); switch (yytoken) { case '{': fun = compound; break; diff --git a/cc1/types.c b/cc1/types.c index cceb98c..3436723 100644 --- a/cc1/types.c +++ b/cc1/types.c @@ -312,8 +312,12 @@ mktype(Type *tp, unsigned op, short nelem, Type *pars[]) tbl = &typetab[t]; for (bp = *tbl; bp; bp = bp->next) { if (eqtype(bp, &type)) { - /* FIXME: data can be a pointer to static data */ - free(data); + /* + * pars was allocated by the caller + * but the type already exists, so + * we have to deallocted it + */ + free(pars); return bp; } }