]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/depends_accurate.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / tools / ccanlint / tests / depends_accurate.c
index a50611863c22feb8fffdbe6bc545ff0b7d03962c..26943faa628a6e98fa93ab5badb9e7c67d511c20 100644 (file)
@@ -21,8 +21,13 @@ static bool has_dep(struct manifest *m, char **deps, bool *used,
        unsigned int i;
 
        /* We can include ourselves, of course. */
-       if (streq(depname + strlen("ccan/"), m->modname))
-               return true;
+       if (strstarts(depname + strlen("ccan/"), m->modname)) {
+               const char *p = depname + strlen("ccan/") + strlen(m->modname);
+               /* And our own tests! */
+               if (streq(p, "/test") || streq(p, ""))
+                       return true;
+               /* But not any submodules; they need an explicit dep */
+       }
 
        for (i = 0; deps[i]; i++) {
                if (streq(deps[i], depname)) {
@@ -47,7 +52,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))
@@ -65,7 +70,8 @@ static bool check_dep_includes(struct manifest *m,
 }
 
 static void check_depends_accurate(struct manifest *m,
-                                  unsigned int *timeleft, struct score *score)
+                                  unsigned int *timeleft UNNEEDED,
+                                  struct score *score)
 {
        struct list_head *list;
        unsigned int i, core_deps, test_deps;