From ba2a8dfe8a772c61cabb931c0039b83659f33ff2 Mon Sep 17 00:00:00 2001
From: cladmi <gaetan.harter@fu-berlin.de>
Date: Fri, 21 Sep 2018 17:57:48 +0200
Subject: [PATCH] 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>
---
 tests/libc_newlib/main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/libc_newlib/main.c b/tests/libc_newlib/main.c
index 11b1bb1327..6136e57fa1 100644
--- a/tests/libc_newlib/main.c
+++ b/tests/libc_newlib/main.c
@@ -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
 }
-- 
GitLab