diff --git a/source/lib/code_annotation.h b/source/lib/code_annotation.h index 3e3277a183..09f777793e 100644 --- a/source/lib/code_annotation.h +++ b/source/lib/code_annotation.h @@ -201,7 +201,11 @@ private:\ #if GCC_VERSION # define PRINTF_ARGS(fmtpos) __attribute__ ((format (printf, fmtpos, fmtpos+1))) # define VPRINTF_ARGS(fmtpos) __attribute__ ((format (printf, fmtpos, 0))) -# define WPRINTF_ARGS(fmtpos) /* not currently supported in GCC */ +# if CONFIG_DEHYDRA +# define WPRINTF_ARGS(fmtpos) __attribute__ ((user("format, w, printf, " #fmtpos ", +1"))) +# else +# define WPRINTF_ARGS(fmtpos) /* not currently supported in GCC */ +# endif # define VWPRINTF_ARGS(fmtpos) /* not currently supported in GCC */ #else # define PRINTF_ARGS(fmtpos) diff --git a/source/lib/config.h b/source/lib/config.h index 84e749abf3..90f5a342b7 100644 --- a/source/lib/config.h +++ b/source/lib/config.h @@ -61,4 +61,9 @@ # define CONFIG_FINAL 0 #endif +// static type checking with Dehydra +#ifndef CONFIG_DEHYDRA +# define CONFIG_DEHYDRA 0 +#endif + #endif // #ifndef INCLUDED_CONFIG diff --git a/source/lib/debug.cpp b/source/lib/debug.cpp index b3edfdf371..b280e40a62 100644 --- a/source/lib/debug.cpp +++ b/source/lib/debug.cpp @@ -255,7 +255,7 @@ public: { } - bool operator()(const wchar_t* fmt, ...) + bool operator()(const wchar_t* fmt, ...) WPRINTF_ARGS(2) { va_list ap; va_start(ap, fmt); diff --git a/source/ps/CConsole.h b/source/ps/CConsole.h index 8ae42eeedb..d90902f3d8 100644 --- a/source/ps/CConsole.h +++ b/source/ps/CConsole.h @@ -55,13 +55,13 @@ public: void Render(); - void InsertMessage(const wchar_t* szMessage, ...); + void InsertMessage(const wchar_t* szMessage, ...) WPRINTF_ARGS(2); void InsertChar(const int szChar, const wchar_t cooked); void SendChatMessage(const wchar_t *szMessage); void ReceivedChatMessage(const wchar_t *pSender, const wchar_t *szMessage); - void SetBuffer(const wchar_t* szMessage, ...); + void SetBuffer(const wchar_t* szMessage, ...) WPRINTF_ARGS(2); void UseHistoryFile( const VfsPath& filename, int historysize );