[Piglit] [PATCH 01/15] util: Make a macro for marking functions as printflike.

Eric Anholt eric at anholt.net
Mon Jan 14 10:55:28 PST 2013


This is the same as we have in Mesa.
---
 tests/util/piglit-util.h |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 600bf92..e04e161 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -78,12 +78,14 @@ lround(double x) {
 
 #endif /* defined(_MSC_VER) */
 
-#ifdef _WIN32
-int asprintf(char **strp, const char *fmt, ...)
-#ifdef __GNUC__
-	__attribute__ ((format (printf, 2, 3)))
+#if (__GNUC__ >= 3)
+#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
+#else
+#define PRINTFLIKE(f, a)
 #endif
-;
+
+#ifdef _WIN32
+int asprintf(char **strp, const char *fmt, ...) PRINTFLIKE(2, 3);
 #endif /* _WIN32 */
 
 // Trick from http://tdistler.com/2011/03/24/how-to-define-nan-not-a-number-on-windows
-- 
1.7.10.4



More information about the Piglit mailing list