Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(254)

Issue 1175041: Avoid Clang warning about known-NULL condition variables when jumping into else statements (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 8 months ago by chandlerc
Modified:
15 years, 7 months ago
CC:
googletestframework_googlegroups.com
Base URL:
http://googletest.googlecode.com/svn/trunk/
Visibility:
Public.

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -4 lines) Patch
M include/gtest/internal/gtest-internal.h View 4 chunks +12 lines, -4 lines 2 comments Download

Messages

Total messages: 5
chandlerc
Hey, When working on googletest, this warning spews like crazy from Clang. We discussed making ...
15 years, 8 months ago (2010-05-09 23:55:46 UTC) #1
Jeffrey Yasskin
http://codereview.appspot.com/1175041/diff/1/2 File include/gtest/internal/gtest-internal.h (right): http://codereview.appspot.com/1175041/diff/1/2#newcode811 include/gtest/internal/gtest-internal.h:811: if (const char* gtest_msg = "") \ Another workaround ...
15 years, 8 months ago (2010-05-10 04:07:53 UTC) #2
wan
http://codereview.appspot.com/1175041/diff/1/2 File include/gtest/internal/gtest-internal.h (right): http://codereview.appspot.com/1175041/diff/1/2#newcode811 include/gtest/internal/gtest-internal.h:811: if (const char* gtest_msg = "") \ On 2010/05/10 ...
15 years, 8 months ago (2010-05-10 07:04:44 UTC) #3
wan
On Mon, May 10, 2010 at 12:04 AM, <wan@google.com> wrote: > > http://codereview.appspot.com/1175041/diff/1/2 > File ...
15 years, 8 months ago (2010-05-10 07:44:43 UTC) #4
chandlerc
15 years, 8 months ago (2010-05-10 08:02:13 UTC) #5
On Mon, May 10, 2010 at 12:44 AM, Zhanyong Wan (λx.x x) <wan@google.com>wrote:

> On Mon, May 10, 2010 at 12:04 AM,  <wan@google.com> wrote:
> >
> > http://codereview.appspot.com/1175041/diff/1/2
> > File include/gtest/internal/gtest-internal.h (right):
> >
> > http://codereview.appspot.com/1175041/diff/1/2#newcode811
> > include/gtest/internal/gtest-internal.h:811: if (const char* gtest_msg =
> > "") \
> > On 2010/05/10 04:07:53, Jeffrey Yasskin wrote:
> >
> >> If someone writes:
> >> if (cond)
> >>   EXPECT_THROW(...) << "stuff";
> >> else
> >>   other_stuff();
> >
> >> which if does that else bind to? Is there a test for that?
> >
> > It's supposed to bind to "if (cond)".  gtest_unittest.cc contains some
> > tests for this sort of things, but they may not be complete enough to
> > cover this.
> >
> > The EXPECT_THROW() macro should behave like a single, atomic statement.
> > Therefore it cannot expand to an unbalanced 'if' statement.  I have an
> > idea on how to fix the Clang warning without sacrificing the properties
> > of EXPECT_THROW() or using a helper class.  Will send out a patch soon.
>
> Unfortunately, my idea doesn't work for EXPECT_THROW().  Clang seems
> really stubborn about the waring.  It works for the rest of the
> exception assertions through.  In the end, I think we still need the
> helper class Jeffrey suggested.
>

If I see one more false positive from this warning, I'll disable it in
google. =[ Jeffrey has a slew of complaints against it, marginalizing its
benefit in my eyes. We'll see if it rears its head again or if upstream
actually fixes it. Thanks for working around it here, will help when
reducing bugs out of googletest.



>
> --
> Zhanyong
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b