From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, qemu-arm@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>
Subject: [PATCH v2 04/22] target/mips: Clean up local variable shadowing
Date: Mon, 4 Sep 2023 18:12:16 +0200 [thread overview]
Message-ID: <20230904161235.84651-5-philmd@linaro.org> (raw)
In-Reply-To: <20230904161235.84651-1-philmd@linaro.org>
Fix:
target/mips/tcg/nanomips_translate.c.inc:4410:33: error: declaration shadows a local variable [-Werror,-Wshadow]
int32_t imm = extract32(ctx->opcode, 1, 13) |
^
target/mips/tcg/nanomips_translate.c.inc:3577:9: note: previous declaration is here
int imm;
^
target/mips/tcg/translate.c:15578:19: error: declaration shadows a local variable [-Werror,-Wshadow]
for (unsigned i = 1; i < 32; i++) {
^
target/mips/tcg/translate.c:15567:9: note: previous declaration is here
int i;
^
target/mips/tcg/msa_helper.c:7478:13: error: declaration shadows a local variable [-Werror,-Wshadow]
MSA_FLOAT_MAXOP(pwx->w[0], min, pws->w[0], pws->w[0], 32);
^
target/mips/tcg/msa_helper.c:7434:23: note: expanded from macro 'MSA_FLOAT_MAXOP'
float_status *status = &env->active_tc.msa_fp_status;
^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/mips/tcg/msa_helper.c | 8 ++++----
target/mips/tcg/translate.c | 8 +++-----
target/mips/tcg/nanomips_translate.c.inc | 6 +++---
3 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c
index 29b31d70fe..391a5fca26 100644
--- a/target/mips/tcg/msa_helper.c
+++ b/target/mips/tcg/msa_helper.c
@@ -7431,15 +7431,15 @@ void helper_msa_ftq_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
#define MSA_FLOAT_MAXOP(DEST, OP, ARG1, ARG2, BITS) \
do { \
- float_status *status = &env->active_tc.msa_fp_status; \
+ float_status *status_ = &env->active_tc.msa_fp_status; \
int c; \
\
- set_float_exception_flags(0, status); \
- DEST = float ## BITS ## _ ## OP(ARG1, ARG2, status); \
+ set_float_exception_flags(0, status_); \
+ DEST = float ## BITS ## _ ## OP(ARG1, ARG2, status_); \
c = update_msacsr(env, 0, 0); \
\
if (get_enabled_exceptions(env, c)) { \
- DEST = ((FLOAT_SNAN ## BITS(status) >> 6) << 6) | c; \
+ DEST = ((FLOAT_SNAN ## BITS(status_) >> 6) << 6) | c; \
} \
} while (0)
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
index 9bb40f1849..26d741d960 100644
--- a/target/mips/tcg/translate.c
+++ b/target/mips/tcg/translate.c
@@ -15564,10 +15564,8 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns,
void mips_tcg_init(void)
{
- int i;
-
cpu_gpr[0] = NULL;
- for (i = 1; i < 32; i++)
+ for (unsigned i = 1; i < 32; i++)
cpu_gpr[i] = tcg_global_mem_new(cpu_env,
offsetof(CPUMIPSState,
active_tc.gpr[i]),
@@ -15584,7 +15582,7 @@ void mips_tcg_init(void)
rname);
}
#endif /* !TARGET_MIPS64 */
- for (i = 0; i < 32; i++) {
+ for (unsigned i = 0; i < 32; i++) {
int off = offsetof(CPUMIPSState, active_fpu.fpr[i].wr.d[0]);
fpu_f64[i] = tcg_global_mem_new_i64(cpu_env, off, fregnames[i]);
@@ -15592,7 +15590,7 @@ void mips_tcg_init(void)
msa_translate_init();
cpu_PC = tcg_global_mem_new(cpu_env,
offsetof(CPUMIPSState, active_tc.PC), "PC");
- for (i = 0; i < MIPS_DSP_ACC; i++) {
+ for (unsigned i = 0; i < MIPS_DSP_ACC; i++) {
cpu_HI[i] = tcg_global_mem_new(cpu_env,
offsetof(CPUMIPSState, active_tc.HI[i]),
regnames_HI[i]);
diff --git a/target/mips/tcg/nanomips_translate.c.inc b/target/mips/tcg/nanomips_translate.c.inc
index a98dde0d2e..d81a7c2d11 100644
--- a/target/mips/tcg/nanomips_translate.c.inc
+++ b/target/mips/tcg/nanomips_translate.c.inc
@@ -4407,8 +4407,8 @@ static int decode_nanomips_32_48_opc(CPUMIPSState *env, DisasContext *ctx)
case NM_BPOSGE32C:
check_dsp_r3(ctx);
{
- int32_t imm = extract32(ctx->opcode, 1, 13) |
- extract32(ctx->opcode, 0, 1) << 13;
+ imm = extract32(ctx->opcode, 1, 13)
+ | extract32(ctx->opcode, 0, 1) << 13;
gen_compute_branch_nm(ctx, OPC_BPOSGE32, 4, -1, -2,
imm << 1);
@@ -4635,7 +4635,7 @@ static int decode_isa_nanomips(CPUMIPSState *env, DisasContext *ctx)
break;
case NM_LI16:
{
- int imm = extract32(ctx->opcode, 0, 7);
+ imm = extract32(ctx->opcode, 0, 7);
imm = (imm == 0x7f ? -1 : imm);
if (rt != 0) {
tcg_gen_movi_tl(cpu_gpr[rt], imm);
--
2.41.0
next prev parent reply other threads:[~2023-09-04 16:18 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-04 16:12 [PATCH v2 00/22] (few more) Steps towards enabling -Wshadow Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 01/22] tcg: Clean up local variable shadowing Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 02/22] target/arm/tcg: " Philippe Mathieu-Daudé
2023-09-08 12:25 ` Peter Maydell
2023-09-04 16:12 ` [PATCH v2 03/22] target/arm/hvf: " Philippe Mathieu-Daudé
2023-09-08 12:26 ` Peter Maydell
2023-09-04 16:12 ` Philippe Mathieu-Daudé [this message]
2023-09-04 16:12 ` [PATCH v2 05/22] target/m68k: " Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 06/22] target/tricore: " Philippe Mathieu-Daudé
2023-09-05 5:34 ` Bastian Koppelmann
2023-09-04 16:12 ` [PATCH v2 07/22] hw/arm/armv7m: " Philippe Mathieu-Daudé
2023-09-08 12:29 ` Peter Maydell
2023-09-04 16:12 ` [PATCH v2 08/22] hw/arm/virt: " Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 09/22] hw/arm/allwinner: " Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 10/22] hw/arm/aspeed: " Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 11/22] hw/ide/ahci: " Philippe Mathieu-Daudé
2023-09-29 5:07 ` Markus Armbruster
2023-09-04 16:12 ` [PATCH v2 12/22] hw/m68k: " Philippe Mathieu-Daudé
2023-09-26 16:28 ` Thomas Huth
2023-09-04 16:12 ` [PATCH v2 13/22] hw/microblaze: " Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 14/22] hw/nios2: " Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 15/22] net/eth: " Philippe Mathieu-Daudé
2023-09-08 13:18 ` Eric Blake
2023-09-10 4:20 ` Akihiko Odaki
2023-09-04 16:12 ` [PATCH v2 16/22] crypto/cipher-gnutls.c: " Philippe Mathieu-Daudé
2023-09-04 16:27 ` Daniel P. Berrangé
2023-09-04 16:29 ` Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 17/22] util/vhost-user-server: " Philippe Mathieu-Daudé
2023-09-22 10:23 ` Michael S. Tsirkin
2023-09-04 16:12 ` [PATCH v2 18/22] semihosting/arm-compat: " Philippe Mathieu-Daudé
2023-09-08 12:36 ` Peter Maydell
2023-10-04 9:41 ` Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 19/22] linux-user/strace: " Philippe Mathieu-Daudé
2023-09-04 16:12 ` [PATCH v2 20/22] sysemu/device_tree: " Philippe Mathieu-Daudé
2023-09-29 4:58 ` Markus Armbruster
2023-09-04 16:12 ` [PATCH v2 21/22] softmmu/memory: " Philippe Mathieu-Daudé
2023-09-05 15:46 ` Peter Xu
2023-09-04 16:12 ` [RFC PATCH v2 22/22] softmmu/physmem: " Philippe Mathieu-Daudé
2023-09-04 16:31 ` Daniel P. Berrangé
2023-09-05 15:50 ` Peter Xu
2023-09-29 5:13 ` [PATCH v2 00/22] (few more) Steps towards enabling -Wshadow Markus Armbruster
2023-09-29 6:42 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230904161235.84651-5-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=aleksandar.rikalo@syrmia.com \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=jiaxun.yang@flygoat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).