qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH 8/9] target/ppc: silence the compiler warnings


From: Chenqun (kuhn)
Subject: RE: [PATCH 8/9] target/ppc: silence the compiler warnings
Date: Thu, 29 Oct 2020 07:16:53 +0000

> -----Original Message-----
> From: David Gibson [mailto:david@gibson.dropbear.id.au]
> Sent: Thursday, October 29, 2020 7:39 AM
> To: Thomas Huth <thuth@redhat.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>; Chenqun (kuhn)
> <kuhn.chenqun@huawei.com>; qemu-devel@nongnu.org;
> qemu-trivial@nongnu.org; Euler Robot <euler.robot@huawei.com>;
> Zhanghailiang <zhang.zhanghailiang@huawei.com>; ganqixin
> <ganqixin@huawei.com>
> Subject: Re: [PATCH 8/9] target/ppc: silence the compiler warnings
> 
> On Wed, Oct 28, 2020 at 04:06:03PM +0100, Thomas Huth wrote:
> > On 28/10/2020 10.56, Philippe Mathieu-Daudé wrote:
> > > On 10/28/20 5:18 AM, Chen Qun wrote:
> > >> When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed
> warning:
> > >> target/ppc/mmu_helper.c: In function ‘dump_mmu’:
> > >> target/ppc/mmu_helper.c:1351:12: warning: this statement may fall
> through [-Wimplicit-fallthrough=]
> > >>  1351 |         if (ppc64_v3_radix(env_archcpu(env))) {
> > >>       |            ^
> > >> target/ppc/mmu_helper.c:1358:5: note: here
> > >>  1358 |     default:
> > >>       |     ^~~~~~~
> > >>
> > >> 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: David Gibson <david@gibson.dropbear.id.au>
> > >> ---
> > >>  target/ppc/mmu_helper.c | 1 +
> > >>  1 file changed, 1 insertion(+)
> > >>
> > >> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> > >> index 8972714775..51749b62df 100644
> > >> --- a/target/ppc/mmu_helper.c
> > >> +++ b/target/ppc/mmu_helper.c
> > >> @@ -1355,6 +1355,7 @@ void dump_mmu(CPUPPCState *env)
> > >>              break;
> > >>          }
> > >>  #endif
> > >> +        /* fall through */
> > >
> > > I'm surprise the compiler emit a warning for missing comment, but
> > > don't emit one for superfluous and confusing ones (when building a
> > > ppc32-only target). You'd need to put this before the #endif.
> > >
> > > But instead of this band-aid to silent warning, replace the TODO by
> > > a LOG_UNIMP call, and add a break before the #endif.
> >
> > +1 for replacing the TODO with a LOG_UNIMP call and adding a break
> > +instead,
> > that would look way less messy than the current code.
> 
> True, that would be a better approach.

Yeah, that's a good idea.  
I'll modify it in the v2.

Thanks,
Chen Qun
> 
> --
> David Gibson                  | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au        | minimalist, thank you.  NOT _the_
> _other_
>                               | _way_ _around_!
> http://www.ozlabs.org/~dgibson

reply via email to

[Prev in Thread] Current Thread [Next in Thread]