X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Flibcore%2Flc_opts_enum.c;h=c286f97c813e91a3d8df744be95b38ac7c60a769;hb=4f25f9ca1fd1d53303f277a140a1aa657782aeba;hp=399cc004ea0a499d5f35806b4940b4f38e43e34b;hpb=a1e9069afa4fa1e16e2d176bcd7905d6a1ed4677;p=libfirm diff --git a/ir/libcore/lc_opts_enum.c b/ir/libcore/lc_opts_enum.c index 399cc004e..c286f97c8 100644 --- a/ir/libcore/lc_opts_enum.c +++ b/ir/libcore/lc_opts_enum.c @@ -15,22 +15,16 @@ #include #include -#ifdef _WIN32 -#include -#endif -#ifdef HAVE_ALLOCA_H -#include -#endif - #include "lc_opts_t.h" #include "lc_opts_enum.h" +#include "xmalloc.h" static const char *delim = " \t|,"; #define DECL_CB(N, op) \ -int lc_opt_enum_ ## N ## _cb(LC_UNUSED(const char *name), LC_UNUSED(lc_opt_type_t type), void *data, size_t len, ...) \ +int lc_opt_enum_ ## N ## _cb(const char *name, lc_opt_type_t type, void *data, size_t len, ...) \ { \ - lc_opt_enum_ ## N ## _var_t *var = data; \ + lc_opt_enum_ ## N ## _var_t *var = (lc_opt_enum_ ## N ## _var_t*)data; \ const lc_opt_enum_ ## N ## _items_t *items = var->items; \ \ va_list args; \ @@ -39,12 +33,14 @@ int lc_opt_enum_ ## N ## _cb(LC_UNUSED(const char *name), LC_UNUSED(lc_opt_type_ const char *arg; \ int res = 0; \ \ + (void) name; \ + (void) type; \ va_start(args, len); \ arg = va_arg(args, const char *); \ va_end(args); \ \ end = strlen(arg); \ - tmp = s = malloc((end + 1) * sizeof(arg[0])); \ + tmp = s = (char*)malloc((end + 1) * sizeof(arg[0])); \ strcpy(s, arg); \ s[end] = '\0'; \ \ @@ -75,14 +71,17 @@ DECL_CB(const_ptr, =) DECL_CB(func_ptr, =) #define DECL_DUMP(T, N, cond) \ -int lc_opt_enum_ ## N ## _dump(char *buf, size_t n, LC_UNUSED(const char *name), LC_UNUSED(lc_opt_type_t type), void *data, LC_UNUSED(size_t len)) \ +int lc_opt_enum_ ## N ## _dump(char *buf, size_t n, const char *name, lc_opt_type_t type, void *data, size_t len) \ { \ - lc_opt_enum_ ## N ## _var_t *var = data; \ + lc_opt_enum_ ## N ## _var_t *var = (lc_opt_enum_ ## N ## _var_t*)data; \ const lc_opt_enum_ ## N ## _items_t *items = var->items; \ const char *prefix = ""; \ TYPE(value) = *var->value; \ int i; \ size_t l = strlen(buf); \ + (void) name; \ + (void) type; \ + (void) len; \ \ if (l >= n) \ return (int)l; \ @@ -102,18 +101,21 @@ int lc_opt_enum_ ## N ## _dump(char *buf, size_t n, LC_UNUSED(const char *name), } \ } \ \ - return strlen(buf); \ + return (int)strlen(buf); \ } \ #define DECL_DUMP_VALS(T, N) \ -int lc_opt_enum_ ## N ## _dump_vals(char *buf, size_t n, LC_UNUSED(const char *name), LC_UNUSED(lc_opt_type_t type), void *data, LC_UNUSED(size_t len)) \ +int lc_opt_enum_ ## N ## _dump_vals(char *buf, size_t n, const char *name, lc_opt_type_t type, void *data, size_t len) \ { \ - lc_opt_enum_ ## N ## _var_t *var = data; \ + lc_opt_enum_ ## N ## _var_t *var = (lc_opt_enum_ ## N ## _var_t*) data; \ const lc_opt_enum_ ## N ## _items_t *items = var->items; \ const char *prefix = ""; \ int i; \ size_t l = strlen(buf); \ + (void) name; \ + (void) type; \ + (void) len; \ \ if (l >= n) \ return (int)l; \ @@ -131,7 +133,7 @@ int lc_opt_enum_ ## N ## _dump_vals(char *buf, size_t n, LC_UNUSED(const char *n prefix = ", "; \ } \ \ - return strlen(buf); \ + return (int)strlen(buf); \ } \