From: Rusty Russell Date: Mon, 3 Dec 2012 08:59:23 +0000 (+1030) Subject: ccanlint: handle nested modules when mentioned in examples. X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=932d65dd6537250e617516749f03a00fea3b34f6;hp=6a4d45337811b56d947e52f031b9ca0c955fcb6c ccanlint: handle nested modules when mentioned in examples. If we see an ccan include line in an example, we add that to the dependencies to try to build the example, but we didn't handle nested modules. Signed-off-by: Rusty Russell --- diff --git a/tools/ccanlint/tests/depends_accurate.c b/tools/ccanlint/tests/depends_accurate.c index 83a19e2c..05ada48a 100644 --- a/tools/ccanlint/tests/depends_accurate.c +++ b/tools/ccanlint/tests/depends_accurate.c @@ -48,7 +48,7 @@ static bool check_dep_includes(struct manifest *m, char *mod; if (!strreg(f, lines[i], "^[ \t]*#[ \t]*include[ \t]*[<\"]" - "(ccan/+.+)/+[^/]+.h", &mod)) + "(ccan/+.+)/+[^/]+\\.h", &mod)) continue; if (has_dep(m, deps, used, mod)) diff --git a/tools/ccanlint/tests/examples_compile.c b/tools/ccanlint/tests/examples_compile.c index ce1d9769..7d8803c6 100644 --- a/tools/ccanlint/tests/examples_compile.c +++ b/tools/ccanlint/tests/examples_compile.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -83,13 +84,10 @@ static struct manifest **get_example_deps(struct manifest *m, /* Other modules implied by includes. */ for (lines = get_ccan_file_lines(f); *lines; lines++) { - unsigned preflen = strspn(*lines, " \t"); - if (strstarts(*lines + preflen, "#include