]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/compulsory_tests/objects_build.c
ccanlint: give a point per compile_ok/compile_fail test
[ccan] / tools / ccanlint / compulsory_tests / objects_build.c
index 13d34a14e041fb90b2fcbba7df020c06805aec31..46fdbd4592ea5561ad350ac9ca3571de297b44b0 100644 (file)
@@ -13,6 +13,7 @@
 #include <err.h>
 #include <string.h>
 #include <ctype.h>
+#include "build.h"
 
 static const char *can_build(struct manifest *m)
 {
@@ -21,9 +22,8 @@ static const char *can_build(struct manifest *m)
        return NULL;
 }
 
-static void check_objs_build(struct manifest *m,
-                            bool keep,
-                            unsigned int *timeleft, struct score *score)
+void build_objects(struct manifest *m,
+                  bool keep, struct score *score, const char *flags)
 {
        struct ccan_file *i;
        bool errors = false, warnings = false;
@@ -38,15 +38,18 @@ static void check_objs_build(struct manifest *m,
                char *fullfile = talloc_asprintf(m, "%s/%s", m->dir, i->name);
 
                i->compiled = maybe_temp_file(m, "", keep, fullfile);
-               if (!compile_object(score, fullfile, ccan_dir, "", i->compiled,
-                                   &output)) {
+               if (!compile_object(score, fullfile, ccan_dir, compiler, flags,
+                                   i->compiled, &output)) {
                        talloc_free(i->compiled);
-                       score->error = "Compiling object files";
-                       score_file_error(score, i, 0, output);
+                       score_file_error(score, i, 0,
+                                        "Compiling object files:\n%s",
+                                        output);
                        errors = true;
                } else if (!streq(output, "")) {
-                       score->error = "Compiling object files gave warnings";
-                       score_file_error(score, i, 0, output);
+                       score_file_error(score, i, 0,
+                                        "Compiling object files gave"
+                                        " warnings:\n%s",
+                                        output);
                        warnings = true;
                }
        }
@@ -57,6 +60,13 @@ static void check_objs_build(struct manifest *m,
        }
 }
 
+static void check_objs_build(struct manifest *m,
+                            bool keep,
+                            unsigned int *timeleft, struct score *score)
+{
+       build_objects(m, keep, score, cflags);
+}
+
 struct ccanlint objects_build = {
        .key = "objects_build",
        .name = "Module object files can be built",