summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Globals.h4
-rw-r--r--src/OSSupport/File.h2
-rw-r--r--src/StringUtils.h6
3 files changed, 8 insertions, 4 deletions
diff --git a/src/Globals.h b/src/Globals.h
index 2cd160677..e907614d7 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -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
diff --git a/src/OSSupport/File.h b/src/OSSupport/File.h
index 07fce6661..e229035b7 100644
--- a/src/OSSupport/File.h
+++ b/src/OSSupport/File.h
@@ -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);
diff --git a/src/StringUtils.h b/src/StringUtils.h
index b64108409..a7f22b100 100644
--- a/src/StringUtils.h
+++ b/src/StringUtils.h
@@ -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, ...);