[hackers] [scc] Fix check of storage validity in functions || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 8 Aug 2015 12:10:22 +0200 (CEST)

commit 8f51e18e15eac2e434a0f51cf788d3b6b621566c
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sat Aug 8 12:07:25 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Aug 8 12:07:25 2015 +0200

    Fix check of storage validity in functions
    
    Symbols have not yet the storage flags in declarator(),
    so the correct point where do this validation is in
    dodcl() after setting the flags.

diff --git a/cc1/decl.c b/cc1/decl.c
index 9a12fa1..75c159e 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -202,8 +202,6 @@ declarator(Type *tp, unsigned ns)
         }
 
         sym->u.pars = pars;
- if (tp->op == FTN && sym->flags & (ISREGISTER|ISAUTO))
- error("invalid storage class for function '%s'", sym->name);
 
         /* TODO: deal with external array declarations of [] */
         if (!tp->defined && sym->name)
_AT_@ -529,6 +527,10 @@ dodcl(int rep, void (*fun)(Symbol *, int, Type *), uint8_t ns, Type *type)
                         sym->token = TYPEIDEN;
                         break;
                 }
+ if (tp->op == FTN && (sym->flags & (ISREGISTER|ISAUTO))) {
+ error("invalid storage class for function '%s'",
+ sym->name);
+ }
                 (*fun)(sym, sclass, type);
         } while (rep && !curfun && accept(','));
 
Received on Sat Aug 08 2015 - 12:10:22 CEST

This archive was generated by hypermail 2.3.0 : Sat Aug 08 2015 - 12:12:13 CEST