]> git.ozlabs.org Git - ccan/commitdiff
tools/ccanlint: compile cleanly with -Wextra.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 4 Nov 2016 20:53:47 +0000 (07:23 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 4 Nov 2016 20:53:47 +0000 (07:23 +1030)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/ccanlint/async.c
tools/ccanlint/ccanlint.c
tools/ccanlint/file_analysis.c
tools/ccanlint/tests/examples_compile.c
tools/manifest.c

index d867079d0782c4f341e9af443517494f52f83c78..e5b9078dbda65c5c36b6b46636b4fad365fd586e 100644 (file)
@@ -34,7 +34,7 @@ struct command {
        const void *ctx;
 };
 
        const void *ctx;
 };
 
-static void killme(int sig)
+static void killme(int sig UNNEEDED)
 {
        kill(-getpid(), SIGKILL);
 }
 {
        kill(-getpid(), SIGKILL);
 }
index e2a687e06c410751996235e82192405726baa654..629ffd515485b9d02766e0478ad6aa88a9bbe9e7 100644 (file)
@@ -84,12 +84,12 @@ static bool skip_test(struct dgraph_node *node, const char *why)
        return true;
 }
 
        return true;
 }
 
-static const char *dep_failed(struct manifest *m)
+static const char *dep_failed(struct manifest *m UNNEEDED)
 {
        return "dependency couldn't run";
 }
 
 {
        return "dependency couldn't run";
 }
 
-static bool cannot_run(struct dgraph_node *node, void *all)
+static bool cannot_run(struct dgraph_node *node, void *all UNNEEDED)
 {
        struct ccanlint *c = container_of(node, struct ccanlint, node);
        c->can_run = dep_failed;
 {
        struct ccanlint *c = container_of(node, struct ccanlint, node);
        c->can_run = dep_failed;
@@ -215,7 +215,7 @@ static void register_test(struct ccanlint *test)
        dgraph_init_node(&test->node);
 }
 
        dgraph_init_node(&test->node);
 }
 
-static bool get_test(const char *member, struct ccanlint *i,
+static bool get_test(const char *member UNNEEDED, struct ccanlint *i,
                     struct ccanlint **ret)
 {
        if (tlist_empty(&i->node.edge[DGRAPH_TO])) {
                     struct ccanlint **ret)
 {
        if (tlist_empty(&i->node.edge[DGRAPH_TO])) {
@@ -252,7 +252,8 @@ bool is_excluded(const char *name)
        return find_test(name)->skip != NULL;
 }
 
        return find_test(name)->skip != NULL;
 }
 
-static bool init_deps(const char *member, struct ccanlint *c, void *unused)
+static bool init_deps(const char *member UNNEEDED,
+                     struct ccanlint *c, void *unused UNNEEDED)
 {
        char **deps = tal_strsplit(NULL, c->needs, " ", STR_EMPTY_OK);
        unsigned int i;
 {
        char **deps = tal_strsplit(NULL, c->needs, " ", STR_EMPTY_OK);
        unsigned int i;
@@ -270,7 +271,7 @@ static bool init_deps(const char *member, struct ccanlint *c, void *unused)
        return true;
 }
 
        return true;
 }
 
-static bool check_names(const char *member, struct ccanlint *c,
+static bool check_names(const char *member UNNEEDED, struct ccanlint *c,
                        ccanlint_map_t *names)
 {
        if (!strmap_add(names, c->name, c))
                        ccanlint_map_t *names)
 {
        if (!strmap_add(names, c->name, c))
@@ -299,7 +300,7 @@ static void init_tests(void)
        strmap_clear(&names);
 }
 
        strmap_clear(&names);
 }
 
-static bool reset_test(struct dgraph_node *node, void *unused)
+static bool reset_test(struct dgraph_node *node, void *unused UNNEEDED)
 {
        struct ccanlint *c = container_of(node, struct ccanlint, node);
        c->skip = NULL;
 {
        struct ccanlint *c = container_of(node, struct ccanlint, node);
        c->skip = NULL;
@@ -312,7 +313,8 @@ static void reset_tests(struct dgraph_node *all)
        dgraph_traverse_to(all, reset_test, NULL);
 }
 
        dgraph_traverse_to(all, reset_test, NULL);
 }
 
-static bool print_deps(const char *member, struct ccanlint *c, void *unused)
+static bool print_deps(const char *member UNNEEDED,
+                      struct ccanlint *c, void *unused UNNEEDED)
 {
        if (!tlist_empty(&c->node.edge[DGRAPH_FROM])) {
                struct dgraph_edge *e;
 {
        if (!tlist_empty(&c->node.edge[DGRAPH_FROM])) {
                struct dgraph_edge *e;
@@ -341,7 +343,7 @@ static void show_tmpdir(const char *dir)
        printf("You can find ccanlint working files in '%s'\n", dir);
 }
 
        printf("You can find ccanlint working files in '%s'\n", dir);
 }
 
-static char *keep_tests(void *unused)
+static char *keep_tests(void *unused UNNEEDED)
 {
        keep_results = true;
 
 {
        keep_results = true;
 
@@ -359,7 +361,7 @@ static bool remove_test(struct dgraph_node *node, const char *why)
        return true;
 }
 
        return true;
 }
 
-static char *exclude_test(const char *testname, void *unused)
+static char *exclude_test(const char *testname, void *unused UNNEEDED)
 {
        struct ccanlint *i = find_test(testname);
        if (!i)
 {
        struct ccanlint *i = find_test(testname);
        if (!i)
@@ -378,7 +380,7 @@ static void skip_test_and_deps(struct ccanlint *c, const char *why)
        skip_test(&c->node, why);
 }
 
        skip_test(&c->node, why);
 }
 
-static char *list_tests(void *arg)
+static char *list_tests(void *arg UNNEEDED)
 {
        struct ccanlint *i;
 
 {
        struct ccanlint *i;
 
@@ -392,7 +394,8 @@ static char *list_tests(void *arg)
        exit(0);
 }
 
        exit(0);
 }
 
-static bool draw_test(const char *member, struct ccanlint *c, const char *style)
+static bool draw_test(const char *member UNNEEDED,
+                     struct ccanlint *c, const char *style)
 {
        /*
         * todo: escape labels in case ccanlint test keys have
 {
        /*
         * todo: escape labels in case ccanlint test keys have
@@ -407,7 +410,8 @@ static void test_dgraph_vertices(const char *style)
        strmap_iterate(&tests, draw_test, style);
 }
 
        strmap_iterate(&tests, draw_test, style);
 }
 
-static bool draw_edges(const char *member, struct ccanlint *c, void *unused)
+static bool draw_edges(const char *member UNNEEDED,
+                      struct ccanlint *c, void *unused UNNEEDED)
 {
        struct dgraph_edge *e;
 
 {
        struct dgraph_edge *e;
 
@@ -425,7 +429,7 @@ static void test_dgraph_edges(void)
        strmap_iterate(&tests, draw_edges, NULL);
 }
 
        strmap_iterate(&tests, draw_edges, NULL);
 }
 
-static char *test_dependency_graph(void *arg)
+static char *test_dependency_graph(void *arg UNNEEDED)
 {
        puts("digraph G {");
 
 {
        puts("digraph G {");
 
@@ -586,7 +590,7 @@ static bool run_tests(struct dgraph_node *all,
        return run.pass;
 }
 
        return run.pass;
 }
 
-static bool add_to_all(const char *member, struct ccanlint *c,
+static bool add_to_all(const char *member UNNEEDED, struct ccanlint *c,
                       struct dgraph_node *all)
 {
        /* If we're excluded on cmdline, don't add. */
                       struct dgraph_node *all)
 {
        /* If we're excluded on cmdline, don't add. */
@@ -614,7 +618,7 @@ static bool test_module(struct dgraph_node *all,
 int main(int argc, char *argv[])
 {
        bool summary = false, pass = true, deps_fail_ignore = false;
 int main(int argc, char *argv[])
 {
        bool summary = false, pass = true, deps_fail_ignore = false;
-       unsigned int i;
+       int i;
        const char *prefix = "";
        char *cwd = path_cwd(NULL), *dir;
        struct ccanlint top;  /* cannot_run may try to set ->can_run */
        const char *prefix = "";
        char *cwd = path_cwd(NULL), *dir;
        struct ccanlint top;  /* cannot_run may try to set ->can_run */
index abcf0795e7111dd3c4432332778e398cca05157a..d2fe2a4c1deb621cda477148fa79b4abbe582954 100644 (file)
@@ -417,7 +417,7 @@ void score_file_error(struct score *score, struct ccan_file *f, unsigned line,
 }
 
 
 }
 
 
-char *get_or_compile_info(const void *ctx, const char *dir)
+char *get_or_compile_info(const void *ctx UNNEEDED, const char *dir)
 {
        struct manifest *m = get_manifest(NULL, dir);
 
 {
        struct manifest *m = get_manifest(NULL, dir);
 
index 745860668beddc8e158d3d5226dc3a4d0b4b849b..cb71bf8329db7e54227b7c26af94e97cfb2b18e6 100644 (file)
@@ -485,7 +485,7 @@ static struct ccan_file *mangle_example(struct manifest *m,
                return NULL;
 
        contents = mangle(m, lines);
                return NULL;
 
        contents = mangle(m, lines);
-       if (write(fd, contents, strlen(contents)) != strlen(contents)) {
+       if (write(fd, contents, strlen(contents)) != (int)strlen(contents)) {
                close(fd);
                return NULL;
        }
                close(fd);
                return NULL;
        }
@@ -550,7 +550,7 @@ static unsigned int try_compiling(struct manifest *m,
 }
 
 static void build_examples(struct manifest *m,
 }
 
 static void build_examples(struct manifest *m,
-                          unsigned int *timeleft, struct score *score)
+                          unsigned int *timeleft UNNEEDED, struct score *score)
 {
        struct ccan_file *i;
        char **prev = NULL;
 {
        struct ccan_file *i;
        char **prev = NULL;
index 3494937a4009b1b7dad69eb9efe268e9e44fe1ad..82668acfed05fd43eab6b59c7d61dba4f258652f 100644 (file)
@@ -183,7 +183,7 @@ static void add_files(struct manifest *m, const char *base, const char *subdir)
 }
 
 static int cmp_names(struct ccan_file *const *a, struct ccan_file *const *b,
 }
 
 static int cmp_names(struct ccan_file *const *a, struct ccan_file *const *b,
-                    void *unused)
+                    void *unused UNNEEDED)
 {
        return strcmp((*a)->name, (*b)->name);
 }
 {
        return strcmp((*a)->name, (*b)->name);
 }