tests/libc_newlib: fix pointers comparison for llvm
With llvm and samr21-xpro, I could not directly do 'printf == iprintf'. But doing `(printf - iprintf) == 0` correctly checked if they are equal. Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
This commit is contained in:
parent
028bc2a3e4
commit
ba2a8dfe8a
@ -58,15 +58,18 @@ static void test_newlib(void)
|
||||
/*
|
||||
* Be sure `iprintf` and `printf` are used when `newlib` is included as
|
||||
* they should be visible in the final elf file for compile time tests
|
||||
*
|
||||
* With llvm and samr21-xpro, I could not directly do 'printf == iprintf'.
|
||||
* But doing `(printf - iprintf) == 0` correctly checked if they are equal.
|
||||
*/
|
||||
|
||||
#ifdef MODULE_NEWLIB
|
||||
#ifdef MODULE_NEWLIB_NANO
|
||||
/* Nano maps iprintf to printf */
|
||||
TEST_ASSERT(iprintf == printf);
|
||||
TEST_ASSERT_MESSAGE((printf - iprintf) == 0, "iprintf == printf");
|
||||
#else
|
||||
/* Normal newlib does not */
|
||||
TEST_ASSERT(iprintf != printf);
|
||||
TEST_ASSERT_MESSAGE((printf - iprintf) != 0, "iprintf != printf");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user