Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt: add upstream patch #162590

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Formula/f/fmt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Fmt < Formula
url "https://github.com/fmtlib/fmt/archive/refs/tags/10.2.1.tar.gz"
sha256 "1250e4cc58bf06ee631567523f48848dc4596133e163f02615c97f78bab6c811"
license "MIT"
revision 1
head "https://github.com/fmtlib/fmt.git", branch: "master"

bottle do
Expand All @@ -18,6 +19,11 @@ class Fmt < Formula

depends_on "cmake" => :build

# Fix handling of static separator; cherry-picked from:
# https://github.com/fmtlib/fmt/commit/44c3fe1ebb466ab5c296e1a1a6991c7c7b51b72e
# Remove when included in a release.
patch :DATA

def install
system "cmake", "-S", ".", "-B", "build", "-DBUILD_SHARED_LIBS=TRUE", *std_cmake_args
system "cmake", "--build", "build"
Expand Down Expand Up @@ -48,3 +54,30 @@ def install
assert_equal "The answer is 42", shell_output("./test")
end
end

__END__
diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h
index 9fc87ecf2027df0346935e7666ea80ec70e65575..872aa9802df1ffa8572a2f0d29f58bdb2b171a1a 100644
--- a/include/fmt/format-inl.h
+++ b/include/fmt/format-inl.h
@@ -110,7 +110,11 @@ template <typename Char> FMT_FUNC Char decimal_point_impl(locale_ref) {

FMT_FUNC auto write_loc(appender out, loc_value value,
const format_specs<>& specs, locale_ref loc) -> bool {
-#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
+#ifdef FMT_STATIC_THOUSANDS_SEPARATOR
+ value.visit(loc_writer<>{
+ out, specs, std::string(1, FMT_STATIC_THOUSANDS_SEPARATOR), "\3", "."});
+ return true;
+#else
auto locale = loc.get<std::locale>();
// We cannot use the num_put<char> facet because it may produce output in
// a wrong encoding.
@@ -119,7 +123,6 @@ FMT_FUNC auto write_loc(appender out, loc_value value,
return std::use_facet<facet>(locale).put(out, value, specs);
return facet(locale).put(out, value, specs);
#endif
- return false;
}
} // namespace detail

Loading