projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Restored somehow lost AMD Family 11h support.
[libfirm]
/
ir
/
libcore
/
lc_opts.c
diff --git
a/ir/libcore/lc_opts.c
b/ir/libcore/lc_opts.c
index
fca9d07
..
a1470b9
100644
(file)
--- a/
ir/libcore/lc_opts.c
+++ b/
ir/libcore/lc_opts.c
@@
-58,8
+58,8
@@
#define OPT_DELIM '-'
#define OPT_DELIM '-'
-#define HELP_TEMPL
"%-15s %-10s %-45s"
-#define HELP_TEMPL_VALS
HELP_TEMPL " [%s] (%s)"
+#define HELP_TEMPL "%-15s %-10s %-45s"
+#define HELP_TEMPL_VALS HELP_TEMPL " [%s] (%s)"
static struct obstack obst;
static struct obstack obst;
@@
-112,9
+112,9
@@
static lc_opt_entry_t *init_entry(lc_opt_entry_t *ent, lc_opt_entry_t *parent,
const char *copied_desc;
obstack_grow0(&obst, name, strlen(name));
const char *copied_desc;
obstack_grow0(&obst, name, strlen(name));
- copied_name = obstack_finish(&obst);
+ copied_name =
(char*)
obstack_finish(&obst);
obstack_grow0(&obst, desc, strlen(desc));
obstack_grow0(&obst, desc, strlen(desc));
- copied_desc = obstack_finish(&obst);
+ copied_desc =
(char*)
obstack_finish(&obst);
memset(ent, 0, sizeof(*ent));
set_name(ent, copied_name);
memset(ent, 0, sizeof(*ent));
set_name(ent, copied_name);
@@
-154,12
+154,12
@@
static lc_opt_entry_t *init_opt(lc_opt_entry_t *ent,
set_error(err, lc_opt_err_none, "");
list_add_tail(&ent->list, &lc_get_grp_special(ent->parent)->opts);
set_error(err, lc_opt_err_none, "");
list_add_tail(&ent->list, &lc_get_grp_special(ent->parent)->opts);
- s->type
= type;
- s->value
= val;
- s->cb
= cb;
+ s->type = type;
+ s->value = val;
+ s->cb = cb;
s->dump = dump;
s->dump_vals = dump_vals;
s->dump = dump;
s->dump_vals = dump_vals;
- s->length
= length;
+ s->length = length;
return ent;
}
return ent;
}
@@
-311,7
+311,7
@@
static lc_opt_entry_t *resolve_up_to_last_str_rec(lc_opt_entry_t *from,
size_t next = strspn(path + end, path_delim);
/* copy the part of the path into a buffer */
size_t next = strspn(path + end, path_delim);
/* copy the part of the path into a buffer */
- char *buf = malloc((end+1) * sizeof(buf[0]));
+ char *buf =
(char*)
malloc((end+1) * sizeof(buf[0]));
strncpy(buf, path, end);
buf[end] = '\0';
strncpy(buf, path, end);
buf[end] = '\0';
@@
-398,7
+398,7
@@
int lc_opt_std_cb(UNUSED(const char *name), lc_opt_type_t type, void *data, size
break;
case lc_opt_type_string:
break;
case lc_opt_type_string:
- strncpy(data, va_arg(args, const char *), length);
+ strncpy(
(char*)
data, va_arg(args, const char *), length);
break;
case lc_opt_type_int:
break;
case lc_opt_type_int:
@@
-432,7
+432,7
@@
int lc_opt_std_dump(char *buf, size_t n, UNUSED(const char *name), lc_opt_type_t
res = snprintf(buf, n, "%s", *((int *) data) ? "true" : "false");
break;
case lc_opt_type_string:
res = snprintf(buf, n, "%s", *((int *) data) ? "true" : "false");
break;
case lc_opt_type_string:
- strncpy(buf, data, n);
+ strncpy(buf,
(const char*)
data, n);
res = n;
break;
case lc_opt_type_int:
res = n;
break;
case lc_opt_type_int:
@@
-542,6
+542,8
@@
int lc_opt_occurs(lc_opt_entry_t *opt, const char *value, lc_opt_err_info_t *err
if (s->cb(opt->name, s->type, s->value, s->length, value))
error = lc_opt_err_none;
break;
if (s->cb(opt->name, s->type, s->value, s->length, value))
error = lc_opt_err_none;
break;
+ case lc_opt_type_invalid:
+ abort();
}
set_error(err, error, value);
}
set_error(err, error, value);
@@
-600,7
+602,7
@@
static void lc_opt_print_grp_path_rec(char *buf, size_t len, const lc_opt_entry_
}
}
}
}
- strncat(buf, ent->name, len);
+ strncat(buf, ent->name, len
-1
);
}
static char *lc_opt_print_grp_path(char *buf, size_t len, const lc_opt_entry_t *ent, char separator, lc_opt_entry_t *stop_ent)
}
static char *lc_opt_print_grp_path(char *buf, size_t len, const lc_opt_entry_t *ent, char separator, lc_opt_entry_t *stop_ent)
@@
-729,7
+731,7
@@
int lc_opt_from_single_arg(const lc_opt_entry_t *root,
int ret = 0;
lc_opt_err_info_t err;
int ret = 0;
lc_opt_err_info_t err;
- c
har *end, *buf
, *eqsign;
+ c
onst char *end
, *eqsign;
if (n >= n_prefix && strncmp(opt_prefix, arg, n_prefix) == 0) {
arg = arg + n_prefix;
if (n >= n_prefix && strncmp(opt_prefix, arg, n_prefix) == 0) {
arg = arg + n_prefix;
@@
-740,8
+742,8
@@
int lc_opt_from_single_arg(const lc_opt_entry_t *root,
* from a file.
*/
if (arg[0] == '@') {
* from a file.
*/
if (arg[0] == '@') {
- size_t n
= strcspn(&arg[1], " \t\n");
- char *fname
=
alloca(n + 1);
+ size_t n = strcspn(&arg[1], " \t\n");
+ char *fname
= (char*)
alloca(n + 1);
FILE *f;
strncpy(fname, &arg[1], n);
FILE *f;
strncpy(fname, &arg[1], n);
@@
-768,7
+770,7
@@
int lc_opt_from_single_arg(const lc_opt_entry_t *root,
* Copy the part of the option into the buffer and add the
* finalizing zero.
*/
* Copy the part of the option into the buffer and add the
* finalizing zero.
*/
-
buf =
obstack_copy0(&obst, arg, end - arg);
+
char *buf = (char*)
obstack_copy0(&obst, arg, end - arg);
/* Resolve the group inside the group */
grp = lc_opt_find_grp(grp, buf, &err);
/* Resolve the group inside the group */
grp = lc_opt_find_grp(grp, buf, &err);
@@
-787,6
+789,7
@@
int lc_opt_from_single_arg(const lc_opt_entry_t *root,
if (!error) {
lc_opt_entry_t *opt;
if (!error) {
lc_opt_entry_t *opt;
+ char *buf;
/*
* Now, we are at the last option part:
/*
* Now, we are at the last option part:
@@
-796,7
+799,7
@@
int lc_opt_from_single_arg(const lc_opt_entry_t *root,
* later.
*/
end = strchr(arg, '=');
* later.
*/
end = strchr(arg, '=');
- buf = obstack_copy0(&obst, arg, end ? end - arg : (int) strlen(arg));
+ buf =
(char*)
obstack_copy0(&obst, arg, end ? end - arg : (int) strlen(arg));
opt = lc_opt_find_opt(grp, buf, &err);
error = lc_opt_raise_error(&err, handler, ERR_STRING, arg);
opt = lc_opt_find_opt(grp, buf, &err);
error = lc_opt_raise_error(&err, handler, ERR_STRING, arg);
@@
-844,9
+847,9
@@
static int opt_arg_emit(lc_appendable_t *app, const lc_arg_occ_t *occ, const lc_
{
char buf[256];
{
char buf[256];
- lc_opt_entry_t *opt = arg->v_ptr;
- const char
*s
= buf;
- size_t
res
= 0;
+ lc_opt_entry_t *opt =
(lc_opt_entry_t*)
arg->v_ptr;
+ const char
*s
= buf;
+ size_t
res
= 0;
switch (occ->conversion) {
case 'V':
switch (occ->conversion) {
case 'V':
@@
-904,7
+907,7
@@
void lc_opt_default_configs(const char *ini_name)
/* <cmnt>.ini */
strncpy(local_ini_file, ini_name, sizeof(local_ini_file));
/* <cmnt>.ini */
strncpy(local_ini_file, ini_name, sizeof(local_ini_file));
- strncat(local_ini_file, ".ini", sizeof(local_ini_file));
+ strncat(local_ini_file, ".ini", sizeof(local_ini_file)
-1
);
local_ini_file[sizeof(local_ini_file) - 1] = '\0';
path[0] = '\0';
local_ini_file[sizeof(local_ini_file) - 1] = '\0';
path[0] = '\0';
@@
-912,7
+915,7
@@
void lc_opt_default_configs(const char *ini_name)
#if _MSC_VER > 1200
/* ARG: need newer SDK to compile this */
SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, path);
#if _MSC_VER > 1200
/* ARG: need newer SDK to compile this */
SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, path);
- strncat(path, "\\", sizeof(path));
+ strncat(path, "\\", sizeof(path)
-1
);
#endif
strncpy(home_dir_ini_file, local_ini_file, sizeof(home_dir_ini_file));
home_dir_ini_file[sizeof(home_dir_ini_file) - 1] = '\0';
#endif
strncpy(home_dir_ini_file, local_ini_file, sizeof(home_dir_ini_file));
home_dir_ini_file[sizeof(home_dir_ini_file) - 1] = '\0';
@@
-921,7
+924,7
@@
void lc_opt_default_configs(const char *ini_name)
struct passwd *entry = getpwuid(getuid());
if (entry != NULL) {
strcpy(path, entry->pw_dir);
struct passwd *entry = getpwuid(getuid());
if (entry != NULL) {
strcpy(path, entry->pw_dir);
- strncat(path, "/", sizeof(path));
+ strncat(path, "/", sizeof(path)
-1
);
/* .<cmnt>rc */
snprintf(home_dir_ini_file, sizeof(home_dir_ini_file), ".%src", ini_name);
home_dir_ini_file[sizeof(home_dir_ini_file) - 1] = '\0';
/* .<cmnt>rc */
snprintf(home_dir_ini_file, sizeof(home_dir_ini_file), ".%src", ini_name);
home_dir_ini_file[sizeof(home_dir_ini_file) - 1] = '\0';
@@
-932,7
+935,7
@@
void lc_opt_default_configs(const char *ini_name)
}
#endif
}
#endif
- strncat(path, home_dir_ini_file, sizeof(path));
+ strncat(path, home_dir_ini_file, sizeof(path)
-1
);
path[sizeof(path) - 1] = '\0';
/* Process ini file in user's home. */
path[sizeof(path) - 1] = '\0';
/* Process ini file in user's home. */