Turn format string issues into compile-time errors

If the compiler can detect an issue with a format string at compile
time, then we should take advantage of that and turn the issue into a
hard compile-time error as such problems almost always lead to UB.

This helps with catching logging or assertion messages that have been
converted over to fmt but are still using the old, non-fmt variants
of the logging macros.

This commit also fixes all incorrect usages that I could find.
This commit is contained in:
Léo Lam
2020-11-25 18:59:47 +01:00
parent a34823df61
commit 585899dba3
3 changed files with 10 additions and 2 deletions

View File

@ -14,6 +14,7 @@
#include "Core/PowerPC/Jit64Common/Jit64AsmCommon.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include <fmt/format.h>
#include <gtest/gtest.h>
namespace
@ -109,7 +110,7 @@ TEST(Jit64, ConvertDoubleToSingle)
const u32 expected = ConvertToSingle(input);
const u32 actual = routines.wrapped_cdts(input);
printf("%016llx -> %08x == %08x\n", input, actual, expected);
fmt::print("{:016x} -> {:08x} == {:08x}\n", input, actual, expected);
EXPECT_EQ(expected, actual);
}