[llvm] r207452 - Add (...) around && clause to appeace gcc 4.8's warning

Richard Smith richard at metafoo.co.uk
Mon Apr 28 16:22:08 PDT 2014


On Mon, Apr 28, 2014 at 4:13 PM, Eli Bendersky <eliben at google.com> wrote:

> On Mon, Apr 28, 2014 at 4:06 PM, Richard Smith <richard at metafoo.co.uk>wrote:
>
>> On Mon, Apr 28, 2014 at 3:32 PM, Eli Bendersky <eliben at google.com> wrote:
>>>
>>> On Mon, Apr 28, 2014 at 3:28 PM, Eric Christopher <echristo at gmail.com>wrote:
>>>
>>>> Uh, that'd be the wrong grouping I imagine?
>>>>
>>>
>>> Good catch, will fix. The original was wrong too, so the gcc warning was
>>> spot on here ;-)
>>>
>>
>> Actually, the code is correct either way. Clang has special case handling
>> to avoid the false positive for this pattern. =)
>>
>
> Interesting. Can you elaborate (or point to this special case in Clang's
> sources)?
>

Look at SemaChecking.cpp, around line 6156. In particular, we don't warn on:

assert(A || B && "string literal");

... because (a) this is a common pattern, and (b) the precedence of || and
&& doesn't matter here because && "string literal" is a no-op.


>
>
>>
>> Eli
>>>
>>>
>>>
>>>> -eric
>>>>
>>>> On Mon, Apr 28, 2014 at 3:19 PM, Eli Bendersky <eliben at google.com>
>>>> wrote:
>>>> > Author: eliben
>>>> > Date: Mon Apr 28 17:19:12 2014
>>>> > New Revision: 207452
>>>> >
>>>> > URL: http://llvm.org/viewvc/llvm-project?rev=207452&view=rev
>>>> > Log:
>>>> > Add (...) around && clause to appeace gcc 4.8's warning
>>>> >
>>>> > Modified:
>>>> >     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>> >
>>>> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>> > URL:
>>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=207452&r1=207451&r2=207452&view=diff
>>>> >
>>>> ==============================================================================
>>>> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
>>>> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Apr 28
>>>> 17:19:12 2014
>>>> > @@ -591,9 +591,9 @@ std::unique_ptr<DIE> DwarfDebug::constru
>>>> >    DIScope DS(Scope->getScopeNode());
>>>> >
>>>> >    assert(Scope->getInlinedAt() ||
>>>> > -         !DS.isSubprogram() && "Only handle inlined subprograms
>>>> here, use "
>>>> > -                               "constructSubprogramScopeDIE for
>>>> non-inlined "
>>>> > -                               "subprograms");
>>>> > +         (!DS.isSubprogram() && "Only handle inlined subprograms
>>>> here, use "
>>>> > +                                "constructSubprogramScopeDIE for
>>>> non-inlined "
>>>> > +                                "subprograms"));
>>>> >
>>>> >    SmallVector<std::unique_ptr<DIE>, 8> Children;
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > llvm-commits mailing list
>>>> > llvm-commits at cs.uiuc.edu
>>>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140428/3ea5526c/attachment.html>


More information about the llvm-commits mailing list