From 94f7686558958adcbe3b2368e63c9ba29f06de81 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Tue, 3 Feb 2026 20:27:01 +0100 Subject: [PATCH] refactor: Remove no longer needed FMT_STRING fmt checks format arguments without the need of FMT_STRING when using C++20. --- src/ccache/util/format.hpp | 13 +++++-------- src/ccache/util/logging.hpp | 11 +++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/ccache/util/format.hpp b/src/ccache/util/format.hpp index 613ac478..eea6f27f 100644 --- a/src/ccache/util/format.hpp +++ b/src/ccache/util/format.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2019-2024 Joel Rosdahl and other contributors +// Copyright (C) 2019-2026 Joel Rosdahl and other contributors // // See doc/authors.adoc for a complete list of contributors. // @@ -25,14 +25,11 @@ #include #include -// Convenience macro for calling `fmt::format` with `FMT_STRING` around the -// format string literal. -#define FMT(format_, ...) fmt::format(FMT_STRING(format_), __VA_ARGS__) +// Convenience macro for `fmt::format`. +#define FMT(format_, ...) fmt::format(format_, __VA_ARGS__) -// Convenience macro for calling `fmt::print` with `FMT_STRING` around the -// format string literal. -#define PRINT(stream_, format_, ...) \ - fmt::print(stream_, FMT_STRING(format_), __VA_ARGS__) +// Convenience macro for `fmt::print`. +#define PRINT(stream_, format_, ...) fmt::print(stream_, format_, __VA_ARGS__) // Convenience macro for calling `fmt::print` with a message that is not a // format string. diff --git a/src/ccache/util/logging.hpp b/src/ccache/util/logging.hpp index a455d126..5c1e5a77 100644 --- a/src/ccache/util/logging.hpp +++ b/src/ccache/util/logging.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2025 Joel Rosdahl and other contributors +// Copyright (C) 2020-2026 Joel Rosdahl and other contributors // // See doc/authors.adoc for a complete list of contributors. // @@ -37,14 +37,13 @@ } while (false) // Log a message (plus a newline character) described by a format string with at -// least one placeholder. `format` is checked at compile time. -#define LOG(format_, ...) LOG_RAW(fmt::format(FMT_STRING(format_), __VA_ARGS__)) +// least one placeholder. +#define LOG(format_, ...) LOG_RAW(fmt::format(format_, __VA_ARGS__)) // Log a message (plus a newline character) described by a format string with at -// least one placeholder without flushing and with a reused timestamp. `format` -// is checked at compile time. +// least one placeholder without flushing and with a reused timestamp. #define BULK_LOG(logger_, format_, ...) \ - logger_.log(fmt::format(FMT_STRING(format_), __VA_ARGS__)) + logger_.log(fmt::format(format_, __VA_ARGS__)) namespace util::logging { -- 2.47.3