Skip to content

Commit

Permalink
Updates fmt sprintf patch for XL compiler based on accepted fmt PR
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyweiss committed Jan 24, 2023
1 parent cae8616 commit b6c3830
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/thirdparty/axom/fmt/README
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 0 additions & 8 deletions src/thirdparty/axom/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -3393,14 +3393,6 @@ template <typename Char> struct arg_formatter {
const basic_format_specs<Char>& specs;
locale_ref locale;

// BEGIN AXOM BUGFIX
arg_formatter(buffer_appender<Char> it, const basic_format_specs<Char>& s)
: out (it), specs (s) {}

arg_formatter(buffer_appender<Char> it, const basic_format_specs<Char>& s, locale_ref l)
: out (it), specs (s), locale (l) {}
// END AXOM BUGFIX

template <typename T>
AXOM_FMT_CONSTEXPR AXOM_FMT_INLINE auto operator()(T value) -> iterator {
return detail::write(out, value, specs, locale);
Expand Down
16 changes: 13 additions & 3 deletions src/thirdparty/axom/fmt/printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ template <typename Char> class printf_width_handler {
}
};

// BEGIN AXOM BUGFIX
// Workaround for a bug with the XL compiler when initializing
// printf_arg_formatter's base class.
template <typename Char>
auto make_arg_formatter(buffer_appender<Char> iter, basic_format_specs<Char>& s)
-> arg_formatter<Char> {
return {iter, s, locale_ref()};
}
// END AXOM BUGFIX

// The ``printf`` argument formatter.
template <typename OutputIt, typename Char>
class printf_arg_formatter : public arg_formatter<Char> {
Expand All @@ -237,10 +247,10 @@ class printf_arg_formatter : public arg_formatter<Char> {
}

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); }

Expand Down
35 changes: 0 additions & 35 deletions src/thirdparty/axom/fmt/xl_clang.patch

This file was deleted.

33 changes: 33 additions & 0 deletions src/thirdparty/axom/fmt/xl_printf.patch
Original file line number Diff line number Diff line change
@@ -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 <typename Char> class printf_width_handler {
}
};

+// BEGIN AXOM BUGFIX
+// Workaround for a bug with the XL compiler when initializing
+// printf_arg_formatter's base class.
+template <typename Char>
+auto make_arg_formatter(buffer_appender<Char> iter, basic_format_specs<Char>& s)
+ -> arg_formatter<Char> {
+ return {iter, s, locale_ref()};
+}
+// END AXOM BUGFIX
+
// The ``printf`` argument formatter.
template <typename OutputIt, typename Char>
class printf_arg_formatter : public arg_formatter<Char> {
@@ -237,8 +247,10 @@ class printf_arg_formatter : public arg_formatter<Char> {
}

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); }

0 comments on commit b6c3830

Please sign in to comment.