1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/talloc/talloc.h>
4 #include <ccan/str/str.h>
17 static const char *can_build(struct manifest *m)
20 return "Safe mode enabled";
24 static bool compile_obj(struct ccan_file *c_file, char *objfile, char **report)
28 err = compile_object(objfile, objfile, c_file->name);
31 *report = talloc_append_string(*report, err);
39 static int cleanup_obj(char *objfile)
45 static void *check_objs_build(struct manifest *m)
50 /* One point for each obj file. */
51 list_for_each(&m->c_files, i, list)
52 build_objs.total_score++;
54 list_for_each(&m->c_files, i, list) {
55 char *objfile = talloc_strdup(m, i->name);
56 objfile[strlen(objfile)-1] = 'o';
58 if (compile_obj(i, objfile, &report))
59 talloc_set_destructor(objfile, cleanup_obj);
64 static const char *describe_objs_build(struct manifest *m, void *check_result)
66 return talloc_asprintf(check_result,
67 "%s", (char *)check_result);
70 struct ccanlint build_objs = {
71 .name = "Module object files can be built",
72 .check = check_objs_build,
73 .describe = describe_objs_build,
77 REGISTER_TEST(build_objs, &depends_exist, NULL);