1*e4b17023SJohn Marino // Debugging support implementation -*- C++ -*- 2*e4b17023SJohn Marino 3*e4b17023SJohn Marino // Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 4*e4b17023SJohn Marino // Free Software Foundation, Inc. 5*e4b17023SJohn Marino // 6*e4b17023SJohn Marino // This file is part of the GNU ISO C++ Library. This library is free 7*e4b17023SJohn Marino // software; you can redistribute it and/or modify it under the 8*e4b17023SJohn Marino // terms of the GNU General Public License as published by the 9*e4b17023SJohn Marino // Free Software Foundation; either version 3, or (at your option) 10*e4b17023SJohn Marino // any later version. 11*e4b17023SJohn Marino 12*e4b17023SJohn Marino // This library is distributed in the hope that it will be useful, 13*e4b17023SJohn Marino // but WITHOUT ANY WARRANTY; without even the implied warranty of 14*e4b17023SJohn Marino // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*e4b17023SJohn Marino // GNU General Public License for more details. 16*e4b17023SJohn Marino 17*e4b17023SJohn Marino // Under Section 7 of GPL version 3, you are granted additional 18*e4b17023SJohn Marino // permissions described in the GCC Runtime Library Exception, version 19*e4b17023SJohn Marino // 3.1, as published by the Free Software Foundation. 20*e4b17023SJohn Marino 21*e4b17023SJohn Marino // You should have received a copy of the GNU General Public License and 22*e4b17023SJohn Marino // a copy of the GCC Runtime Library Exception along with this program; 23*e4b17023SJohn Marino // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24*e4b17023SJohn Marino // <http://www.gnu.org/licenses/>. 25*e4b17023SJohn Marino 26*e4b17023SJohn Marino /** @file debug/macros.h 27*e4b17023SJohn Marino * This file is a GNU debug extension to the Standard C++ Library. 28*e4b17023SJohn Marino */ 29*e4b17023SJohn Marino 30*e4b17023SJohn Marino #ifndef _GLIBCXX_DEBUG_MACROS_H 31*e4b17023SJohn Marino #define _GLIBCXX_DEBUG_MACROS_H 1 32*e4b17023SJohn Marino 33*e4b17023SJohn Marino /** 34*e4b17023SJohn Marino * Macros used by the implementation to verify certain 35*e4b17023SJohn Marino * properties. These macros may only be used directly by the debug 36*e4b17023SJohn Marino * wrappers. Note that these are macros (instead of the more obviously 37*e4b17023SJohn Marino * @a correct choice of making them functions) because we need line and 38*e4b17023SJohn Marino * file information at the call site, to minimize the distance between 39*e4b17023SJohn Marino * the user error and where the error is reported. 40*e4b17023SJohn Marino * 41*e4b17023SJohn Marino */ 42*e4b17023SJohn Marino #define _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,_File,_Line) \ 43*e4b17023SJohn Marino do \ 44*e4b17023SJohn Marino { \ 45*e4b17023SJohn Marino if (! (_Condition)) \ 46*e4b17023SJohn Marino __gnu_debug::_Error_formatter::_M_at(_File, _Line) \ 47*e4b17023SJohn Marino ._ErrorMessage._M_error(); \ 48*e4b17023SJohn Marino } while (false) 49*e4b17023SJohn Marino 50*e4b17023SJohn Marino #define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage) \ 51*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,__FILE__,__LINE__) 52*e4b17023SJohn Marino 53*e4b17023SJohn Marino // Verify that [_First, _Last) forms a valid iterator range. 54*e4b17023SJohn Marino #define __glibcxx_check_valid_range(_First,_Last) \ 55*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \ 56*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_valid_range) \ 57*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 58*e4b17023SJohn Marino ._M_iterator(_Last, #_Last)) 59*e4b17023SJohn Marino 60*e4b17023SJohn Marino // Verify that [_First, _Last) forms a non-empty iterator range. 61*e4b17023SJohn Marino #define __glibcxx_check_non_empty_range(_First,_Last) \ 62*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_First != _Last, \ 63*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_non_empty_range) \ 64*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 65*e4b17023SJohn Marino ._M_iterator(_Last, #_Last)) 66*e4b17023SJohn Marino 67*e4b17023SJohn Marino /** Verify that we can insert into *this with the iterator _Position. 68*e4b17023SJohn Marino * Insertion into a container at a specific position requires that 69*e4b17023SJohn Marino * the iterator be nonsingular, either dereferenceable or past-the-end, 70*e4b17023SJohn Marino * and that it reference the sequence we are inserting into. Note that 71*e4b17023SJohn Marino * this macro is only valid when the container is a_Safe_sequence and 72*e4b17023SJohn Marino * the iterator is a _Safe_iterator. 73*e4b17023SJohn Marino */ 74*e4b17023SJohn Marino #define __glibcxx_check_insert(_Position) \ 75*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \ 76*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_insert_singular) \ 77*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 78*e4b17023SJohn Marino ._M_iterator(_Position, #_Position)); \ 79*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ 80*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_insert_different) \ 81*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 82*e4b17023SJohn Marino ._M_iterator(_Position, #_Position)) 83*e4b17023SJohn Marino 84*e4b17023SJohn Marino /** Verify that we can insert into *this after the iterator _Position. 85*e4b17023SJohn Marino * Insertion into a container after a specific position requires that 86*e4b17023SJohn Marino * the iterator be nonsingular, either dereferenceable or before-begin, 87*e4b17023SJohn Marino * and that it reference the sequence we are inserting into. Note that 88*e4b17023SJohn Marino * this macro is only valid when the container is a_Safe_sequence and 89*e4b17023SJohn Marino * the iterator is a _Safe_iterator. 90*e4b17023SJohn Marino */ 91*e4b17023SJohn Marino #define __glibcxx_check_insert_after(_Position) \ 92*e4b17023SJohn Marino __glibcxx_check_insert(_Position); \ 93*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(!_Position._M_is_end(), \ 94*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_insert_after_end) \ 95*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 96*e4b17023SJohn Marino ._M_iterator(_Position, #_Position)) 97*e4b17023SJohn Marino 98*e4b17023SJohn Marino /** Verify that we can insert the values in the iterator range 99*e4b17023SJohn Marino * [_First, _Last) into *this with the iterator _Position. Insertion 100*e4b17023SJohn Marino * into a container at a specific position requires that the iterator 101*e4b17023SJohn Marino * be nonsingular (i.e., either dereferenceable or past-the-end), 102*e4b17023SJohn Marino * that it reference the sequence we are inserting into, and that the 103*e4b17023SJohn Marino * iterator range [_First, Last) is a valid (possibly empty) 104*e4b17023SJohn Marino * range. Note that this macro is only valid when the container is a 105*e4b17023SJohn Marino * _Safe_sequence and the iterator is a _Safe_iterator. 106*e4b17023SJohn Marino * 107*e4b17023SJohn Marino * @todo We would like to be able to check for noninterference of 108*e4b17023SJohn Marino * _Position and the range [_First, _Last), but that can't (in 109*e4b17023SJohn Marino * general) be done. 110*e4b17023SJohn Marino */ 111*e4b17023SJohn Marino #define __glibcxx_check_insert_range(_Position,_First,_Last) \ 112*e4b17023SJohn Marino __glibcxx_check_valid_range(_First,_Last); \ 113*e4b17023SJohn Marino __glibcxx_check_insert(_Position) 114*e4b17023SJohn Marino 115*e4b17023SJohn Marino /** Verify that we can insert the values in the iterator range 116*e4b17023SJohn Marino * [_First, _Last) into *this after the iterator _Position. Insertion 117*e4b17023SJohn Marino * into a container after a specific position requires that the iterator 118*e4b17023SJohn Marino * be nonsingular (i.e., either dereferenceable or past-the-end), 119*e4b17023SJohn Marino * that it reference the sequence we are inserting into, and that the 120*e4b17023SJohn Marino * iterator range [_First, Last) is a valid (possibly empty) 121*e4b17023SJohn Marino * range. Note that this macro is only valid when the container is a 122*e4b17023SJohn Marino * _Safe_sequence and the iterator is a _Safe_iterator. 123*e4b17023SJohn Marino * 124*e4b17023SJohn Marino * @todo We would like to be able to check for noninterference of 125*e4b17023SJohn Marino * _Position and the range [_First, _Last), but that can't (in 126*e4b17023SJohn Marino * general) be done. 127*e4b17023SJohn Marino */ 128*e4b17023SJohn Marino #define __glibcxx_check_insert_range_after(_Position,_First,_Last) \ 129*e4b17023SJohn Marino __glibcxx_check_valid_range(_First,_Last); \ 130*e4b17023SJohn Marino __glibcxx_check_insert_after(_Position) 131*e4b17023SJohn Marino 132*e4b17023SJohn Marino /** Verify that we can erase the element referenced by the iterator 133*e4b17023SJohn Marino * _Position. We can erase the element if the _Position iterator is 134*e4b17023SJohn Marino * dereferenceable and references this sequence. 135*e4b17023SJohn Marino */ 136*e4b17023SJohn Marino #define __glibcxx_check_erase(_Position) \ 137*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(), \ 138*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_erase_bad) \ 139*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 140*e4b17023SJohn Marino ._M_iterator(_Position, #_Position)); \ 141*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ 142*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_erase_different) \ 143*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 144*e4b17023SJohn Marino ._M_iterator(_Position, #_Position)) 145*e4b17023SJohn Marino 146*e4b17023SJohn Marino /** Verify that we can erase the element after the iterator 147*e4b17023SJohn Marino * _Position. We can erase the element if the _Position iterator is 148*e4b17023SJohn Marino * before a dereferenceable one and references this sequence. 149*e4b17023SJohn Marino */ 150*e4b17023SJohn Marino #define __glibcxx_check_erase_after(_Position) \ 151*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_Position._M_before_dereferenceable(), \ 152*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_erase_after_bad) \ 153*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 154*e4b17023SJohn Marino ._M_iterator(_Position, #_Position)); \ 155*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ 156*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_erase_different) \ 157*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 158*e4b17023SJohn Marino ._M_iterator(_Position, #_Position)) 159*e4b17023SJohn Marino 160*e4b17023SJohn Marino /** Verify that we can erase the elements in the iterator range 161*e4b17023SJohn Marino * [_First, _Last). We can erase the elements if [_First, _Last) is a 162*e4b17023SJohn Marino * valid iterator range within this sequence. 163*e4b17023SJohn Marino */ 164*e4b17023SJohn Marino #define __glibcxx_check_erase_range(_First,_Last) \ 165*e4b17023SJohn Marino __glibcxx_check_valid_range(_First,_Last); \ 166*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ 167*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_erase_different) \ 168*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 169*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 170*e4b17023SJohn Marino ._M_iterator(_Last, #_Last)) 171*e4b17023SJohn Marino 172*e4b17023SJohn Marino /** Verify that we can erase the elements in the iterator range 173*e4b17023SJohn Marino * (_First, _Last). We can erase the elements if (_First, _Last) is a 174*e4b17023SJohn Marino * valid iterator range within this sequence. 175*e4b17023SJohn Marino */ 176*e4b17023SJohn Marino #define __glibcxx_check_erase_range_after(_First,_Last) \ 177*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_First._M_can_compare(_Last), \ 178*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_erase_different) \ 179*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 180*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 181*e4b17023SJohn Marino ._M_iterator(_Last, #_Last)); \ 182*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ 183*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_erase_different) \ 184*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 185*e4b17023SJohn Marino ._M_iterator(_First, #_First)); \ 186*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_First != _Last, \ 187*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_valid_range2) \ 188*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 189*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 190*e4b17023SJohn Marino ._M_iterator(_Last, #_Last)); \ 191*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_First._M_incrementable(), \ 192*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_valid_range2) \ 193*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 194*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 195*e4b17023SJohn Marino ._M_iterator(_Last, #_Last)); \ 196*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(!_Last._M_is_before_begin(), \ 197*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_valid_range2) \ 198*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 199*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 200*e4b17023SJohn Marino ._M_iterator(_Last, #_Last)) \ 201*e4b17023SJohn Marino 202*e4b17023SJohn Marino // Verify that the subscript _N is less than the container's size. 203*e4b17023SJohn Marino #define __glibcxx_check_subscript(_N) \ 204*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(_N < this->size(), \ 205*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_subscript_oob) \ 206*e4b17023SJohn Marino ._M_sequence(*this, "this") \ 207*e4b17023SJohn Marino ._M_integer(_N, #_N) \ 208*e4b17023SJohn Marino ._M_integer(this->size(), "size")) 209*e4b17023SJohn Marino 210*e4b17023SJohn Marino // Verify that the container is nonempty 211*e4b17023SJohn Marino #define __glibcxx_check_nonempty() \ 212*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(! this->empty(), \ 213*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_empty) \ 214*e4b17023SJohn Marino ._M_sequence(*this, "this")) 215*e4b17023SJohn Marino 216*e4b17023SJohn Marino // Verify that the iterator range [_First, _Last) is sorted 217*e4b17023SJohn Marino #define __glibcxx_check_sorted(_First,_Last) \ 218*e4b17023SJohn Marino __glibcxx_check_valid_range(_First,_Last); \ 219*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last), \ 220*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_unsorted) \ 221*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 222*e4b17023SJohn Marino ._M_iterator(_Last, #_Last)) 223*e4b17023SJohn Marino 224*e4b17023SJohn Marino /** Verify that the iterator range [_First, _Last) is sorted by the 225*e4b17023SJohn Marino predicate _Pred. */ 226*e4b17023SJohn Marino #define __glibcxx_check_sorted_pred(_First,_Last,_Pred) \ 227*e4b17023SJohn Marino __glibcxx_check_valid_range(_First,_Last); \ 228*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last, _Pred), \ 229*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_unsorted_pred) \ 230*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 231*e4b17023SJohn Marino ._M_iterator(_Last, #_Last) \ 232*e4b17023SJohn Marino ._M_string(#_Pred)) 233*e4b17023SJohn Marino 234*e4b17023SJohn Marino // Special variant for std::merge, std::includes, std::set_* 235*e4b17023SJohn Marino #define __glibcxx_check_sorted_set(_First1,_Last1,_First2) \ 236*e4b17023SJohn Marino __glibcxx_check_valid_range(_First1,_Last1); \ 237*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY( \ 238*e4b17023SJohn Marino __gnu_debug::__check_sorted_set(_First1, _Last1, _First2), \ 239*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_unsorted) \ 240*e4b17023SJohn Marino ._M_iterator(_First1, #_First1) \ 241*e4b17023SJohn Marino ._M_iterator(_Last1, #_Last1)) 242*e4b17023SJohn Marino 243*e4b17023SJohn Marino // Likewise with a _Pred. 244*e4b17023SJohn Marino #define __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ 245*e4b17023SJohn Marino __glibcxx_check_valid_range(_First1,_Last1); \ 246*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY( \ 247*e4b17023SJohn Marino __gnu_debug::__check_sorted_set(_First1, _Last1, _First2, _Pred), \ 248*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_unsorted_pred) \ 249*e4b17023SJohn Marino ._M_iterator(_First1, #_First1) \ 250*e4b17023SJohn Marino ._M_iterator(_Last1, #_Last1) \ 251*e4b17023SJohn Marino ._M_string(#_Pred)) 252*e4b17023SJohn Marino 253*e4b17023SJohn Marino /** Verify that the iterator range [_First, _Last) is partitioned 254*e4b17023SJohn Marino w.r.t. the value _Value. */ 255*e4b17023SJohn Marino #define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ 256*e4b17023SJohn Marino __glibcxx_check_valid_range(_First,_Last); \ 257*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ 258*e4b17023SJohn Marino _Value), \ 259*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_unpartitioned) \ 260*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 261*e4b17023SJohn Marino ._M_iterator(_Last, #_Last) \ 262*e4b17023SJohn Marino ._M_string(#_Value)) 263*e4b17023SJohn Marino 264*e4b17023SJohn Marino #define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ 265*e4b17023SJohn Marino __glibcxx_check_valid_range(_First,_Last); \ 266*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ 267*e4b17023SJohn Marino _Value), \ 268*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_unpartitioned) \ 269*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 270*e4b17023SJohn Marino ._M_iterator(_Last, #_Last) \ 271*e4b17023SJohn Marino ._M_string(#_Value)) 272*e4b17023SJohn Marino 273*e4b17023SJohn Marino /** Verify that the iterator range [_First, _Last) is partitioned 274*e4b17023SJohn Marino w.r.t. the value _Value and predicate _Pred. */ 275*e4b17023SJohn Marino #define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ 276*e4b17023SJohn Marino __glibcxx_check_valid_range(_First,_Last); \ 277*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ 278*e4b17023SJohn Marino _Value, _Pred), \ 279*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_unpartitioned_pred) \ 280*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 281*e4b17023SJohn Marino ._M_iterator(_Last, #_Last) \ 282*e4b17023SJohn Marino ._M_string(#_Pred) \ 283*e4b17023SJohn Marino ._M_string(#_Value)) 284*e4b17023SJohn Marino 285*e4b17023SJohn Marino /** Verify that the iterator range [_First, _Last) is partitioned 286*e4b17023SJohn Marino w.r.t. the value _Value and predicate _Pred. */ 287*e4b17023SJohn Marino #define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ 288*e4b17023SJohn Marino __glibcxx_check_valid_range(_First,_Last); \ 289*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ 290*e4b17023SJohn Marino _Value, _Pred), \ 291*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_unpartitioned_pred) \ 292*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 293*e4b17023SJohn Marino ._M_iterator(_Last, #_Last) \ 294*e4b17023SJohn Marino ._M_string(#_Pred) \ 295*e4b17023SJohn Marino ._M_string(#_Value)) 296*e4b17023SJohn Marino 297*e4b17023SJohn Marino // Verify that the iterator range [_First, _Last) is a heap 298*e4b17023SJohn Marino #define __glibcxx_check_heap(_First,_Last) \ 299*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last), \ 300*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_not_heap) \ 301*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 302*e4b17023SJohn Marino ._M_iterator(_Last, #_Last)) 303*e4b17023SJohn Marino 304*e4b17023SJohn Marino /** Verify that the iterator range [_First, _Last) is a heap 305*e4b17023SJohn Marino w.r.t. the predicate _Pred. */ 306*e4b17023SJohn Marino #define __glibcxx_check_heap_pred(_First,_Last,_Pred) \ 307*e4b17023SJohn Marino _GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last, _Pred), \ 308*e4b17023SJohn Marino _M_message(__gnu_debug::__msg_not_heap_pred) \ 309*e4b17023SJohn Marino ._M_iterator(_First, #_First) \ 310*e4b17023SJohn Marino ._M_iterator(_Last, #_Last) \ 311*e4b17023SJohn Marino ._M_string(#_Pred)) 312*e4b17023SJohn Marino 313*e4b17023SJohn Marino #ifdef _GLIBCXX_DEBUG_PEDANTIC 314*e4b17023SJohn Marino # define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_ASSERT(_String != 0) 315*e4b17023SJohn Marino # define __glibcxx_check_string_len(_String,_Len) \ 316*e4b17023SJohn Marino _GLIBCXX_DEBUG_ASSERT(_String != 0 || _Len == 0) 317*e4b17023SJohn Marino #else 318*e4b17023SJohn Marino # define __glibcxx_check_string(_String) 319*e4b17023SJohn Marino # define __glibcxx_check_string_len(_String,_Len) 320*e4b17023SJohn Marino #endif 321*e4b17023SJohn Marino 322*e4b17023SJohn Marino #endif 323