[hackers] [scc] Fix type in several declarations || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 5 Aug 2015 22:16:05 +0200 (CEST)

commit 423f75f011f84fbc1ae9b439e34860f1d09d583f
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Aug 5 22:15:27 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_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
_AT_@ -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
_AT_@ -14,7 +14,7 @@
 struct dcldata {
         unsigned char op;
         unsigned short nelem;
- unsigned ndcl;
+ unsigned char ndcl;
         void *data;
 };
 
_AT_@ -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
_AT_@ -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
_AT_@ -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;
                 }
         }
Received on Wed Aug 05 2015 - 22:16:05 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 05 2015 - 22:24:16 CEST