On 05/07/19 19:44 +0100, Jonathan Wakely wrote:
On 05/07/19 20:23 +0200, Daniel Krügler wrote:
Am Fr., 5. Juli 2019 um 18:13 Uhr schrieb Jonathan Wakely <jwak...@redhat.com>:
[..]
I decided against the simplification in the second patch, and
committed the attached one which is closer to the first patch I sent
(preserving the __atomic_add and __exchange_and_add functions even
when they just call the built-ins).
Tested x86_64-linux, powerpc64-linux, powerpc-aix. Committed to trunk.
Unrelated to the actual patch, I noticed some explicit "throw()" forms
used as exception specifications - shouldn't these be replaced by
either explicit "noexcept" or at least by a library macro that expands
to one or the other?
Yes, they should be _GLIBCXX_NOTHROW.
(I'm sorry, if such unrelated questions are
considered as inappropriate for this list).
Entirely appropriate, thanks!
Here's a patch to fix that and the dumb mistake I made in
__atomic_add_dispatch. I'll commit after testing finishes.
commit 1542776ebab8848109d125d05a548fca5efb513a
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Sat Jul 6 21:24:51 2019 +0100
Fix recent regression in __atomic_add_dispatch
* include/ext/atomicity.h (__exchange_and_add, __atomic_add): Replace
throw() with _GLIBCXX_NOTHROW.
(__atomic_add_dispatch): Return after performing atomic increment.
diff --git a/libstdc++-v3/include/ext/atomicity.h b/libstdc++-v3/include/ext/atomicity.h
index 73225b3de20..333c8843e14 100644
--- a/libstdc++-v3/include/ext/atomicity.h
+++ b/libstdc++-v3/include/ext/atomicity.h
@@ -55,10 +55,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
#else
_Atomic_word
- __exchange_and_add(volatile _Atomic_word*, int) throw ();
+ __exchange_and_add(volatile _Atomic_word*, int) _GLIBCXX_NOTHROW;
void
- __atomic_add(volatile _Atomic_word*, int) throw ();
+ __atomic_add(volatile _Atomic_word*, int) _GLIBCXX_NOTHROW;
#endif
inline _Atomic_word
@@ -92,7 +92,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
#ifdef __GTHREADS
if (__gthread_active_p())
- __atomic_add(__mem, __val);
+ {
+ __atomic_add(__mem, __val);
+ return;
+ }
#endif
__atomic_add_single(__mem, __val);
}