Browse Source

tools/ccanlint: compile cleanly with -Wextra.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell 9 years ago
parent
commit
9961094e24

+ 1 - 1
tools/ccanlint/async.c

@@ -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);
 }
 }

+ 19 - 15
tools/ccanlint/ccanlint.c

@@ -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);
 	struct ccanlint *c = container_of(node, struct ccanlint, node);
 	c->can_run = dep_failed;
 	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)
 		     struct ccanlint **ret)
 {
 {
 	if (tlist_empty(&i->node.edge[DGRAPH_TO])) {
 	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);
 	char **deps = tal_strsplit(NULL, c->needs, " ", STR_EMPTY_OK);
 	unsigned int i;
 	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)
 			ccanlint_map_t *names)
 {
 {
 	if (!strmap_add(names, c->name, c))
 	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);
 	struct ccanlint *c = container_of(node, struct ccanlint, node);
 	c->skip = NULL;
 	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])) {
 	if (!tlist_empty(&c->node.edge[DGRAPH_FROM])) {
 		struct dgraph_edge *e;
 		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);
 	struct ccanlint *i = find_test(testname);
 	if (!i)
 	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)
 		       struct dgraph_node *all)
 {
 {
 	/* If we're excluded on cmdline, don't add. */
 	/* 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[])
 int main(int argc, char *argv[])
 {
 {
 	bool summary = false, pass = true, deps_fail_ignore = false;
 	bool summary = false, pass = true, deps_fail_ignore = false;
-	unsigned int i;
+	int i;
 	const char *prefix = "";
 	const char *prefix = "";
 	char *cwd = path_cwd(NULL), *dir;
 	char *cwd = path_cwd(NULL), *dir;
 	struct ccanlint top;  /* cannot_run may try to set ->can_run */
 	struct ccanlint top;  /* cannot_run may try to set ->can_run */

+ 1 - 1
tools/ccanlint/file_analysis.c

@@ -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);
 
 

+ 2 - 2
tools/ccanlint/tests/examples_compile.c

@@ -485,7 +485,7 @@ static struct ccan_file *mangle_example(struct manifest *m,
 		return NULL;
 		return NULL;
 
 
 	contents = mangle(m, lines);
 	contents = mangle(m, lines);
-	if (write(fd, contents, strlen(contents)) != strlen(contents)) {
+	if (write(fd, contents, strlen(contents)) != (int)strlen(contents)) {
 		close(fd);
 		close(fd);
 		return NULL;
 		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;
 	struct ccan_file *i;
 	char **prev = NULL;
 	char **prev = NULL;

+ 1 - 1
tools/manifest.c

@@ -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);
 }
 }