From 913507044b55d7cc4203eb6285c483c61561aca6 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Sat, 25 Oct 2025 16:28:24 +0100 Subject: [PATCH] Fix leaky `diagnostic ignored` pragma (#4588) Ignoring the `-Wconversion` diagnostic in `make_format_args` was leaking out of the header, resulting in that warning being ignored in downstream code that includes `fmt/base.h`. Instead, we should `push`/`pop` the diagnostics to ensure this is cleaned up. --- include/fmt/base.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/fmt/base.h b/include/fmt/base.h index 2227545d..2e443ca0 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -236,6 +236,7 @@ FMT_PRAGMA_GCC(optimize("Og")) # define FMT_GCC_OPTIMIZED #endif FMT_PRAGMA_CLANG(diagnostic push) +FMT_PRAGMA_GCC(diagnostic push) #ifdef FMT_ALWAYS_INLINE // Use the provided definition. @@ -2997,6 +2998,7 @@ FMT_INLINE void println(format_string fmt, T&&... args) { return fmt::println(stdout, fmt, static_cast(args)...); } +FMT_PRAGMA_GCC(diagnostic pop) FMT_PRAGMA_CLANG(diagnostic pop) FMT_PRAGMA_GCC(pop_options) FMT_END_EXPORT