public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 01/15] sim: aarch64: fix -Wshadow=local warnings
@ 2023-12-22  1:23 Mike Frysinger
  2023-12-22  1:23 ` [PATCH 02/15] sim: arm: " Mike Frysinger
                   ` (15 more replies)
  0 siblings, 16 replies; 18+ messages in thread
From: Mike Frysinger @ 2023-12-22  1:23 UTC (permalink / raw)
  To: gdb-patches

These functions have local vars named "val" of type float, and
then create nested vars named "val" of type double.  This is a
bit confusing and causes build time warnings.
---
 sim/aarch64/simulator.c | 42 ++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/sim/aarch64/simulator.c b/sim/aarch64/simulator.c
index 8825819a3910..e7537b739aa0 100644
--- a/sim/aarch64/simulator.c
+++ b/sim/aarch64/simulator.c
@@ -7942,44 +7942,44 @@ do_FRINT (sim_cpu *cpu)
   TRACE_DECODE (cpu, "emulated at line %d", __LINE__);
   if (INSTR (22, 22))
     {
-      double val = aarch64_get_FP_double (cpu, rs);
+      double dval = aarch64_get_FP_double (cpu, rs);
 
       switch (rmode)
 	{
 	case 0: /* mode N: nearest or even.  */
 	  {
-	    double rval = round (val);
+	    double rval = round (dval);
 
-	    if (val - rval == 0.5)
+	    if (dval - rval == 0.5)
 	      {
 		if (((rval / 2.0) * 2.0) != rval)
 		  rval += 1.0;
 	      }
 
-	    aarch64_set_FP_double (cpu, rd, round (val));
+	    aarch64_set_FP_double (cpu, rd, round (dval));
 	    return;
 	  }
 
 	case 1: /* mode P: towards +inf.  */
-	  if (val < 0.0)
-	    aarch64_set_FP_double (cpu, rd, trunc (val));
+	  if (dval < 0.0)
+	    aarch64_set_FP_double (cpu, rd, trunc (dval));
 	  else
-	    aarch64_set_FP_double (cpu, rd, round (val));
+	    aarch64_set_FP_double (cpu, rd, round (dval));
 	  return;
 
 	case 2: /* mode M: towards -inf.  */
-	  if (val < 0.0)
-	    aarch64_set_FP_double (cpu, rd, round (val));
+	  if (dval < 0.0)
+	    aarch64_set_FP_double (cpu, rd, round (dval));
 	  else
-	    aarch64_set_FP_double (cpu, rd, trunc (val));
+	    aarch64_set_FP_double (cpu, rd, trunc (dval));
 	  return;
 
 	case 3: /* mode Z: towards 0.  */
-	  aarch64_set_FP_double (cpu, rd, trunc (val));
+	  aarch64_set_FP_double (cpu, rd, trunc (dval));
 	  return;
 
 	case 4: /* mode A: away from 0.  */
-	  aarch64_set_FP_double (cpu, rd, round (val));
+	  aarch64_set_FP_double (cpu, rd, round (dval));
 	  return;
 
 	case 6: /* mode X: use FPCR with exactness check.  */
@@ -9186,29 +9186,29 @@ do_scalar_FCM (sim_cpu *cpu)
   TRACE_DECODE (cpu, "emulated at line %d", __LINE__);
   if (INSTR (22, 22))
     {
-      double val1 = aarch64_get_FP_double (cpu, rn);
-      double val2 = aarch64_get_FP_double (cpu, rm);
+      double dval1 = aarch64_get_FP_double (cpu, rn);
+      double dval2 = aarch64_get_FP_double (cpu, rm);
 
       switch (EUac)
 	{
 	case 0: /* 000 */
-	  result = val1 == val2;
+	  result = dval1 == dval2;
 	  break;
 
 	case 3: /* 011 */
-	  val1 = fabs (val1);
-	  val2 = fabs (val2);
+	  dval1 = fabs (dval1);
+	  dval2 = fabs (dval2);
 	  ATTRIBUTE_FALLTHROUGH;
 	case 2: /* 010 */
-	  result = val1 >= val2;
+	  result = dval1 >= dval2;
 	  break;
 
 	case 7: /* 111 */
-	  val1 = fabs (val1);
-	  val2 = fabs (val2);
+	  dval1 = fabs (dval1);
+	  dval2 = fabs (dval2);
 	  ATTRIBUTE_FALLTHROUGH;
 	case 6: /* 110 */
-	  result = val1 > val2;
+	  result = dval1 > dval2;
 	  break;
 
 	default:
-- 
2.43.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-12-23  4:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-22  1:23 [PATCH 01/15] sim: aarch64: fix -Wshadow=local warnings Mike Frysinger
2023-12-22  1:23 ` [PATCH 02/15] sim: arm: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 03/15] sim: bfin: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 04/15] sim: common: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 05/15] sim: cris: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 06/15] sim: erc32: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 07/15] sim: frv: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 08/15] sim: h8300: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 09/15] sim: iq2000: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 10/15] sim: m68hc11: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 11/15] sim: mips: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 12/15] sim: ppc: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 13/15] sim: riscv: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 14/15] sim: sh: " Mike Frysinger
2023-12-22  1:23 ` [PATCH 15/15] sim: warnings: enable -Wshadow=local Mike Frysinger
2023-12-22 15:26   ` Tom Tromey
2023-12-23  4:28 ` [PATCH] sim: m32c: fix -Wshadow=local warnings Mike Frysinger
2023-12-23  4:28 ` [PATCH] sim: cris: disable -Wshadow=local in generated mloop files Mike Frysinger

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 read-only IMAP folder(s) and NNTP newsgroup(s).