What does 'test' in testcases do?

Christopher Jefferson chris@bubblescope.net
Sun Oct 20 10:09:00 GMT 2013


I decided to try to trace the reason for adding:

bool test __attribute__((unused)) = true;

into tests. It seems to be from the following piece of code in
util/testsuite_hooks.h:

#ifdef _GLIBCXX_ASSERT
# include <cassert>
# define VERIFY(fn) assert(fn)
#else
# define VERIFY(fn) test &= bool(fn)
#endif

So, if we have assert we call it, else we do 'test &= bool(fn)'.

However, as far as I can see, no test does anything with 'test', so I
think this is ignoring any failing tests on any platform which does
not have 'assert'?

If I am understanding correctly, this should probably be fixed. I'm
not sure what the intention was.. probably returning 'test' from main?
Is there still platforms without assert where this matters?

Chris



More information about the Libstdc++ mailing list