From 09cc7e2ddfa40190172eb38d4448c35f5e761cdb Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Fri, 7 Feb 2014 01:10:04 +1300 Subject: [PATCH] Give StringFromFormat a printf format attribute. It gives StringFromFormat printf style arguments that should be type-checked against a format string. --- Source/Core/Common/StringUtil.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h index 46ed382724..7846cbee3d 100644 --- a/Source/Core/Common/StringUtil.h +++ b/Source/Core/Common/StringUtil.h @@ -14,7 +14,14 @@ #include "Common.h" -std::string StringFromFormat(const char* format, ...); +std::string StringFromFormat(const char* format, ...) +#if !defined _WIN32 +// On compilers that support function attributes, this gives StringFromFormat +// the same errors and warnings that printf would give. + __attribute__ ((__format__(printf, 1, 2))) +#endif +; + // Cheap! bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);