Added macros to follow format string checking through wrappers

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

View File

@ -39,6 +39,8 @@
#define ALIGN_8
#define ALIGN_16
#define FORMATSTRING(formatIndex,va_argsIndex)
#elif defined(__GNUC__)
// TODO: Can GCC explicitly mark classes as abstract (no instances can be created)?
@ -57,6 +59,8 @@
// Some portability macros :)
#define stricmp strcasecmp
#define FORMATSTRING(formatIndex,va_argsIndex) __attribute__((format (printf, formatIndex, va_argsIndex)))
#else
#error "You are using an unsupported compiler, you might need to #define some stuff here for your compiler"

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, ...);