Skip to content
Snippets Groups Projects
Unverified Commit ba2a8dfe authored by cladmi's avatar cladmi
Browse files

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: default avatarKaspar Schleiser <kaspar@schleiser.de>
parent 028bc2a3
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment