]> git.ozlabs.org Git - ccan/blob - tools/ccanlint/tests/info_ported.c
ccanlint: remove empty statement warnings.
[ccan] / tools / ccanlint / tests / info_ported.c
1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/str/str.h>
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <fcntl.h>
7 #include <unistd.h>
8 #include <limits.h>
9 #include <errno.h>
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <err.h>
13 #include <string.h>
14 #include <ctype.h>
15
16 static const char *can_build(struct manifest *m)
17 {
18         char *msg;
19
20         /* FIXME: In safe mode, we'd need complex guesstiparsing. */
21         if (safe_mode)
22                 return NULL;
23
24         msg = get_ported(m, m->dir, true, get_or_compile_info);
25         if (!msg)
26                 return NULL;
27         return tal_fmt(m, "'_info ported' says '%s'", msg);
28 }
29
30 static void check_info_ported(struct manifest *m UNNEEDED,
31                               unsigned int *timeleft UNNEEDED,
32                               struct score *score)
33 {
34         score->pass = true;
35         score->score = 1;
36 }
37
38 struct ccanlint info_ported = {
39         .key = "info_ported",
40         .can_run = can_build,
41         .name = "_info indicates support for this platform",
42         .check = check_info_ported,
43         .needs = "info_compiles"
44 };
45
46 REGISTER_TEST(info_ported);