macros.h 20 KB

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