]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/atomic/detail/extra_fp_ops_emulated.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / atomic / detail / extra_fp_ops_emulated.hpp
index 043ee13e03580c206b818f46b314f1675bdf877f..df556758c573da03322e2163b4f6e0e2132df6fd 100644 (file)
 #define BOOST_ATOMIC_DETAIL_EXTRA_FP_OPS_EMULATED_HPP_INCLUDED_
 
 #include <cstddef>
+#include <boost/static_assert.hpp>
 #include <boost/memory_order.hpp>
 #include <boost/atomic/detail/config.hpp>
 #include <boost/atomic/detail/bitwise_fp_cast.hpp>
 #include <boost/atomic/detail/extra_fp_operations_fwd.hpp>
+#include <boost/atomic/detail/header.hpp>
 
 #ifdef BOOST_HAS_PRAGMA_ONCE
 #pragma once
@@ -28,9 +30,9 @@ namespace boost {
 namespace atomics {
 namespace detail {
 
-//! Generic implementation of extra floating point operations
+//! Emulated implementation of extra floating point operations
 template< typename Base, typename Value, std::size_t Size >
-struct emulated_extra_fp_operations :
+struct extra_fp_operations_emulated :
     public Base
 {
     typedef Base base_type;
@@ -38,8 +40,9 @@ struct emulated_extra_fp_operations :
     typedef Value value_type;
     typedef typename base_type::scoped_lock scoped_lock;
 
-    static BOOST_FORCEINLINE value_type fetch_negate(storage_type volatile& storage, memory_order) BOOST_NOEXCEPT
+    static value_type fetch_negate(storage_type volatile& storage, memory_order) BOOST_NOEXCEPT
     {
+        BOOST_STATIC_ASSERT_MSG(!base_type::is_interprocess, "Boost.Atomic: operation invoked on a non-lock-free inter-process atomic object");
         storage_type& s = const_cast< storage_type& >(storage);
         scoped_lock lock(&storage);
         value_type old_val = atomics::detail::bitwise_fp_cast< value_type >(s);
@@ -48,8 +51,9 @@ struct emulated_extra_fp_operations :
         return old_val;
     }
 
-    static BOOST_FORCEINLINE value_type negate(storage_type volatile& storage, memory_order) BOOST_NOEXCEPT
+    static value_type negate(storage_type volatile& storage, memory_order) BOOST_NOEXCEPT
     {
+        BOOST_STATIC_ASSERT_MSG(!base_type::is_interprocess, "Boost.Atomic: operation invoked on a non-lock-free inter-process atomic object");
         storage_type& s = const_cast< storage_type& >(storage);
         scoped_lock lock(&storage);
         value_type old_val = atomics::detail::bitwise_fp_cast< value_type >(s);
@@ -58,8 +62,9 @@ struct emulated_extra_fp_operations :
         return new_val;
     }
 
-    static BOOST_FORCEINLINE value_type add(storage_type volatile& storage, value_type v, memory_order) BOOST_NOEXCEPT
+    static value_type add(storage_type volatile& storage, value_type v, memory_order) BOOST_NOEXCEPT
     {
+        BOOST_STATIC_ASSERT_MSG(!base_type::is_interprocess, "Boost.Atomic: operation invoked on a non-lock-free inter-process atomic object");
         storage_type& s = const_cast< storage_type& >(storage);
         scoped_lock lock(&storage);
         value_type old_val = atomics::detail::bitwise_fp_cast< value_type >(s);
@@ -68,8 +73,9 @@ struct emulated_extra_fp_operations :
         return new_val;
     }
 
-    static BOOST_FORCEINLINE value_type sub(storage_type volatile& storage, value_type v, memory_order) BOOST_NOEXCEPT
+    static value_type sub(storage_type volatile& storage, value_type v, memory_order) BOOST_NOEXCEPT
     {
+        BOOST_STATIC_ASSERT_MSG(!base_type::is_interprocess, "Boost.Atomic: operation invoked on a non-lock-free inter-process atomic object");
         storage_type& s = const_cast< storage_type& >(storage);
         scoped_lock lock(&storage);
         value_type old_val = atomics::detail::bitwise_fp_cast< value_type >(s);
@@ -80,23 +86,26 @@ struct emulated_extra_fp_operations :
 
     static BOOST_FORCEINLINE void opaque_negate(storage_type volatile& storage, memory_order order) BOOST_NOEXCEPT
     {
+        BOOST_STATIC_ASSERT_MSG(!base_type::is_interprocess, "Boost.Atomic: operation invoked on a non-lock-free inter-process atomic object");
         fetch_negate(storage, order);
     }
 
     static BOOST_FORCEINLINE void opaque_add(storage_type volatile& storage, value_type v, memory_order order) BOOST_NOEXCEPT
     {
+        BOOST_STATIC_ASSERT_MSG(!base_type::is_interprocess, "Boost.Atomic: operation invoked on a non-lock-free inter-process atomic object");
         base_type::fetch_add(storage, v, order);
     }
 
     static BOOST_FORCEINLINE void opaque_sub(storage_type volatile& storage, value_type v, memory_order order) BOOST_NOEXCEPT
     {
+        BOOST_STATIC_ASSERT_MSG(!base_type::is_interprocess, "Boost.Atomic: operation invoked on a non-lock-free inter-process atomic object");
         base_type::fetch_sub(storage, v, order);
     }
 };
 
 template< typename Base, typename Value, std::size_t Size >
 struct extra_fp_operations< Base, Value, Size, false > :
-    public emulated_extra_fp_operations< Base, Value, Size >
+    public extra_fp_operations_emulated< Base, Value, Size >
 {
 };
 
@@ -104,4 +113,6 @@ struct extra_fp_operations< Base, Value, Size, false > :
 } // namespace atomics
 } // namespace boost
 
+#include <boost/atomic/detail/footer.hpp>
+
 #endif // BOOST_ATOMIC_DETAIL_EXTRA_FP_OPS_EMULATED_HPP_INCLUDED_