diff mbox series

[5/9] target/sparc/translate: silence the compiler warnings

Message ID 20201028041819.2169003-6-kuhn.chenqun@huawei.com
State Superseded
Headers show
Series silence the compiler warnings | expand

Commit Message

Chenqun (kuhn) Oct. 28, 2020, 4:18 a.m. UTC
When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/sparc/translate.c: In function ‘gen_st_asi’:
target/sparc/translate.c:2320:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
 2320 |         if (!(dc->def->features & CPU_FEATURE_HYPV)) {
      |            ^
target/sparc/translate.c:2329:5: note: here
 2329 |     case GET_ASI_DIRECT:
      |     ^~~~

The "fall through" statement place is not correctly identified by the compiler.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Artyom Tarasenko <atar4qemu@gmail.com>
---
 target/sparc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Artyom Tarasenko Oct. 28, 2020, 6:39 a.m. UTC | #1
ср, 28 окт. 2020 г., 5:19 Chen Qun <kuhn.chenqun@huawei.com>:

> When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed

> warning:

> target/sparc/translate.c: In function ‘gen_st_asi’:

> target/sparc/translate.c:2320:12: warning: this statement may fall through

> [-Wimplicit-fallthrough=]

>  2320 |         if (!(dc->def->features & CPU_FEATURE_HYPV)) {

>       |            ^

> target/sparc/translate.c:2329:5: note: here

>  2329 |     case GET_ASI_DIRECT:

>       |     ^~~~

>

> The "fall through" statement place is not correctly identified by the

> compiler.

>

> Reported-by: Euler Robot <euler.robot@huawei.com>

> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>

>


Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>


---
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

> Cc: Artyom Tarasenko <atar4qemu@gmail.com>

> ---

>  target/sparc/translate.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/target/sparc/translate.c b/target/sparc/translate.c

> index 1a4efd4ed6..a3d9aaa46b 100644

> --- a/target/sparc/translate.c

> +++ b/target/sparc/translate.c

> @@ -2324,8 +2324,8 @@ static void gen_st_asi(DisasContext *dc, TCGv src,

> TCGv addr,

>          }

>          /* in OpenSPARC T1+ CPUs TWINX ASIs in store instructions

>           * are ST_BLKINIT_ ASIs */

> -        /* fall through */

>  #endif

> +        /* fall through */

>      case GET_ASI_DIRECT:

>          gen_address_mask(dc, addr);

>          tcg_gen_qemu_st_tl(src, addr, da.mem_idx, da.memop);

> --

> 2.27.0

>

>
<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ср, 28 окт. 2020 г., 5:19 Chen Qun &lt;<a href="mailto:kuhn.chenqun@huawei.com">kuhn.chenqun@huawei.com</a>&gt;:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:<br>
target/sparc/translate.c: In function ‘gen_st_asi’:<br>
target/sparc/translate.c:2320:12: warning: this statement may fall through [-Wimplicit-fallthrough=]<br>
 2320 |         if (!(dc-&gt;def-&gt;features &amp; CPU_FEATURE_HYPV)) {<br>
      |            ^<br>
target/sparc/translate.c:2329:5: note: here<br>
 2329 |     case GET_ASI_DIRECT:<br>
      |     ^~~~<br>
<br>
The &quot;fall through&quot; statement place is not correctly identified by the compiler.<br>
<br>
Reported-by: Euler Robot &lt;<a href="mailto:euler.robot@huawei.com" target="_blank" rel="noreferrer">euler.robot@huawei.com</a>&gt;<br>
Signed-off-by: Chen Qun &lt;<a href="mailto:kuhn.chenqun@huawei.com" target="_blank" rel="noreferrer">kuhn.chenqun@huawei.com</a>&gt;<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Reviewed-by: <span style="font-family:sans-serif">Artyom Tarasenko &lt;</span><a href="mailto:atar4qemu@gmail.com" style="font-family:sans-serif">atar4qemu@gmail.com</a><span style="font-family:sans-serif">&gt;</span></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

---<br>
Cc: Mark Cave-Ayland &lt;<a href="mailto:mark.cave-ayland@ilande.co.uk" target="_blank" rel="noreferrer">mark.cave-ayland@ilande.co.uk</a>&gt;<br>
Cc: Artyom Tarasenko &lt;<a href="mailto:atar4qemu@gmail.com" target="_blank" rel="noreferrer">atar4qemu@gmail.com</a>&gt;<br>
---<br>
 target/sparc/translate.c | 2 +-<br>
 1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/target/sparc/translate.c b/target/sparc/translate.c<br>
index 1a4efd4ed6..a3d9aaa46b 100644<br>
--- a/target/sparc/translate.c<br>
+++ b/target/sparc/translate.c<br>
@@ -2324,8 +2324,8 @@ static void gen_st_asi(DisasContext *dc, TCGv src, TCGv addr,<br>
         }<br>
         /* in OpenSPARC T1+ CPUs TWINX ASIs in store instructions<br>
          * are ST_BLKINIT_ ASIs */<br>
-        /* fall through */<br>
 #endif<br>
+        /* fall through */<br>
     case GET_ASI_DIRECT:<br>
         gen_address_mask(dc, addr);<br>
         tcg_gen_qemu_st_tl(src, addr, da.mem_idx, da.memop);<br>
-- <br>
2.27.0<br>
<br>
</blockquote></div></div></div>
Philippe Mathieu-Daudé Oct. 28, 2020, 9:50 a.m. UTC | #2
On 10/28/20 5:18 AM, Chen Qun wrote:
> When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
> target/sparc/translate.c: In function ‘gen_st_asi’:
> target/sparc/translate.c:2320:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
>  2320 |         if (!(dc->def->features & CPU_FEATURE_HYPV)) {
>       |            ^
> target/sparc/translate.c:2329:5: note: here
>  2329 |     case GET_ASI_DIRECT:
>       |     ^~~~
> 
> The "fall through" statement place is not correctly identified by the compiler.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Cc: Artyom Tarasenko <atar4qemu@gmail.com>
> ---
>  target/sparc/translate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/sparc/translate.c b/target/sparc/translate.c
> index 1a4efd4ed6..a3d9aaa46b 100644
> --- a/target/sparc/translate.c
> +++ b/target/sparc/translate.c
> @@ -2324,8 +2324,8 @@ static void gen_st_asi(DisasContext *dc, TCGv src, TCGv addr,
>          }
>          /* in OpenSPARC T1+ CPUs TWINX ASIs in store instructions
>           * are ST_BLKINIT_ ASIs */
> -        /* fall through */
>  #endif
> +        /* fall through */
>      case GET_ASI_DIRECT:
>          gen_address_mask(dc, addr);
>          tcg_gen_qemu_st_tl(src, addr, da.mem_idx, da.memop);
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index 1a4efd4ed6..a3d9aaa46b 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -2324,8 +2324,8 @@  static void gen_st_asi(DisasContext *dc, TCGv src, TCGv addr,
         }
         /* in OpenSPARC T1+ CPUs TWINX ASIs in store instructions
          * are ST_BLKINIT_ ASIs */
-        /* fall through */
 #endif
+        /* fall through */
     case GET_ASI_DIRECT:
         gen_address_mask(dc, addr);
         tcg_gen_qemu_st_tl(src, addr, da.mem_idx, da.memop);