Commit dc846fc5 authored by Michael Beck's avatar Michael Beck
Browse files

Fixed more size_t related warnings.

[r28276]
parent e8838501
/*
* Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
* Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
......@@ -111,15 +111,15 @@ int (get_loop_n_sons)(const ir_loop *loop)
* Returns NULL if there isn`t a pos`th loop_node */
ir_loop *get_loop_son(ir_loop *loop, int pos)
{
int child_nr = 0, loop_nr = -1;
size_t child_nr = 0;
int loop_nr = -1;
assert(loop && loop->kind == k_ir_loop);
while (child_nr < ARR_LEN(loop->children)) {
for (child_nr = 0; child_nr < ARR_LEN(loop->children); ++child_nr) {
if (*(loop->children[child_nr].kind) == k_ir_loop)
loop_nr++;
if (loop_nr == pos)
return loop->children[child_nr].son;
child_nr++;
}
return NULL;
}
......@@ -136,12 +136,13 @@ int get_loop_n_nodes(const ir_loop *loop)
* Returns NULL if there isn't a pos'th ir_node */
ir_node *get_loop_node(const ir_loop *loop, int pos)
{
int child_nr, node_nr = -1;
size_t child_nr;
int node_nr = -1;
assert(loop && loop->kind == k_ir_loop);
assert(pos < get_loop_n_nodes(loop));
for (child_nr = 0; child_nr < ARR_LEN(loop->children); child_nr++) {
for (child_nr = 0; child_nr < ARR_LEN(loop->children); ++child_nr) {
if (*(loop->children[child_nr].kind) == k_ir_node)
node_nr++;
if (node_nr == pos)
......
/*
* Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
* Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
......@@ -430,13 +430,14 @@ static ir_region *new_SwitchCase(struct obstack *obst, ir_region_kind type, ir_r
reg->succ = NEW_ARR_D(ir_region *, obst, 1);
reg->succ[0] = exit;
DEBUG_ONLY(
DEBUG_ONLY({
size_t i;
DB((dbg, LEVEL_2, " Created %s(%u)\n", reg->type == ir_rk_Switch ? "Switch" : "Case", reg->nr));
for (i = 1; i < ARR_LEN(reg->parts); ++i) {
DB((dbg, LEVEL_2, " Case(%u)\n", reg->parts[i].region->nr));
}
DB((dbg, LEVEL_2, " Exit(%u)\n", exit->nr));
)
})
return reg;
} /* new_SwitchCase */
......
/*
* Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
* Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
......@@ -2199,7 +2199,7 @@ void ia32_gen_routine(ir_graph *irg)
Those are ascending with ascending addresses. */
qsort(exc_list, ARR_LEN(exc_list), sizeof(exc_list[0]), cmp_exc_entry);
{
int i;
size_t i;
for (i = 0; i < ARR_LEN(exc_list); ++i) {
be_emit_cstring("\t.long ");
......
......@@ -172,7 +172,7 @@ static inline int _get_irn_deps(const ir_node *node) {
static inline ir_node *_get_irn_dep(const ir_node *node, int pos) {
assert(node->deps && "dependency array node yet allocated. use add_irn_dep()");
assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range");
assert(pos >= 0 && pos < (int)ARR_LEN(node->deps) && "dependency index out of range");
return node->deps[pos];
}
......@@ -184,7 +184,7 @@ static inline void _set_irn_dep(ir_node *node, int pos, ir_node *dep)
ir_node *old;
assert(node->deps && "dependency array node yet allocated. use add_irn_dep()");
assert(pos >= 0 && pos < ARR_LEN(node->deps) && "dependency index out of range");
assert(pos >= 0 && pos < (int)ARR_LEN(node->deps) && "dependency index out of range");
old = node->deps[pos];
node->deps[pos] = dep;
edges_notify_edge_kind(node, pos, dep, old, EDGE_KIND_DEP, get_irn_irg(node));
......
......@@ -66,7 +66,7 @@ static inline int _get_irp_n_irgs(void)
static inline ir_graph *_get_irp_irg(int pos)
{
assert(0 <= pos && pos <= ARR_LEN(irp->graphs));
assert(0 <= pos && pos <= (int)ARR_LEN(irp->graphs));
return irp->graphs[pos];
}
......
......@@ -32,7 +32,7 @@ int lc_appendable_snwadd(lc_appendable_t *app, const char *str, size_t len,
unsigned int width, int left_just, char pad)
{
int res = 0;
int i;
size_t i;
size_t to_pad = width > len ? width - len : 0;
/* If not left justified, pad left */
......
/*
* Copyright (C) 1995-2010 University of Karlsruhe. All right reserved.
* Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
......@@ -2216,7 +2216,7 @@ static void lower_irg(lower_env_t *env, ir_graph *irg)
prepare_links_and_handle_rotl, env);
if (env->flags & MUST_BE_LOWERED) {
int i;
size_t i;
ir_reserve_resources(irg, IR_RESOURCE_IRN_VISITED);
inc_irg_visited(irg);
......
......@@ -86,8 +86,8 @@ void gc_irgs(size_t n_keep, ir_entity ** keep_arr)
DB((dbg, LEVEL_1, " method %+F kept alive.\n", marked[idx]));
}
for (i = 0; i < ARR_LEN(marked); ++i) {
ir_graph *irg = get_entity_irg(marked[i]);
for (idx = 0; idx < ARR_LEN(marked); ++idx) {
ir_graph *irg = get_entity_irg(marked[idx]);
ir_node *node;
if (irg == NULL)
......
......@@ -1179,7 +1179,7 @@ static void fix_head_inversion(void)
/* Does the loop inversion. */
static void inversion_walk(entry_edge *head_entries)
{
int i;
size_t i;
/*
* The order of rewiring bottom-up is crucial.
......@@ -1462,7 +1462,8 @@ static void correct_phis(ir_node *node, void *env)
static void place_copies(int copies)
{
ir_node *loophead = loop_head;
int c, i;
size_t i;
int c;
int be_src_pos = loop_info.be_src_pos;
/* Serialize loops by fixing their head ins.
......@@ -1578,11 +1579,12 @@ static void place_copies(int copies)
/* Copies the cur_loop several times. */
static void copy_loop(entry_edge *cur_loop_outs, int copies)
{
int i, c;
int c;
ir_reserve_resources(current_ir_graph, IR_RESOURCE_IRN_VISITED);
for (c = 0; c < copies; ++c) {
size_t i;
inc_irg_visited(current_ir_graph);
......
......@@ -490,7 +490,7 @@ static void exchange_calls(quadruple_t *q, ir_entity *cloned_ent)
{
int pos = q->pos;
ir_node *new_call, *call;
int i;
size_t i;
/* We iterate the list of the "call".*/
for (i = 0; i < ARR_LEN(q->calls); ++i) {
......
......@@ -826,11 +826,11 @@ ir_entity *get_class_member_by_name(ir_type *clss, ident *name)
static void remove_class_member(ir_type *clss, ir_entity *member)
{
int i;
size_t i;
assert(clss && (clss->type_op == type_class));
for (i = 0; i < (ARR_LEN (clss->attr.ca.members)); i++) {
for (i = 0; i < ARR_LEN(clss->attr.ca.members); ++i) {
if (clss->attr.ca.members[i] == member) {
for (; i < (ARR_LEN (clss->attr.ca.members)) - 1; i++)
for (; i < ARR_LEN(clss->attr.ca.members) - 1; ++i)
clss->attr.ca.members[i] = clss->attr.ca.members[i + 1];
ARR_SETLEN(ir_entity*, clss->attr.ca.members, ARR_LEN(clss->attr.ca.members) - 1);
break;
......@@ -882,11 +882,11 @@ void set_class_subtype(ir_type *clss, ir_type *subtype, int pos)
void remove_class_subtype(ir_type *clss, ir_type *subtype)
{
int i;
size_t i;
assert(clss && (clss->type_op == type_class));
for (i = 0; i < (ARR_LEN (clss->attr.ca.subtypes)); i++)
for (i = 0; i < ARR_LEN(clss->attr.ca.subtypes); ++i)
if (clss->attr.ca.subtypes[i] == subtype) {
for (; i < (ARR_LEN (clss->attr.ca.subtypes))-1; i++)
for (; i < ARR_LEN(clss->attr.ca.subtypes) - 1; ++i)
clss->attr.ca.subtypes[i] = clss->attr.ca.subtypes[i+1];
ARR_SETLEN(ir_type*, clss->attr.ca.subtypes, ARR_LEN(clss->attr.ca.subtypes) - 1);
break;
......@@ -938,11 +938,11 @@ void set_class_supertype(ir_type *clss, ir_type *supertype, int pos)
void remove_class_supertype(ir_type *clss, ir_type *supertype)
{
int i;
size_t i;
assert(clss && (clss->type_op == type_class));
for (i = 0; i < (ARR_LEN(clss->attr.ca.supertypes)); i++)
for (i = 0; i < ARR_LEN(clss->attr.ca.supertypes); ++i)
if (clss->attr.ca.supertypes[i] == supertype) {
for (; i < (ARR_LEN(clss->attr.ca.supertypes))-1; i++)
for (; i < ARR_LEN(clss->attr.ca.supertypes) - 1; ++i)
clss->attr.ca.supertypes[i] = clss->attr.ca.supertypes[i+1];
ARR_SETLEN(ir_type*, clss->attr.ca.supertypes, ARR_LEN(clss->attr.ca.supertypes) - 1);
break;
......@@ -1118,11 +1118,11 @@ int get_struct_member_index(const ir_type *strct, ir_entity *mem)
static void remove_struct_member(ir_type *strct, ir_entity *member)
{
int i;
size_t i;
assert(strct && (strct->type_op == type_struct));
for (i = 0; i < (ARR_LEN (strct->attr.sa.members)); i++)
for (i = 0; i < ARR_LEN(strct->attr.sa.members); ++i)
if (strct->attr.sa.members[i] == member) {
for (; i < (ARR_LEN (strct->attr.sa.members))-1; i++)
for (; i < ARR_LEN(strct->attr.sa.members) - 1; ++i)
strct->attr.sa.members[i] = strct->attr.sa.members[i+1];
ARR_SETLEN(ir_entity*, strct->attr.sa.members, ARR_LEN(strct->attr.sa.members) - 1);
break;
......@@ -1574,11 +1574,11 @@ int get_union_member_index(const ir_type *uni, ir_entity *mem)
static void remove_union_member(ir_type *uni, ir_entity *member)
{
int i;
size_t i;
assert(uni && (uni->type_op == type_union));
for (i = 0; i < (ARR_LEN(uni->attr.ua.members)); i++) {
for (i = 0; i < ARR_LEN(uni->attr.ua.members); ++i) {
if (uni->attr.ua.members[i] == member) {
for (; i < (ARR_LEN(uni->attr.ua.members))-1; i++)
for (; i < ARR_LEN(uni->attr.ua.members) - 1; i++)
uni->attr.ua.members[i] = uni->attr.ua.members[i+1];
ARR_SETLEN(ir_entity*, uni->attr.ua.members, ARR_LEN(uni->attr.ua.members) - 1);
break;
......
Supports Markdown
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