Commit fba46ae0 authored by Rusty Russell's avatar Rusty Russell

opt: handle -Wcast-qual warnings.

parent ec822c65
......@@ -61,8 +61,9 @@ int main(int argc, char *argv[])
return 1;
if (strcmp(argv[1], "depends") == 0) {
printf("ccan/typesafe_cb\n");
printf("ccan/cast\n");
printf("ccan/compiler\n");
printf("ccan/typesafe_cb\n");
return 0;
}
......
/* Licensed under GPLv3+ - see LICENSE file for details */
#include <ccan/opt/opt.h>
#include <ccan/cast/cast.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
......@@ -52,7 +53,7 @@ char *opt_set_invbool_arg(const char *arg, bool *b)
/* Set a char *. */
char *opt_set_charp(const char *arg, char **p)
{
*p = (char *)arg;
*p = cast_const(char *, arg);
return NULL;
}
......
......@@ -7,7 +7,7 @@ extern unsigned int opt_count, opt_num_short, opt_num_short_arg, opt_num_long;
extern const char *opt_argv0;
#define subtable_of(entry) ((struct opt_table *)((entry)->names))
#define subtable_of(entry) ((const struct opt_table *)((entry)->names))
const char *first_sopt(unsigned *i);
const char *next_sopt(const char *names, unsigned *i);
......
......@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
}
/* opt_set_charp */
{
char *arg = (char *)"wrong";
char *arg = cast_const(char *, "wrong");
reset_options();
opt_register_arg("-a", opt_set_charp, NULL, &arg, "All");
ok1(parse_args(&argc, &argv, "-a", "string", NULL));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment