From 4b5166f21276cd5a8e104c05576755e2b85b87d3 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Mon, 23 Jan 2023 17:45:15 -0800 Subject: [PATCH] Updates fmt sprintf patch for XL compiler based on accepted fmt PR See: https://github.com/fmtlib/fmt/pull/3256 --- src/thirdparty/axom/fmt/README | 2 +- src/thirdparty/axom/fmt/format.h | 8 ------ src/thirdparty/axom/fmt/printf.h | 16 ++++++++--- src/thirdparty/axom/fmt/xl_clang.patch | 35 ------------------------- src/thirdparty/axom/fmt/xl_printf.patch | 33 +++++++++++++++++++++++ 5 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 src/thirdparty/axom/fmt/xl_clang.patch create mode 100644 src/thirdparty/axom/fmt/xl_printf.patch diff --git a/src/thirdparty/axom/fmt/README b/src/thirdparty/axom/fmt/README index 83ed98bdc0..d718ccef24 100644 --- a/src/thirdparty/axom/fmt/README +++ b/src/thirdparty/axom/fmt/README @@ -11,5 +11,5 @@ We also put fmt in the axom namespace to isolate it from other libraries that mi > find . -type f -regex .*[.]h$ -exec sed -i "s/fmt::/axom::fmt::/g" {} \; * Add `namespace axom { \` to `AXOM_FMT_BEGIN_NAMESPACE` in `fmt/core.h` * Add `} \` to `AXOM_FMT_END_NAMESPACE` in `fmt/core.h` -* Apply `src/thirdparty/axom/fmt/xl_clang.patch` -- bugfix for XL compiler +* 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 diff --git a/src/thirdparty/axom/fmt/format.h b/src/thirdparty/axom/fmt/format.h index 480af73a92..8fdbee451f 100644 --- a/src/thirdparty/axom/fmt/format.h +++ b/src/thirdparty/axom/fmt/format.h @@ -3393,14 +3393,6 @@ template struct arg_formatter { const basic_format_specs& specs; locale_ref locale; - // BEGIN AXOM BUGFIX - arg_formatter(buffer_appender it, const basic_format_specs& s) - : out (it), specs (s) {} - - arg_formatter(buffer_appender it, const basic_format_specs& s, locale_ref l) - : out (it), specs (s), locale (l) {} - // END AXOM BUGFIX - template AXOM_FMT_CONSTEXPR AXOM_FMT_INLINE auto operator()(T value) -> iterator { return detail::write(out, value, specs, locale); diff --git a/src/thirdparty/axom/fmt/printf.h b/src/thirdparty/axom/fmt/printf.h index 0ee1f30f3e..903fbe480d 100644 --- a/src/thirdparty/axom/fmt/printf.h +++ b/src/thirdparty/axom/fmt/printf.h @@ -220,6 +220,16 @@ template class printf_width_handler { } }; +// BEGIN AXOM BUGFIX +// Workaround for a bug with the XL compiler when initializing +// printf_arg_formatter's base class. +template +auto make_arg_formatter(buffer_appender iter, basic_format_specs& s) + -> arg_formatter { + return {iter, s, locale_ref()}; +} +// END AXOM BUGFIX + // The ``printf`` argument formatter. template class printf_arg_formatter : public arg_formatter { @@ -237,10 +247,10 @@ class printf_arg_formatter : public arg_formatter { } public: - // BEGIN AXOM BUGFIX +// BEGIN AXOM BUGFIX printf_arg_formatter(OutputIt iter, format_specs& s, context_type& ctx) - : base{iter, s}, context_(ctx) {} - // END AXOM BUGFIX + : base(make_arg_formatter(iter, s)), context_(ctx) {} +// END AXOM BUGFIX OutputIt operator()(monostate value) { return base::operator()(value); } diff --git a/src/thirdparty/axom/fmt/xl_clang.patch b/src/thirdparty/axom/fmt/xl_clang.patch deleted file mode 100644 index 6038440aa5..0000000000 --- a/src/thirdparty/axom/fmt/xl_clang.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/src/thirdparty/axom/fmt/format.h b/src/thirdparty/axom/fmt/format.h -index 309b7d098..047bf255e 100644 ---- a/src/thirdparty/axom/fmt/format.h -+++ b/src/thirdparty/axom/fmt/format.h -@@ -3389,6 +3389,14 @@ template struct arg_formatter { - const basic_format_specs& specs; - locale_ref locale; - -+ // BEGIN AXOM BUGFIX -+ arg_formatter(buffer_appender it, const basic_format_specs& s) -+ : out (it), specs (s) {} -+ -+ arg_formatter(buffer_appender it, const basic_format_specs& s, locale_ref l) -+ : out (it), specs (s), locale (l) {} -+ // END AXOM BUGFIX -+ - template - AXOM_FMT_CONSTEXPR AXOM_FMT_INLINE auto operator()(T value) -> iterator { - return detail::write(out, value, specs, locale); -diff --git a/src/thirdparty/axom/fmt/printf.h b/src/thirdparty/axom/fmt/printf.h -index 1c6f960a6..0ee1f30f3 100644 ---- a/src/thirdparty/axom/fmt/printf.h -+++ b/src/thirdparty/axom/fmt/printf.h -@@ -237,8 +237,10 @@ class printf_arg_formatter : public arg_formatter { - } - - public: -+ // BEGIN AXOM BUGFIX - printf_arg_formatter(OutputIt iter, format_specs& s, context_type& ctx) -- : base{iter, s, locale_ref()}, context_(ctx) {} -+ : base{iter, s}, context_(ctx) {} -+ // END AXOM BUGFIX - - OutputIt operator()(monostate value) { return base::operator()(value); } - diff --git a/src/thirdparty/axom/fmt/xl_printf.patch b/src/thirdparty/axom/fmt/xl_printf.patch new file mode 100644 index 0000000000..98d1bf541e --- /dev/null +++ b/src/thirdparty/axom/fmt/xl_printf.patch @@ -0,0 +1,33 @@ +diff --git a/src/thirdparty/axom/fmt/printf.h b/src/thirdparty/axom/fmt/printf.h +index 1c6f960a6..7f221d01b 100644 +--- a/src/thirdparty/axom/fmt/printf.h ++++ b/src/thirdparty/axom/fmt/printf.h +@@ -220,6 +220,16 @@ template class printf_width_handler { + } + }; + ++// BEGIN AXOM BUGFIX ++// Workaround for a bug with the XL compiler when initializing ++// printf_arg_formatter's base class. ++template ++auto make_arg_formatter(buffer_appender iter, basic_format_specs& s) ++ -> arg_formatter { ++ return {iter, s, locale_ref()}; ++} ++// END AXOM BUGFIX ++ + // The ``printf`` argument formatter. + template + class printf_arg_formatter : public arg_formatter { +@@ -237,8 +247,10 @@ class printf_arg_formatter : public arg_formatter { + } + + public: ++// BEGIN AXOM BUGFIX + printf_arg_formatter(OutputIt iter, format_specs& s, context_type& ctx) +- : base{iter, s, locale_ref()}, context_(ctx) {} ++ : base(make_arg_formatter(iter, s)), context_(ctx) {} ++// END AXOM BUGFIX + + OutputIt operator()(monostate value) { return base::operator()(value); } +