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

Re: [Xen-devel] [PATCH] clang: disable the gcc-compat warnings for read_atomic



On Tue, Apr 11, 2017 at 02:35:59AM -0600, Jan Beulich wrote:
> >>> On 11.04.17 at 09:54, <roger.pau@xxxxxxxxxx> wrote:
> > clang gcc-compat warnings can wrongly fire when certain constructions are 
> > used,
> > at least the following flow:
> > 
> > switch ( ... )
> > {
> > case ...:
> >     while ( ({ int x; switch ( foo ) { case 1: x = 1; break; } x }) )
                                                                    ^ missing ;
> >     {
> >         ...
> > 
> > Will cause clang to emit the following warning "'break' is bound to loop, 
> > GCC
> > binds it to switch", which is a false positive, and both gcc and clang bound
> 
> bind (I think)

Right, I think so.

> 
> > the break to the inner switch. In order to workaround this issue, disable 
> > the
> > gcc-compat checks for the usage of the read_atomic macro.
> 
> Hmm, so far it wasn't clear to me that this is also needing an outer
> switch() - can you confirm switch inside the while control expression
> alone does not trigger the warning?

Yes, I can confirm that the following:

while ( ({ int x; switch ( foo ) { case 1: x = 1; break; } x; }) )
{
    ...

Does not trigger the warning.

> > This has been reported upstream as 
> > http://bugs.llvm.org/show_bug.cgi?id=32595.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> The patch itself is fine with me, i.e.
> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> but besides wanting to wait for above confirmation, I'd also like
> to allow some time for others to voice objections to this new
> approach.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.