[PATCH] D61046: Fix compilation warnings when compiling with GCC 7.3

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 10:04:39 PDT 2019

nikic added inline comments.

Comment at: clang/trunk/unittests/AST/ASTImporterTest.cpp:4054
+    }
shafik wrote:
> aganea wrote:
> > Fixes
> > ```
> > [2097/2979] Building CXX object tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/LookupTest.cpp.o
> > /mnt/f/svn/clang/unittests/Tooling/LookupTest.cpp: In lambda function:
> > /mnt/f/svn/clang/unittests/Tooling/LookupTest.cpp:220:8: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
> >      if (Type.getDecl()->getQualifiedNameAsString() == "x::y::Old")
> >         ^
> > ```
> You mixed up the error messages but I see what is going on.
> So you may want to add a comment since it is not apparent that what is going on is due the `EXPECT_TRUE` macro eventually expanding to an `if..else` which is what is triggering the warning. Since someone may come by in the future and just remove the braces since it is not apparent why they are there.
> Same below as well.
EXPECT_* inside if is quite common, I don't think we should add a comment every time it is used.



More information about the cfe-commits mailing list