]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/file_analysis.c
ccanlint: add simple check for comment referring to LICENSE file.
[ccan] / tools / ccanlint / file_analysis.c
index 530416e368cb1fd17a48f93fa7c9bc220b0f1a20..c20211677d6b3db3063ca0947778232d1ca18718 100644 (file)
@@ -1,3 +1,4 @@
+#include "config.h"
 #include "ccanlint.h"
 #include <ccan/talloc/talloc.h>
 #include <ccan/str/str.h>
@@ -85,6 +86,7 @@ struct ccan_file *new_ccan_file(const void *ctx, const char *dir, char *name)
        f->fullname = talloc_asprintf(f, "%s/%s", dir, f->name);
        f->contents = NULL;
        f->cov_compiled = NULL;
+       f->simplified = NULL;
        return f;
 }
 
@@ -404,6 +406,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;
 }