This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[v3] Finish-up libstdc++/20534


Hi,

tested x86-linux, committed.

Paolo.

///////////////////
2005-05-31  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/20534 (contd)
	* include/debug/macros.h: Add _GLIBCXX_DEBUG_ABORT, using
	__gnu_debug::__fancy_abort.
	* src/debug.cc: Define the latter.
	* include/debug/debug.h: Use _GLIBCXX_DEBUG_ABORT instead of
	assert.
	* config/linker-map.gnu (__gnu_debug::__fancy_abort): Add.
diff -urN libstdc++-v3-orig/config/linker-map.gnu libstdc++-v3/config/linker-map.gnu
--- libstdc++-v3-orig/config/linker-map.gnu	2005-05-26 16:15:14.000000000 +0200
+++ libstdc++-v3/config/linker-map.gnu	2005-05-29 14:47:15.000000000 +0200
@@ -310,6 +310,7 @@
     _ZNSt8ios_base17_M_call_callbacksENS_5eventE;
     _ZNSt8ios_base20_M_dispose_callbacksEv;
     _ZNSt6locale5facet13_S_get_c_nameEv;
+    _ZN11__gnu_debug13__fancy_abortEPKciS1_S1_;
 
 } GLIBCXX_3.4.4;
 
diff -urN libstdc++-v3-orig/include/debug/debug.h libstdc++-v3/include/debug/debug.h
--- libstdc++-v3-orig/include/debug/debug.h	2005-05-27 19:29:54.000000000 +0200
+++ libstdc++-v3/include/debug/debug.h	2005-05-29 14:35:37.000000000 +0200
@@ -41,15 +41,10 @@
 
 #ifdef _GLIBCXX_DEBUG
 #  include <debug/macros.h>
-
-// The debug mode requires assert functionality, but keep this include
-// conditionalized, so that non-debug use doesn't mandate exposure to the
-// assert macro.
-#  include <cassert> 
-#  define _GLIBCXX_DEBUG_ASSERT(_Condition) assert(_Condition)
+#  define _GLIBCXX_DEBUG_ASSERT(_Condition) _GLIBCXX_DEBUG_ABORT(_Condition)
 
 #  ifdef _GLIBCXX_DEBUG_PEDANTIC
-#    define _GLIBCXX_DEBUG_PEDASSERT(_Condition) assert(_Condition)
+#    define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ABORT(_Condition)
 #  else
 #    define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
 #  endif
diff -urN libstdc++-v3-orig/include/debug/macros.h libstdc++-v3/include/debug/macros.h
--- libstdc++-v3-orig/include/debug/macros.h	2005-05-27 17:01:44.000000000 +0200
+++ libstdc++-v3/include/debug/macros.h	2005-05-29 15:06:38.000000000 +0200
@@ -40,7 +40,17 @@
  * the user error and where the error is reported.
  *
  */
-#define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage)		\
+namespace __gnu_debug
+{ void __fancy_abort(const char*, int, const char*, const char*); }
+#define _GLIBCXX_DEBUG_ABORT(_Condition)                                \
+  do {                                                                  \
+    if (! (_Condition))                                                 \
+      ::__gnu_debug::__fancy_abort(__FILE__, __LINE__,                  \
+				   __PRETTY_FUNCTION__,                 \
+				   #_Condition);                        \
+  } while (false)
+
+#define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage)		        \
   do {									\
     if (! (_Condition))							\
       ::__gnu_debug::_Error_formatter::_M_at(__FILE__, __LINE__)	\
diff -urN libstdc++-v3-orig/src/debug.cc libstdc++-v3/src/debug.cc
--- libstdc++-v3-orig/src/debug.cc	2005-03-24 06:45:45.000000000 +0100
+++ libstdc++-v3/src/debug.cc	2005-05-29 15:24:17.000000000 +0200
@@ -48,6 +48,15 @@
 
 namespace __gnu_debug
 {
+  void
+  __fancy_abort(const char* __file, int __line, const char* __function,
+		const char* __condition)
+  {
+    printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
+	   __function, __condition);
+    abort();
+  }
+
   const char* _S_debug_messages[] = 
   {
     "function requires a valid iterator range [%1.name;, %2.name;)",

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