00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef _GLIBCXX_DEBUG_DEBUG_H
00032 #define _GLIBCXX_DEBUG_DEBUG_H 1
00033 
00042 #ifdef _GLIBCXX_DEBUG
00043 
00044 # include <debug/macros.h>
00045 # include <cstdlib>
00046 # include <cstdio>
00047 
00048 
00049 
00050 namespace __gnu_debug
00051 { 
00052   inline void
00053   __replacement_assert(const char* __file, int __line, const char* __function,
00054                const char* __condition)
00055   {
00056     std::printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
00057         __function, __condition);
00058     std::abort();
00059   }
00060 }
00061 
00062 #define _GLIBCXX_DEBUG_ASSERT(_Condition)                               \
00063   do {                                                                  \
00064     if (! (_Condition))                                                 \
00065       ::__gnu_debug::__replacement_assert(__FILE__, __LINE__,           \
00066                    __PRETTY_FUNCTION__,                 \
00067                    #_Condition);                        \
00068   } while (false)
00069 
00070 #  ifdef _GLIBCXX_DEBUG_PEDANTIC
00071 #    define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)
00072 #  else
00073 #    define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
00074 #  endif
00075 
00076 #  define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg)
00077 #  define __glibcxx_requires_valid_range(_First,_Last) \
00078      __glibcxx_check_valid_range(_First,_Last)
00079 #  define __glibcxx_requires_sorted(_First,_Last) \
00080      __glibcxx_check_sorted(_First,_Last)
00081 #  define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \
00082      __glibcxx_check_sorted_pred(_First,_Last,_Pred)
00083 #  define __glibcxx_requires_partitioned(_First,_Last,_Value)   \
00084      __glibcxx_check_partitioned(_First,_Last,_Value)
00085 #  define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred) \
00086      __glibcxx_check_partitioned_pred(_First,_Last,_Value,_Pred)
00087 #  define __glibcxx_requires_heap(_First,_Last) \
00088      __glibcxx_check_heap(_First,_Last)
00089 #  define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \
00090      __glibcxx_check_heap_pred(_First,_Last,_Pred)
00091 #  define __glibcxx_requires_nonempty() __glibcxx_check_nonempty()
00092 #  define __glibcxx_requires_string(_String) __glibcxx_check_string(_String)
00093 #  define __glibcxx_requires_string_len(_String,_Len)   \
00094      __glibcxx_check_string_len(_String,_Len)
00095 #  define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N)
00096 
00097 #  include <debug/functions.h>
00098 #  include <debug/formatter.h>
00099 #else
00100 #  define _GLIBCXX_DEBUG_ASSERT(_Condition)
00101 #  define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
00102 #  define __glibcxx_requires_cond(_Cond,_Msg)
00103 #  define __glibcxx_requires_valid_range(_First,_Last)
00104 #  define __glibcxx_requires_sorted(_First,_Last)
00105 #  define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)
00106 #  define __glibcxx_requires_partitioned(_First,_Last,_Value)
00107 #  define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred)
00108 #  define __glibcxx_requires_heap(_First,_Last)
00109 #  define __glibcxx_requires_heap_pred(_First,_Last,_Pred)
00110 #  define __glibcxx_requires_nonempty()
00111 #  define __glibcxx_requires_string(_String)
00112 #  define __glibcxx_requires_string_len(_String,_Len)
00113 #  define __glibcxx_requires_subscript(_N)
00114 #endif
00115 
00116 #endif