aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Triplett <josh@freedesktop.org>2007-03-07 21:45:57 -0800
committerJosh Triplett <josh@freedesktop.org>2007-03-07 21:45:57 -0800
commitb7955d6cb0b64cd7af70c80de4a971073cccb78c (patch)
treed1d7bfc9e73c1c2a594d6bc991467b4ba32bc541 /symbol.h
parentFree up some special bits in modifiers. (diff)
downloadsparse-b7955d6cb0b64cd7af70c80de4a971073cccb78c.tar.gz
sparse-b7955d6cb0b64cd7af70c80de4a971073cccb78c.tar.bz2
sparse-b7955d6cb0b64cd7af70c80de4a971073cccb78c.zip
Introducing statement keywords
This change using keyword lookup for statement parsing instead of a order compare. Signed-Off-By: Christopher Li <sparse@chrisli.org> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Josh Triplett <josh@freedesktop.org>
Diffstat (limited to 'symbol.h')
-rw-r--r--symbol.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/symbol.h b/symbol.h
index e530ff8..144c9eb 100644
--- a/symbol.h
+++ b/symbol.h
@@ -64,6 +64,7 @@ enum keyword {
KW_QUALIFIER = 1 << 2,
KW_ATTRIBUTE = 1 << 3,
KW_TYPEOF = 1 << 4,
+ KW_STATEMENT = 1 << 5,
};
struct context {
@@ -91,6 +92,7 @@ struct symbol_op {
/* keywrods */
struct token *(*declarator)(struct token *token, struct ctype *ctype);
+ struct token *(*statement)(struct token *token, struct statement *stmt);
};
extern int expand_safe_p(struct expression *expr, int cost);
@@ -291,6 +293,13 @@ static inline int get_sym_type(struct symbol *type)
return type->type;
}
+static inline struct symbol *lookup_keyword(struct ident *ident, enum namespace ns)
+{
+ if (!ident->keyword)
+ return NULL;
+ return lookup_symbol(ident, ns);
+}
+
#define is_restricted_type(type) (get_sym_type(type) == SYM_RESTRICT)
#define is_fouled_type(type) (get_sym_type(type) == SYM_FOULED)
#define is_bitfield_type(type) (get_sym_type(type) == SYM_BITFIELD)