[cfe-dev] question about clang warning

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Mon Apr 10 21:00:58 PDT 2017


On Mon, Apr 10, 2017 at 5:53 PM Brian Cain <brian.cain at gmail.com> wrote:

> On Mon, Apr 10, 2017 at 6:20 PM, Caroline Tice via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>
> I'm forwarding this question about clang warnings for a friend:
>
> ...
>
>
>
>
>
> In my understanding the break statement is clearly part of the switch
> construct and in this context there is a single loop, it is not clear why
> clang is referring to an enclosing loop.  Could someone verify that this is
> correct and explain why?
>
>
> I'm not sure that it's correct but there exist similar test cases that
> would suggest it's the intended behavior.
>
>
> https://github.com/llvm-mirror/clang/blob/master/test/Analysis/dead-stores.c#L483
>

Not sure that's equivalent/related - in this case the break is inside a
switch and seems to pertain to that switch. Doesn't look to me like it has
anything to do with any loops.

My read on this is that it's a false positive - probably "any break in a
statement expression" triggers this, instead of it being a bit more
selective about whether that break appears within some other breakable
scope.


>
>
> This review shows a motivating example for this warning  (which does not
> include nested loops): https://reviews.llvm.org/D2518
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170411/41f33a1e/attachment.html>


More information about the cfe-dev mailing list