From 04c29e8c365789bc25ebb44cb0572e4e0698c446 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 19 Apr 2004 12:32:28 -0700 Subject: [PATCH] Fix up typename parsing. We should not allow multiple type specifiers, even of the same time (we used to silently accept "int int x;"). --- parse.c | 8 +++----- symbol.c | 12 ++++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/parse.c b/parse.c index 098808af..24391d39 100644 --- a/parse.c +++ b/parse.c @@ -425,11 +425,9 @@ static struct token *declaration_specifiers(struct token *next, struct ctype *ct if (type) { if (qual) break; - if (type != ctype->base_type) { - if (ctype->base_type) - break; - ctype->base_type = type; - } + if (ctype->base_type) + break; + ctype->base_type = type; } apply_ctype(token->pos, &thistype, ctype); diff --git a/symbol.c b/symbol.c index 4f804ac0..460a5ad2 100644 --- a/symbol.c +++ b/symbol.c @@ -373,16 +373,16 @@ struct sym_init { /* Type specifiers */ { "void", &void_ctype, 0 }, - { "char", &int_type, MOD_CHAR }, - { "short", &int_type, MOD_SHORT }, + { "char", NULL, MOD_CHAR }, + { "short", NULL, MOD_SHORT }, { "int", &int_type, 0 }, { "long", NULL, MOD_LONG }, { "float", &fp_type, 0 }, { "double", &fp_type, MOD_LONG }, - { "signed", &int_type, MOD_SIGNED }, - { "__signed", &int_type, MOD_SIGNED }, - { "__signed__", &int_type, MOD_SIGNED }, - { "unsigned", &int_type, MOD_UNSIGNED }, + { "signed", NULL, MOD_SIGNED }, + { "__signed", NULL, MOD_SIGNED }, + { "__signed__", NULL, MOD_SIGNED }, + { "unsigned", NULL, MOD_UNSIGNED }, { "__label__", &label_type, MOD_LABEL | MOD_UNSIGNED }, /* Type qualifiers */ -- 2.11.4.GIT