Skip to contentSkip to conversation

accel/tcg: Suppress compiler warning with flag -Wclobbered

PATCH In review Stefan Weil via 2 participants 2 messages Nov 5, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 accel/tcg: Suppress compiler warning with flag -Wclobbered

At least some versions of gcc show a warning when compiler flag -Wclobbered is used (tested with gcc on Debian bookworm i386 and with cross gcc for Windows on Debian bullseye).

---
 accel/tcg/translate-all.c | 3 +++
 1 file changed, 3 insertions(+)
accel/tcg/translate-all.c +3 -0
index 921944a5ab..90191d97ec 100644
@@ -743,6 +743,8 @@ void page_collection_unlock(struct page_collection *set)
 #endif /* !CONFIG_USER_ONLY */
 
 /* Called with mmap_lock held for user mode emulation.  */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclobbered"
 TranslationBlock *tb_gen_code(CPUState *cpu,
                               target_ulong pc, target_ulong cs_base,
                               uint32_t flags, int cflags)
@@ -1020,6 +1022,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
     }
     return tb;
 }
+#pragma GCC diagnostic pop
 
 /* user-mode: call with mmap_lock held */
 void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr)
Signature · 1 line
2.30.2
#1 lore raw
Quoted 23 lines · Stefan Weil

At least some versions of gcc show a warning when compiler flag -Wclobbered is used (tested with gcc on Debian bookworm i386 and with cross gcc for Windows on Debian bullseye).

---
  accel/tcg/translate-all.c | 3 +++
  1 file changed, 3 insertions(+)
accel/tcg/translate-all.c +2 -0
index 921944a5ab..90191d97ec 100644
@@ -743,6 +743,8 @@ void page_collection_unlock(struct page_collection *set)
  #endif /* !CONFIG_USER_ONLY */
 
  /* Called with mmap_lock held for user mode emulation.  */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclobbered"
  TranslationBlock *tb_gen_code(CPUState *cpu,
                                target_ulong pc, target_ulong cs_base,
                                uint32_t flags, int cflags)

accel/tcg/translate-all.c TranslationBlock *tb_gen_code(CPUState *cpu, · line 1025

Quoted 4 lines
accel/tcg/translate-all.c +1 -0
@@ -1020,6 +1022,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
      }
      return tb;
  }
+#pragma GCC diagnostic pop

No, I think this is a real setjmp problem.
I'll send a patch for this and a similar error in disas/nanomips.c.

r~