PR libstdc++/20534 (contd)
authorPaolo Carlini <pcarlini@suse.de>
Tue, 31 May 2005 18:31:55 +0000 (18:31 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 31 May 2005 18:31:55 +0000 (18:31 +0000)
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.

From-SVN: r100405

libstdc++-v3/ChangeLog
libstdc++-v3/config/linker-map.gnu
libstdc++-v3/include/debug/debug.h
libstdc++-v3/include/debug/macros.h
libstdc++-v3/src/debug.cc

index 31357005d8938833cda25e3878b363dbe6e36466..4660ce9693e8c7956b8f53ac40ae65b782129e88 100644 (file)
@@ -1,3 +1,13 @@
+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.
+
 2005-05-30  Paolo Carlini  <pcarlini@suse.de>
 
        * include/std/std_complex.h (log(const complex<_Tp>&)): When
index 769e5fe96a63474133a5830895ea8160c704965a..a9d20abe21e798d3a6efceaaedc83f6ea922a27a 100644 (file)
@@ -310,6 +310,7 @@ GLIBCXX_3.4.5 {
     _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;
 
index b4ffb6f62a84cd97e24f9d346a73a0026893cc2a..7cd08cdeca03276e0ba5d68c33a69784468941e6 100644 (file)
 
 #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
index c89ff9e84e467338a883c394ea99646eeb08a8f3..3fe60c9df9a7efa62b2ebb80be68ad65af0267ca 100644 (file)
  * 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__)       \
index 3375adf1f4720fd8082e2183852fed238057d795..621a1c9672742060b3b8cb78b9b0c473efc01c54 100644 (file)
@@ -48,6 +48,15 @@ namespace __gnu_internal
 
 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;)",