Silence unreachable code warnings in MSVC when FMT_USE_EXCEPTIONS are disabled. (#4515)

This commit is contained in:
Mattias Ljungström
2025-08-17 18:35:28 +02:00
committed by GitHub
parent f91dc80f4c
commit 9588458917

View File

@@ -138,8 +138,12 @@ FMT_FUNC void report_error(const char* message) {
// from MSVC.
FMT_THROW(format_error(message));
#else
fputs(message, stderr);
abort();
// Silence unreachable code warnings in MSVC.
volatile bool b = true;
if (b) {
fputs(message, stderr);
abort();
}
#endif
}