diff --git a/src/include/OpenImageIO/detail/fmt.h b/src/include/OpenImageIO/detail/fmt.h index 74e6fae78c..62ecbb4673 100644 --- a/src/include/OpenImageIO/detail/fmt.h +++ b/src/include/OpenImageIO/detail/fmt.h @@ -19,13 +19,13 @@ # define FMT_EXCEPTIONS 0 #endif -// Redefining FMT_THROW to something benign seems to avoid some UB or possibly -// gcc 11+ compiler bug triggered by the definition of FMT_THROW in fmt 10.1+ -// when FMT_EXCEPTIONS=0, which results in mangling SIMD math. This nugget -// below works around the problems for hard to understand reasons. -#if !defined(FMT_THROW) && !FMT_EXCEPTIONS && OIIO_GNUC_VERSION >= 110000 +// Redefining FMT_THROW to print and log the error. This should only occur if +// we've made a mistake and mismatched a format string and its arguments. +// Hopefully this will help us track it down. +#if !defined(FMT_THROW) && !FMT_EXCEPTIONS # define FMT_THROW(x) \ - OIIO_ASSERT_MSG(0, "fmt exception: %s", (x).what()), std::terminate() + OIIO::print("fmt exception: {}", (x).what()), \ + OIIO::errorfmt("fmt exception: {}", (x).what()) #endif // Use the grisu fast floating point formatting for old fmt versions