diff options
author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-03-30 20:51:05 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 20:59:54 -0700 |
commit | 7d109870a35846a8f25f4b6f20cf25bfc53ed293 (patch) | |
tree | a8cf01fcccdd11269171bdfef85f5f3d81546130 /expression.h | |
parent | Don't die on excessive warnings, just print a warning and stop (diff) | |
download | sparse-7d109870a35846a8f25f4b6f20cf25bfc53ed293.tar.gz sparse-7d109870a35846a8f25f4b6f20cf25bfc53ed293.tar.bz2 sparse-7d109870a35846a8f25f4b6f20cf25bfc53ed293.zip |
Introduce a "struct position", and have the different types refer
to it, instead of having everybody have pointers to "struct token"
only because they wanted to have the position.
Fix array addition type degeneration.
Diffstat (limited to 'expression.h')
-rw-r--r-- | expression.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/expression.h b/expression.h index bf201ba..1897153 100644 --- a/expression.h +++ b/expression.h @@ -32,9 +32,12 @@ enum expression_type { struct expression { enum expression_type type; int op; - struct token *token; + struct position pos; struct symbol *ctype; union { + // EXPR_CONSTANT + struct token *token; + // EXPR_VALUE unsigned long long value; @@ -42,7 +45,10 @@ struct expression { struct expression *unop; // EXPR_SYMBOL - struct symbol *symbol; + struct symbol_arg { + struct symbol *symbol; + struct ident *symbol_name; + }; // EXPR_STATEMENT struct statement *statement; @@ -90,11 +96,11 @@ struct token *assignment_expression(struct token *token, struct expression **tre extern int evaluate_expression(struct expression *); -static inline struct expression *alloc_expression(struct token *token, int type) +static inline struct expression *alloc_expression(struct position pos, int type) { struct expression *expr = __alloc_expression(0); expr->type = type; - expr->token = token; + expr->pos = pos; return expr; } @@ -103,7 +109,7 @@ struct token *typename(struct token *, struct symbol **); static inline int lookup_type(struct token *token) { - if (token->type == TOKEN_IDENT) + if (token->pos.type == TOKEN_IDENT) return lookup_symbol(token->ident, NS_TYPEDEF) != NULL; return 0; } |