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