mirror of
https://github.com/matrix-construct/construct
synced 2024-05-19 19:33:45 +02:00
ircd::exception: Move throwing errno+system_category out-of-line.
This commit is contained in:
parent
6c7a978a60
commit
09021ac28b
|
@ -40,6 +40,7 @@ namespace ircd
|
||||||
std::system_error make_system_error(const std::error_code &);
|
std::system_error make_system_error(const std::error_code &);
|
||||||
std::system_error make_system_error(const boost::system::error_code &);
|
std::system_error make_system_error(const boost::system::error_code &);
|
||||||
std::system_error make_system_error(const boost::system::system_error &);
|
std::system_error make_system_error(const boost::system::system_error &);
|
||||||
|
[[noreturn]] void throw_system_error();
|
||||||
template<class... args> std::exception_ptr make_system_eptr(args&&...);
|
template<class... args> std::exception_ptr make_system_eptr(args&&...);
|
||||||
template<class... args> [[noreturn]] void throw_system_error(args&&...);
|
template<class... args> [[noreturn]] void throw_system_error(args&&...);
|
||||||
template<class E, class... args> std::exception_ptr make_exception_ptr(args&&...);
|
template<class E, class... args> std::exception_ptr make_exception_ptr(args&&...);
|
||||||
|
|
|
@ -107,10 +107,7 @@ ircd::sys::call(function&& f,
|
||||||
};
|
};
|
||||||
|
|
||||||
if(unlikely(!nothrow && ret == -1L))
|
if(unlikely(!nothrow && ret == -1L))
|
||||||
throw std::system_error
|
throw_system_error();
|
||||||
{
|
|
||||||
errno, std::system_category()
|
|
||||||
};
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,10 +63,8 @@ ircd::allocator::allocate(const size_t alignment,
|
||||||
throw std::bad_alloc{};
|
throw std::bad_alloc{};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw std::system_error
|
throw_system_error();
|
||||||
{
|
__builtin_unreachable();
|
||||||
errc, std::system_category()
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(ret != nullptr);
|
assert(ret != nullptr);
|
||||||
|
|
|
@ -152,6 +152,16 @@ noexcept
|
||||||
ec == boost::system::generic_category();
|
ec == boost::system::generic_category();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[noreturn]]
|
||||||
|
void
|
||||||
|
ircd::throw_system_error()
|
||||||
|
{
|
||||||
|
throw std::system_error
|
||||||
|
{
|
||||||
|
errno, std::system_category()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
std::system_error
|
std::system_error
|
||||||
ircd::make_system_error(const boost::system::system_error &e)
|
ircd::make_system_error(const boost::system::system_error &e)
|
||||||
{
|
{
|
||||||
|
|
20
ircd/fs.cc
20
ircd/fs.cc
|
@ -1022,10 +1022,7 @@ ircd::fs::_read_preadv(const fd &fd,
|
||||||
return 0UL;
|
return 0UL;
|
||||||
|
|
||||||
if(unlikely(ret == -1))
|
if(unlikely(ret == -1))
|
||||||
throw std::system_error
|
throw_system_error();
|
||||||
{
|
|
||||||
errno, std::system_category()
|
|
||||||
};
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1052,10 +1049,7 @@ ircd::fs::_read_preadv2(const fd &fd,
|
||||||
return 0UL;
|
return 0UL;
|
||||||
|
|
||||||
if(unlikely(ret == -1))
|
if(unlikely(ret == -1))
|
||||||
throw std::system_error
|
throw_system_error();
|
||||||
{
|
|
||||||
errno, std::system_category()
|
|
||||||
};
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1407,10 +1401,7 @@ ircd::fs::_write_pwritev(const fd &fd,
|
||||||
return 0UL;
|
return 0UL;
|
||||||
|
|
||||||
if(unlikely(ret == -1))
|
if(unlikely(ret == -1))
|
||||||
throw std::system_error
|
throw_system_error();
|
||||||
{
|
|
||||||
errno, std::system_category()
|
|
||||||
};
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1440,10 +1431,7 @@ ircd::fs::_write_pwritev2(const fd &fd,
|
||||||
return 0UL;
|
return 0UL;
|
||||||
|
|
||||||
if(unlikely(ret == -1))
|
if(unlikely(ret == -1))
|
||||||
throw std::system_error
|
throw_system_error();
|
||||||
{
|
|
||||||
errno, std::system_category()
|
|
||||||
};
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,10 +432,7 @@ ircd::prof::event::event(const int &group,
|
||||||
};
|
};
|
||||||
|
|
||||||
if(ret == (void *)-1)
|
if(ret == (void *)-1)
|
||||||
throw std::system_error
|
throw_system_error();
|
||||||
{
|
|
||||||
errno, std::system_category()
|
|
||||||
};
|
|
||||||
|
|
||||||
if(map_size && ret == nullptr)
|
if(map_size && ret == nullptr)
|
||||||
throw error
|
throw error
|
||||||
|
|
Loading…
Reference in a new issue