1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/talloc/talloc.h>
4 #include <ccan/grab_file/grab_file.h>
5 #include <ccan/str/str.h>
18 static const char *can_build(struct manifest *m)
21 return "Safe mode enabled";
25 static void *check_includes_build(struct manifest *m)
31 tmpfile = temp_file(m, ".c");
33 fd = open(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600);
35 return talloc_asprintf(m, "Creating temporary file: %s",
38 contents = talloc_asprintf(tmpfile, "#include <ccan/%s/%s.h>\n",
39 m->basename, m->basename);
40 if (write(fd, contents, strlen(contents)) != strlen(contents)) {
42 return "Failure writing to temporary file";
46 if (compile_object(m, tmpfile, &err))
51 static const char *describe_includes_build(struct manifest *m,
54 return talloc_asprintf(check_result,
55 "#include of the main header file:\n"
56 "%s", (char *)check_result);
59 struct ccanlint includes_build = {
60 .name = "Can compile against main header",
62 .check = check_includes_build,
63 .describe = describe_includes_build,
67 REGISTER_TEST(includes_build, &depends_exist, NULL);