mesa: Add __printf__ attribute to printf-like functions to get warnings.
authorEric Anholt <eric@anholt.net>
Wed, 1 Sep 2010 21:39:50 +0000 (14:39 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 2 Sep 2010 00:08:23 +0000 (17:08 -0700)
src/mesa/main/compiler.h
src/mesa/main/imports.h

index e0507cc..ded69c3 100644 (file)
@@ -316,6 +316,11 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
 #endif
 #endif
 
+#if (__GNUC__ >= 3)
+#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
+#else
+#define PRINTFLIKE(f, a)
+#endif
 
 #ifndef NULL
 #define NULL 0
index 317e2b7..751f206 100644 (file)
@@ -566,19 +566,19 @@ extern unsigned int
 _mesa_str_checksum(const char *str);
 
 extern int
-_mesa_snprintf( char *str, size_t size, const char *fmt, ... );
+_mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4);
 
 extern void
-_mesa_warning( __GLcontext *gc, const char *fmtString, ... );
+_mesa_warning( __GLcontext *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3);
 
 extern void
-_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... );
+_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3);
 
 extern void
-_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... );
+_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4);
 
 extern void
-_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... );
+_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3);
 
 
 #if defined(_MSC_VER) && !defined(snprintf)