diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-09-30 14:34:05 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-10-01 19:45:41 +0200 |
commit | bcc292b22d847c15776403197fcacc5ddbb6cd20 (patch) | |
tree | 734009e506a2f93fe11c99658d4acdb2a038fdbb /src | |
parent | 2a739598b14690998b20858321c244ad7e4bb9a1 (diff) |
Extend printf warnings to error()
Diffstat (limited to 'src')
-rw-r--r-- | src/util.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/util.h b/src/util.h index efb76e49b8..d80b3c28b2 100644 --- a/src/util.h +++ b/src/util.h @@ -56,13 +56,22 @@ static const int64 CENT = 1000000; /* Format characters for (s)size_t and ptrdiff_t */ #if defined(_MSC_VER) || defined(__MSVCRT__) + /* (s)size_t and ptrdiff_t have the same size specifier in MSVC: + http://msdn.microsoft.com/en-us/library/tcxf1dw6%28v=vs.100%29.aspx + */ #define PRIszx "Ix" #define PRIszu "Iu" #define PRIszd "Id" -#else + #define PRIpdx "Ix" + #define PRIpdu "Iu" + #define PRIpdd "Id" +#else /* C99 standard */ #define PRIszx "zx" #define PRIszu "zu" #define PRIszd "zd" + #define PRIpdx "tx" + #define PRIpdu "tu" + #define PRIpdd "td" #endif // This is needed because the foreach macro can't get over the comma in pair<t1, t2> @@ -154,6 +163,8 @@ std::string real_strprintf(const std::string &format, int dummy, ...); #define strprintf(format, ...) real_strprintf(format, 0, __VA_ARGS__) std::string vstrprintf(const char *format, va_list ap); +bool ATTR_WARN_PRINTF(1,2) error(const char *format, ...); + /* Redefine printf so that it directs output to debug.log * * Do this *after* defining the other printf-like functions, because otherwise the @@ -162,7 +173,6 @@ std::string vstrprintf(const char *format, va_list ap); */ #define printf OutputDebugStringF -bool error(const char *format, ...); void LogException(std::exception* pex, const char* pszThread); void PrintException(std::exception* pex, const char* pszThread); void PrintExceptionContinue(std::exception* pex, const char* pszThread); |