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
00032
00033
00034
00035 #ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H
00036 #define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 namespace std
00048 {
00049 namespace __debug { }
00050 }
00051
00052 namespace __gnu_cxx
00053 {
00054 namespace __debug { };
00055 }
00056
00057 namespace __gnu_debug
00058 {
00059 using namespace std::__debug;
00060 using namespace __gnu_cxx::__debug;
00061 }
00062
00063 #ifndef _GLIBCXX_DEBUG
00064
00065 # define _GLIBCXX_DEBUG_ASSERT(_Condition)
00066 # define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
00067 # define _GLIBCXX_DEBUG_ONLY(_Statement) ;
00068 # define __glibcxx_requires_cond(_Cond,_Msg)
00069 # define __glibcxx_requires_valid_range(_First,_Last)
00070 # define __glibcxx_requires_sorted(_First,_Last)
00071 # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)
00072 # define __glibcxx_requires_partitioned(_First,_Last,_Value)
00073 # define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred)
00074 # define __glibcxx_requires_heap(_First,_Last)
00075 # define __glibcxx_requires_heap_pred(_First,_Last,_Pred)
00076 # define __glibcxx_requires_nonempty()
00077 # define __glibcxx_requires_string(_String)
00078 # define __glibcxx_requires_string_len(_String,_Len)
00079 # define __glibcxx_requires_subscript(_N)
00080
00081 #else
00082
00083 # include <cstdlib>
00084 # include <cstdio>
00085 # include <debug/macros.h>
00086
00087 namespace std
00088 {
00089 namespace __debug
00090 {
00091
00092
00093 inline void
00094 __replacement_assert(const char* __file, int __line,
00095 const char* __function, const char* __condition)
00096 {
00097 printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
00098 __function, __condition);
00099 abort();
00100 }
00101 }
00102 }
00103
00104 #define _GLIBCXX_DEBUG_ASSERT(_Condition) \
00105 do \
00106 { \
00107 if (! (_Condition)) \
00108 std::__debug::__replacement_assert(__FILE__, __LINE__, \
00109 __PRETTY_FUNCTION__, #_Condition); \
00110 } while (false)
00111
00112 #ifdef _GLIBCXX_DEBUG_PEDANTIC
00113 # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)
00114 #else
00115 # define _GLIBCXX_DEBUG_PEDASSERT(_Condition)
00116 #endif
00117 # define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement
00118
00119 # define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg)
00120 # define __glibcxx_requires_valid_range(_First,_Last) \
00121 __glibcxx_check_valid_range(_First,_Last)
00122 # define __glibcxx_requires_sorted(_First,_Last) \
00123 __glibcxx_check_sorted(_First,_Last)
00124 # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \
00125 __glibcxx_check_sorted_pred(_First,_Last,_Pred)
00126 # define __glibcxx_requires_partitioned(_First,_Last,_Value) \
00127 __glibcxx_check_partitioned(_First,_Last,_Value)
00128 # define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred) \
00129 __glibcxx_check_partitioned_pred(_First,_Last,_Value,_Pred)
00130 # define __glibcxx_requires_heap(_First,_Last) \
00131 __glibcxx_check_heap(_First,_Last)
00132 # define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \
00133 __glibcxx_check_heap_pred(_First,_Last,_Pred)
00134 # define __glibcxx_requires_nonempty() __glibcxx_check_nonempty()
00135 # define __glibcxx_requires_string(_String) __glibcxx_check_string(_String)
00136 # define __glibcxx_requires_string_len(_String,_Len) \
00137 __glibcxx_check_string_len(_String,_Len)
00138 # define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N)
00139
00140 # include <debug/functions.h>
00141 # include <debug/formatter.h>
00142
00143 #endif
00144
00145 #endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H