Index: src/base/compiler-specific.h |
diff --git a/src/base/compiler-specific.h b/src/base/compiler-specific.h |
index ffd5a44e141d069fd8f11996ce15da2c41d02b6c..822893ffecf073924c03cfcef70760fc4f0cdde6 100644 |
--- a/src/base/compiler-specific.h |
+++ b/src/base/compiler-specific.h |
@@ -26,6 +26,17 @@ |
#define WARN_UNUSED_RESULT /* NOT SUPPORTED */ |
#endif |
+// Tell the compiler a function is using a printf-style format string. |
+// |format_param| is the one-based index of the format string parameter; |
+// |dots_param| is the one-based index of the "..." parameter. |
+// For v*printf functions (which take a va_list), pass 0 for dots_param. |
+// (This is undocumented but matches what the system C headers do.) |
+#if defined(__GNUC__) |
+#define PRINTF_FORMAT(format_param, dots_param) \ |
+ __attribute__((format(printf, format_param, dots_param))) |
+#else |
+#define PRINTF_FORMAT(format_param, dots_param) |
+#endif |
// The C++ standard requires that static const members have an out-of-class |
// definition (in a single compilation unit), but MSVC chokes on this (when |