diff mbox series

[PULL,1/5] target/s390x: fix build warning (gcc-12 -fsanitize=thread)

Message ID 20240816072218.27125-2-thuth@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,1/5] target/s390x: fix build warning (gcc-12 -fsanitize=thread) | expand

Commit Message

Thomas Huth Aug. 16, 2024, 7:22 a.m. UTC
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>

Found on debian stable.

../target/s390x/tcg/translate.c: In function ‘get_mem_index’:
../target/s390x/tcg/translate.c:398:1: error: control reaches end of non-void function [-Werror=return-type]
  398 | }

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-ID: <20240814224132.897098-4-pierrick.bouvier@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/s390x/tcg/translate.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Philippe Mathieu-Daudé Aug. 16, 2024, 7:45 a.m. UTC | #1
On 16/8/24 09:22, Thomas Huth wrote:
> From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> 
> Found on debian stable.
> 
> ../target/s390x/tcg/translate.c: In function ‘get_mem_index’:
> ../target/s390x/tcg/translate.c:398:1: error: control reaches end of non-void function [-Werror=return-type]
>    398 | }
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
> Message-ID: <20240814224132.897098-4-pierrick.bouvier@linaro.org>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   target/s390x/tcg/translate.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
> index c81e035dea..bcfff40b25 100644
> --- a/target/s390x/tcg/translate.c
> +++ b/target/s390x/tcg/translate.c
> @@ -392,7 +392,6 @@ static int get_mem_index(DisasContext *s)
>           return MMU_HOME_IDX;
>       default:
>           g_assert_not_reached();
> -        break;

Why aren't the other cases problematic?

$ git grep -A1 g_assert_not_reached | fgrep -B1 break
accel/tcg/plugin-gen.c:253:        g_assert_not_reached();
accel/tcg/plugin-gen.c-254-        break;
--
block/ssh.c:476:        g_assert_not_reached();
block/ssh.c-477-        break;
--
fpu/softfloat-parts.c.inc:1375:            g_assert_not_reached();
fpu/softfloat-parts.c.inc-1376-            break;
--
fpu/softfloat-parts.c.inc:1388:            g_assert_not_reached();
fpu/softfloat-parts.c.inc-1389-            break;
--
hw/gpio/nrf51_gpio.c:42:        g_assert_not_reached();
hw/gpio/nrf51_gpio.c-43-        break;
--
hw/misc/imx6_ccm.c:303:        g_assert_not_reached();
hw/misc/imx6_ccm.c-304-        break;
--
hw/misc/mac_via.c:497:                g_assert_not_reached();
hw/misc/mac_via.c-498-                break;
--
hw/misc/mac_via.c:558:            g_assert_not_reached();
hw/misc/mac_via.c-559-            break;
--
hw/pci-host/gt64120.c:691:        g_assert_not_reached();
hw/pci-host/gt64120.c-692-        break;
--
hw/pci-host/gt64120.c:935:        g_assert_not_reached();
hw/pci-host/gt64120.c-936-        break;
--
hw/scsi/virtio-scsi.c:359:        g_assert_not_reached();
hw/scsi/virtio-scsi.c-360-        break;
--
hw/tpm/tpm_spapr.c:208:                g_assert_not_reached();
hw/tpm/tpm_spapr.c-209-                break;
--
target/arm/hyp_gdbstub.c:160:        g_assert_not_reached();
target/arm/hyp_gdbstub.c-161-        break;
--
target/riscv/insn_trans/trans_rvv.c.inc:3174:        g_assert_not_reached();
target/riscv/insn_trans/trans_rvv.c.inc-3175-        break;
--
target/riscv/insn_trans/trans_rvv.c.inc:3259:        g_assert_not_reached();
target/riscv/insn_trans/trans_rvv.c.inc-3260-        break;
--
target/riscv/monitor.c:186:        g_assert_not_reached();
target/riscv/monitor.c-187-        break;
--
target/s390x/tcg/translate.c:394:        g_assert_not_reached();
target/s390x/tcg/translate.c-395-        break;
--
tcg/loongarch64/tcg-target.c.inc:652:        g_assert_not_reached();
tcg/loongarch64/tcg-target.c.inc-653-        break;
--
tests/qtest/migration-helpers.c:78:        g_assert_not_reached();
tests/qtest/migration-helpers.c-79-        break;
--
ui/qemu-pixman.c:51:        g_assert_not_reached();
ui/qemu-pixman.c-52-        break;
Thomas Huth Aug. 16, 2024, 8:26 a.m. UTC | #2
On 16/08/2024 09.45, Philippe Mathieu-Daudé wrote:
> On 16/8/24 09:22, Thomas Huth wrote:
>> From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>
>> Found on debian stable.
>>
>> ../target/s390x/tcg/translate.c: In function ‘get_mem_index’:
>> ../target/s390x/tcg/translate.c:398:1: error: control reaches end of 
>> non-void function [-Werror=return-type]
>>    398 | }
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
>> Message-ID: <20240814224132.897098-4-pierrick.bouvier@linaro.org>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   target/s390x/tcg/translate.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
>> index c81e035dea..bcfff40b25 100644
>> --- a/target/s390x/tcg/translate.c
>> +++ b/target/s390x/tcg/translate.c
>> @@ -392,7 +392,6 @@ static int get_mem_index(DisasContext *s)
>>           return MMU_HOME_IDX;
>>       default:
>>           g_assert_not_reached();
>> -        break;
> 
> Why aren't the other cases problematic?

No clue, but I guess we can tackle them once anybody runs into a problem in 
one of these spots.

  Thomas
Pierrick Bouvier Aug. 16, 2024, 5:55 p.m. UTC | #3
On 8/16/24 00:45, Philippe Mathieu-Daudé wrote:
> On 16/8/24 09:22, Thomas Huth wrote:
>> From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>
>> Found on debian stable.
>>
>> ../target/s390x/tcg/translate.c: In function ‘get_mem_index’:
>> ../target/s390x/tcg/translate.c:398:1: error: control reaches end of non-void function [-Werror=return-type]
>>     398 | }
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
>> Message-ID: <20240814224132.897098-4-pierrick.bouvier@linaro.org>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>    target/s390x/tcg/translate.c | 1 -
>>    1 file changed, 1 deletion(-)
>>
>> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
>> index c81e035dea..bcfff40b25 100644
>> --- a/target/s390x/tcg/translate.c
>> +++ b/target/s390x/tcg/translate.c
>> @@ -392,7 +392,6 @@ static int get_mem_index(DisasContext *s)
>>            return MMU_HOME_IDX;
>>        default:
>>            g_assert_not_reached();
>> -        break;
> 
> Why aren't the other cases problematic?
> 
> $ git grep -A1 g_assert_not_reached | fgrep -B1 break
> accel/tcg/plugin-gen.c:253:        g_assert_not_reached();
> accel/tcg/plugin-gen.c-254-        break;
> --
> block/ssh.c:476:        g_assert_not_reached();
> block/ssh.c-477-        break;
> --
> fpu/softfloat-parts.c.inc:1375:            g_assert_not_reached();
> fpu/softfloat-parts.c.inc-1376-            break;
> --
> fpu/softfloat-parts.c.inc:1388:            g_assert_not_reached();
> fpu/softfloat-parts.c.inc-1389-            break;
> --
> hw/gpio/nrf51_gpio.c:42:        g_assert_not_reached();
> hw/gpio/nrf51_gpio.c-43-        break;
> --
> hw/misc/imx6_ccm.c:303:        g_assert_not_reached();
> hw/misc/imx6_ccm.c-304-        break;
> --
> hw/misc/mac_via.c:497:                g_assert_not_reached();
> hw/misc/mac_via.c-498-                break;
> --
> hw/misc/mac_via.c:558:            g_assert_not_reached();
> hw/misc/mac_via.c-559-            break;
> --
> hw/pci-host/gt64120.c:691:        g_assert_not_reached();
> hw/pci-host/gt64120.c-692-        break;
> --
> hw/pci-host/gt64120.c:935:        g_assert_not_reached();
> hw/pci-host/gt64120.c-936-        break;
> --
> hw/scsi/virtio-scsi.c:359:        g_assert_not_reached();
> hw/scsi/virtio-scsi.c-360-        break;
> --
> hw/tpm/tpm_spapr.c:208:                g_assert_not_reached();
> hw/tpm/tpm_spapr.c-209-                break;
> --
> target/arm/hyp_gdbstub.c:160:        g_assert_not_reached();
> target/arm/hyp_gdbstub.c-161-        break;
> --
> target/riscv/insn_trans/trans_rvv.c.inc:3174:        g_assert_not_reached();
> target/riscv/insn_trans/trans_rvv.c.inc-3175-        break;
> --
> target/riscv/insn_trans/trans_rvv.c.inc:3259:        g_assert_not_reached();
> target/riscv/insn_trans/trans_rvv.c.inc-3260-        break;
> --
> target/riscv/monitor.c:186:        g_assert_not_reached();
> target/riscv/monitor.c-187-        break;
> --
> target/s390x/tcg/translate.c:394:        g_assert_not_reached();
> target/s390x/tcg/translate.c-395-        break;
> --
> tcg/loongarch64/tcg-target.c.inc:652:        g_assert_not_reached();
> tcg/loongarch64/tcg-target.c.inc-653-        break;
> --
> tests/qtest/migration-helpers.c:78:        g_assert_not_reached();
> tests/qtest/migration-helpers.c-79-        break;
> --
> ui/qemu-pixman.c:51:        g_assert_not_reached();
> ui/qemu-pixman.c-52-        break;
> 

I'll take a look at constructions where code is present after 
g_assert_not_reached() and make a series out of it to clean this.
diff mbox series

Patch

diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index c81e035dea..bcfff40b25 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -392,7 +392,6 @@  static int get_mem_index(DisasContext *s)
         return MMU_HOME_IDX;
     default:
         g_assert_not_reached();
-        break;
     }
 #endif
 }