Commit 94b797a5 authored by Rusty Russell's avatar Rusty Russell

ccanlint: fix listing of dependencies

gcc gave a warning:
	tools/ccanlint/ccanlint.c:230:19: error: ‘c’ may be used uninitialized in this function

Which indicated that test dependency printing was broken: we need to
loop through the tests!  Also, we haven't parsed options yet, so
verbose is never true: move it to later and make it depend on -vvv.
parent 6aa15db4
...@@ -285,19 +285,24 @@ static void init_tests(void) ...@@ -285,19 +285,24 @@ static void init_tests(void)
} }
btree_delete(keys); btree_delete(keys);
btree_delete(names); btree_delete(names);
}
if (!verbose) static void print_test_depends(void)
return; {
struct list_head *list;
foreach_ptr(list, &compulsory_tests, &normal_tests) { foreach_ptr(list, &compulsory_tests, &normal_tests) {
struct ccanlint *c;
printf("\%s Tests\n", printf("\%s Tests\n",
list == &compulsory_tests ? "Compulsory" : "Normal"); list == &compulsory_tests ? "Compulsory" : "Normal");
if (!list_empty(&c->dependencies)) { list_for_each(list, c, list) {
const struct dependent *d; if (!list_empty(&c->dependencies)) {
printf("These depend on us:\n"); const struct dependent *d;
list_for_each(&c->dependencies, d, node) printf("These depend on %s:\n", c->key);
printf("\t%s\n", d->dependent->name); list_for_each(&c->dependencies, d, node)
printf("\t%s\n", d->dependent->key);
}
} }
} }
} }
...@@ -640,8 +645,10 @@ int main(int argc, char *argv[]) ...@@ -640,8 +645,10 @@ int main(int argc, char *argv[])
dir[strlen(dir)-1] = '\0'; dir[strlen(dir)-1] = '\0';
if (dir != base_dir) if (dir != base_dir)
prefix = talloc_append_string(talloc_basename(NULL, dir), ": "); prefix = talloc_append_string(talloc_basename(NULL, dir), ": ");
if (verbose >= 3) if (verbose >= 3) {
compile_verbose = true; compile_verbose = true;
print_test_depends();
}
if (verbose >= 4) if (verbose >= 4)
tools_verbose = true; tools_verbose = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment