aboutsummaryrefslogtreecommitdiff
path: root/sim/or1k
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-01-12 04:11:29 -0500
committerMike Frysinger <vapier@gentoo.org>2021-01-12 04:15:28 -0500
commite998918e9890d5efc0270ad6f140e098eaf0081f (patch)
tree5c2bf70927ebef7930c014c09d242da62f8de95e /sim/or1k
parent5e9e2f41ebaa79d983133bb1374423815adb2f58 (diff)
downloadfsf-binutils-gdb-e998918e9890d5efc0270ad6f140e098eaf0081f.zip
fsf-binutils-gdb-e998918e9890d5efc0270ad6f140e098eaf0081f.tar.gz
fsf-binutils-gdb-e998918e9890d5efc0270ad6f140e098eaf0081f.tar.bz2
sim: or1k: fix mixing of code & decl warning
Use the correct style of declaring variables at top of scope. This fixes a few compiler warnings in the process.
Diffstat (limited to 'sim/or1k')
-rw-r--r--sim/or1k/ChangeLog5
-rw-r--r--sim/or1k/traps.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/sim/or1k/ChangeLog b/sim/or1k/ChangeLog
index e25c563..1079c66 100644
--- a/sim/or1k/ChangeLog
+++ b/sim/or1k/ChangeLog
@@ -1,5 +1,10 @@
2021-01-12 Mike Frysinger <vapier@gentoo.org>
+ * traps.c (or1k32bf_exception): Move handler_pc decl to top of scope.
+ (or1k32bf_mfspr): Move val decl to top of function body.
+
+2021-01-12 Mike Frysinger <vapier@gentoo.org>
+
* Makefile.in (SIM_OBJS): Delete redundant sim-cpu.o, sim-hload.o,
sim-hrw.o, sim-reg.o, sim-reason.o, sim-engine.o, sim-model.o,
sim-stop.o, and $(TRAPS_OBJ) entries.
diff --git a/sim/or1k/traps.c b/sim/or1k/traps.c
index 85d8729..0a0f1aa 100644
--- a/sim/or1k/traps.c
+++ b/sim/or1k/traps.c
@@ -128,6 +128,7 @@ or1k32bf_exception (sim_cpu *current_cpu, USI pc, USI exnum)
}
else
{
+ IADDR handler_pc;
/* Calculate the exception program counter. */
switch (exnum)
@@ -162,8 +163,8 @@ or1k32bf_exception (sim_cpu *current_cpu, USI pc, USI exnum)
current_cpu->next_delay_slot = 0;
/* Jump program counter into handler. */
- IADDR handler_pc =
- (GET_H_SYS_SR_EPH ()? 0xf0000000 : 0x00000000) + (exnum << 8);
+ handler_pc =
+ (GET_H_SYS_SR_EPH () ? 0xf0000000 : 0x00000000) + (exnum << 8);
sim_engine_restart (sd, current_cpu, NULL, handler_pc);
}
@@ -191,6 +192,7 @@ USI
or1k32bf_mfspr (sim_cpu *current_cpu, USI addr)
{
SIM_DESC sd = CPU_STATE (current_cpu);
+ SI val;
if (!GET_H_SYS_SR_SM () && !GET_H_SYS_SR_SUMRA ())
{
@@ -202,7 +204,7 @@ or1k32bf_mfspr (sim_cpu *current_cpu, USI addr)
if (addr >= NUM_SPR)
goto bad_address;
- SI val = GET_H_SPR (addr);
+ val = GET_H_SPR (addr);
switch (addr)
{