Skip to content

Commit 9e2c949

Browse files
authored
Merge pull request #15214 from ladislas/ladislas/bugfix/mbed_assert_no_throw
Allow unit tests to be compiled with -fno-exception
2 parents f75ff22 + 568ffbf commit 9e2c949

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

platform/tests/UNITTESTS/doubles/mbed_assert_stub.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ extern "C" void mbed_assert_internal(const char *expr, const char *file, int lin
2626
{
2727
fprintf(stderr, "mbed assertation failed: %s, file: %s, line %d \n", expr, file, line);
2828
if (mbed_assert_throw_errors) {
29+
#ifdef __EXCEPTIONS
2930
throw 1;
31+
#else
32+
FAIL();
33+
#endif
3034
}
3135

3236
/* Ensure we fail the unit test if the Mbed assertion fails. Without this,

0 commit comments

Comments
 (0)