diff --git a/src/thirdparty/axom/fmt/README b/src/thirdparty/axom/fmt/README index d718ccef24..12a66b7f47 100644 --- a/src/thirdparty/axom/fmt/README +++ b/src/thirdparty/axom/fmt/README @@ -13,3 +13,4 @@ We also put fmt in the axom namespace to isolate it from other libraries that mi * Add `} \` to `AXOM_FMT_END_NAMESPACE` in `fmt/core.h` * Apply `src/thirdparty/axom/fmt/xl_printf.patch` -- bugfix for XL compiler * Apply `src/thirdparty/axom/fmt/hipcc_long_double.patch` -- bugfix for dealing with `long double` type on EAS architecture with hip compiler +* Apply `src/thirdparty/axom/fmt/runtime_error.patch` -- workaround for dealing with `std::runtime_error` bug in nvcc \ No newline at end of file diff --git a/src/thirdparty/axom/fmt/format-inl.h b/src/thirdparty/axom/fmt/format-inl.h index ff6e6323f8..efdbeb40ac 100644 --- a/src/thirdparty/axom/fmt/format-inl.h +++ b/src/thirdparty/axom/fmt/format-inl.h @@ -121,11 +121,17 @@ template AXOM_FMT_FUNC Char decimal_point_impl(locale_ref) { AXOM_FMT_API AXOM_FMT_FUNC format_error::~format_error() noexcept = default; #endif -AXOM_FMT_FUNC std::system_error vsystem_error(int error_code, string_view format_str, +// BEGIN AXOM BUGFIX +// NVCC's preprocessor converts 'std::error_code' to `class std::error_code' +// and then complains that `return class std::error_code' isn't valid! +using axom_fmt_system_error = std::system_error; + +AXOM_FMT_FUNC axom_fmt_system_error vsystem_error(int error_code, string_view format_str, format_args args) { auto ec = std::error_code(error_code, std::generic_category()); - return std::system_error(ec, vformat(format_str, args)); + return axom_fmt_system_error(ec, vformat(format_str, args)); } +// END AXOM BUGFIX namespace detail { @@ -1449,16 +1455,18 @@ AXOM_FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) { buffer_.push_back(0); } +// BEGIN AXOM BUGFIX AXOM_FMT_FUNC void format_system_error(detail::buffer& out, int error_code, const char* message) noexcept { AXOM_FMT_TRY { auto ec = std::error_code(error_code, std::generic_category()); - write(std::back_inserter(out), std::system_error(ec, message).what()); + write(std::back_inserter(out), axom_fmt_system_error(ec, message).what()); return; } AXOM_FMT_CATCH(...) {} format_error_code(out, error_code, message); } +// END AXOM BUGFIX AXOM_FMT_FUNC void report_system_error(int error_code, const char* message) noexcept { diff --git a/src/thirdparty/axom/fmt/runtime_error.patch b/src/thirdparty/axom/fmt/runtime_error.patch new file mode 100644 index 0000000000..fa92887310 --- /dev/null +++ b/src/thirdparty/axom/fmt/runtime_error.patch @@ -0,0 +1,44 @@ +diff --git a/src/thirdparty/axom/fmt/format-inl.h b/src/thirdparty/axom/fmt/format-inl.h +index ff6e6323f..efdbeb40a 100644 +--- a/src/thirdparty/axom/fmt/format-inl.h ++++ b/src/thirdparty/axom/fmt/format-inl.h +@@ -121,11 +121,17 @@ template AXOM_FMT_FUNC Char decimal_point_impl(locale_ref) { + AXOM_FMT_API AXOM_FMT_FUNC format_error::~format_error() noexcept = default; + #endif + +-AXOM_FMT_FUNC std::system_error vsystem_error(int error_code, string_view format_str, ++// BEGIN AXOM BUGFIX ++// NVCC's preprocessor converts 'std::error_code' to `class std::error_code' ++// and then complains that `return class std::error_code' isn't valid! ++using axom_fmt_system_error = std::system_error; ++ ++AXOM_FMT_FUNC axom_fmt_system_error vsystem_error(int error_code, string_view format_str, + format_args args) { + auto ec = std::error_code(error_code, std::generic_category()); +- return std::system_error(ec, vformat(format_str, args)); ++ return axom_fmt_system_error(ec, vformat(format_str, args)); + } ++// END AXOM BUGFIX + + namespace detail { + +@@ -1449,16 +1455,18 @@ AXOM_FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) { + buffer_.push_back(0); + } + ++// BEGIN AXOM BUGFIX + AXOM_FMT_FUNC void format_system_error(detail::buffer& out, int error_code, + const char* message) noexcept { + AXOM_FMT_TRY { + auto ec = std::error_code(error_code, std::generic_category()); +- write(std::back_inserter(out), std::system_error(ec, message).what()); ++ write(std::back_inserter(out), axom_fmt_system_error(ec, message).what()); + return; + } + AXOM_FMT_CATCH(...) {} + format_error_code(out, error_code, message); + } ++// END AXOM BUGFIX + + AXOM_FMT_FUNC void report_system_error(int error_code, + const char* message) noexcept {