summaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2017-11-20 21:56:37 +0000
committerChris Wilson <chris+github@qwirx.com>2017-11-26 20:46:47 +0000
commit447c2cd3d6884b8383884dbbfe65db845ea5c04d (patch)
treed3358b504b37433871a83afcbb520141d327527b /test/common
parentb7c6a133b8868223bc39084968e0cac332fd4dfe (diff)
Remove invalid use of null references (undefined behaviour)
Enable the relevant compiler warning as an error, if supported (-Werror=undefined-bool-conversion). http://www.gotw.ca/conv/002.htm http://stackoverflow.com/questions/2165078/a-reference-can-not-be-null-or-it-can-be-null (cherry picked from commit f2911acac0c8375a08ecc0a55f853a5a59c4d511) (cherry picked from commit 5a50b98401302a5ba89366e4c0f8cccdd88d8722)
Diffstat (limited to 'test/common')
-rw-r--r--test/common/testcommon.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/common/testcommon.cpp b/test/common/testcommon.cpp
index bd75ac37..3de7da1d 100644
--- a/test/common/testcommon.cpp
+++ b/test/common/testcommon.cpp
@@ -312,10 +312,11 @@ int test(int argc, const char *argv[])
// Check that using timer methods without initialisation
// throws an assertion failure. Can only do this in debug mode
#ifndef BOX_RELEASE_BUILD
- TEST_CHECK_THROWS(Timers::Add(*(Timer*)NULL),
- CommonException, AssertFailed);
- TEST_CHECK_THROWS(Timers::Remove(*(Timer*)NULL),
- CommonException, AssertFailed);
+ {
+ Timer tim(0, "tim");
+ TEST_CHECK_THROWS(Timers::Add(tim), CommonException, AssertFailed);
+ Timers::Remove(tim);
+ }
#endif
// TEST_CHECK_THROWS(Timers::Signal(), CommonException, AssertFailed);