Log, client/Response, io/BufferedOutputStream: drop support for libfmt < 7

Remove some compatibility code.
This commit is contained in:
Max Kellermann 2022-11-28 18:51:37 +01:00
parent b09a776a26
commit 7f3868727b
5 changed files with 9 additions and 24 deletions

1
NEWS
View File

@ -24,6 +24,7 @@ ver 0.24 (not yet released)
- GCC 10 or clang 11 (or newer) recommended
* static partition configuration
* remove Haiku support
* require libfmt 7 or later
ver 0.23.11 (2022/11/28)
* database

View File

@ -248,7 +248,7 @@ if boost_dep.version() == '1.67'
warning('Your Boost version 1.67 is known to be buggy, and the MPD build will fail. Please upgrade to Boost 1.68 or later.')
endif
fmt_dep = dependency('fmt', fallback: ['fmt', 'fmt_dep'])
fmt_dep = dependency('fmt', version: '>= 7', fallback: ['fmt', 'fmt_dep'])
if compiler.get_id() == 'clang' and compiler.version().version_compare('<15')
fmt_dep = declare_dependency(

View File

@ -23,7 +23,7 @@
#include "LogLevel.hxx"
#include <fmt/core.h>
#if FMT_VERSION < 70000 || FMT_VERSION >= 80000
#if FMT_VERSION >= 80000
#include <fmt/format.h>
#endif
@ -48,14 +48,10 @@ LogFmt(LogLevel level, const Domain &domain,
#if FMT_VERSION >= 90000
return LogVFmt(level, domain, format_str,
fmt::make_format_args(args...));
#elif FMT_VERSION >= 70000
#else
return LogVFmt(level, domain, fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#else
/* expensive fallback for older libfmt versions */
const auto result = fmt::format(format_str, args...);
return Log(level, domain, result);
#endif
}

View File

@ -23,7 +23,7 @@
#include "protocol/Ack.hxx"
#include <fmt/core.h>
#if FMT_VERSION < 70000 || FMT_VERSION >= 80000
#if FMT_VERSION >= 80000
#include <fmt/format.h>
#endif
@ -85,14 +85,10 @@ public:
#if FMT_VERSION >= 90000
return VFmt(format_str,
fmt::make_format_args(args...));
#elif FMT_VERSION >= 70000
#else
return VFmt(fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#else
/* expensive fallback for older libfmt versions */
const auto result = fmt::format(format_str, args...);
return Write(result.data(), result.size());
#endif
}
@ -115,14 +111,10 @@ public:
#if FMT_VERSION >= 90000
return VFmtError(code, format_str,
fmt::make_format_args(args...));
#elif FMT_VERSION >= 70000
#else
return VFmtError(code, fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#else
/* expensive fallback for older libfmt versions */
const auto result = fmt::format(format_str, args...);
return Error(code, result.c_str());
#endif
}
};

View File

@ -34,7 +34,7 @@
#include "util/DynamicFifoBuffer.hxx"
#include <fmt/core.h>
#if FMT_VERSION < 70000 || FMT_VERSION >= 80000
#if FMT_VERSION >= 80000
#include <fmt/format.h>
#endif
@ -104,14 +104,10 @@ public:
#if FMT_VERSION >= 90000
VFmt(format_str,
fmt::make_format_args(args...));
#elif FMT_VERSION >= 70000
#else
VFmt(fmt::to_string_view(format_str),
fmt::make_args_checked<Args...>(format_str,
args...));
#else
/* expensive fallback for older libfmt versions */
const auto result = fmt::format(format_str, args...);
Write(result.data(), result.size());
#endif
}