From 376e7c78961ff5605f8b1241191c7ec9c22e352b Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 22 Dec 2010 00:54:22 +0000 Subject: [PATCH] Fixed some 64bit warnings by using size_t and fixing compare functions. [r28196] --- ir/be/beabi.c | 4 ++-- ir/debug/debugger.c | 6 +++--- ir/libcore/lc_printf.c | 2 +- ir/lower/lower_dw.c | 4 ++-- ir/stat/distrib.c | 6 ++++-- ir/stat/firmstat.c | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ir/be/beabi.c b/ir/be/beabi.c index ffa46c192..5046377ee 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2010 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -1193,7 +1193,7 @@ static int cmp_regs(const void *a, const void *b) if (p->reg->reg_class == q->reg->reg_class) return p->reg->index - q->reg->index; else - return p->reg->reg_class - q->reg->reg_class; + return p->reg->reg_class < q->reg->reg_class ? -1 : +1; } static void reg_map_to_arr(reg_node_map_t *res, pmap *reg_map) diff --git a/ir/debug/debugger.c b/ir/debug/debugger.c index cd808b6b5..e8d3e7a75 100644 --- a/ir/debug/debugger.c +++ b/ir/debug/debugger.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2010 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -933,7 +933,7 @@ static struct lexer { unsigned cur_token; /**< current token. */ unsigned number; /**< current token attribute. */ const char *s; /**< current token attribute. */ - unsigned len; /**< current token attribute. */ + size_t len; /**< current token attribute. */ const char *curr_pos; const char *end_pos; @@ -1052,7 +1052,7 @@ static unsigned get_token(void) void firm_debug(const char *cmd) { char name[1024], fname[1024]; - int len; + size_t len; init_lexer(cmd); diff --git a/ir/libcore/lc_printf.c b/ir/libcore/lc_printf.c index c8a552c16..e740c0347 100644 --- a/ir/libcore/lc_printf.c +++ b/ir/libcore/lc_printf.c @@ -387,7 +387,7 @@ int lc_evpprintf(const lc_arg_env_t *env, lc_appendable_t *app, const char *fmt, for (ch = *s; ch != '}' && ch != '\0'; ch = *++s); if (s - named) { - int n = s - named; + size_t n = s - named; char *name; lc_arg_t tmp; diff --git a/ir/lower/lower_dw.c b/ir/lower/lower_dw.c index b02960787..0aa2a83b5 100644 --- a/ir/lower/lower_dw.c +++ b/ir/lower/lower_dw.c @@ -1992,7 +1992,7 @@ static int cmp_op_mode(const void *elt, const void *key, size_t size) const op_mode_entry_t *e2 = (const op_mode_entry_t*)key; (void) size; - return (e1->op - e2->op) | (e1->imode - e2->imode) | (e1->omode - e2->omode); + return (e1->op != e2->op) | (e1->imode != e2->imode) | (e1->omode != e2->omode); } /** @@ -2004,7 +2004,7 @@ static int cmp_conv_tp(const void *elt, const void *key, size_t size) const conv_tp_entry_t *e2 = (const conv_tp_entry_t*)key; (void) size; - return (e1->imode - e2->imode) | (e1->omode - e2->omode); + return (e1->imode != e2->imode) | (e1->omode != e2->omode); } /** diff --git a/ir/stat/distrib.c b/ir/stat/distrib.c index cc6df373b..e145b3e6a 100644 --- a/ir/stat/distrib.c +++ b/ir/stat/distrib.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2010 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -54,7 +54,9 @@ static int int_cmp_fun(const void *elt, const void *key) const distrib_entry_t *p1 = (const distrib_entry_t*)elt; const distrib_entry_t *p2 = (const distrib_entry_t*)key; - return (char *)p1->object - (char *)p2->object; + if (p1->object == p2->object) + return 0; + return p1->object < p2->object ? -1 : 1; } /* diff --git a/ir/stat/firmstat.c b/ir/stat/firmstat.c index bf7c7e920..5e663a919 100644 --- a/ir/stat/firmstat.c +++ b/ir/stat/firmstat.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2010 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -2134,7 +2134,7 @@ void stat_dump_snapshot(const char *name, const char *phase) { char fname[2048]; const char *p; - int l; + size_t l; if (! status->stat_options) return; -- 2.20.1