From 2c0d9e9409fa8161b781ce9a67f12220d0605703 Mon Sep 17 00:00:00 2001 From: Matt Stafford Date: Thu, 6 Jun 2024 13:03:49 +1000 Subject: [PATCH] Add a define to force the use of fallback_file --- include/fmt/format-inl.h | 11 +++++++++-- test/scan.h | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 0750e7fcb947..8d07cc672337 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -1600,14 +1600,21 @@ template class fallback_file : public file_base { } }; -template +#ifndef FMT_USE_FALLBACK_FILE +# define FMT_USE_FALLBACK_FILE 1 +#endif + +template auto get_file(F* f, int) -> apple_file { return f; } -template +template inline auto get_file(F* f, int) -> glibc_file { return f; } + inline auto get_file(FILE* f, ...) -> fallback_file { return f; } using file_ref = decltype(get_file(static_cast(nullptr), 0)); diff --git a/test/scan.h b/test/scan.h index 15a80356e9c7..1f1cda74ef47 100644 --- a/test/scan.h +++ b/test/scan.h @@ -153,11 +153,13 @@ class string_scan_buffer final : public scan_buffer { class file_scan_buffer final : public scan_buffer { private: - template + template static auto get_file(F* f, int) -> glibc_file { return f; } - template + template static auto get_file(F* f, int) -> apple_file { return f; }