- foreach_ptr(list, &m->c_files, &m->h_files,
- &m->run_tests, &m->api_tests,
+ used = talloc_zero_array(m, bool, core_deps + test_deps + 1);
+
+ foreach_ptr(list, &m->c_files, &m->h_files) {
+ struct ccan_file *f;
+
+ list_for_each(list, f, list)
+ ok &= check_dep_includes(m, deps, used, score, f);
+ }
+
+ for (i = 0; i < core_deps; i++) {
+ if (!used[i])
+ score_file_error(score, m->info_file, 0,
+ "%s is an unused dependency",
+ deps[i]);
+ }
+
+ /* Now append test dependencies to deps. */
+ deps = talloc_realloc(NULL, deps, char *,
+ (core_deps + test_deps + 1) * sizeof(char *));
+ memcpy(&deps[core_deps], tdeps, test_deps * sizeof(char *));
+ /* ccan/tap is given a free pass. */
+ deps[core_deps + test_deps] = (char *)"ccan/tap";
+ deps[core_deps + test_deps + 1] = NULL;
+
+ foreach_ptr(list, &m->run_tests, &m->api_tests,