From bda7c7c515496a78ceb57d2ee07746f33e3c0c79 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Tue, 1 May 2007 11:30:58 -0700 Subject: [PATCH] Fix most -Wshadow warnings in Sparse. Signed-off-by: Josh Triplett --- compile-i386.c | 2 -- ctags.c | 9 +++++---- evaluate.c | 8 ++++---- example.c | 2 +- parse.c | 1 - 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/compile-i386.c b/compile-i386.c index a6c4431b..425a1bc7 100644 --- a/compile-i386.c +++ b/compile-i386.c @@ -1006,8 +1006,6 @@ static void sort_array(struct expression *expr) list[0] = entry; sorted = 1; } else { - unsigned int i; - for (i = 0; i < sorted; i++) if (sort_array_cmp(entry, list[i]) <= 0) break; diff --git a/ctags.c b/ctags.c index 17dd1c11..bdddcf77 100644 --- a/ctags.c +++ b/ctags.c @@ -28,12 +28,13 @@ static int cmp_sym(const void *m, const void *n) struct ident *b = ((struct symbol *)n)->ident; int ret = strncmp(a->name, b->name, MAX(a->len, b->len)); if (!ret) { - struct position a = ((struct symbol *)m)->pos; - struct position b = ((struct symbol *)n)->pos; + struct position a_pos = ((struct symbol *)m)->pos; + struct position b_pos = ((struct symbol *)n)->pos; - ret = strcmp(stream_name(a.stream), stream_name(b.stream)); + ret = strcmp(stream_name(a_pos.stream), + stream_name(b_pos.stream)); if (!ret) - return a.line < b.line; + return a_pos.line < b_pos.line; } return ret; } diff --git a/evaluate.c b/evaluate.c index 58f208f3..59b3d32e 100644 --- a/evaluate.c +++ b/evaluate.c @@ -785,11 +785,11 @@ const char * type_difference(struct symbol *target, struct symbol *source, PREPARE_PTR_LIST(source->arguments, arg2); i = 1; for (;;) { - const char *diff; - diff = type_difference(arg1, arg2, 0, 0); - if (diff) { + const char *diffstr; + diffstr = type_difference(arg1, arg2, 0, 0); + if (diffstr) { static char argdiff[80]; - sprintf(argdiff, "incompatible argument %d (%s)", i, diff); + sprintf(argdiff, "incompatible argument %d (%s)", i, diffstr); return argdiff; } if (!arg1) diff --git a/example.c b/example.c index 9d68d127..ae897dca 100644 --- a/example.c +++ b/example.c @@ -679,7 +679,7 @@ static struct hardreg *copy_reg(struct bb_state *state, struct hardreg *src, pse } for (i = 0; i < REGNO; i++) { - struct hardreg *reg = hardregs + i; + reg = hardregs + i; if (!reg->contains) { output_comment(state, "copying %s to %s", show_pseudo(target), reg->name); output_insn(state, "movl %s,%s", src->name, reg->name); diff --git a/parse.c b/parse.c index 6f391772..78dd78c9 100644 --- a/parse.c +++ b/parse.c @@ -1954,7 +1954,6 @@ static struct token *parse_function_body(struct token *token, struct symbol *dec if (!function_computed_target_list) warning(decl->pos, "function '%s' has computed goto but no targets?", show_ident(decl->ident)); else { - struct statement *stmt; FOR_EACH_PTR(function_computed_goto_list, stmt) { stmt->target_list = function_computed_target_list; } END_FOR_EACH_PTR(stmt); -- 2.11.4.GIT