GCC has a nifty ability to typecheck varargs functions that follow the printf
conventions. This change uses that in HAIL_LOG. If you build with -Wall, gcc
can now give warnings about HAIL_LOG invocations where there are too many or
too few arguments, or arguments of the wrong types.

Sorry for the duplicate email. I forgot the signoff originally.

Signed-off-by: Colin McCabe <[email protected]>
---
 include/hail_log.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/hail_log.h b/include/hail_log.h
index d6794b4..ca26f22 100644
--- a/include/hail_log.h
+++ b/include/hail_log.h
@@ -4,7 +4,8 @@
 #include <stdbool.h>
 
 struct hail_log {
-       void (*func)(int prio, const char *fmt, ...);
+       void (*func)(int prio, const char *fmt, ...)
+               __attribute__((format(printf,2,3)));
        bool verbose;
 };
 
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to