1 // Debugging support implementation -*- C++ -*- 2 3 // Copyright (C) 2003-2020 Free Software Foundation, Inc. 4 // 5 // This file is part of the GNU ISO C++ Library. This library is free 6 // software; you can redistribute it and/or modify it under the 7 // terms of the GNU General Public License as published by the 8 // Free Software Foundation; either version 3, or (at your option) 9 // any later version. 10 11 // This library is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 16 // Under Section 7 of GPL version 3, you are granted additional 17 // permissions described in the GCC Runtime Library Exception, version 18 // 3.1, as published by the Free Software Foundation. 19 20 // You should have received a copy of the GNU General Public License and 21 // a copy of the GCC Runtime Library Exception along with this program; 22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 // <http://www.gnu.org/licenses/>. 24 25 /** @file debug/macros.h 26 * This file is a GNU debug extension to the Standard C++ Library. 27 */ 28 29 #ifndef _GLIBCXX_DEBUG_MACROS_H 30 #define _GLIBCXX_DEBUG_MACROS_H 1 31 32 /** 33 * Macros used by the implementation to verify certain 34 * properties. These macros may only be used directly by the debug 35 * wrappers. Note that these are macros (instead of the more obviously 36 * @a correct choice of making them functions) because we need line and 37 * file information at the call site, to minimize the distance between 38 * the user error and where the error is reported. 39 * 40 */ 41 #if 0 /* defined _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED */ 42 # define _GLIBCXX_DEBUG_VERIFY_COND_AT(_Cond,_ErrMsg,_File,_Line,_Func) \ 43 if (__builtin_is_constant_evaluated()) \ 44 /* FIXME: Compilation error here when !_Cond. */ \ 45 break; \ 46 if (! (_Cond)) \ 47 __gnu_debug::_Error_formatter::_S_at(_File, _Line, _Func) \ 48 ._ErrMsg._M_error() 49 #else 50 # define _GLIBCXX_DEBUG_VERIFY_COND_AT(_Cond,_ErrMsg,_File,_Line,_Func) \ 51 if (! (_Cond)) \ 52 __gnu_debug::_Error_formatter::_S_at(_File, _Line, _Func) \ 53 ._ErrMsg._M_error() 54 #endif 55 56 #define _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond,_ErrMsg,_File,_Line,_Func) \ 57 do \ 58 { \ 59 _GLIBCXX_DEBUG_VERIFY_COND_AT(_Cond,_ErrMsg,_File,_Line,_Func); \ 60 } while (false) 61 62 #define _GLIBCXX_DEBUG_VERIFY_AT(_Cond,_ErrMsg,_File,_Line) \ 63 _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond,_ErrMsg,_File,_Line,__PRETTY_FUNCTION__) 64 65 #define _GLIBCXX_DEBUG_VERIFY(_Cond,_ErrMsg) \ 66 _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond, _ErrMsg, __FILE__, __LINE__, \ 67 __PRETTY_FUNCTION__) 68 69 // Verify that [_First, _Last) forms a valid iterator range. 70 #define __glibcxx_check_valid_range(_First,_Last) \ 71 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \ 72 _M_message(__gnu_debug::__msg_valid_range) \ 73 ._M_iterator(_First, #_First) \ 74 ._M_iterator(_Last, #_Last)) 75 76 #define __glibcxx_check_valid_range_at(_First,_Last,_File,_Line,_Func) \ 77 _GLIBCXX_DEBUG_VERIFY_AT_F(__gnu_debug::__valid_range(_First, _Last), \ 78 _M_message(__gnu_debug::__msg_valid_range) \ 79 ._M_iterator(_First, #_First) \ 80 ._M_iterator(_Last, #_Last), \ 81 _File,_Line,_Func) 82 83 #define __glibcxx_check_valid_range2(_First,_Last,_Dist) \ 84 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last, _Dist), \ 85 _M_message(__gnu_debug::__msg_valid_range) \ 86 ._M_iterator(_First, #_First) \ 87 ._M_iterator(_Last, #_Last)) 88 89 #define __glibcxx_check_valid_constructor_range(_First,_Last) \ 90 __gnu_debug::__check_valid_range(_First, _Last, \ 91 __FILE__, __LINE__, __PRETTY_FUNCTION__) 92 93 // Verify that [_First, _Last) forms a non-empty iterator range. 94 #define __glibcxx_check_non_empty_range(_First,_Last) \ 95 _GLIBCXX_DEBUG_VERIFY(_First != _Last, \ 96 _M_message(__gnu_debug::__msg_non_empty_range) \ 97 ._M_iterator(_First, #_First) \ 98 ._M_iterator(_Last, #_Last)) 99 100 // Verify that [_First, _First + _Size) forms a valid range. 101 #define __glibcxx_check_can_increment(_First,_Size) \ 102 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__can_advance(_First, _Size), \ 103 _M_message(__gnu_debug::__msg_iter_subscript_oob) \ 104 ._M_iterator(_First, #_First) \ 105 ._M_integer(_Size, #_Size)) 106 107 #define __glibcxx_check_can_increment_range(_First1,_Last1,_First2) \ 108 do \ 109 { \ 110 typename __gnu_debug::_Distance_traits<__decltype(_First1)>::__type __dist;\ 111 _GLIBCXX_DEBUG_VERIFY_COND_AT( \ 112 __gnu_debug::__valid_range(_First1, _Last1, __dist),\ 113 _M_message(__gnu_debug::__msg_valid_range) \ 114 ._M_iterator(_First1, #_First1) \ 115 ._M_iterator(_Last1, #_Last1), \ 116 __FILE__,__LINE__,__PRETTY_FUNCTION__); \ 117 _GLIBCXX_DEBUG_VERIFY_COND_AT( \ 118 __gnu_debug::__can_advance(_First2, __dist.first),\ 119 _M_message(__gnu_debug::__msg_iter_subscript_oob)\ 120 ._M_iterator(_First2, #_First2) \ 121 ._M_integer(__dist.first), \ 122 __FILE__,__LINE__,__PRETTY_FUNCTION__); \ 123 } while(false) 124 125 #define __glibcxx_check_can_decrement_range(_First1,_Last1,_First2) \ 126 do \ 127 { \ 128 typename __gnu_debug::_Distance_traits<__decltype(_First1)>::__type __dist;\ 129 _GLIBCXX_DEBUG_VERIFY_COND_AT( \ 130 __gnu_debug::__valid_range(_First1, _Last1, __dist),\ 131 _M_message(__gnu_debug::__msg_valid_range) \ 132 ._M_iterator(_First1, #_First1) \ 133 ._M_iterator(_Last1, #_Last1), \ 134 __FILE__,__LINE__,__PRETTY_FUNCTION__); \ 135 _GLIBCXX_DEBUG_VERIFY_COND_AT( \ 136 __gnu_debug::__can_advance(_First2, -__dist.first),\ 137 _M_message(__gnu_debug::__msg_iter_subscript_oob)\ 138 ._M_iterator(_First2, #_First2) \ 139 ._M_integer(-__dist.first), \ 140 __FILE__,__LINE__,__PRETTY_FUNCTION__); \ 141 } while(false) 142 143 /** Verify that we can insert into *this with the iterator _Position. 144 * Insertion into a container at a specific position requires that 145 * the iterator be nonsingular, either dereferenceable or past-the-end, 146 * and that it reference the sequence we are inserting into. Note that 147 * this macro is only valid when the container is a_Safe_sequence and 148 * the iterator is a _Safe_iterator. 149 */ 150 #define __glibcxx_check_insert(_Position) \ 151 _GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \ 152 _M_message(__gnu_debug::__msg_insert_singular) \ 153 ._M_sequence(*this, "this") \ 154 ._M_iterator(_Position, #_Position)); \ 155 _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ 156 _M_message(__gnu_debug::__msg_insert_different) \ 157 ._M_sequence(*this, "this") \ 158 ._M_iterator(_Position, #_Position)) 159 160 /** Verify that we can insert into *this after the iterator _Position. 161 * Insertion into a container after a specific position requires that 162 * the iterator be nonsingular, either dereferenceable or before-begin, 163 * and that it reference the sequence we are inserting into. Note that 164 * this macro is only valid when the container is a_Safe_sequence and 165 * the iterator is a _Safe_iterator. 166 */ 167 #define __glibcxx_check_insert_after(_Position) \ 168 __glibcxx_check_insert(_Position); \ 169 _GLIBCXX_DEBUG_VERIFY(!_Position._M_is_end(), \ 170 _M_message(__gnu_debug::__msg_insert_after_end) \ 171 ._M_sequence(*this, "this") \ 172 ._M_iterator(_Position, #_Position)) 173 174 /** Verify that we can insert the values in the iterator range 175 * [_First, _Last) into *this with the iterator _Position. Insertion 176 * into a container at a specific position requires that the iterator 177 * be nonsingular (i.e., either dereferenceable or past-the-end), 178 * that it reference the sequence we are inserting into, and that the 179 * iterator range [_First, _Last) is a valid (possibly empty) 180 * range which does not reference the sequence we are inserting into. 181 * Note that this macro is only valid when the container is a 182 * _Safe_sequence and the _Position iterator is a _Safe_iterator. 183 */ 184 #define __glibcxx_check_insert_range(_Position,_First,_Last,_Dist) \ 185 __glibcxx_check_valid_range2(_First,_Last,_Dist); \ 186 __glibcxx_check_insert(_Position); \ 187 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\ 188 _M_message(__gnu_debug::__msg_insert_range_from_self)\ 189 ._M_iterator(_First, #_First) \ 190 ._M_iterator(_Last, #_Last) \ 191 ._M_sequence(*this, "this")) 192 193 /** Verify that we can insert the values in the iterator range 194 * [_First, _Last) into *this after the iterator _Position. Insertion 195 * into a container after a specific position requires that the iterator 196 * be nonsingular (i.e., either dereferenceable or past-the-end), 197 * that it reference the sequence we are inserting into, and that the 198 * iterator range [_First, _Last) is a valid (possibly empty) 199 * range which does not reference the sequence we are inserting into. 200 * Note that this macro is only valid when the container is a 201 * _Safe_sequence and the _Position iterator is a _Safe_iterator. 202 */ 203 #define __glibcxx_check_insert_range_after(_Position,_First,_Last,_Dist)\ 204 __glibcxx_check_valid_range2(_First,_Last,_Dist); \ 205 __glibcxx_check_insert_after(_Position); \ 206 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\ 207 _M_message(__gnu_debug::__msg_insert_range_from_self)\ 208 ._M_iterator(_First, #_First) \ 209 ._M_iterator(_Last, #_Last) \ 210 ._M_sequence(*this, "this")) 211 212 /** Verify that we can erase the element referenced by the iterator 213 * _Position. We can erase the element if the _Position iterator is 214 * dereferenceable and references this sequence. 215 */ 216 #define __glibcxx_check_erase(_Position) \ 217 _GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(), \ 218 _M_message(__gnu_debug::__msg_erase_bad) \ 219 ._M_sequence(*this, "this") \ 220 ._M_iterator(_Position, #_Position)); \ 221 _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ 222 _M_message(__gnu_debug::__msg_erase_different) \ 223 ._M_sequence(*this, "this") \ 224 ._M_iterator(_Position, #_Position)) 225 226 /** Verify that we can erase the element after the iterator 227 * _Position. We can erase the element if the _Position iterator is 228 * before a dereferenceable one and references this sequence. 229 */ 230 #define __glibcxx_check_erase_after(_Position) \ 231 _GLIBCXX_DEBUG_VERIFY(_Position._M_before_dereferenceable(), \ 232 _M_message(__gnu_debug::__msg_erase_after_bad) \ 233 ._M_sequence(*this, "this") \ 234 ._M_iterator(_Position, #_Position)); \ 235 _GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ 236 _M_message(__gnu_debug::__msg_erase_different) \ 237 ._M_sequence(*this, "this") \ 238 ._M_iterator(_Position, #_Position)) 239 240 /** Verify that we can erase the elements in the iterator range 241 * [_First, _Last). We can erase the elements if [_First, _Last) is a 242 * valid iterator range within this sequence. 243 */ 244 #define __glibcxx_check_erase_range(_First,_Last) \ 245 __glibcxx_check_valid_range(_First,_Last); \ 246 _GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ 247 _M_message(__gnu_debug::__msg_erase_different) \ 248 ._M_sequence(*this, "this") \ 249 ._M_iterator(_First, #_First) \ 250 ._M_iterator(_Last, #_Last)) 251 252 /** Verify that we can erase the elements in the iterator range 253 * (_First, _Last). We can erase the elements if (_First, _Last) is a 254 * valid iterator range within this sequence. 255 */ 256 #define __glibcxx_check_erase_range_after(_First,_Last) \ 257 _GLIBCXX_DEBUG_VERIFY(_First._M_can_compare(_Last), \ 258 _M_message(__gnu_debug::__msg_erase_different) \ 259 ._M_sequence(*this, "this") \ 260 ._M_iterator(_First, #_First) \ 261 ._M_iterator(_Last, #_Last)); \ 262 _GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ 263 _M_message(__gnu_debug::__msg_erase_different) \ 264 ._M_sequence(*this, "this") \ 265 ._M_iterator(_First, #_First)); \ 266 _GLIBCXX_DEBUG_VERIFY(_First != _Last, \ 267 _M_message(__gnu_debug::__msg_valid_range2) \ 268 ._M_sequence(*this, "this") \ 269 ._M_iterator(_First, #_First) \ 270 ._M_iterator(_Last, #_Last)); \ 271 _GLIBCXX_DEBUG_VERIFY(_First._M_incrementable(), \ 272 _M_message(__gnu_debug::__msg_valid_range2) \ 273 ._M_sequence(*this, "this") \ 274 ._M_iterator(_First, #_First) \ 275 ._M_iterator(_Last, #_Last)); \ 276 _GLIBCXX_DEBUG_VERIFY(!_Last._M_is_before_begin(), \ 277 _M_message(__gnu_debug::__msg_valid_range2) \ 278 ._M_sequence(*this, "this") \ 279 ._M_iterator(_First, #_First) \ 280 ._M_iterator(_Last, #_Last)) \ 281 282 // Verify that the subscript _N is less than the container's size. 283 #define __glibcxx_check_subscript(_N) \ 284 _GLIBCXX_DEBUG_VERIFY(_N < this->size(), \ 285 _M_message(__gnu_debug::__msg_subscript_oob) \ 286 ._M_sequence(*this, "this") \ 287 ._M_integer(_N, #_N) \ 288 ._M_integer(this->size(), "size")) 289 290 // Verify that the bucket _N is less than the container's buckets count. 291 #define __glibcxx_check_bucket_index(_N) \ 292 _GLIBCXX_DEBUG_VERIFY(_N < this->bucket_count(), \ 293 _M_message(__gnu_debug::__msg_bucket_index_oob) \ 294 ._M_sequence(*this, "this") \ 295 ._M_integer(_N, #_N) \ 296 ._M_integer(this->bucket_count(), "size")) 297 298 // Verify that the container is nonempty 299 #define __glibcxx_check_nonempty() \ 300 _GLIBCXX_DEBUG_VERIFY(! this->empty(), \ 301 _M_message(__gnu_debug::__msg_empty) \ 302 ._M_sequence(*this, "this")) 303 304 // Verify that a predicate is irreflexive 305 #define __glibcxx_check_irreflexive(_First,_Last) \ 306 _GLIBCXX_DEBUG_VERIFY(_First == _Last || !(*_First < *_First), \ 307 _M_message(__gnu_debug::__msg_irreflexive_ordering) \ 308 ._M_iterator_value_type(_First, "< operator type")) 309 310 #if __cplusplus >= 201103L 311 # define __glibcxx_check_irreflexive2(_First,_Last) \ 312 _GLIBCXX_DEBUG_VERIFY(_First == _Last \ 313 || __gnu_debug::__is_irreflexive(_First), \ 314 _M_message(__gnu_debug::__msg_irreflexive_ordering) \ 315 ._M_iterator_value_type(_First, "< operator type")) 316 #else 317 # define __glibcxx_check_irreflexive2(_First,_Last) 318 #endif 319 320 #define __glibcxx_check_irreflexive_pred(_First,_Last,_Pred) \ 321 _GLIBCXX_DEBUG_VERIFY(_First == _Last || !_Pred(*_First, *_First), \ 322 _M_message(__gnu_debug::__msg_irreflexive_ordering) \ 323 ._M_instance(_Pred, "functor") \ 324 ._M_iterator_value_type(_First, "ordered type")) 325 326 #if __cplusplus >= 201103L 327 # define __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) \ 328 _GLIBCXX_DEBUG_VERIFY(_First == _Last \ 329 ||__gnu_debug::__is_irreflexive_pred(_First, _Pred), \ 330 _M_message(__gnu_debug::__msg_irreflexive_ordering) \ 331 ._M_instance(_Pred, "functor") \ 332 ._M_iterator_value_type(_First, "ordered type")) 333 #else 334 # define __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) 335 #endif 336 337 // Verify that the iterator range [_First, _Last) is sorted 338 #define __glibcxx_check_sorted(_First,_Last) \ 339 __glibcxx_check_valid_range(_First,_Last); \ 340 __glibcxx_check_irreflexive(_First,_Last); \ 341 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \ 342 __gnu_debug::__base(_First), \ 343 __gnu_debug::__base(_Last)), \ 344 _M_message(__gnu_debug::__msg_unsorted) \ 345 ._M_iterator(_First, #_First) \ 346 ._M_iterator(_Last, #_Last)) 347 348 /** Verify that the iterator range [_First, _Last) is sorted by the 349 predicate _Pred. */ 350 #define __glibcxx_check_sorted_pred(_First,_Last,_Pred) \ 351 __glibcxx_check_valid_range(_First,_Last); \ 352 __glibcxx_check_irreflexive_pred(_First,_Last,_Pred); \ 353 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \ 354 __gnu_debug::__base(_First), \ 355 __gnu_debug::__base(_Last), _Pred), \ 356 _M_message(__gnu_debug::__msg_unsorted_pred) \ 357 ._M_iterator(_First, #_First) \ 358 ._M_iterator(_Last, #_Last) \ 359 ._M_string(#_Pred)) 360 361 // Special variant for std::merge, std::includes, std::set_* 362 #define __glibcxx_check_sorted_set(_First1,_Last1,_First2) \ 363 __glibcxx_check_valid_range(_First1,_Last1); \ 364 _GLIBCXX_DEBUG_VERIFY( \ 365 __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \ 366 __gnu_debug::__base(_Last1), _First2),\ 367 _M_message(__gnu_debug::__msg_unsorted) \ 368 ._M_iterator(_First1, #_First1) \ 369 ._M_iterator(_Last1, #_Last1)) 370 371 // Likewise with a _Pred. 372 #define __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ 373 __glibcxx_check_valid_range(_First1,_Last1); \ 374 _GLIBCXX_DEBUG_VERIFY( \ 375 __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \ 376 __gnu_debug::__base(_Last1), \ 377 _First2, _Pred), \ 378 _M_message(__gnu_debug::__msg_unsorted_pred) \ 379 ._M_iterator(_First1, #_First1) \ 380 ._M_iterator(_Last1, #_Last1) \ 381 ._M_string(#_Pred)) 382 383 /** Verify that the iterator range [_First, _Last) is partitioned 384 w.r.t. the value _Value. */ 385 #define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ 386 __glibcxx_check_valid_range(_First,_Last); \ 387 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ 388 __gnu_debug::__base(_First), \ 389 __gnu_debug::__base(_Last), _Value), \ 390 _M_message(__gnu_debug::__msg_unpartitioned) \ 391 ._M_iterator(_First, #_First) \ 392 ._M_iterator(_Last, #_Last) \ 393 ._M_string(#_Value)) 394 395 #define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ 396 __glibcxx_check_valid_range(_First,_Last); \ 397 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ 398 __gnu_debug::__base(_First), \ 399 __gnu_debug::__base(_Last), _Value), \ 400 _M_message(__gnu_debug::__msg_unpartitioned) \ 401 ._M_iterator(_First, #_First) \ 402 ._M_iterator(_Last, #_Last) \ 403 ._M_string(#_Value)) 404 405 /** Verify that the iterator range [_First, _Last) is partitioned 406 w.r.t. the value _Value and predicate _Pred. */ 407 #define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ 408 __glibcxx_check_valid_range(_First,_Last); \ 409 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ 410 __gnu_debug::__base(_First), \ 411 __gnu_debug::__base(_Last), _Value, _Pred), \ 412 _M_message(__gnu_debug::__msg_unpartitioned_pred) \ 413 ._M_iterator(_First, #_First) \ 414 ._M_iterator(_Last, #_Last) \ 415 ._M_string(#_Pred) \ 416 ._M_string(#_Value)) 417 418 /** Verify that the iterator range [_First, _Last) is partitioned 419 w.r.t. the value _Value and predicate _Pred. */ 420 #define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ 421 __glibcxx_check_valid_range(_First,_Last); \ 422 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ 423 __gnu_debug::__base(_First), \ 424 __gnu_debug::__base(_Last), _Value, _Pred), \ 425 _M_message(__gnu_debug::__msg_unpartitioned_pred) \ 426 ._M_iterator(_First, #_First) \ 427 ._M_iterator(_Last, #_Last) \ 428 ._M_string(#_Pred) \ 429 ._M_string(#_Value)) 430 431 // Verify that the iterator range [_First, _Last) is a heap 432 #define __glibcxx_check_heap(_First,_Last) \ 433 _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ 434 __gnu_debug::__base(_Last)), \ 435 _M_message(__gnu_debug::__msg_not_heap) \ 436 ._M_iterator(_First, #_First) \ 437 ._M_iterator(_Last, #_Last)) 438 439 /** Verify that the iterator range [_First, _Last) is a heap 440 w.r.t. the predicate _Pred. */ 441 #define __glibcxx_check_heap_pred(_First,_Last,_Pred) \ 442 _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ 443 __gnu_debug::__base(_Last), \ 444 _Pred), \ 445 _M_message(__gnu_debug::__msg_not_heap_pred) \ 446 ._M_iterator(_First, #_First) \ 447 ._M_iterator(_Last, #_Last) \ 448 ._M_string(#_Pred)) 449 450 // Verify that the container is not self move assigned 451 #define __glibcxx_check_self_move_assign(_Other) \ 452 _GLIBCXX_DEBUG_VERIFY(this != &_Other, \ 453 _M_message(__gnu_debug::__msg_self_move_assign) \ 454 ._M_sequence(*this, "this")) 455 456 // Verify that load factor is positive 457 #define __glibcxx_check_max_load_factor(_F) \ 458 _GLIBCXX_DEBUG_VERIFY(_F > 0.0f, \ 459 _M_message(__gnu_debug::__msg_valid_load_factor) \ 460 ._M_sequence(*this, "this")) 461 462 #define __glibcxx_check_equal_allocs(_This, _Other) \ 463 _GLIBCXX_DEBUG_VERIFY(_This.get_allocator() == _Other.get_allocator(), \ 464 _M_message(__gnu_debug::__msg_equal_allocs) \ 465 ._M_sequence(_This, "this")) 466 467 #define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_PEDASSERT(_String != 0) 468 #define __glibcxx_check_string_len(_String,_Len) \ 469 _GLIBCXX_DEBUG_PEDASSERT(_String != 0 || _Len == 0) 470 471 #endif 472