[llvm] r304083 - Added braces to address gcc warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]. NFC.

Galina Kistanova via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 13:39:44 PDT 2017


Let me summarize what we have.

The old trick with "switch (0) case 0: default:" does not work with gcc-7.1
any more. The same is for the one-time-for-loop. And, unless I'm missing
something, we do not have other ideas which may work.

I have filed an issue https://github.com/google/googletest/issues/1119.

In the mean time, these are the only warnings which block me from having
the gcc-7.1 bot in the production master and I would like to get this
resolved as soon as possible.

Unless anyone has a better idea, I'm going to add the explicit braces in
those 37 places and be done with this.

Thanks

Galina


On Sat, Jun 3, 2017 at 10:25 PM, Galina Kistanova <gkistanova at gmail.com>
wrote:

> Unfortunately, a do { ... } while (0) wrapper wouldn't work either.
> Because of usages like this:
>
> ASSERT_EQ(&TestOption, Retrieved) << "Retrieved wrong option.";
>
> Galina
>
> On Sun, May 28, 2017 at 2:41 PM, Joerg Sonnenberger via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> On Sat, May 27, 2017 at 10:30:54PM -0700, Craig Topper via llvm-commits
>> wrote:
>> > EXPECT_STREQ should already be using this as far as I can tell.
>>
>> GTEST_ASSERT_ should get a do { ... } while (0) wrapper. That's much
>> better than the switch statement it is currently trying to use.
>>
>> Joerg
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170614/d32b2c4d/attachment.html>


More information about the llvm-commits mailing list