From 897b776250a0c9edd72cc5a2dc17cc2717af9290 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 22 Aug 2016 23:32:05 -0400 Subject: [PATCH] string_util: Use C++ attribute specifier for format strings This is also compatible with both clang and GCC --- src/common/string_util.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/common/string_util.h b/src/common/string_util.h index 08392b66..70713c5e 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -11,15 +11,16 @@ namespace Dynarmic { namespace Common { +#ifdef __MINGW32__ +[[gnu::format(gnu_printf, 1, 2)]] +#elif !defined(_MSC_VER) +[[gnu::format(printf, 1, 2)]] +#endif std::string StringFromFormat( #ifdef _MSC_VER _Printf_format_string_ #endif - const char* format, ...) -#if defined(__GNUC__) && !defined(__clang__) - __attribute__((format(gnu_printf, 1, 2))) -#endif - ; + const char* format, ...); template constexpr char SignToChar(T value) {