tools/ccanlint: test_depends_accurate: catch #include of other ccan C files.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 30 Aug 2016 00:35:06 +0000 (10:05 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 30 Aug 2016 00:48:40 +0000 (10:18 +0930)
Jon sent a test patch for sha256 which "#include <ccan/str/hex/hex.c>"
without adding str/hex to testdepends.  It "worked" (it wouldn't have
linked with "hex.h"), but ccanlint didn't spot the dependency.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/ccanlint/tests/depends_accurate.c

index a50611863c22feb8fffdbe6bc545ff0b7d03962c..9ade3cba071b2b96f2c000b7f9a03e56a8f414f6 100644 (file)
@@ -47,7 +47,7 @@ static bool check_dep_includes(struct manifest *m,
                char *mod;
                if (!tal_strreg(f, lines[i],
                                "^[ \t]*#[ \t]*include[ \t]*[<\"]"
-                               "(ccan/+.+)/+[^/]+\\.h", &mod))
+                               "(ccan/+.+)/+[^/]+\\.[ch][\">]", &mod))
                        continue;
 
                if (has_dep(m, deps, used, mod))