1
0
Fork 0

Added macros to follow format string checking through wrappers

This commit is contained in:
Tycho 2014-03-11 13:41:15 -07:00
parent bb4b35e438
commit 53faac10c5
3 changed files with 8 additions and 4 deletions

View File

@ -38,6 +38,8 @@
// No alignment needed in MSVC
#define ALIGN_8
#define ALIGN_16
#define FORMATSTRING(formatIndex,va_argsIndex)
#elif defined(__GNUC__)
@ -56,6 +58,8 @@
// Some portability macros :)
#define stricmp strcasecmp
#define FORMATSTRING(formatIndex,va_argsIndex) __attribute__((format (printf, formatIndex, va_argsIndex)))
#else

View File

@ -131,7 +131,7 @@ public:
/** Returns the list of all items in the specified folder (files, folders, nix pipes, whatever's there). */
static AStringVector GetFolderContents(const AString & a_Folder); // Exported in ManualBindings.cpp
int Printf(const char * a_Fmt, ...);
int Printf(const char * a_Fmt, ...) FORMATSTRING(2,3);
/** Flushes all the bufferef output into the file (only when writing) */
void Flush(void);

View File

@ -22,13 +22,13 @@ typedef std::list<AString> AStringList;
/** Add the formated string to the existing data in the string */
extern AString & AppendVPrintf(AString & str, const char * format, va_list args);
extern AString & AppendVPrintf(AString & str, const char * format, va_list args) FORMATSTRING(2,0);
/// Output the formatted text into the string
extern AString & Printf (AString & str, const char * format, ...);
extern AString & Printf (AString & str, const char * format, ...) FORMATSTRING(2,3);
/// Output the formatted text into string, return string by value
extern AString Printf(const char * format, ...);
extern AString Printf(const char * format, ...) FORMATSTRING(1,2);
/// Add the formatted string to the existing data in the string
extern AString & AppendPrintf (AString & str, const char * format, ...);