This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Avoid defining assert in reent.h


On _REENT_SMALL targets reent.h pollutes the user namespace by defining 
assert(x). This causes a failure in the libstdc++ testsuite 
(17_intro/no_assert_neg.cc).

The attached patch fixes this by defining and using __reent_assert.

Tested with cross to arm-none-eabi.
Ok?

Paul

2006-09-20  Paul Brook  <paul@codesourcery.com>

	newlib/
	* libc/include/sys/reent.h: Define and use __reent_assert.
Index: newlib/libc/include/sys/reent.h
===================================================================
RCS file: /var/cvsroot/src-cvs/src/newlib/libc/include/sys/reent.h,v
retrieving revision 1.34
diff -u -p -r1.34 reent.h
--- newlib/libc/include/sys/reent.h	8 Feb 2005 01:33:16 -0000	1.34
+++ newlib/libc/include/sys/reent.h	20 Sep 2006 21:47:43 -0000
@@ -459,8 +459,9 @@ struct _reent
 /* Only built the assert() calls if we are built with debugging.  */
 #if DEBUG 
 #include <assert.h>
+#define __reent_assert(x) assert(x)
 #else
-#define assert(x) ((void)0)
+#define __reent_assert(x) ((void)0)
 #endif
 
 /* Generic _REENT check macro.  */
@@ -468,7 +469,7 @@ struct _reent
   struct _reent *_r = (var); \
   if (_r->what == NULL) { \
     _r->what = (type)malloc(size); \
-    assert(_r->what); \
+    __reent_assert(_r->what); \
     init; \
   } \
 } while (0)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]