aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2005-11-22 18:24:23 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-22 22:41:22 -0800
commit50f66bdbdbc3a1a6c6d09ecc579d51d7dfd76561 (patch)
treeb28c9ed03f815a55061adb10c50c434e7767ba57 /pre-process.c
parent[PATCH] no need to special-case comma after ## (diff)
downloadsparse-50f66bdbdbc3a1a6c6d09ecc579d51d7dfd76561.tar.gz
sparse-50f66bdbdbc3a1a6c6d09ecc579d51d7dfd76561.tar.bz2
sparse-50f66bdbdbc3a1a6c6d09ecc579d51d7dfd76561.zip
[PATCH] shut up the bogus warnings about the #if'ed-out section
Standard requires much more relaxed treatment of the groups that are #if...'ed out. We used to generate bogus warnings there; fixed, testcase added. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'pre-process.c')
-rw-r--r--pre-process.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/pre-process.c b/pre-process.c
index 63eb73c..bd7bcd0 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -1061,12 +1061,13 @@ static int do_handle_define(struct stream *stream, struct token **line, struct t
struct symbol *sym;
struct ident *name;
+ if (false_nesting)
+ return free_preprocessor_line(token);
+
if (token_type(left) != TOKEN_IDENT) {
sparse_error(token->pos, "expected identifier to 'define'");
return 0;
}
- if (false_nesting)
- return free_preprocessor_line(token);
if (stream->constant == CONSTANT_FILE_MAYBE)
MARK_STREAM_NONCONST(token->pos);
@@ -1133,12 +1134,13 @@ static int handle_undef(struct stream *stream, struct token **line, struct token
struct token *left = token->next;
struct symbol **sym;
+ if (false_nesting)
+ return free_preprocessor_line(token);
+
if (token_type(left) != TOKEN_IDENT) {
sparse_error(token->pos, "expected identifier to 'undef'");
return 0;
}
- if (false_nesting)
- return free_preprocessor_line(token);
if (stream->constant == CONSTANT_FILE_MAYBE)
MARK_STREAM_NONCONST(token->pos);
@@ -1602,6 +1604,9 @@ static void handle_preprocessor_line(struct stream *stream, struct token **line,
return;
}
+ if (false_nesting)
+ return;
+
sparse_error(token->pos, "unrecognized preprocessor line '%s'", show_token_sequence(token));
}