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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon May 29 13:57:39 PDT 2017


Similar to the thread on cfe-dev. Seems like it might be worth figuring out
why gtest isn't protecting itself from this, rather than fixing all this.

On Mon, May 22, 2017 at 10:00 PM Galina Kistanova via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: gkistanova
> Date: Tue May 23 00:00:10 2017
> New Revision: 303602
>
> URL: http://llvm.org/viewvc/llvm-project?rev=303602&view=rev
> Log:
> Cosmetic. Added braces to address gcc warning: suggest explicit braces to
> avoid ambiguous 'else' [-Wdangling-else].
>
> Modified:
>     llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
>
> Modified: llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp?rev=303602&r1=303601&r2=303602&view=diff
>
> ==============================================================================
> --- llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp (original)
> +++ llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp Tue May 23
> 00:00:10 2017
> @@ -311,8 +311,9 @@ void TestAllForms() {
>    EXPECT_EQ(Data2, toReference(DieDG.find(Attr_DW_FORM_ref2), 0));
>    EXPECT_EQ(Data4, toReference(DieDG.find(Attr_DW_FORM_ref4), 0));
>    EXPECT_EQ(Data8, toReference(DieDG.find(Attr_DW_FORM_ref8), 0));
> -  if (Version >= 4)
> +  if (Version >= 4) {
>      EXPECT_EQ(Data8_2, toReference(DieDG.find(Attr_DW_FORM_ref_sig8), 0));
> +  }
>    EXPECT_EQ(UData[0], toReference(DieDG.find(Attr_DW_FORM_ref_udata), 0));
>
>    //----------------------------------------------------------------------
> @@ -320,15 +321,17 @@ void TestAllForms() {
>    //----------------------------------------------------------------------
>    EXPECT_EQ(1ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_true), 0));
>    EXPECT_EQ(0ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_false), 1));
> -  if (Version >= 4)
> +  if (Version >= 4) {
>      EXPECT_EQ(1ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_present), 0));
> +  }
>
>    //----------------------------------------------------------------------
>    // Test SLEB128 based forms
>    //----------------------------------------------------------------------
>    EXPECT_EQ(SData, toSigned(DieDG.find(Attr_DW_FORM_sdata), 0));
> -  if (Version >= 5)
> +  if (Version >= 5) {
>      EXPECT_EQ(ICSData, toSigned(DieDG.find(Attr_DW_FORM_implicit_const),
> 0));
> +  }
>
>    //----------------------------------------------------------------------
>    // Test ULEB128 based forms
> @@ -340,9 +343,10 @@ void TestAllForms() {
>    //----------------------------------------------------------------------
>    EXPECT_EQ(Dwarf32Values[0],
>              toReference(DieDG.find(Attr_DW_FORM_GNU_ref_alt), 0));
> -  if (Version >= 4)
> +  if (Version >= 4) {
>      EXPECT_EQ(Dwarf32Values[1],
>                toSectionOffset(DieDG.find(Attr_DW_FORM_sec_offset), 0));
> +  }
>
>    //----------------------------------------------------------------------
>    // Add an address at the end to make sure we can decode this value
>
>
> _______________________________________________
> 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/20170529/7eaa9ae2/attachment.html>


More information about the llvm-commits mailing list