From ff1caa58c9289a40c8ec5493f987fab4ce38ecd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Sun, 31 Aug 2025 17:05:54 +0200 Subject: [PATCH] Use FMT_THROW in report_error (#4521) With exceptions: No change (if FMT_THROW is not user provided) Without exceptions: Now also states where it comes from (report_error) and uses fprintf instead of fputs. My motivation is, now that I have my own fmt::assert_failed, also to get rid of fputs for my embedded build. --- include/fmt/format-inl.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 3b317af8..386c9723 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -147,12 +147,7 @@ FMT_FUNC void report_error(const char* message) { volatile bool b = true; if (!b) return; #endif -#if FMT_USE_EXCEPTIONS - throw format_error(message); -#else - fputs(message, stderr); - abort(); -#endif + FMT_THROW(format_error(message)); } template typename Locale::id format_facet::id;