Merge pull request #10014 from cladmi/pr/tests_libc/fix_for_llvm

tests/libc_newlib: fix pointers comparison for llvm
This commit is contained in:
Martine Lenders 2018-09-25 15:50:37 +02:00 committed by GitHub
commit f1529b886c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,15 +58,18 @@ static void test_newlib(void)
/* /*
* Be sure `iprintf` and `printf` are used when `newlib` is included as * 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 * 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
#ifdef MODULE_NEWLIB_NANO #ifdef MODULE_NEWLIB_NANO
/* Nano maps iprintf to printf */ /* Nano maps iprintf to printf */
TEST_ASSERT(iprintf == printf); TEST_ASSERT_MESSAGE((printf - iprintf) == 0, "iprintf == printf");
#else #else
/* Normal newlib does not */ /* Normal newlib does not */
TEST_ASSERT(iprintf != printf); TEST_ASSERT_MESSAGE((printf - iprintf) != 0, "iprintf != printf");
#endif #endif
#endif #endif
} }