aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-01-14 10:03:25 -0800
committerEric Anholt <eric@anholt.net>2013-01-21 12:45:06 -0800
commit7f90d9bb2710a6c9e117561287b17a2a83036a38 (patch)
tree54ada043844123b1426b4bfb0fb2c9beeec59c3b
parent48940da0e035a986a8d490dab795a2bff15d4486 (diff)
downloadpiglit-7f90d9bb2710a6c9e117561287b17a2a83036a38.tar.gz
util: Make a macro for marking functions as printflike.
This is the same as we have in Mesa. Reviewed-by: Carl Worth <cworth@cworth.org> Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--tests/util/piglit-util.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 600bf92d..e04e161b 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