2
0
mirror of https://github.com/boostorg/compat.git synced 2026-01-19 04:02:16 +00:00

Move detal::throw_system_error to a separate header

This commit is contained in:
Peter Dimov
2023-06-25 11:38:15 +03:00
parent da96abfadd
commit fed8c15440
2 changed files with 29 additions and 13 deletions

View File

@@ -0,0 +1,25 @@
#ifndef BOOST_COMPAT_DETAIL_THROW_SYSTEM_ERROR_HPP_INCLUDED
#define BOOST_COMPAT_DETAIL_THROW_SYSTEM_ERROR_HPP_INCLUDED
// Copyright 2023 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/throw_exception.hpp>
#include <boost/config.hpp>
#include <system_error>
namespace boost {
namespace compat {
namespace detail {
BOOST_NORETURN BOOST_NOINLINE inline void throw_system_error( std::errc e, boost::source_location const& loc = BOOST_CURRENT_LOCATION )
{
boost::throw_exception( std::system_error( std::make_error_code( e ) ), loc );
}
} // namespace detail
} // namespace compat
} // namespace boost
#endif // BOOST_COMPAT_DETAIL_THROW_SYSTEM_ERROR_HPP_INCLUDED

View File

@@ -5,12 +5,11 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/throw_exception.hpp>
#include <boost/config.hpp>
#include <boost/compat/detail/throw_system_error.hpp>
#include <memory>
#include <mutex>
#include <system_error>
#include <memory> // std::addressof
#include <mutex> // std::defer_lock_t
#include <system_error> // std::errc
namespace boost {
namespace compat {
@@ -21,14 +20,6 @@ class shared_lock;
template <class Mutex>
void swap( shared_lock<Mutex>& x, shared_lock<Mutex>& y ) noexcept;
namespace detail {
BOOST_NORETURN BOOST_NOINLINE inline void
throw_system_error( std::errc e, boost::source_location const& loc = BOOST_CURRENT_LOCATION ) {
boost::throw_exception( std::system_error( std::make_error_code( e ) ), loc );
}
} // namespace detail
template <class Mutex>
class shared_lock {
private: