[hackers] [scc] Add inline keyword || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 15 Sep 2015 12:37:11 +0200 (CEST)

commit 5ac24b9b6ee631848b5a2cc893ba7381ccf9c87f
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Sep 15 12:34:04 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Sep 15 12:34:04 2015 +0200

    Add inline keyword
    
    This keyword must be used only in functions. At this moment is is
    accepted, but it is not done the semantic analysis.

diff --git a/cc1/cc1.h b/cc1/cc1.h
index a6d2746..e2dca97 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
_AT_@ -173,6 +173,7 @@ enum tokens {
         CONST = 1, /* type qualifier tokens are used as flags */
         RESTRICT = 2,
         VOLATILE = 4,
+ INLINE = 8,
         TQUALIFIER = 128,
         TYPE,
         IDEN,
diff --git a/cc1/decl.c b/cc1/decl.c
index 9731451..dbd9f73 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -26,6 +26,7 @@ struct declarators {
 struct decl {
         unsigned ns;
         int sclass;
+ int qualifier;
         Symbol *sym;
         Symbol **pars;
         Type *type;
_AT_@ -259,7 +260,7 @@ declarator(struct declarators *dp, unsigned ns)
 static Type *structdcl(void), *enumdcl(void);
 
 static Type *
-specifier(int *sclass)
+specifier(int *sclass, int *qualifier)
 {
         Type *tp = NULL;
         int spec, qlf, sign, type, cls, size, mask;
_AT_@ -336,8 +337,8 @@ specifier(int *sclass)
         }
 
 return_type:
- if (sclass)
- *sclass = cls;
+ *sclass = cls;
+ *qualifier = qlf;
         if (!tp) {
                 if (spec) {
                         tp = ctype(type, sign, size);
_AT_@ -684,7 +685,7 @@ dodcl(int rep, Symbol *(*fun)(struct decl *), unsigned ns, Type *parent)
 
         dcl.ns = ns;
         dcl.parent = parent;
- base = specifier(&dcl.sclass);
+ base = specifier(&dcl.sclass, &dcl.qualifier);
 
         do {
                 stack.nr = 0;
diff --git a/cc1/symbol.c b/cc1/symbol.c
index 6d32e51..e14f1a4 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -321,6 +321,7 @@ ikeywords(void)
                 {"for", FOR, FOR},
                 {"goto", GOTO, GOTO},
                 {"if", IF, IF},
+ {"inline", TQUALIFIER, INLINE},
                 {"int", TYPE, INT},
                 {"long", TYPE, LONG},
                 {"register", SCLASS, REGISTER},
Received on Tue Sep 15 2015 - 12:37:11 CEST

This archive was generated by hypermail 2.3.0 : Tue Sep 15 2015 - 12:48:14 CEST