lib/fmt: require libfmt 9

Version 9 added the "debug format" which I'd like to use.
This commit is contained in:
Max Kellermann
2024-04-16 11:31:07 +02:00
parent 08810991c2
commit 39c9e92f42
12 changed files with 7 additions and 103 deletions
-15
View File
@@ -4,9 +4,6 @@
#pragma once
#include <fmt/core.h>
#if FMT_VERSION >= 80000 && FMT_VERSION < 90000
#include <fmt/format.h>
#endif
#include <stdexcept> // IWYU pragma: export
@@ -19,14 +16,8 @@ template<typename S, typename... Args>
auto
FmtRuntimeError(const S &format_str, Args&&... args) noexcept
{
#if FMT_VERSION >= 90000
return VFmtRuntimeError(format_str,
fmt::make_format_args(args...));
#else
return VFmtRuntimeError(fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#endif
}
[[nodiscard]] [[gnu::pure]]
@@ -38,12 +29,6 @@ template<typename S, typename... Args>
auto
FmtInvalidArgument(const S &format_str, Args&&... args) noexcept
{
#if FMT_VERSION >= 90000
return VFmtInvalidArgument(format_str,
fmt::make_format_args(args...));
#else
return VFmtInvalidArgument(fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#endif
}
-15
View File
@@ -6,9 +6,6 @@
#include "system/Error.hxx" // IWYU pragma: export
#include <fmt/core.h>
#if FMT_VERSION >= 80000 && FMT_VERSION < 90000
#include <fmt/format.h>
#endif
#include <type_traits>
@@ -23,14 +20,8 @@ std::system_error
FmtSystemError(std::error_code code,
const S &format_str, Args&&... args) noexcept
{
#if FMT_VERSION >= 90000
return VFmtSystemError(code, format_str,
fmt::make_format_args(args...));
#else
return VFmtSystemError(code, fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#endif
}
#ifdef _WIN32
@@ -46,14 +37,8 @@ std::system_error
FmtLastError(DWORD code,
const S &format_str, Args&&... args) noexcept
{
#if FMT_VERSION >= 90000
return VFmtLastError(code, format_str,
fmt::make_format_args(args...));
#else
return VFmtLastError(code, fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#endif
}
template<typename S, typename... Args>
-15
View File
@@ -6,9 +6,6 @@
#include "util/StringBuffer.hxx"
#include <fmt/core.h>
#if FMT_VERSION < 90000
#include <fmt/format.h> // for the fmt::buffer::flush() implementation
#endif
template<std::size_t size>
StringBuffer<size> &
@@ -35,14 +32,8 @@ StringBuffer<size> &
FmtToBuffer(StringBuffer<size> &buffer,
const S &format_str, Args&&... args) noexcept
{
#if FMT_VERSION >= 90000
return VFmtToBuffer(buffer, format_str,
fmt::make_format_args(args...));
#else
return VFmtToBuffer(buffer, fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#endif
}
template<std::size_t size, typename S, typename... Args>
@@ -50,12 +41,6 @@ template<std::size_t size, typename S, typename... Args>
auto
FmtBuffer(const S &format_str, Args&&... args) noexcept
{
#if FMT_VERSION >= 90000
return VFmtBuffer<size>(format_str,
fmt::make_format_args(args...));
#else
return VFmtBuffer<size>(fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#endif
}
+1 -1
View File
@@ -1,4 +1,4 @@
libfmt = dependency('fmt', version: '>= 7', fallback: ['fmt', 'fmt_dep'])
libfmt = dependency('fmt', version: '>= 9', fallback: ['fmt', 'fmt_dep'])
if compiler.get_id() == 'clang' and compiler.version().version_compare('<15')
libfmt = declare_dependency(