aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 11:13:56 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 11:13:56 -0700
commitf73ca60933f0145696081b7727f172a8f21e148e (patch)
tree9397a6a3a850816017abe726ab1cace40b7399af /expression.c
parent[PATCH] Fix address space ordering problem (diff)
downloadsparse-f73ca60933f0145696081b7727f172a8f21e148e.tar.gz
sparse-f73ca60933f0145696081b7727f172a8f21e148e.tar.bz2
sparse-f73ca60933f0145696081b7727f172a8f21e148e.zip
Warn about undefined preprocessor symbols at expansion time, not parse time
This means that we can do #if defined(TOKEN) && TOKEN > 1 and we will _not_ warn even with -Wundef, since the "TOKEN > 1" test will never even be expanded if TOKEN isn't defined. Al Viro gets credit for the algorithm changes, I just did the actual coding. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'expression.c')
-rw-r--r--expression.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/expression.c b/expression.c
index 310aa17..0a79581 100644
--- a/expression.c
+++ b/expression.c
@@ -301,6 +301,15 @@ struct token *primary_expression(struct token *token, struct expression **tree)
token = token->next;
break;
+ case TOKEN_ZERO_IDENT: {
+ expr = alloc_expression(token->pos, EXPR_SYMBOL);
+ expr->ctype = &int_ctype;
+ expr->symbol = &zero_int;
+ expr->symbol_name = token->ident;
+ token = token->next;
+ break;
+ }
+
case TOKEN_IDENT: {
struct symbol *sym = lookup_symbol(token->ident, NS_SYMBOL | NS_TYPEDEF);
struct token *next = token->next;