Re: [Patch] Implement is_[nothrow_]swappable (p0185r1) - 2nd try

2016-06-16 Thread Daniel Krügler
2016-06-16 17:07 GMT+02:00 Jonathan Wakely :
> On 16/06/16 14:08 +0100, Jonathan Wakely wrote:
>>
>>
>> /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/./value.h:285:3:
>> error: static assertion failed
>>
>> /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/./value.h:287:3:
>> error: static assertion failed
>>
>> /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/./value.h:289:3:
>> error: static assertion failed
>>
>> Those assertions fail for both 20_util/is_nothrow_swappable/value.cc
>> and 20_util/is_nothrow_swappable/value_ext.cc
>
>
> Those assertions should be changed because with your patch queue,
> priority_queue and stack are nothrow swappable, because they don't
> depend on the value_type's swappable trait, but the sequence's.

Yes, I agree.

> The other problems are that some tests need their dg-error lines
> adjusting, and  says #ifdef __cplusplus >= 201402L which
> should be #if.

OK.

Thanks again for your patience to test the whole mess!

- Daniel


Re: [Patch] Implement is_[nothrow_]swappable (p0185r1) - 2nd try

2016-06-16 Thread Jonathan Wakely

On 16/06/16 14:08 +0100, Jonathan Wakely wrote:

/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/./value.h:285:3:
error: static assertion failed
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/./value.h:287:3:
error: static assertion failed
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/./value.h:289:3:
error: static assertion failed

Those assertions fail for both 20_util/is_nothrow_swappable/value.cc
and 20_util/is_nothrow_swappable/value_ext.cc


Those assertions should be changed because with your patch queue,
priority_queue and stack are nothrow swappable, because they don't
depend on the value_type's swappable trait, but the sequence's.

The other problems are that some tests need their dg-error lines
adjusting, and  says #ifdef __cplusplus >= 201402L which
should be #if.

Here's the patch I've tested and committed, thanks for working on
this!

commit e875362ec65adc793161cec9ee6d025ac86f12e5
Author: Jonathan Wakely 
Date:   Thu Jun 16 13:55:08 2016 +0100

Provide swappable traits (p0185r1)

2016-06-16  Daniel Kruegler  

	Provide swappable traits (p0185r1)
	* include/std/type_traits (is_swappable, is_nothrow_swappable,
	is_swappable_with, is_nothrow_swappable_with, is_swappable_v,
	is_nothrow_swappable_v, is_swappable_with_v,
	is_nothrow_swappable_with_v): New.
	* include/bits/stl_pair.h: Use it as per p0185r1.
	* include/bits/stl_queue.h: Likewise.
	* include/bits/stl_stack.h: Likewise.
	* include/bits/unique_ptr.h: Likewise.
	* include/std/tuple: Likewise.
	* include/std/array: Likewise. Fix zero-size member swap.
	* include/bits/hashtable.h: Use __and_.
	* testsuite/20_util/is_nothrow_swappable/requirements/
	explicit_instantiation.cc: Change test options to std=gnu++17.
	* testsuite/20_util/is_nothrow_swappable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable/value.cc: Likewise.
	* testsuite/20_util/is_swappable/requirements/
	explicit_instantiation.cc: Likewise.
	* testsuite/20_util/is_swappable/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_swappable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_swappable/requirements/
	explicit_instantiation_ext.cc: New.
	* testsuite/20_util/is_nothrow_swappable/requirements/typedefs_ext.cc:
	New.
	* testsuite/20_util/is_nothrow_swappable/value.h: New.
	* testsuite/20_util/is_nothrow_swappable/value_ext.cc: New.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/
	explicit_instantiation.cc: New.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/typedefs.cc:
	New.
	* testsuite/20_util/is_nothrow_swappable_with/value.cc: New.
	* testsuite/20_util/is_swappable/requirements/
	explicit_instantiation_ext.cc: New.
	* testsuite/20_util/is_swappable/requirements/typedefs_ext.cc: New.
	* testsuite/20_util/is_swappable/value.h: New.
	* testsuite/20_util/is_swappable/value_ext.cc: New.
	* testsuite/20_util/is_swappable_with/requirements/
	explicit_instantiation.cc: New.
	* testsuite/20_util/is_swappable_with/requirements/typedefs.cc: New.
	* testsuite/20_util/is_swappable_with/value.cc: New.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust
	dg-error line numbers.
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
	Likewise.

diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index 5748920..05f27b4 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -475,8 +475,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   void
   swap(_Hashtable&)
-  noexcept(__is_nothrow_swappable<_H1>::value
-	   && __is_nothrow_swappable<_Equal>::value);
+  noexcept(__and_<__is_nothrow_swappable<_H1>,
+	  __is_nothrow_swappable<_Equal>>::value);
 
   // Basic container operations
   iterator
@@ -1236,8 +1236,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal,
 	   _H1, _H2, _Hash, _RehashPolicy, _Traits>::
 swap(_Hashtable& __x)
-noexcept(__is_nothrow_swappable<_H1>::value
-	 && __is_nothrow_swappable<_Equal>::value)
+noexcept(__and_<__is_nothrow_swappable<_H1>,
+	__is_nothrow_swappable<_Equal>>::value)
 {
   // The only base class with member variables is hash_code_base.
   // We define _Hash_code_base::_M_swap because different
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 37ee5cc..5ff160a 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -341,8 +341,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   void
   swap(pair& __p)
-  

Re: [Patch] Implement is_[nothrow_]swappable (p0185r1) - 2nd try

2016-06-16 Thread Jonathan Wakely

On 16/06/16 14:01 +0100, Jonathan Wakely wrote:

On 16/06/16 14:00 +0100, Jonathan Wakely wrote:

On 15/06/16 20:07 +0200, Daniel Krügler wrote:

2016-06-14 23:22 GMT+02:00 Daniel Krügler :

This is an implementation of the Standard is_swappable traits according to

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0185r1.html

During that work it has been found that std::array's member swap's exception
specification for zero-size arrays was incorrectly depending on the value_type
and that was fixed as well.

This patch is *untested*, because I cannot make the tests run on my
Windows system.

Upon the suggestion of Mike Stump I'm proposing this patch
nonetheless, asking for sending
me as specific feedback as possible for any failing tests so that I
can try to make further
adjustments if needed.


And now also with the promised patch files.


I'm still seeing large numbers of failed static assertions, and
duplicate definitions. I'll try to fix them.


Ah, the duplicate definitions might be because I messed up applying
the patch.


With that fixed, the remaining failures are:

/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/./value.h:285:3:
error: static assertion failed
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/./value.h:287:3:
error: static assertion failed
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/./value.h:289:3:
error: static assertion failed

Those assertions fail for both 20_util/is_nothrow_swappable/value.cc
and 20_util/is_nothrow_swappable/value_ext.cc




Re: [Patch] Implement is_[nothrow_]swappable (p0185r1) - 2nd try

2016-06-16 Thread Jonathan Wakely

On 16/06/16 14:00 +0100, Jonathan Wakely wrote:

On 15/06/16 20:07 +0200, Daniel Krügler wrote:

2016-06-14 23:22 GMT+02:00 Daniel Krügler :

This is an implementation of the Standard is_swappable traits according to

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0185r1.html

During that work it has been found that std::array's member swap's exception
specification for zero-size arrays was incorrectly depending on the value_type
and that was fixed as well.

This patch is *untested*, because I cannot make the tests run on my
Windows system.

Upon the suggestion of Mike Stump I'm proposing this patch
nonetheless, asking for sending
me as specific feedback as possible for any failing tests so that I
can try to make further
adjustments if needed.


And now also with the promised patch files.


I'm still seeing large numbers of failed static assertions, and
duplicate definitions. I'll try to fix them.


Ah, the duplicate definitions might be because I messed up applying
the patch.


Re: [Patch] Implement is_[nothrow_]swappable (p0185r1) - 2nd try

2016-06-16 Thread Jonathan Wakely

On 15/06/16 20:07 +0200, Daniel Krügler wrote:

2016-06-14 23:22 GMT+02:00 Daniel Krügler :

This is an implementation of the Standard is_swappable traits according to

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0185r1.html

During that work it has been found that std::array's member swap's exception
specification for zero-size arrays was incorrectly depending on the value_type
and that was fixed as well.

This patch is *untested*, because I cannot make the tests run on my
Windows system.

Upon the suggestion of Mike Stump I'm proposing this patch
nonetheless, asking for sending
me as specific feedback as possible for any failing tests so that I
can try to make further
adjustments if needed.


And now also with the promised patch files.


I'm still seeing large numbers of failed static assertions, and
duplicate definitions. I'll try to fix them.

As Marc suggested, getting access to the compile farm would allow you
to test on a real OS. Installing GNU/Linux in a VM would also allow
you to run the tests. (I have no idea how to test on Windows, I never
managed to get it working when I tried).



Re: [Patch] Implement is_[nothrow_]swappable (p0185r1) - 2nd try

2016-06-15 Thread Daniel Krügler
2016-06-14 23:22 GMT+02:00 Daniel Krügler :
> This is an implementation of the Standard is_swappable traits according to
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0185r1.html
>
> During that work it has been found that std::array's member swap's exception
> specification for zero-size arrays was incorrectly depending on the value_type
> and that was fixed as well.
>
> This patch is *untested*, because I cannot make the tests run on my
> Windows system.
>
> Upon the suggestion of Mike Stump I'm proposing this patch
> nonetheless, asking for sending
> me as specific feedback as possible for any failing tests so that I
> can try to make further
> adjustments if needed.

And now also with the promised patch files.

> Thanks for your patience,
>
> - Daniel


changelog.patch
Description: Binary data


is_swappable_2.patch
Description: Binary data


Re: [Patch] Implement is_[nothrow_]swappable (p0185r1) - 2nd try

2016-06-14 Thread Marc Glisse


ENOPATCH ;-)

(I highly recommend https://gcc.gnu.org/wiki/CompileFarm )

--
Marc Glisse


Re: [Patch] Implement is_[nothrow_]swappable (p0185r1)

2016-05-25 Thread Mike Stump
On May 24, 2016, at 9:50 PM, Daniel Krügler  wrote:
> 
> 2016-05-23 13:50 GMT+02:00 Jonathan Wakely :
>> On 17/05/16 20:39 +0200, Daniel Krügler wrote:
>>> 
>>> This is an implementation of the Standard is_swappable traits according to
>>> 
>>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0185r1.html
>>> 
>>> During that work it has been found that std::array's member swap's
>>> exception
>>> specification for zero-size arrays was incorrectly depending on the
>>> value_type
>>> and that was fixed as well.
>> 
>> This looks good to me, I'll get it committed (with some adjustment to
>> the ChangeLog format) - thanks.
> 
> Unfortunately I need to withdraw the suggested patch. Besides some
> obvious errors there are issues that require me to get the testsuite
> run on my Windows system, which had not yet succeeded.
> 
> I would appreciate, if anyone who has succeeded to run the test suite
> on a Windows system (preferably mingw), could contact me off-list.

So, you can fix up the code that matters, and re-post the that code, and merely 
say the patch doesn't have testing on it and ask others to run the test suite 
for you.  Once you hear back and that the patch tests out well, you can then 
seek approval for inclusion, even though you never tested it.  Longer term, it 
is handy to be able to run the test suite yourself...  If Windows proves to be 
a pain, you you can run a VM with linux on it, and then run the test suite in 
the linux VM on windows.  Also, you can grab cygwin, testing there should be 
very, very close to just install cygwin, make && make check.

Re: [Patch] Implement is_[nothrow_]swappable (p0185r1)

2016-05-24 Thread Daniel Krügler
2016-05-23 13:50 GMT+02:00 Jonathan Wakely :
> On 17/05/16 20:39 +0200, Daniel Krügler wrote:
>>
>> This is an implementation of the Standard is_swappable traits according to
>>
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0185r1.html
>>
>> During that work it has been found that std::array's member swap's
>> exception
>> specification for zero-size arrays was incorrectly depending on the
>> value_type
>> and that was fixed as well.
>
> This looks good to me, I'll get it committed (with some adjustment to
> the ChangeLog format) - thanks.

Unfortunately I need to withdraw the suggested patch. Besides some
obvious errors there are issues that require me to get the testsuite
run on my Windows system, which had not yet succeeded.

I would appreciate, if anyone who has succeeded to run the test suite
on a Windows system (preferably mingw), could contact me off-list.

Thanks,

- Daniel


-- 


SavedURI :Show URLShow URLSavedURI :
SavedURI :Hide URLHide URLSavedURI :
https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.de.LEt2fN4ilLE.O/m=m_i,t,it/am=OCMOBiHj9kJxhnelj6j997_NLil29vVAOBGeBBRgJwD-m_0_8B_AD-qOEw/rt=h/d=1/rs=AItRSTODy9wv1JKZMABIG3Ak8ViC4kuOWA?random=1395770800154https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.de.LEt2fN4ilLE.O/m=m_i,t,it/am=OCMOBiHj9kJxhnelj6j997_NLil29vVAOBGeBBRgJwD-m_0_8B_AD-qOEw/rt=h/d=1/rs=AItRSTODy9wv1JKZMABIG3Ak8ViC4kuOWA?random=1395770800154



Re: [Patch] Implement is_[nothrow_]swappable (p0185r1)

2016-05-23 Thread Jonathan Wakely

On 17/05/16 20:39 +0200, Daniel Krügler wrote:

This is an implementation of the Standard is_swappable traits according to

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0185r1.html

During that work it has been found that std::array's member swap's exception
specification for zero-size arrays was incorrectly depending on the value_type
and that was fixed as well.


This looks good to me, I'll get it committed (with some adjustment to
the ChangeLog format) - thanks.