]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/include/debug/macros.h
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / include / debug / macros.h
CommitLineData
d2763ab5
BK
1// Debugging support implementation -*- C++ -*-
2
99dee823 3// Copyright (C) 2003-2021 Free Software Foundation, Inc.
d2763ab5
BK
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
748086b7 8// Free Software Foundation; either version 3, or (at your option)
d2763ab5
BK
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
748086b7
JJ
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.
d2763ab5 19
748086b7
JJ
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/>.
d2763ab5 24
78a53887
BK
25/** @file debug/macros.h
26 * This file is a GNU debug extension to the Standard C++ Library.
27 */
28
d2763ab5
BK
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
2a60a9f6 36 * @a correct choice of making them functions) because we need line and
d2763ab5
BK
37 * file information at the call site, to minimize the distance between
38 * the user error and where the error is reported.
39 *
40 */
38b17c27
FD
41#define _GLIBCXX_DEBUG_VERIFY_COND_AT(_Cond,_ErrMsg,_File,_Line,_Func) \
42 if (__builtin_expect(!bool(_Cond), false)) \
84a9d3b6
FD
43 __gnu_debug::_Error_formatter::_S_at(_File, _Line, _Func) \
44 ._ErrMsg._M_error()
45
a5277405 46#define _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond,_ErrMsg,_File,_Line,_Func) \
38b17c27
FD
47 do { \
48 __glibcxx_assert_1(_Cond) \
49 { _GLIBCXX_DEBUG_VERIFY_COND_AT(_Cond,_ErrMsg,_File,_Line,_Func); } \
d2763ab5
BK
50 } while (false)
51
a5277405
FD
52#define _GLIBCXX_DEBUG_VERIFY_AT(_Cond,_ErrMsg,_File,_Line) \
53 _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond,_ErrMsg,_File,_Line,__PRETTY_FUNCTION__)
54
55#define _GLIBCXX_DEBUG_VERIFY(_Cond,_ErrMsg) \
56 _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond, _ErrMsg, __FILE__, __LINE__, \
57 __PRETTY_FUNCTION__)
f5886803 58
d2763ab5
BK
59// Verify that [_First, _Last) forms a valid iterator range.
60#define __glibcxx_check_valid_range(_First,_Last) \
45f388bb
BK
61_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \
62 _M_message(__gnu_debug::__msg_valid_range) \
d2763ab5
BK
63 ._M_iterator(_First, #_First) \
64 ._M_iterator(_Last, #_Last))
65
90aabc7e
FD
66#define __glibcxx_check_valid_range_at(_First,_Last,_File,_Line,_Func) \
67_GLIBCXX_DEBUG_VERIFY_AT_F(__gnu_debug::__valid_range(_First, _Last), \
68 _M_message(__gnu_debug::__msg_valid_range) \
69 ._M_iterator(_First, #_First) \
70 ._M_iterator(_Last, #_Last), \
71 _File,_Line,_Func)
72
24167c42
FD
73#define __glibcxx_check_valid_range2(_First,_Last,_Dist) \
74_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last, _Dist), \
75 _M_message(__gnu_debug::__msg_valid_range) \
76 ._M_iterator(_First, #_First) \
77 ._M_iterator(_Last, #_Last))
78
90aabc7e
FD
79#define __glibcxx_check_valid_constructor_range(_First,_Last) \
80 __gnu_debug::__check_valid_range(_First, _Last, \
81 __FILE__, __LINE__, __PRETTY_FUNCTION__)
82
a8028a3e
JW
83// Verify that [_First, _Last) forms a non-empty iterator range.
84#define __glibcxx_check_non_empty_range(_First,_Last) \
85_GLIBCXX_DEBUG_VERIFY(_First != _Last, \
86 _M_message(__gnu_debug::__msg_non_empty_range) \
87 ._M_iterator(_First, #_First) \
88 ._M_iterator(_Last, #_Last))
89
eb04ee1d
FD
90// Verify that [_First, _First + _Size) forms a valid range.
91#define __glibcxx_check_can_increment(_First,_Size) \
92_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__can_advance(_First, _Size), \
93 _M_message(__gnu_debug::__msg_iter_subscript_oob) \
94 ._M_iterator(_First, #_First) \
95 ._M_integer(_Size, #_Size))
96
84a9d3b6
FD
97#define __glibcxx_check_can_increment_range(_First1,_Last1,_First2) \
98 do \
99 { \
100 typename __gnu_debug::_Distance_traits<__decltype(_First1)>::__type __dist;\
815eb852 101 _GLIBCXX_DEBUG_VERIFY_AT_F( \
84a9d3b6
FD
102 __gnu_debug::__valid_range(_First1, _Last1, __dist),\
103 _M_message(__gnu_debug::__msg_valid_range) \
104 ._M_iterator(_First1, #_First1) \
105 ._M_iterator(_Last1, #_Last1), \
106 __FILE__,__LINE__,__PRETTY_FUNCTION__); \
815eb852 107 _GLIBCXX_DEBUG_VERIFY_AT_F( \
84a9d3b6
FD
108 __gnu_debug::__can_advance(_First2, __dist.first),\
109 _M_message(__gnu_debug::__msg_iter_subscript_oob)\
110 ._M_iterator(_First2, #_First2) \
111 ._M_integer(__dist.first), \
112 __FILE__,__LINE__,__PRETTY_FUNCTION__); \
113 } while(false)
114
115#define __glibcxx_check_can_decrement_range(_First1,_Last1,_First2) \
116 do \
117 { \
118 typename __gnu_debug::_Distance_traits<__decltype(_First1)>::__type __dist;\
815eb852 119 _GLIBCXX_DEBUG_VERIFY_AT_F( \
84a9d3b6
FD
120 __gnu_debug::__valid_range(_First1, _Last1, __dist),\
121 _M_message(__gnu_debug::__msg_valid_range) \
122 ._M_iterator(_First1, #_First1) \
123 ._M_iterator(_Last1, #_Last1), \
124 __FILE__,__LINE__,__PRETTY_FUNCTION__); \
815eb852 125 _GLIBCXX_DEBUG_VERIFY_AT_F( \
84a9d3b6
FD
126 __gnu_debug::__can_advance(_First2, -__dist.first),\
127 _M_message(__gnu_debug::__msg_iter_subscript_oob)\
128 ._M_iterator(_First2, #_First2) \
129 ._M_integer(-__dist.first), \
130 __FILE__,__LINE__,__PRETTY_FUNCTION__); \
131 } while(false)
132
d2763ab5
BK
133/** Verify that we can insert into *this with the iterator _Position.
134 * Insertion into a container at a specific position requires that
b8b4301e
PC
135 * the iterator be nonsingular, either dereferenceable or past-the-end,
136 * and that it reference the sequence we are inserting into. Note that
137 * this macro is only valid when the container is a_Safe_sequence and
138 * the iterator is a _Safe_iterator.
d2763ab5
BK
139*/
140#define __glibcxx_check_insert(_Position) \
141_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \
5720787a 142 _M_message(__gnu_debug::__msg_insert_singular) \
d2763ab5
BK
143 ._M_sequence(*this, "this") \
144 ._M_iterator(_Position, #_Position)); \
145_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
5720787a 146 _M_message(__gnu_debug::__msg_insert_different) \
d2763ab5
BK
147 ._M_sequence(*this, "this") \
148 ._M_iterator(_Position, #_Position))
149
b8b4301e
PC
150/** Verify that we can insert into *this after the iterator _Position.
151 * Insertion into a container after a specific position requires that
152 * the iterator be nonsingular, either dereferenceable or before-begin,
153 * and that it reference the sequence we are inserting into. Note that
154 * this macro is only valid when the container is a_Safe_sequence and
155 * the iterator is a _Safe_iterator.
156*/
157#define __glibcxx_check_insert_after(_Position) \
158__glibcxx_check_insert(_Position); \
159_GLIBCXX_DEBUG_VERIFY(!_Position._M_is_end(), \
160 _M_message(__gnu_debug::__msg_insert_after_end) \
161 ._M_sequence(*this, "this") \
162 ._M_iterator(_Position, #_Position))
163
d2763ab5
BK
164/** Verify that we can insert the values in the iterator range
165 * [_First, _Last) into *this with the iterator _Position. Insertion
166 * into a container at a specific position requires that the iterator
167 * be nonsingular (i.e., either dereferenceable or past-the-end),
168 * that it reference the sequence we are inserting into, and that the
72d1f255
JW
169 * iterator range [_First, _Last) is a valid (possibly empty)
170 * range which does not reference the sequence we are inserting into.
171 * Note that this macro is only valid when the container is a
5720787a 172 * _Safe_sequence and the _Position iterator is a _Safe_iterator.
d2763ab5 173*/
24167c42
FD
174#define __glibcxx_check_insert_range(_Position,_First,_Last,_Dist) \
175__glibcxx_check_valid_range2(_First,_Last,_Dist); \
5720787a 176__glibcxx_check_insert(_Position); \
72d1f255 177_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\
5720787a
FD
178 _M_message(__gnu_debug::__msg_insert_range_from_self)\
179 ._M_iterator(_First, #_First) \
180 ._M_iterator(_Last, #_Last) \
181 ._M_sequence(*this, "this"))
b8b4301e
PC
182
183/** Verify that we can insert the values in the iterator range
184 * [_First, _Last) into *this after the iterator _Position. Insertion
185 * into a container after a specific position requires that the iterator
186 * be nonsingular (i.e., either dereferenceable or past-the-end),
187 * that it reference the sequence we are inserting into, and that the
72d1f255
JW
188 * iterator range [_First, _Last) is a valid (possibly empty)
189 * range which does not reference the sequence we are inserting into.
190 * Note that this macro is only valid when the container is a
191 * _Safe_sequence and the _Position iterator is a _Safe_iterator.
b8b4301e 192*/
24167c42 193#define __glibcxx_check_insert_range_after(_Position,_First,_Last,_Dist)\
84a9d3b6 194__glibcxx_check_valid_range2(_First,_Last,_Dist); \
72d1f255
JW
195__glibcxx_check_insert_after(_Position); \
196_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\
5720787a
FD
197 _M_message(__gnu_debug::__msg_insert_range_from_self)\
198 ._M_iterator(_First, #_First) \
199 ._M_iterator(_Last, #_Last) \
200 ._M_sequence(*this, "this"))
d2763ab5
BK
201
202/** Verify that we can erase the element referenced by the iterator
203 * _Position. We can erase the element if the _Position iterator is
204 * dereferenceable and references this sequence.
205*/
206#define __glibcxx_check_erase(_Position) \
207_GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(), \
45f388bb 208 _M_message(__gnu_debug::__msg_erase_bad) \
d2763ab5
BK
209 ._M_sequence(*this, "this") \
210 ._M_iterator(_Position, #_Position)); \
211_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
45f388bb 212 _M_message(__gnu_debug::__msg_erase_different) \
d2763ab5
BK
213 ._M_sequence(*this, "this") \
214 ._M_iterator(_Position, #_Position))
215
b8b4301e
PC
216/** Verify that we can erase the element after the iterator
217 * _Position. We can erase the element if the _Position iterator is
218 * before a dereferenceable one and references this sequence.
219*/
220#define __glibcxx_check_erase_after(_Position) \
221_GLIBCXX_DEBUG_VERIFY(_Position._M_before_dereferenceable(), \
222 _M_message(__gnu_debug::__msg_erase_after_bad) \
223 ._M_sequence(*this, "this") \
224 ._M_iterator(_Position, #_Position)); \
225_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \
226 _M_message(__gnu_debug::__msg_erase_different) \
227 ._M_sequence(*this, "this") \
228 ._M_iterator(_Position, #_Position))
229
d2763ab5
BK
230/** Verify that we can erase the elements in the iterator range
231 * [_First, _Last). We can erase the elements if [_First, _Last) is a
232 * valid iterator range within this sequence.
233*/
234#define __glibcxx_check_erase_range(_First,_Last) \
235__glibcxx_check_valid_range(_First,_Last); \
236_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \
45f388bb 237 _M_message(__gnu_debug::__msg_erase_different) \
d2763ab5
BK
238 ._M_sequence(*this, "this") \
239 ._M_iterator(_First, #_First) \
240 ._M_iterator(_Last, #_Last))
241
b8b4301e
PC
242/** Verify that we can erase the elements in the iterator range
243 * (_First, _Last). We can erase the elements if (_First, _Last) is a
244 * valid iterator range within this sequence.
245*/
246#define __glibcxx_check_erase_range_after(_First,_Last) \
247_GLIBCXX_DEBUG_VERIFY(_First._M_can_compare(_Last), \
248 _M_message(__gnu_debug::__msg_erase_different) \
249 ._M_sequence(*this, "this") \
250 ._M_iterator(_First, #_First) \
251 ._M_iterator(_Last, #_Last)); \
252_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \
253 _M_message(__gnu_debug::__msg_erase_different) \
254 ._M_sequence(*this, "this") \
255 ._M_iterator(_First, #_First)); \
256_GLIBCXX_DEBUG_VERIFY(_First != _Last, \
257 _M_message(__gnu_debug::__msg_valid_range2) \
258 ._M_sequence(*this, "this") \
259 ._M_iterator(_First, #_First) \
260 ._M_iterator(_Last, #_Last)); \
261_GLIBCXX_DEBUG_VERIFY(_First._M_incrementable(), \
262 _M_message(__gnu_debug::__msg_valid_range2) \
263 ._M_sequence(*this, "this") \
264 ._M_iterator(_First, #_First) \
265 ._M_iterator(_Last, #_Last)); \
266_GLIBCXX_DEBUG_VERIFY(!_Last._M_is_before_begin(), \
267 _M_message(__gnu_debug::__msg_valid_range2) \
268 ._M_sequence(*this, "this") \
269 ._M_iterator(_First, #_First) \
270 ._M_iterator(_Last, #_Last)) \
271
d2763ab5
BK
272// Verify that the subscript _N is less than the container's size.
273#define __glibcxx_check_subscript(_N) \
274_GLIBCXX_DEBUG_VERIFY(_N < this->size(), \
7181e991 275 _M_message(__gnu_debug::__msg_subscript_oob) \
d2763ab5
BK
276 ._M_sequence(*this, "this") \
277 ._M_integer(_N, #_N) \
278 ._M_integer(this->size(), "size"))
279
7181e991
FD
280// Verify that the bucket _N is less than the container's buckets count.
281#define __glibcxx_check_bucket_index(_N) \
282_GLIBCXX_DEBUG_VERIFY(_N < this->bucket_count(), \
283 _M_message(__gnu_debug::__msg_bucket_index_oob) \
284 ._M_sequence(*this, "this") \
285 ._M_integer(_N, #_N) \
286 ._M_integer(this->bucket_count(), "size"))
287
d2763ab5
BK
288// Verify that the container is nonempty
289#define __glibcxx_check_nonempty() \
290_GLIBCXX_DEBUG_VERIFY(! this->empty(), \
45f388bb 291 _M_message(__gnu_debug::__msg_empty) \
d2763ab5
BK
292 ._M_sequence(*this, "this"))
293
97d57665
FD
294// Verify that a predicate is irreflexive
295#define __glibcxx_check_irreflexive(_First,_Last) \
296 _GLIBCXX_DEBUG_VERIFY(_First == _Last || !(*_First < *_First), \
297 _M_message(__gnu_debug::__msg_irreflexive_ordering) \
298 ._M_iterator_value_type(_First, "< operator type"))
299
300#if __cplusplus >= 201103L
301# define __glibcxx_check_irreflexive2(_First,_Last) \
302 _GLIBCXX_DEBUG_VERIFY(_First == _Last \
303 || __gnu_debug::__is_irreflexive(_First), \
304 _M_message(__gnu_debug::__msg_irreflexive_ordering) \
305 ._M_iterator_value_type(_First, "< operator type"))
306#else
307# define __glibcxx_check_irreflexive2(_First,_Last)
308#endif
309
310#define __glibcxx_check_irreflexive_pred(_First,_Last,_Pred) \
311 _GLIBCXX_DEBUG_VERIFY(_First == _Last || !_Pred(*_First, *_First), \
312 _M_message(__gnu_debug::__msg_irreflexive_ordering) \
313 ._M_instance(_Pred, "functor") \
314 ._M_iterator_value_type(_First, "ordered type"))
315
316#if __cplusplus >= 201103L
317# define __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) \
318 _GLIBCXX_DEBUG_VERIFY(_First == _Last \
319 ||__gnu_debug::__is_irreflexive_pred(_First, _Pred), \
320 _M_message(__gnu_debug::__msg_irreflexive_ordering) \
321 ._M_instance(_Pred, "functor") \
322 ._M_iterator_value_type(_First, "ordered type"))
323#else
324# define __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred)
325#endif
326
d2763ab5
BK
327// Verify that the iterator range [_First, _Last) is sorted
328#define __glibcxx_check_sorted(_First,_Last) \
329__glibcxx_check_valid_range(_First,_Last); \
97d57665 330__glibcxx_check_irreflexive(_First,_Last); \
8915a229
FD
331 _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \
332 __gnu_debug::__base(_First), \
333 __gnu_debug::__base(_Last)), \
45f388bb 334 _M_message(__gnu_debug::__msg_unsorted) \
d2763ab5
BK
335 ._M_iterator(_First, #_First) \
336 ._M_iterator(_Last, #_Last))
337
338/** Verify that the iterator range [_First, _Last) is sorted by the
339 predicate _Pred. */
340#define __glibcxx_check_sorted_pred(_First,_Last,_Pred) \
341__glibcxx_check_valid_range(_First,_Last); \
97d57665 342__glibcxx_check_irreflexive_pred(_First,_Last,_Pred); \
8915a229
FD
343_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \
344 __gnu_debug::__base(_First), \
345 __gnu_debug::__base(_Last), _Pred), \
45f388bb 346 _M_message(__gnu_debug::__msg_unsorted_pred) \
d2763ab5
BK
347 ._M_iterator(_First, #_First) \
348 ._M_iterator(_Last, #_Last) \
349 ._M_string(#_Pred))
350
a4c07f2d
PC
351// Special variant for std::merge, std::includes, std::set_*
352#define __glibcxx_check_sorted_set(_First1,_Last1,_First2) \
353__glibcxx_check_valid_range(_First1,_Last1); \
354_GLIBCXX_DEBUG_VERIFY( \
8915a229
FD
355 __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \
356 __gnu_debug::__base(_Last1), _First2),\
a4c07f2d
PC
357 _M_message(__gnu_debug::__msg_unsorted) \
358 ._M_iterator(_First1, #_First1) \
359 ._M_iterator(_Last1, #_Last1))
360
361// Likewise with a _Pred.
362#define __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) \
363__glibcxx_check_valid_range(_First1,_Last1); \
364_GLIBCXX_DEBUG_VERIFY( \
8915a229
FD
365 __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \
366 __gnu_debug::__base(_Last1), \
367 _First2, _Pred), \
a4c07f2d
PC
368 _M_message(__gnu_debug::__msg_unsorted_pred) \
369 ._M_iterator(_First1, #_First1) \
370 ._M_iterator(_Last1, #_Last1) \
371 ._M_string(#_Pred))
372
d2763ab5
BK
373/** Verify that the iterator range [_First, _Last) is partitioned
374 w.r.t. the value _Value. */
f5ad3163 375#define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \
d2763ab5 376__glibcxx_check_valid_range(_First,_Last); \
8915a229
FD
377_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \
378 __gnu_debug::__base(_First), \
379 __gnu_debug::__base(_Last), _Value), \
45f388bb 380 _M_message(__gnu_debug::__msg_unpartitioned) \
d2763ab5
BK
381 ._M_iterator(_First, #_First) \
382 ._M_iterator(_Last, #_Last) \
383 ._M_string(#_Value))
384
f5ad3163
PC
385#define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \
386__glibcxx_check_valid_range(_First,_Last); \
8915a229
FD
387_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \
388 __gnu_debug::__base(_First), \
389 __gnu_debug::__base(_Last), _Value), \
f5ad3163
PC
390 _M_message(__gnu_debug::__msg_unpartitioned) \
391 ._M_iterator(_First, #_First) \
392 ._M_iterator(_Last, #_Last) \
393 ._M_string(#_Value))
394
395/** Verify that the iterator range [_First, _Last) is partitioned
396 w.r.t. the value _Value and predicate _Pred. */
397#define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \
398__glibcxx_check_valid_range(_First,_Last); \
8915a229
FD
399_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \
400 __gnu_debug::__base(_First), \
401 __gnu_debug::__base(_Last), _Value, _Pred), \
f5ad3163
PC
402 _M_message(__gnu_debug::__msg_unpartitioned_pred) \
403 ._M_iterator(_First, #_First) \
404 ._M_iterator(_Last, #_Last) \
405 ._M_string(#_Pred) \
406 ._M_string(#_Value))
407
d2763ab5
BK
408/** Verify that the iterator range [_First, _Last) is partitioned
409 w.r.t. the value _Value and predicate _Pred. */
f5ad3163 410#define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \
d2763ab5 411__glibcxx_check_valid_range(_First,_Last); \
8915a229
FD
412_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \
413 __gnu_debug::__base(_First), \
414 __gnu_debug::__base(_Last), _Value, _Pred), \
45f388bb 415 _M_message(__gnu_debug::__msg_unpartitioned_pred) \
d2763ab5
BK
416 ._M_iterator(_First, #_First) \
417 ._M_iterator(_Last, #_Last) \
418 ._M_string(#_Pred) \
419 ._M_string(#_Value))
420
421// Verify that the iterator range [_First, _Last) is a heap
422#define __glibcxx_check_heap(_First,_Last) \
0545ebf2
FD
423 _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \
424 __gnu_debug::__base(_Last)), \
45f388bb 425 _M_message(__gnu_debug::__msg_not_heap) \
d2763ab5
BK
426 ._M_iterator(_First, #_First) \
427 ._M_iterator(_Last, #_Last))
428
429/** Verify that the iterator range [_First, _Last) is a heap
430 w.r.t. the predicate _Pred. */
431#define __glibcxx_check_heap_pred(_First,_Last,_Pred) \
0545ebf2
FD
432 _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \
433 __gnu_debug::__base(_Last), \
434 _Pred), \
45f388bb 435 _M_message(__gnu_debug::__msg_not_heap_pred) \
d2763ab5
BK
436 ._M_iterator(_First, #_First) \
437 ._M_iterator(_Last, #_Last) \
438 ._M_string(#_Pred))
439
72d1f255 440// Verify that load factor is positive
14cbb5d8
FD
441#define __glibcxx_check_max_load_factor(_F) \
442_GLIBCXX_DEBUG_VERIFY(_F > 0.0f, \
443 _M_message(__gnu_debug::__msg_valid_load_factor) \
739fd6a6
PC
444 ._M_sequence(*this, "this"))
445
15ee1a77
FD
446#define __glibcxx_check_equal_allocs(_This, _Other) \
447_GLIBCXX_DEBUG_VERIFY(_This.get_allocator() == _Other.get_allocator(), \
e77c9aed 448 _M_message(__gnu_debug::__msg_equal_allocs) \
15ee1a77 449 ._M_sequence(_This, "this"))
e77c9aed 450
24167c42
FD
451#define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_PEDASSERT(_String != 0)
452#define __glibcxx_check_string_len(_String,_Len) \
453 _GLIBCXX_DEBUG_PEDASSERT(_String != 0 || _Len == 0)
d2763ab5
BK
454
455#endif