]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/system/detail/error_category.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / system / detail / error_category.hpp
index 5aa0c38a13f3869eca4e416d236c01f3832a7270..a205d81cab279a7865d85baa89530ad401c53f20 100644 (file)
@@ -19,6 +19,7 @@
 
 #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
 # include <system_error>
+# include <atomic>
 #endif
 
 namespace boost
@@ -38,11 +39,7 @@ namespace detail
 
 BOOST_SYSTEM_CONSTEXPR bool failed_impl( int ev, error_category const & cat );
 
-#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
-
-std::error_category const & to_std_category( error_category const & cat );
-
-#endif
+class std_category;
 
 } // namespace detail
 
@@ -58,9 +55,8 @@ private:
     friend std::size_t hash_value( error_code const & ec );
     friend BOOST_SYSTEM_CONSTEXPR bool detail::failed_impl( int ev, error_category const & cat );
 
-#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
-    friend std::error_category const & detail::to_std_category( error_category const & cat );
-#endif
+    friend class error_code;
+    friend class error_condition;
 
 #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
 public:
@@ -80,6 +76,16 @@ private:
 
     boost::ulong_long_type id_;
 
+#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
+
+    mutable std::atomic< boost::system::detail::std_category* > ps_;
+
+#else
+
+    boost::system::detail::std_category* ps_;
+
+#endif
+
 protected:
 
 #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS)
@@ -97,11 +103,11 @@ protected:
 
 #endif
 
-    BOOST_SYSTEM_CONSTEXPR error_category() BOOST_NOEXCEPT: id_( 0 )
+    BOOST_SYSTEM_CONSTEXPR error_category() BOOST_NOEXCEPT: id_( 0 ), ps_()
     {
     }
 
-    explicit BOOST_SYSTEM_CONSTEXPR error_category( boost::ulong_long_type id ) BOOST_NOEXCEPT: id_( id )
+    explicit BOOST_SYSTEM_CONSTEXPR error_category( boost::ulong_long_type id ) BOOST_NOEXCEPT: id_( id ), ps_()
     {
     }
 
@@ -121,24 +127,24 @@ public:
         return ev != 0;
     }
 
-    BOOST_SYSTEM_CONSTEXPR bool operator==( const error_category & rhs ) const BOOST_NOEXCEPT
+    friend BOOST_SYSTEM_CONSTEXPR bool operator==( error_category const & lhs, error_category const & rhs ) BOOST_NOEXCEPT
     {
-        return rhs.id_ == 0? this == &rhs: id_ == rhs.id_;
+        return rhs.id_ == 0? &lhs == &rhs: lhs.id_ == rhs.id_;
     }
 
-    BOOST_SYSTEM_CONSTEXPR bool operator!=( const error_category & rhs ) const BOOST_NOEXCEPT
+    friend BOOST_SYSTEM_CONSTEXPR bool operator!=( error_category const & lhs, error_category const & rhs ) BOOST_NOEXCEPT
     {
-        return !( *this == rhs );
+        return !( lhs == rhs );
     }
 
-    BOOST_SYSTEM_CONSTEXPR bool operator<( const error_category & rhs ) const BOOST_NOEXCEPT
+    friend BOOST_SYSTEM_CONSTEXPR bool operator<( error_category const & lhs, error_category const & rhs ) BOOST_NOEXCEPT
     {
-        if( id_ < rhs.id_ )
+        if( lhs.id_ < rhs.id_ )
         {
             return true;
         }
 
-        if( id_ > rhs.id_ )
+        if( lhs.id_ > rhs.id_ )
         {
             return false;
         }
@@ -148,13 +154,15 @@ public:
             return false; // equal
         }
 
-        return std::less<error_category const *>()( this, &rhs );
+        return std::less<error_category const *>()( &lhs, &rhs );
     }
 
 #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
-
+# if defined(__SUNPRO_CC) // trailing __global is not supported
     operator std::error_category const & () const;
-
+# else
+    operator std::error_category const & () const BOOST_SYMBOL_VISIBLE;
+# endif
 #endif
 };
 
@@ -165,8 +173,9 @@ public:
 namespace detail
 {
 
-static const boost::ulong_long_type generic_category_id = ( boost::ulong_long_type( 0xB2AB117A ) << 32 ) + 0x257EDF0D;
-static const boost::ulong_long_type system_category_id = ( boost::ulong_long_type( 0x8FAFD21E ) << 32 ) + 0x25C5E09B;
+static const boost::ulong_long_type generic_category_id = ( boost::ulong_long_type( 0xB2AB117A ) << 32 ) + 0x257EDFD0;
+static const boost::ulong_long_type system_category_id = generic_category_id + 1;
+static const boost::ulong_long_type interop_category_id = generic_category_id + 2;
 
 BOOST_SYSTEM_CONSTEXPR inline bool failed_impl( int ev, error_category const & cat )
 {