As suggested by Casey, so the compiler can catch failures to return
errors.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
// This is part of the glue for hooking new code to old. Since
// Context* and other things give us integer codes from errno, wrap
// them in an error_code.
-boost::system::error_code to_error_code(int ret) noexcept
+[[nodiscard]] boost::system::error_code to_error_code(int ret) noexcept
{
if (ret == 0)
return {};
// This is more complicated. For the case of categories defined
// elsewhere, we have to convert everything here.
-int from_error_code(boost::system::error_code e) noexcept
+[[nodiscard]] int from_error_code(boost::system::error_code e) noexcept
{
if (!e)
return 0;
return { static_cast<int>(e), ceph_category() };
}
-boost::system::error_code to_error_code(int ret) noexcept;
-int from_error_code(boost::system::error_code e) noexcept;
+[[nodiscard]] boost::system::error_code to_error_code(int ret) noexcept;
+[[nodiscard]] int from_error_code(boost::system::error_code e) noexcept;
}
#pragma GCC diagnostic pop
#pragma clang diagnostic pop