]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/tests/main_header_compiles.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / tools / ccanlint / tests / main_header_compiles.c
index 99f3aa38855928e8611dc0967f4ff854a65e6ed9..1b741d4fd7c5c4b7aa0d77694023f42d4db04f35 100644 (file)
@@ -1,7 +1,5 @@
 #include <tools/ccanlint/ccanlint.h>
 #include <tools/tools.h>
-#include <ccan/talloc/talloc.h>
-#include <ccan/grab_file/grab_file.h>
 #include <ccan/str/str.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -15,7 +13,7 @@
 #include <string.h>
 #include <ctype.h>
 
-static const char *can_build(struct manifest *m)
+static const char *can_build(struct manifest *m UNNEEDED)
 {
        if (safe_mode)
                return "Safe mode enabled";
@@ -36,23 +34,23 @@ static struct ccan_file *main_header(struct manifest *m)
 }
 
 static void check_includes_build(struct manifest *m,
-                                bool keep,
-                                unsigned int *timeleft, struct score *score)
+                                unsigned int *timeleft UNNEEDED,
+                                struct score *score)
 {
        char *contents;
        char *tmpsrc, *tmpobj, *cmdout;
        int fd;
        struct ccan_file *mainh = main_header(m);
 
-       tmpsrc = maybe_temp_file(m, "-included.c", keep, mainh->fullname);
-       tmpobj = maybe_temp_file(m, ".o", keep, tmpsrc);
+       tmpsrc = temp_file(m, "-included.c", mainh->fullname);
+       tmpobj = temp_file(m, ".o", tmpsrc);
 
        fd = open(tmpsrc, O_WRONLY | O_CREAT | O_EXCL, 0600);
        if (fd < 0)
                err(1, "Creating temporary file %s", tmpsrc);
 
-       contents = talloc_asprintf(tmpsrc, "#include <ccan/%s/%s.h>\n",
-                                  m->basename, m->basename);
+       contents = tal_fmt(tmpsrc, "#include <ccan/%s/%s.h>\n",
+                          m->modname, m->basename);
        if (write(fd, contents, strlen(contents)) != strlen(contents))
                err(1, "writing to temporary file %s", tmpsrc);
        close(fd);
@@ -62,7 +60,7 @@ static void check_includes_build(struct manifest *m,
                score->pass = true;
                score->score = score->total;
        } else {
-               score->error = talloc_asprintf(score,
+               score->error = tal_fmt(score,
                                       "#include of the main header file:\n%s",
                                       cmdout);
        }
@@ -73,7 +71,7 @@ struct ccanlint main_header_compiles = {
        .name = "Modules main header compiles",
        .check = check_includes_build,
        .can_run = can_build,
-       .needs = "depends_exist main_header_exists"
+       .needs = "depends_exist main_header_exists info_ported"
 };
 
 REGISTER_TEST(main_header_compiles);