+2019-07-05 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/ext/atomicity.h [_GLIBCXX_ATOMIC_BUILTINS] (__atomic_add)
+ (__exchange_and_add): Replace static specifier with always_inline
+ attribute.
+ (__exchange_and_add_single, __atomic_add_single): Likewise.
+ (__exchange_and_add_dispatch, __atomic_add_dispatch): Likewise. Also
+ combine !__gthread_active_p() and !__GTHREADS branches.
+
2019-07-03 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/91067
// __exchange_and_add_dispatch
// __atomic_add_dispatch
#ifdef _GLIBCXX_ATOMIC_BUILTINS
- static inline _Atomic_word
+ inline _Atomic_word
+ __attribute__((__always_inline__))
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
- static inline void
+ inline void
+ __attribute__((__always_inline__))
__atomic_add(volatile _Atomic_word* __mem, int __val)
{ __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
#else
_Atomic_word
- __attribute__ ((__unused__))
__exchange_and_add(volatile _Atomic_word*, int) throw ();
void
- __attribute__ ((__unused__))
__atomic_add(volatile _Atomic_word*, int) throw ();
#endif
- static inline _Atomic_word
+ inline _Atomic_word
+ __attribute__((__always_inline__))
__exchange_and_add_single(_Atomic_word* __mem, int __val)
{
_Atomic_word __result = *__mem;
return __result;
}
- static inline void
+ inline void
+ __attribute__((__always_inline__))
__atomic_add_single(_Atomic_word* __mem, int __val)
{ *__mem += __val; }
- static inline _Atomic_word
- __attribute__ ((__unused__))
+ inline _Atomic_word
+ __attribute__ ((__always_inline__))
__exchange_and_add_dispatch(_Atomic_word* __mem, int __val)
{
#ifdef __GTHREADS
if (__gthread_active_p())
return __exchange_and_add(__mem, __val);
- else
- return __exchange_and_add_single(__mem, __val);
-#else
- return __exchange_and_add_single(__mem, __val);
#endif
+ return __exchange_and_add_single(__mem, __val);
}
- static inline void
- __attribute__ ((__unused__))
+ inline void
+ __attribute__ ((__always_inline__))
__atomic_add_dispatch(_Atomic_word* __mem, int __val)
{
#ifdef __GTHREADS
if (__gthread_active_p())
__atomic_add(__mem, __val);
- else
- __atomic_add_single(__mem, __val);
-#else
- __atomic_add_single(__mem, __val);
#endif
+ __atomic_add_single(__mem, __val);
}
_GLIBCXX_END_NAMESPACE_VERSION