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

Restore compatibility with 10.1 ABI #42

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
52 changes: 52 additions & 0 deletions recipe/0001-Restore-symbol-from-10.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From a82712d220fc2df963c9a5463c77dd6d92ad7577 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20R=C3=BCth?= <[email protected]>
Date: Tue, 2 Jan 2024 23:43:30 -0600
Subject: [PATCH] Restore symbol from 10.1

Fixes #3785.

the write_console symbol has changed from 10.1 to 10.2. Here we restore
the symbol as introduced in 10.1.
---
include/fmt/format-inl.h | 5 +++++
include/fmt/format.h | 1 +
2 files changed, 6 insertions(+)

diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h
index e9a4ca45..daeae5b1 100644
--- a/include/fmt/format-inl.h
+++ b/include/fmt/format-inl.h
@@ -1434,6 +1434,7 @@ FMT_FUNC auto vformat(string_view fmt, format_args args) -> std::string {
namespace detail {
#if !defined(_WIN32) || defined(FMT_WINDOWS_NO_WCHAR)
FMT_FUNC auto write_console(int, string_view) -> bool { return false; }
+FMT_FUNC auto write_console(std::FILE* f, string_view text) -> bool { return false; }
#else
using dword = conditional_t<sizeof(long) == 4, unsigned long, unsigned>;
extern "C" __declspec(dllimport) int __stdcall WriteConsoleW( //
@@ -1444,6 +1445,10 @@ FMT_FUNC bool write_console(int fd, string_view text) {
return WriteConsoleW(reinterpret_cast<void*>(_get_osfhandle(fd)), u16.c_str(),
static_cast<dword>(u16.size()), nullptr, nullptr) != 0;
}
+
+FMT_FUNC auto write_console(std::FILE* f, string_view text) -> bool {
+ return write_console(_fileno(f), text);
+}
#endif

#ifdef _WIN32
diff --git a/include/fmt/format.h b/include/fmt/format.h
index 97f0e1fb..7637c8a0 100644
--- a/include/fmt/format.h
+++ b/include/fmt/format.h
@@ -999,6 +999,7 @@ struct is_contiguous<basic_memory_buffer<T, SIZE, Allocator>> : std::true_type {
FMT_END_EXPORT
namespace detail {
FMT_API auto write_console(int fd, string_view text) -> bool;
+FMT_API auto write_console(std::FILE* f, string_view text) -> bool;
FMT_API void print(std::FILE*, string_view);
} // namespace detail

--
2.43.0

5 changes: 4 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ package:
source:
url: https://github.com/fmtlib/fmt/archive/{{ version }}.tar.gz
sha256: {{ sha256 }}
patches:
# Upstreamed at https://github.com/fmtlib/fmt/pull/3786
- 0001-Restore-symbol-from-10.1.patch

build:
number: 0
number: 1
skip: true # [win and vc<14]
run_exports:
- {{ pin_subpackage('fmt', max_pin='x') }}
Expand Down