commit 5ac24b9b6ee631848b5a2cc893ba7381ccf9c87f
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Tue Sep 15 12:34:04 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
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
@@ -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
@@ -26,6 +26,7 @@ struct declarators {
 struct decl {
        unsigned ns;
        int sclass;
+       int qualifier;
        Symbol *sym;
        Symbol **pars;
        Type *type;
@@ -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;
@@ -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);
@@ -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
@@ -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},

Reply via email to