Skip to contentSkip to conversation

linux-user: Fix trivial build error on loongarch64 hosts

PATCH In review Philippe Mathieu-Daudé 2 participants 3 messages Jan 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 linux-user: Fix trivial build error on loongarch64 hosts

When building using GCC 8.3.0 on loongarch64 (Loongnix) we get:

In file included from ../linux-user/signal.c:33:
../linux-user/host/loongarch64/host-signal.h: In function ‘host_signal_write’:
../linux-user/host/loongarch64/host-signal.h:57:9: error: a label can only be part of a statement and a declaration is not a statement

         uint32_t sel = (insn >> 15) & 0b11111111111;
         ^~~~~~~~

We don't use the 'sel' variable more than once, so drop it.

Meson output for the record:

Host machine cpu family: loongarch64
Host machine cpu: loongarch64
C compiler for the host machine: cc (gcc 8.3.0 "cc (Loongnix 8.3.0-6.lnd.vec.27) 8.3.0") C linker for the host machine: cc ld.bfd 2.31.1-system

Fixes ad812c3bd65 ("linux-user: Implement CPU-specific signal handler for loongarch64 hosts")
---
 linux-user/host/loongarch64/host-signal.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
linux-user/host/loongarch64/host-signal.h +1 -3
index 05e2c823717..7effa242515 100644
@@ -54,9 +54,7 @@ static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
         }
         break;
     case 0b001110: /* indexed, atomic, bounds-checking memory operations */
-        uint32_t sel = (insn >> 15) & 0b11111111111;
-
-        switch (sel) {
+        switch ((insn >> 15) & 0b11111111111) {
         case 0b00000100000: /* stx.b */
         case 0b00000101000: /* stx.h */
         case 0b00000110000: /* stx.w */
Signature · 1 line
2.33.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 17 lines · Philippe Mathieu-Daudé

When building using GCC 8.3.0 on loongarch64 (Loongnix) we get:

In file included from ../linux-user/signal.c:33:
../linux-user/host/loongarch64/host-signal.h: In function ‘host_signal_write’:

   ../linux-user/host/loongarch64/host-signal.h:57:9: error: a label can only be part of a statement and a declaration is not a statement
          uint32_t sel = (insn >> 15) & 0b11111111111;
          ^~~~~~~~

We don't use the 'sel' variable more than once, so drop it.

Meson output for the record:

Host machine cpu family: loongarch64
Host machine cpu: loongarch64
C compiler for the host machine: cc (gcc 8.3.0 "cc (Loongnix 8.3.0-6.lnd.vec.27) 8.3.0") C linker for the host machine: cc ld.bfd 2.31.1-system

Quoted 8 lines
Fixes ad812c3bd65 ("linux-user: Implement CPU-specific signal handler for loongarch64 hosts")
---
  linux-user/host/loongarch64/host-signal.h | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

r~

#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 17 lines · Philippe Mathieu-Daudé

When building using GCC 8.3.0 on loongarch64 (Loongnix) we get:

In file included from ../linux-user/signal.c:33:
../linux-user/host/loongarch64/host-signal.h: In function ‘host_signal_write’:

   ../linux-user/host/loongarch64/host-signal.h:57:9: error: a label can only be part of a statement and a declaration is not a statement
          uint32_t sel = (insn >> 15) & 0b11111111111;
          ^~~~~~~~

We don't use the 'sel' variable more than once, so drop it.

Meson output for the record:

Host machine cpu family: loongarch64
Host machine cpu: loongarch64
C compiler for the host machine: cc (gcc 8.3.0 "cc (Loongnix 8.3.0-6.lnd.vec.27) 8.3.0") C linker for the host machine: cc ld.bfd 2.31.1-system

Quoted 5 lines
Fixes ad812c3bd65 ("linux-user: Implement CPU-specific signal handler for loongarch64 hosts")

As a build fix, I'll pop this into tcg-next.

r~