diff options
author | rpj <rpj> | 2005-03-16 01:33:20 +0000 |
---|---|---|
committer | rpj <rpj> | 2005-03-16 01:33:20 +0000 |
commit | 37f6fe772e5779120d2ee372c5d51ff60b6801dc (patch) | |
tree | b611e6b1c26e36a32e761962ab6693b02744c784 /tests/test.h | |
parent | 3d32060783bcaf10f38ff6eef6fcf5711bfeada4 (diff) |
Diffstat (limited to 'tests/test.h')
-rw-r--r-- | tests/test.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/test.h b/tests/test.h index a664bb6..11498cd 100644 --- a/tests/test.h +++ b/tests/test.h @@ -109,8 +109,13 @@ char * error_string[] = { # define ASSERT_TRACE 1 #endif +/* + * Trick to force the compiler to not optimise out dead or obvious expressions. + */ +int ptw32_assert_force = 1; + # define assert(e) \ - ((e) ? ((ASSERT_TRACE) ? fprintf(stderr, \ + (ptw32_assert_force && (e) ? ((ASSERT_TRACE) ? fprintf(stderr, \ "Assertion succeeded: (%s), file %s, line %d\n", \ #e, __FILE__, (int) __LINE__), \ fflush(stderr) : \ @@ -120,7 +125,7 @@ char * error_string[] = { int assertE; # define assert_e(e, o, r) \ - (((assertE = e) o (r)) ? ((ASSERT_TRACE) ? fprintf(stderr, \ + (ptw32_assert_force && ((assertE = e) o (r)) ? ((ASSERT_TRACE) ? fprintf(stderr, \ "Assertion succeeded: (%s), file %s, line %d\n", \ #e, __FILE__, (int) __LINE__), \ fflush(stderr) : \ |