This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/4] selftest.h: Add ASSERT_TRUE_AT and ASSERT_FALSE_AT
On Wed, 2016-08-03 at 10:06 -0600, Jeff Law wrote:
> On 08/03/2016 09:45 AM, David Malcolm wrote:
> > I split out the selftest.h changes from v2 of the kit for ease of
> > review;
> > here they are.
> >
> > Successfully bootstrapped®rtested in conjunction with the rest
> > of the
> > patch kit on x86_64-pc-linux-gnu.
> >
> > OK for trunk?
> >
> > gcc/ChangeLog:
> > * selftest.h (ASSERT_TRUE): Reimplement in terms of...
> > (ASSERT_TRUE_AT): New macro.
> > (ASSERT_FALSE): Reimplement in terms of...
> > (ASSERT_FALSE_AT): New macro.
> > (ASSERT_STREQ_AT): Fix typo in comment.
> OK. Though I do wonder if these should just be normal functions...
> I
> assume there's a good reason for the macro pain :)
I tried to do it with an inline function, but a macro seems to be
better: as a macro, we can capture the stringification of the input
expression, so that we can print it (and its evaluated value) if it
fails.