ccanlint: Add -k option to keep results.
[ccan] / tools / ccanlint / compulsory_tests / build_objs.c
index 2f189e859f25a8b523505609cafd31c429e3a443..6899b7b04986e5418e03f20e861a9435b3cea413 100644 (file)
@@ -21,19 +21,23 @@ static const char *can_build(struct manifest *m)
        return NULL;
 }
 
        return NULL;
 }
 
-static void *check_objs_build(struct manifest *m)
+static void *check_objs_build(struct manifest *m,
+                             bool keep, unsigned int *timeleft)
 {
        char *report = NULL;
        struct ccan_file *i;
 
        list_for_each(&m->c_files, i, list) {
                char *err;
 {
        char *report = NULL;
        struct ccan_file *i;
 
        list_for_each(&m->c_files, i, list) {
                char *err;
+               char *fullfile = talloc_asprintf(m, "%s/%s", m->dir, i->name);
 
                /* One point for each obj file. */
                build_objs.total_score++;
 
 
                /* One point for each obj file. */
                build_objs.total_score++;
 
-               i->compiled = compile_object(m, i->name, &err);
-               if (!i->compiled) {
+               i->compiled = maybe_temp_file(m, "", keep, fullfile);
+               err = compile_object(m, fullfile, ccan_dir, i->compiled);
+               if (err) {
+                       talloc_free(i->compiled);
                        if (report)
                                report = talloc_append_string(report, err);
                        else
                        if (report)
                                report = talloc_append_string(report, err);
                        else
@@ -49,6 +53,7 @@ static const char *describe_objs_build(struct manifest *m, void *check_result)
 }
 
 struct ccanlint build_objs = {
 }
 
 struct ccanlint build_objs = {
+       .key = "build-objects",
        .name = "Module object files can be built",
        .check = check_objs_build,
        .describe = describe_objs_build,
        .name = "Module object files can be built",
        .check = check_objs_build,
        .describe = describe_objs_build,