diff mbox

Tests fixes and debug vector pendantic capacity management change

Message ID 5495A3E5.9010807@gmail.com
State New
Headers show

Commit Message

François Dumont Dec. 20, 2014, 4:29 p.m. UTC
Hi

     Following a discussion on Reflector that has been reported to me, 
people are complaining about management of the vector capacity in the 
pedantic debug mode. Even if it is not crystal clear in the Standard 
there seems to be a consensus that clear shouldn't impact it. So here is 
a simple patch to stop resetting _M_guaranteed_capacity in this method.

     As I run all tests in debug mode I also fix another problem. In 
testsuite/23_containers/vector/bool/allocator/swap.cc == and != 
propagating_allocator operators must be within __gnu_test namespace in 
order to be considered thanks to ADL when in debug mode.

     There are also 2 tests that XPASS:
XPASS: experimental/string_view/element_access/char/2.cc execution test
XPASS: experimental/string_view/element_access/wchar_t/2.cc execution test

     Debug assertions has been commented about because not compatible 
with constexpr. Do we keep them this way ?

2014-12-20  François Dumont  <fdumont@gcc.gnu.org>

     * include/debug/vector (std::__debug::vector<>::clear()): Do not reset
     guaranteed capacity.
     * testsuite/23_containers/vector/bool/allocator/swap.cc: Move
     propagating_allocator equality and inequality operators to __gnu_test
     namespace.

François

Comments

Jonathan Wakely Dec. 20, 2014, 6:09 p.m. UTC | #1
On 20/12/14 17:29 +0100, François Dumont wrote:
>Hi
>
>    Following a discussion on Reflector that has been reported to me, 
>people are complaining about management of the vector capacity in the 
>pedantic debug mode. Even if it is not crystal clear in the Standard 
>there seems to be a consensus that clear shouldn't impact it. So here 
>is a simple patch to stop resetting _M_guaranteed_capacity in this 
>method.
>
>    As I run all tests in debug mode I also fix another problem. In 
>testsuite/23_containers/vector/bool/allocator/swap.cc == and != 
>propagating_allocator operators must be within __gnu_test namespace in 
>order to be considered thanks to ADL when in debug mode.

Thanks for fixing that.

>    There are also 2 tests that XPASS:
>XPASS: experimental/string_view/element_access/char/2.cc execution test
>XPASS: experimental/string_view/element_access/wchar_t/2.cc execution test
>
>    Debug assertions has been commented about because not compatible 
>with constexpr. Do we keep them this way ?

Yes, otherwise they stop being constexpr.
François Dumont Dec. 20, 2014, 7:32 p.m. UTC | #2
On 20/12/2014 19:09, Jonathan Wakely wrote:
>>    There are also 2 tests that XPASS:
>> XPASS: experimental/string_view/element_access/char/2.cc execution test
>> XPASS: experimental/string_view/element_access/wchar_t/2.cc execution 
>> test
>>
>>    Debug assertions has been commented about because not compatible 
>> with constexpr. Do we keep them this way ?
>
> Yes, otherwise they stop being constexpr.
>

I was more wondering if it fine to keep tests reporting a XPASS status 
cause they are displayed as the FAIL ones. But I think that XPASS is 
indeed a good status for a temporary issue.

Patch committed.

François
diff mbox

Patch

Index: include/debug/vector
===================================================================
--- include/debug/vector	(revision 218987)
+++ include/debug/vector	(working copy)
@@ -669,7 +669,6 @@ 
       {
 	_Base::clear();
 	this->_M_invalidate_all();
-	this->_M_guaranteed_capacity = 0;
       }
 
       _Base&
Index: testsuite/23_containers/vector/bool/allocator/swap.cc
===================================================================
--- testsuite/23_containers/vector/bool/allocator/swap.cc	(revision 218987)
+++ testsuite/23_containers/vector/bool/allocator/swap.cc	(working copy)
@@ -23,9 +23,9 @@ 
 
 using T = bool;
 
-using __gnu_test::propagating_allocator;
-
-// It is undefined behaviour to swap() containers wth unequal allocators
+namespace __gnu_test
+{
+  // It is undefined behaviour to swap() containers with unequal allocators
 // if the allocator doesn't propagate, so ensure the allocators compare
 // equal, while still being able to test propagation via get_personality().
 bool
@@ -41,7 +41,10 @@ 
 {
   return false;
 }
+}
 
+using __gnu_test::propagating_allocator;
+
 void test01()
 {
   bool test __attribute__((unused)) = true;