[PATCH 0/1] replace forced __assert_func with assert macro

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/1] replace forced __assert_func with assert macro

KrimtonZ
Modified the implementation of eBalloc to use the assert macro over the
hardcoded __assert_func.  The same is done for __reent_assert.  This
will honor the usage of -DNDEBUG to prevent the usage of assertion.

KrimtonZ (1):
  change forced use of __assert_func to use the assert macro in reent.h
    and mprec.h, this honors the use of -DNDEBUG to not use assertion

 newlib/libc/include/sys/reent.h | 2 +-
 newlib/libc/stdlib/mprec.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/1] change forced use of __assert_func to use the assert macro in reent.h and mprec.h, this honors the use of -DNDEBUG to not use assertion

KrimtonZ
---
 newlib/libc/include/sys/reent.h | 2 +-
 newlib/libc/stdlib/mprec.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index 74b70e9c0..2d561453f 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -501,7 +501,7 @@ extern const struct __sFILE_fake __sf_fake_stderr;
 /* Specify how to handle reent_check malloc failures. */
 #ifdef _REENT_CHECK_VERIFY
 #include <assert.h>
-#define __reent_assert(x) ((x) ? (void)0 : __assert_func(__FILE__, __LINE__, (char *)0, "REENT malloc succeeded"))
+#define __reent_assert(x) ((x) ? (void)0 : assert("REENT malloc succeeded"))
 #else
 #define __reent_assert(x) ((void)0)
 #endif
diff --git a/newlib/libc/stdlib/mprec.h b/newlib/libc/stdlib/mprec.h
index a1492aa38..595f485d4 100644
--- a/newlib/libc/stdlib/mprec.h
+++ b/newlib/libc/stdlib/mprec.h
@@ -344,7 +344,7 @@ typedef struct _Bigint _Bigint;
 #define eBalloc(__reent_ptr, __len) ({ \
    void *__ptr = Balloc(__reent_ptr, __len); \
    if (__ptr == NULL) \
-     __assert_func(__FILE__, __LINE__, (char *)0, "Balloc succeeded"); \
+     assert("Balloc succeeded"); \
    __ptr; \
    })
   
--
2.17.1