commit 6a8265d1262a3c63665f78a29d59d84387e8f68a
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Sat Aug 8 12:06:11 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Sat Aug 8 12:06:11 2015 +0200

    Convert typename() to dodcl() function
    
    Al the functions which need a declaration are used dodcl(),
    except typename(). This patch makes the code more orthogonal
    and remove 3 lines!!!!

diff --git a/cc1/cc1.h b/cc1/cc1.h
index 3fbda77..e42b59b 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -114,7 +114,7 @@ enum {
 
 /* namespaces */
 enum {
-       NS_IDEN,
+       NS_IDEN = 1,
        NS_TAG,
        NS_LABEL,
        NS_CPP,
diff --git a/cc1/decl.c b/cc1/decl.c
index 6fdad29..9a12fa1 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -84,7 +84,6 @@ static Symbol *dodcl(int rep,
                      void (*fun)(Symbol *, int, Type *),
                      uint8_t ns, Type *type);
 
-/* FIXME: what happens with the context in int (*f)(int)[];? */
 static struct dcldata *
 fundcl(struct dcldata *dp)
 {
@@ -421,22 +420,13 @@ enumdcl(void)
        return tp;
 }
 
-Type *
-typename(void)
+static void
+type(Symbol *sym, int sclass, Type *data)
 {
-       unsigned sclass;
-       Type *tp;
-       Symbol *sym;
-
-       tp = specifier(&sclass);
        if (sclass)
                error("class storage in type name");
-       sym = declarator(tp, NS_IDEN);
-
        if (!sym->name)
                error("unexpected identifier in type name");
-
-       return  sym->type;
 }
 
 static void
@@ -565,3 +555,9 @@ fieldlist(Type *tp)
                dodcl(1, field, tp->ns, tp);
        expect(';');
 }
+
+Type *
+typename(void)
+{
+       return dodcl(0, type, 0, NULL)->type;
+}

Reply via email to