commit 9b5f080eb2ecc01e6aebe3d900c893519b0cc402
parent e7d61b828ba8ace866a5cffb1cfb5bffae8434e6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 4 Aug 2015 09:24:06 +0200
Remove default int without type modifier, storage, qualifier
This logic was creating some problems in typenames, so it is
better remove from the datapath of specifier and add it later
directly in external declarations (or don't add it again).
Diffstat:
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/cc1/decl.c b/cc1/decl.c
@@ -188,9 +188,9 @@ static Type *
specifier(unsigned *sclass)
{
Type *tp = NULL;
- unsigned qlf, sign, type, cls, size;
+ unsigned spec, qlf, sign, type, cls, size;
- qlf = sign = type = cls = size = 0;
+ spec = qlf = sign = type = cls = size = 0;
for (;;) {
unsigned *p;
@@ -258,12 +258,13 @@ specifier(unsigned *sclass)
} else {
next();
}
+ spec = 1;
}
return_type:
if (sclass)
*sclass = cls;
- if (!tp)
+ if (!tp && spec)
tp = ctype(type, sign, size);
return tp;
diff --git a/cc1/types.c b/cc1/types.c
@@ -222,9 +222,7 @@ ctype(unsigned type, unsigned sign, unsigned size)
goto invalid_type;
return booltype;
case 0:
- if (!sign && !size) {
- warn("type defaults to 'int' in declaration");
- }
+ warn("type defaults to 'int' in declaration");
/* fallthrough */
case INT:
switch (size) {