1
0
forked from 0ad/0ad

Annotate some more printf-style functions, for type checking

This was SVN commit r7176.
This commit is contained in:
Ykkrosh 2009-11-06 23:06:50 +00:00
parent d7a057143d
commit 378bd89c1d
4 changed files with 13 additions and 4 deletions

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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 );