Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libstdc++-v3 / include / debug / macros.h
index 07d714d..26732c9 100644 (file)
@@ -1,7 +1,6 @@
 // Debugging support implementation -*- C++ -*-
 
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-// Free Software Foundation, Inc.
+// Copyright (C) 2003-2013 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -202,11 +201,19 @@ _GLIBCXX_DEBUG_VERIFY(!_Last._M_is_before_begin(),                        \
 // Verify that the subscript _N is less than the container's size.
 #define __glibcxx_check_subscript(_N)                                  \
 _GLIBCXX_DEBUG_VERIFY(_N < this->size(),                               \
-                     _M_message(__gnu_debug::__msg_subscript_oob)      \
+                     _M_message(__gnu_debug::__msg_subscript_oob)      \
                       ._M_sequence(*this, "this")                      \
                      ._M_integer(_N, #_N)                              \
                      ._M_integer(this->size(), "size"))
 
+// Verify that the bucket _N is less than the container's buckets count.
+#define __glibcxx_check_bucket_index(_N)                               \
+_GLIBCXX_DEBUG_VERIFY(_N < this->bucket_count(),                       \
+                     _M_message(__gnu_debug::__msg_bucket_index_oob)   \
+                      ._M_sequence(*this, "this")                      \
+                     ._M_integer(_N, #_N)                              \
+                     ._M_integer(this->bucket_count(), "size"))
+
 // Verify that the container is nonempty
 #define __glibcxx_check_nonempty()                                     \
 _GLIBCXX_DEBUG_VERIFY(! this->empty(),                                 \
@@ -296,7 +303,8 @@ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \
 
 // Verify that the iterator range [_First, _Last) is a heap
 #define __glibcxx_check_heap(_First,_Last)                             \
-_GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last),                   \
+  _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First),    \
+                                      __gnu_debug::__base(_Last)),     \
                      _M_message(__gnu_debug::__msg_not_heap)           \
                      ._M_iterator(_First, #_First)                     \
                      ._M_iterator(_Last, #_Last))
@@ -304,12 +312,31 @@ _GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last),                      \
 /** Verify that the iterator range [_First, _Last) is a heap
     w.r.t. the predicate _Pred. */
 #define __glibcxx_check_heap_pred(_First,_Last,_Pred)                  \
-_GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last, _Pred),            \
+  _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First),    \
+                                      __gnu_debug::__base(_Last),      \
+                                      _Pred),                          \
                      _M_message(__gnu_debug::__msg_not_heap_pred)      \
                       ._M_iterator(_First, #_First)                    \
                      ._M_iterator(_Last, #_Last)                       \
                      ._M_string(#_Pred))
 
+// Verify that the container is not self move assigned
+#define __glibcxx_check_self_move_assign(_Other)                       \
+_GLIBCXX_DEBUG_VERIFY(this != &_Other,                                 \
+                     _M_message(__gnu_debug::__msg_self_move_assign)   \
+                      ._M_sequence(*this, "this"))
+
+// Verify that load factor is position
+#define __glibcxx_check_max_load_factor(_F)                            \
+_GLIBCXX_DEBUG_VERIFY(_F > 0.0f,                                       \
+                     _M_message(__gnu_debug::__msg_valid_load_factor)  \
+                      ._M_sequence(*this, "this"))
+
+#define __glibcxx_check_equal_allocs(_Other)                   \
+_GLIBCXX_DEBUG_VERIFY(this->get_allocator() == _Other.get_allocator(), \
+                     _M_message(__gnu_debug::__msg_equal_allocs)       \
+                     ._M_sequence(*this, "this"))
+
 #ifdef _GLIBCXX_DEBUG_PEDANTIC
 #  define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_ASSERT(_String != 0)
 #  define __glibcxx_check_string_len(_String,_Len) \