libstdc++
|
00001 // Debugging support implementation -*- C++ -*- 00002 00003 // Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 00004 // Free Software Foundation, Inc. 00005 // 00006 // This file is part of the GNU ISO C++ Library. This library is free 00007 // software; you can redistribute it and/or modify it under the 00008 // terms of the GNU General Public License as published by the 00009 // Free Software Foundation; either version 3, or (at your option) 00010 // any later version. 00011 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 00017 // Under Section 7 of GPL version 3, you are granted additional 00018 // permissions described in the GCC Runtime Library Exception, version 00019 // 3.1, as published by the Free Software Foundation. 00020 00021 // You should have received a copy of the GNU General Public License and 00022 // a copy of the GCC Runtime Library Exception along with this program; 00023 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00024 // <http://www.gnu.org/licenses/>. 00025 00026 /** @file debug/debug.h 00027 * This file is a GNU debug extension to the Standard C++ Library. 00028 */ 00029 00030 #ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H 00031 #define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1 00032 00033 /** Macros and namespaces used by the implementation outside of debug 00034 * wrappers to verify certain properties. The __glibcxx_requires_xxx 00035 * macros are merely wrappers around the __glibcxx_check_xxx wrappers 00036 * when we are compiling with debug mode, but disappear when we are 00037 * in release mode so that there is no checking performed in, e.g., 00038 * the standard library algorithms. 00039 */ 00040 00041 // Debug mode namespaces. 00042 00043 /** 00044 * @namespace std::__debug 00045 * @brief GNU debug code, replaces standard behavior with debug behavior. 00046 */ 00047 namespace std 00048 { 00049 namespace __debug { } 00050 } 00051 00052 /** @namespace __gnu_debug 00053 * @brief GNU debug classes for public use. 00054 */ 00055 namespace __gnu_debug 00056 { 00057 using namespace std::__debug; 00058 } 00059 00060 #ifndef _GLIBCXX_DEBUG 00061 00062 # define _GLIBCXX_DEBUG_ASSERT(_Condition) 00063 # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) 00064 # define _GLIBCXX_DEBUG_ONLY(_Statement) ; 00065 # define __glibcxx_requires_cond(_Cond,_Msg) 00066 # define __glibcxx_requires_valid_range(_First,_Last) 00067 # define __glibcxx_requires_non_empty_range(_First,_Last) 00068 # define __glibcxx_requires_sorted(_First,_Last) 00069 # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) 00070 # define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) 00071 # define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) 00072 # define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) 00073 # define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) 00074 # define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) 00075 # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) 00076 # define __glibcxx_requires_heap(_First,_Last) 00077 # define __glibcxx_requires_heap_pred(_First,_Last,_Pred) 00078 # define __glibcxx_requires_nonempty() 00079 # define __glibcxx_requires_string(_String) 00080 # define __glibcxx_requires_string_len(_String,_Len) 00081 # define __glibcxx_requires_subscript(_N) 00082 00083 #else 00084 00085 # include <debug/macros.h> 00086 00087 #define _GLIBCXX_DEBUG_ASSERT(_Condition) __glibcxx_assert(_Condition) 00088 00089 #ifdef _GLIBCXX_DEBUG_PEDANTIC 00090 # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition) 00091 #else 00092 # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) 00093 #endif 00094 00095 # define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement 00096 00097 # define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg) 00098 # define __glibcxx_requires_valid_range(_First,_Last) \ 00099 __glibcxx_check_valid_range(_First,_Last) 00100 # define __glibcxx_requires_non_empty_range(_First,_Last) \ 00101 __glibcxx_check_non_empty_range(_First,_Last) 00102 # define __glibcxx_requires_sorted(_First,_Last) \ 00103 __glibcxx_check_sorted(_First,_Last) 00104 # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \ 00105 __glibcxx_check_sorted_pred(_First,_Last,_Pred) 00106 # define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) \ 00107 __glibcxx_check_sorted_set(_First1,_Last1,_First2) 00108 # define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ 00109 __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) 00110 # define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) \ 00111 __glibcxx_check_partitioned_lower(_First,_Last,_Value) 00112 # define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) \ 00113 __glibcxx_check_partitioned_upper(_First,_Last,_Value) 00114 # define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ 00115 __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) 00116 # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ 00117 __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) 00118 # define __glibcxx_requires_heap(_First,_Last) \ 00119 __glibcxx_check_heap(_First,_Last) 00120 # define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \ 00121 __glibcxx_check_heap_pred(_First,_Last,_Pred) 00122 # define __glibcxx_requires_nonempty() __glibcxx_check_nonempty() 00123 # define __glibcxx_requires_string(_String) __glibcxx_check_string(_String) 00124 # define __glibcxx_requires_string_len(_String,_Len) \ 00125 __glibcxx_check_string_len(_String,_Len) 00126 # define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N) 00127 00128 # include <debug/functions.h> 00129 00130 #endif 00131 00132 #endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H