From 932d65dd6537250e617516749f03a00fea3b34f6 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 3 Dec 2012 19:29:23 +1030 Subject: [PATCH] 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 --- tools/ccanlint/tests/depends_accurate.c | 2 +- tools/ccanlint/tests/examples_compile.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) 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