Commit 54529d18 authored by Matthias Braun's avatar Matthias Braun
Browse files

- newer gcc warned me about errors in our strncat usage - this function is very

  unintuitive as it writes up to n+1 bytes, so you have to do:
  	strncat(buf, X, sizeof(buf)-1);
- fixed a bunch of other warnings in release mode

[r25996]
parent 8995741d
......@@ -533,8 +533,8 @@ void ir_reserve_resources(ir_graph *irg, ir_resources_t resources);
void ir_free_resources(ir_graph *irg, ir_resources_t resources);
ir_resources_t ir_resources_reserved(const ir_graph *irg);
#else
#define ir_reserve_resources(irg,resources)
#define ir_free_resources(irg,resources)
#define ir_reserve_resources(irg,resources) (void)0
#define ir_free_resources(irg,resources) (void)0
#define ir_resources_reserved(irg) 0
#endif
......
......@@ -260,6 +260,7 @@ static int rta_fill_incremental(void)
return n_runs;
}
#ifdef DEBUG_libfirm
/**
* Count the number of graphs that we have found to be live.
*/
......@@ -277,6 +278,7 @@ static int stats(void)
return n_live_graphs;
}
#endif
/* remove a graph, part I */
/*
......
......@@ -311,6 +311,7 @@ static arm_fpaConst_attr_t *get_arm_fpaConst_attr(ir_node *node) {
return fpa_attr;
}
#ifndef NDEBUG
static int is_arm_CondJmp(const ir_node *node) {
int code = get_arm_irn_opcode(node);
......@@ -318,6 +319,7 @@ static int is_arm_CondJmp(const ir_node *node) {
code == iro_arm_fpaCnfBra || iro_arm_fpaCmfeBra ||
code == iro_arm_fpaCnfeBra);
}
#endif
/* Returns the attributes of a CondJmp node. */
arm_CondJmp_attr_t *get_arm_CondJmp_attr(ir_node *node) {
......
......@@ -102,11 +102,13 @@ static spill_env_t *senv;
static size_t n_regs;
static size_t max_register_pressure;
static bool tentative_mode;
static bool should_have_reached_fixpoint;
static bool do_push_unused_livethroughs;
/** Execution frequency for the current graph. */
static ir_exec_freq *exec_freq;
static ir_visited_t worklist_visited;
#ifdef DEBUG_LIBFIRM
static bool should_have_reached_fixpoint;
#endif
static worklist_t *new_worklist(void)
{
......@@ -556,7 +558,7 @@ static bool fill_start_worklist(worklist_t *new_worklist, ir_node *block)
double best_execfreq = -1;
worklist_t *best_worklist = NULL;
ir_node *best_succ_block = NULL;
int best_pos;
int best_pos = -1;
const ir_edge_t *edge;
/* construct worklist */
......
......@@ -154,17 +154,17 @@ void firm_dbg_set_file(firm_dbg_module_t *module, FILE *file);
/* DEBUG OUTPUT IS COMPLETELY DISABLED */
#define DBG(x)
#define DB(x)
#define DBG(x) (void)0
#define DB(x) (void)0
/** create a debug handle in release mode */
#define FIRM_DBG_REGISTER(handle, name)
#define FIRM_DBG_REGISTER(handle, name) (void)0
#define DEBUG_ONLY(code)
#define RELEASE_ONLY(code) code
#define firm_dbg_set_mask(module, mask)
#define firm_dbg_get_mask(module)
#define firm_dbg_set_file(module, file)
#define firm_dbg_set_mask(module, mask) (void)0
#define firm_dbg_get_mask(module) (void)0
#define firm_dbg_set_file(module, file) (void)0
#endif /* DEBUG_libfirm */
......
......@@ -203,12 +203,12 @@ static int firm_emit(lc_appendable_t *app,
for (i = 0; i < n; ++i) {
ent = get_compound_graph_path_node(X, i);
strncat(buf, ".", sizeof(buf));
strncat(buf, get_entity_name(ent), sizeof(buf));
strncat(buf, ".", sizeof(buf)-1);
strncat(buf, get_entity_name(ent), sizeof(buf)-1);
if (is_Array_type(get_entity_owner(ent))) {
snprintf(add, sizeof(add), "[%d]",
get_compound_graph_path_array_index(X, i));
strncat(buf, add, sizeof(buf));
strncat(buf, add, sizeof(buf)-1);
}
}
add[0] = '\0';
......@@ -225,7 +225,7 @@ static int firm_emit(lc_appendable_t *app,
}
if (occ->flag_plus)
strncat(buf, add, sizeof(buf));
strncat(buf, add, sizeof(buf)-1);
return lc_arg_append(app, occ, buf, strlen(buf));
......
......@@ -2030,7 +2030,9 @@ static void dump_enum_item(FILE *F, ir_type *tp, int pos)
* Dumps a new style initializer.
*/
static void dump_entity_initializer(FILE *F, const ir_entity *ent) {
/* TODO */
(void) F;
(void) ent;
}
/** Dumps a type or entity and it's edges. */
......
......@@ -217,9 +217,9 @@ void dump_irg_grgen(ir_graph *irg, char *suffix)
{
char filename[100] = "";
strncat(filename, get_entity_name(get_irg_entity(irg)), 100);
strncat(filename, suffix, 100);
strncat(filename, ".grg", 100);
strncat(filename, get_entity_name(get_irg_entity(irg)), sizeof(filename)-1);
strncat(filename, suffix, sizeof(filename)-1);
strncat(filename, ".grg", sizeof(filename)-1);
dump_irg_grgen_file(irg, filename, 0);
}
......
......@@ -119,7 +119,6 @@ static void irg_walk_cg(ir_node * node, ir_visited_t visited,
current_ir_graph = rem;
}
#endif
/**
* Insert all ir_graphs in irg_set, that are (transitive) reachable.
......@@ -137,6 +136,7 @@ static void collect_irgs(ir_node * node, pset_new_t *irg_set) {
}
}
}
#endif
/**
* specialized version of irg_walk_2, called if only pre callback exists
......
......@@ -322,7 +322,7 @@ void add_irp_opcode(ir_op *opcode) {
assert(irp);
len = ARR_LEN(irp->opcodes);
code = opcode->code;
if (code >= len) {
if ((int) code >= len) {
ARR_RESIZE(ir_op*, irp->opcodes, code+1);
memset(&irp->opcodes[len], 0, (code-len+1) * sizeof(irp->opcodes[0]));
}
......
......@@ -352,6 +352,8 @@ static void check_all_partitions(environment_t *env) {
assert(leader != node && leader->part == node->part);
}
}
#else
(void) env;
#endif
}
......@@ -359,13 +361,19 @@ static void check_all_partitions(environment_t *env) {
* Check list.
*/
static void do_check_list(const node_t *list, int ofs, const partition_t *Z) {
const node_t *e;
#ifndef NDEBUG
const node_t *e;
#define NEXT(e) *((const node_t **)((char *)(e) + (ofs)))
for (e = list; e != NULL; e = NEXT(e)) {
assert(e->part == Z);
}
#undef NEXT
#else
(void) list;
(void) ofs;
(void) Z;
#endif
} /* ido_check_list */
/**
......
......@@ -2131,10 +2131,10 @@ void stat_dump_snapshot(const char *name, const char *phase)
fname[0] = '\0';
p = name;
} /* if */
strncat(fname, "firmstat-", sizeof(fname));
strncat(fname, phase, sizeof(fname));
strncat(fname, "-", sizeof(fname));
strncat(fname, p, sizeof(fname));
strncat(fname, "firmstat-", sizeof(fname)-1);
strncat(fname, phase, sizeof(fname)-1);
strncat(fname, "-", sizeof(fname)-1);
strncat(fname, p, sizeof(fname)-1);
stat_dump_init(fname);
......
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