From 061e359bfc50f006a08410d43527342025d498ad Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 22 Mar 2011 11:43:00 +1030 Subject: [PATCH] ccanlint: roughly handle multiple conditions on #if line. Just grab the tokens for the simple case: this allows the ccanlint reduce_features test to work on eg. ccan/cast. --- tools/ccanlint/file_analysis.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/ccanlint/file_analysis.c b/tools/ccanlint/file_analysis.c index 530416e3..d8d2d3e9 100644 --- a/tools/ccanlint/file_analysis.c +++ b/tools/ccanlint/file_analysis.c @@ -404,6 +404,17 @@ static bool parse_hash_if(struct pp_conditions *cond, const char **line) return false; if (!defined) cond->type = PP_COND_IF; + + /* FIXME: We just chain them, ignoring operators. */ + if (get_token(line, "||") || get_token(line, "&&")) { + struct pp_conditions *sub = talloc(cond, struct pp_conditions); + + sub->parent = cond->parent; + sub->type = PP_COND_IFDEF; + if (parse_hash_if(sub, line)) + cond->parent = sub; + } + return true; } -- 2.39.2