diff mbox series

[6/9] target/sparc/win_helper: silence the compiler warnings

Message ID 20201028041819.2169003-7-kuhn.chenqun@huawei.com
State Accepted
Commit 9cf5a9cf60a3c5271dee05b6a81a05fb45bee622
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/win_helper.c: In function ‘get_gregset’:
target/sparc/win_helper.c:304:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
  304 |         trace_win_helper_gregset_error(pstate);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target/sparc/win_helper.c:306:5: note: here
  306 |     case 0:
      |     ^~~~

Add the corresponding "fall through" comment to fix it.

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/win_helper.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Artyom Tarasenko Oct. 28, 2020, 6:42 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/win_helper.c: In function ‘get_gregset’:
> target/sparc/win_helper.c:304:9: warning: this statement may fall through
> [-Wimplicit-fallthrough=]
>   304 |         trace_win_helper_gregset_error(pstate);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> target/sparc/win_helper.c:306:5: note: here
>   306 |     case 0:
>       |     ^~~~
>
> Add the corresponding "fall through" comment to fix it.
>
> 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/win_helper.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/target/sparc/win_helper.c b/target/sparc/win_helper.c
> index 8290a21142..32eacc05e6 100644
> --- a/target/sparc/win_helper.c
> +++ b/target/sparc/win_helper.c
> @@ -303,6 +303,7 @@ static inline uint64_t *get_gregset(CPUSPARCState
> *env, uint32_t pstate)
>      default:
>          trace_win_helper_gregset_error(pstate);
>          /* pass through to normal set of global registers */
> +        /* fall through */
>      case 0:
>          return env->bgregs;
>      case PS_AG:
> --
> 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/win_helper.c: In function ‘get_gregset’:<br>
target/sparc/win_helper.c:304:9: warning: this statement may fall through [-Wimplicit-fallthrough=]<br>
  304 |         trace_win_helper_gregset_error(pstate);<br>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
target/sparc/win_helper.c:306:5: note: here<br>
  306 |     case 0:<br>
      |     ^~~~<br>
<br>
Add the corresponding &quot;fall through&quot; comment to fix it.<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"><span style="font-family:sans-serif">Reviewed-by: </span><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><br></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/win_helper.c | 1 +<br>
 1 file changed, 1 insertion(+)<br>
<br>
diff --git a/target/sparc/win_helper.c b/target/sparc/win_helper.c<br>
index 8290a21142..32eacc05e6 100644<br>
--- a/target/sparc/win_helper.c<br>
+++ b/target/sparc/win_helper.c<br>
@@ -303,6 +303,7 @@ static inline uint64_t *get_gregset(CPUSPARCState *env, uint32_t pstate)<br>
     default:<br>
         trace_win_helper_gregset_error(pstate);<br>
         /* pass through to normal set of global registers */<br>
+        /* fall through */<br>
     case 0:<br>
         return env-&gt;bgregs;<br>
     case PS_AG:<br>
-- <br>
2.27.0<br>
<br>
</blockquote></div></div></div>
Philippe Mathieu-Daudé Oct. 28, 2020, 9:51 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/win_helper.c: In function ‘get_gregset’:
> target/sparc/win_helper.c:304:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   304 |         trace_win_helper_gregset_error(pstate);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> target/sparc/win_helper.c:306:5: note: here
>   306 |     case 0:
>       |     ^~~~
> 
> Add the corresponding "fall through" comment to fix it.
> 
> 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/win_helper.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/target/sparc/win_helper.c b/target/sparc/win_helper.c
> index 8290a21142..32eacc05e6 100644
> --- a/target/sparc/win_helper.c
> +++ b/target/sparc/win_helper.c
> @@ -303,6 +303,7 @@ static inline uint64_t *get_gregset(CPUSPARCState *env, uint32_t pstate)
>      default:
>          trace_win_helper_gregset_error(pstate);
>          /* pass through to normal set of global registers */
> +        /* fall through */

Can you keep the comment, doing s/pass/fall/?

>      case 0:
>          return env->bgregs;
>      case PS_AG:
>
Chenqun (kuhn) Oct. 29, 2020, 2:45 a.m. UTC | #3
> -----Original Message-----

> From: Philippe Mathieu-Daudé [mailto:philippe.mathieu.daude@gmail.com]

> On Behalf Of Philippe Mathieu-Daudé

> Sent: Wednesday, October 28, 2020 5:51 PM

> To: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; qemu-devel@nongnu.org;

> qemu-trivial@nongnu.org

> Cc: Zhanghailiang <zhang.zhanghailiang@huawei.com>; Mark Cave-Ayland

> <mark.cave-ayland@ilande.co.uk>; ganqixin <ganqixin@huawei.com>; Euler

> Robot <euler.robot@huawei.com>; Artyom Tarasenko

> <atar4qemu@gmail.com>

> Subject: Re: [PATCH 6/9] target/sparc/win_helper: silence the compiler

> warnings

> 

> On 10/28/20 5:18 AM, Chen Qun wrote:

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

> warning:

> > target/sparc/win_helper.c: In function ‘get_gregset’:

> > target/sparc/win_helper.c:304:9: warning: this statement may fall through

> [-Wimplicit-fallthrough=]

> >   304 |         trace_win_helper_gregset_error(pstate);

> >       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> > target/sparc/win_helper.c:306:5: note: here

> >   306 |     case 0:

> >       |     ^~~~

> >

> > Add the corresponding "fall through" comment to fix it.

> >

> > 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/win_helper.c | 1 +

> >  1 file changed, 1 insertion(+)

> >

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

> > index 8290a21142..32eacc05e6 100644

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

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

> > @@ -303,6 +303,7 @@ static inline uint64_t *get_gregset(CPUSPARCState

> *env, uint32_t pstate)

> >      default:

> >          trace_win_helper_gregset_error(pstate);

> >          /* pass through to normal set of global registers */

> > +        /* fall through */

> 

> Can you keep the comment, doing s/pass/fall/?

> 

That looks good, too.

Thanks,
Chen Qun
> >      case 0:

> >          return env->bgregs;

> >      case PS_AG:

> >
diff mbox series

Patch

diff --git a/target/sparc/win_helper.c b/target/sparc/win_helper.c
index 8290a21142..32eacc05e6 100644
--- a/target/sparc/win_helper.c
+++ b/target/sparc/win_helper.c
@@ -303,6 +303,7 @@  static inline uint64_t *get_gregset(CPUSPARCState *env, uint32_t pstate)
     default:
         trace_win_helper_gregset_error(pstate);
         /* pass through to normal set of global registers */
+        /* fall through */
     case 0:
         return env->bgregs;
     case PS_AG: