diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17c9933a2..730339af7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,7 +98,7 @@ jobs: with: action: build directory: output/full - setup-options: -Ddocumentation=disabled -Dtest=true -Dsystemd=enabled -Dpcre=enabled + setup-options: -Ddocumentation=disabled -Dtest=true -Dsystemd=enabled -Dpcre=enabled --force-fallback-for=fmt options: --verbose meson-version: 0.56.0 @@ -107,7 +107,7 @@ jobs: with: action: test directory: output/full - setup-options: -Ddocumentation=disabled -Dtest=true -Dsystemd=enabled -Dpcre=enabled + setup-options: -Ddocumentation=disabled -Dtest=true -Dsystemd=enabled -Dpcre=enabled --force-fallback-for=fmt options: --verbose meson-version: 0.56.0 @@ -116,7 +116,7 @@ jobs: with: action: build directory: output/mini - setup-options: -Dbuildtype=minsize -Dauto_features=disabled -Dtest=true -Ddaemon=false -Dinotify=false -Depoll=false -Deventfd=false -Dsignalfd=false -Dtcp=false -Ddsd=false -Ddatabase=false -Dneighbor=false -Dcue=false -Dfifo=false -Dhttpd=false -Dpipe=false -Drecorder=false -Dsnapcast=false + setup-options: -Dbuildtype=minsize -Dauto_features=disabled -Dtest=true -Ddaemon=false -Dinotify=false -Depoll=false -Deventfd=false -Dsignalfd=false -Dtcp=false -Ddsd=false -Ddatabase=false -Dneighbor=false -Dcue=false -Dfifo=false -Dhttpd=false -Dpipe=false -Drecorder=false -Dsnapcast=false --force-fallback-for=fmt options: --verbose meson-version: 0.56.0 diff --git a/NEWS b/NEWS index c3aadfef7..e5124c414 100644 --- a/NEWS +++ b/NEWS @@ -55,7 +55,7 @@ ver 0.24 (not yet released) - remove JACK DLL support * remove Haiku support * remove Boost dependency -* require libfmt 7 or later +* require libfmt 9 or later * documentation: switch to sphinx-rtd-theme ver 0.23.15 (2023/12/20) diff --git a/src/Log.cxx b/src/Log.cxx index 590b39df2..b4bbf9bce 100644 --- a/src/Log.cxx +++ b/src/Log.cxx @@ -14,11 +14,7 @@ LogVFmt(LogLevel level, const Domain &domain, fmt::string_view format_str, fmt::format_args args) noexcept { fmt::memory_buffer buffer; -#if FMT_VERSION >= 80000 fmt::vformat_to(std::back_inserter(buffer), format_str, args); -#else - fmt::vformat_to(buffer, format_str, args); -#endif Log(level, domain, {buffer.data(), buffer.size()}); } diff --git a/src/Log.hxx b/src/Log.hxx index c5dec17ba..713f047d8 100644 --- a/src/Log.hxx +++ b/src/Log.hxx @@ -1,15 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef MPD_LOG_HXX -#define MPD_LOG_HXX +#pragma once #include "LogLevel.hxx" #include -#if FMT_VERSION >= 80000 && FMT_VERSION < 90000 -#include -#endif #include #include @@ -29,14 +25,8 @@ void LogFmt(LogLevel level, const Domain &domain, const S &format_str, Args&&... args) noexcept { -#if FMT_VERSION >= 90000 return LogVFmt(level, domain, format_str, fmt::make_format_args(args...)); -#else - return LogVFmt(level, domain, fmt::to_string_view(format_str), - fmt::make_args_checked(format_str, - args...)); -#endif } template @@ -126,5 +116,3 @@ LogError(const std::exception_ptr &ep, const char *msg) noexcept { Log(LogLevel::ERROR, ep, msg); } - -#endif /* LOG_H */ diff --git a/src/client/Response.cxx b/src/client/Response.cxx index 169a18a0c..e2db07309 100644 --- a/src/client/Response.cxx +++ b/src/client/Response.cxx @@ -28,11 +28,7 @@ bool Response::VFmt(fmt::string_view format_str, fmt::format_args args) noexcept { fmt::memory_buffer buffer; -#if FMT_VERSION >= 80000 fmt::vformat_to(std::back_inserter(buffer), format_str, args); -#else - fmt::vformat_to(buffer, format_str, args); -#endif return Write(buffer.data(), buffer.size()); } diff --git a/src/client/Response.hxx b/src/client/Response.hxx index 748745954..4b0bad768 100644 --- a/src/client/Response.hxx +++ b/src/client/Response.hxx @@ -1,15 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef MPD_RESPONSE_HXX -#define MPD_RESPONSE_HXX +#pragma once #include "protocol/Ack.hxx" #include -#if FMT_VERSION >= 80000 && FMT_VERSION < 90000 -#include -#endif #include #include @@ -66,14 +62,8 @@ public: template bool Fmt(const S &format_str, Args&&... args) noexcept { -#if FMT_VERSION >= 90000 return VFmt(format_str, fmt::make_format_args(args...)); -#else - return VFmt(fmt::to_string_view(format_str), - fmt::make_args_checked(format_str, - args...)); -#endif } /** @@ -92,15 +82,7 @@ public: template void FmtError(enum ack code, const S &format_str, Args&&... args) noexcept { -#if FMT_VERSION >= 90000 return VFmtError(code, format_str, fmt::make_format_args(args...)); -#else - return VFmtError(code, fmt::to_string_view(format_str), - fmt::make_args_checked(format_str, - args...)); -#endif } }; - -#endif diff --git a/src/io/BufferedOutputStream.cxx b/src/io/BufferedOutputStream.cxx index 0c706e8b7..bd0ad654e 100644 --- a/src/io/BufferedOutputStream.cxx +++ b/src/io/BufferedOutputStream.cxx @@ -52,11 +52,7 @@ BufferedOutputStream::VFmt(fmt::string_view format_str, fmt::format_args args) /* TODO format into this object's buffer instead of allocating a new one */ fmt::memory_buffer b; -#if FMT_VERSION >= 80000 fmt::vformat_to(std::back_inserter(b), format_str, args); -#else - fmt::vformat_to(b, format_str, args); -#endif return Write(std::as_bytes(std::span{b.data(), b.size()})); } diff --git a/src/io/BufferedOutputStream.hxx b/src/io/BufferedOutputStream.hxx index 73a71c037..fa5fd82c3 100644 --- a/src/io/BufferedOutputStream.hxx +++ b/src/io/BufferedOutputStream.hxx @@ -7,9 +7,6 @@ #include "util/SpanCast.hxx" #include -#if FMT_VERSION >= 80000 && FMT_VERSION < 90000 -#include -#endif #include #include @@ -71,14 +68,8 @@ public: template void Fmt(const S &format_str, Args&&... args) { -#if FMT_VERSION >= 90000 VFmt(format_str, fmt::make_format_args(args...)); -#else - VFmt(fmt::to_string_view(format_str), - fmt::make_args_checked(format_str, - args...)); -#endif } #ifdef _UNICODE diff --git a/src/lib/fmt/RuntimeError.hxx b/src/lib/fmt/RuntimeError.hxx index e2d2bf6de..61623ec38 100644 --- a/src/lib/fmt/RuntimeError.hxx +++ b/src/lib/fmt/RuntimeError.hxx @@ -4,9 +4,6 @@ #pragma once #include -#if FMT_VERSION >= 80000 && FMT_VERSION < 90000 -#include -#endif #include // IWYU pragma: export @@ -19,14 +16,8 @@ template 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(format_str, - args...)); -#endif } [[nodiscard]] [[gnu::pure]] @@ -38,12 +29,6 @@ template 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(format_str, - args...)); -#endif } diff --git a/src/lib/fmt/SystemError.hxx b/src/lib/fmt/SystemError.hxx index a53e26ec2..40636daf3 100644 --- a/src/lib/fmt/SystemError.hxx +++ b/src/lib/fmt/SystemError.hxx @@ -6,9 +6,6 @@ #include "system/Error.hxx" // IWYU pragma: export #include -#if FMT_VERSION >= 80000 && FMT_VERSION < 90000 -#include -#endif #include @@ -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(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(format_str, - args...)); -#endif } template diff --git a/src/lib/fmt/ToBuffer.hxx b/src/lib/fmt/ToBuffer.hxx index 563223dda..01f6102f5 100644 --- a/src/lib/fmt/ToBuffer.hxx +++ b/src/lib/fmt/ToBuffer.hxx @@ -6,9 +6,6 @@ #include "util/StringBuffer.hxx" #include -#if FMT_VERSION < 90000 -#include // for the fmt::buffer::flush() implementation -#endif template StringBuffer & @@ -35,14 +32,8 @@ StringBuffer & FmtToBuffer(StringBuffer &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(format_str, - args...)); -#endif } template @@ -50,12 +41,6 @@ template auto FmtBuffer(const S &format_str, Args&&... args) noexcept { -#if FMT_VERSION >= 90000 return VFmtBuffer(format_str, fmt::make_format_args(args...)); -#else - return VFmtBuffer(fmt::to_string_view(format_str), - fmt::make_args_checked(format_str, - args...)); -#endif } diff --git a/src/lib/fmt/meson.build b/src/lib/fmt/meson.build index 793c296fc..f6b0243ee 100644 --- a/src/lib/fmt/meson.build +++ b/src/lib/fmt/meson.build @@ -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(