[hackers] [scc] Remove default int without type modifier, storage, qualifier || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 4 Aug 2015 22:15:13 +0200 (CEST)

commit 9b5f080eb2ecc01e6aebe3d900c893519b0cc402
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Aug 4 09:24:06 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Aug 4 09:24:06 2015 +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).

diff --git a/cc1/decl.c b/cc1/decl.c
index 7e3c5fd..bc5057f 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -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;
_AT_@ -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
index 6eaabcd..0cf283f 100644
--- a/cc1/types.c
+++ b/cc1/types.c
_AT_@ -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) {
Received on Tue Aug 04 2015 - 22:15:13 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 04 2015 - 22:24:17 CEST