aboutsummaryrefslogtreecommitdiff
path: root/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'decl.c')
-rw-r--r--decl.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/decl.c b/decl.c
index a9ee504..6e7d360 100644
--- a/decl.c
+++ b/decl.c
@@ -322,6 +322,7 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)
struct expr *e;
enum typespec ts = SPECNONE;
enum typequal tq = QUALNONE;
+ enum tokenkind op;
int ntypes = 0;
unsigned long long i;
@@ -335,7 +336,8 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)
for (;;) {
if (typequal(&tq) || storageclass(sc) || funcspec(fs))
continue;
- switch (tok.kind) {
+ op = tok.kind;
+ switch (op) {
/* 6.7.2 Type specifiers */
case TVOID:
t = &typevoid;
@@ -417,6 +419,7 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)
next();
break;
case TTYPEOF:
+ case TTYPEOF_UNQUAL:
next();
expect(TLPAREN, "after 'typeof'");
t = typename(s, &tq);
@@ -425,26 +428,13 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align)
if (e->decayed)
e = e->base;
t = e->type;
- tq |= e->qual;
+ if (op == TTYPEOF)
+ tq |= e->qual;
delexpr(e);
}
++ntypes;
expect(TRPAREN, "to close 'typeof'");
break;
- case TTYPEOF_UNQUAL:
- next();
- expect(TLPAREN, "after 'typeof_unqual'");
- t = typename(s, NULL);
- if (!t) {
- e = expr(s);
- if (e->decayed)
- e = e->base;
- t = e->type;
- delexpr(e);
- }
- ++ntypes;
- expect(TRPAREN, "to close 'typeof_unqual'");
- break;
/* 6.7.5 Alignment specifier */
case TALIGNAS: