diff options
author | Alan Jenkins <alan-jenkins@tuffmail.co.uk> | 2009-08-07 10:17:12 +0100 |
---|---|---|
committer | Jon Masters <jcm@jonmasters.org> | 2009-10-01 01:58:14 -0400 |
commit | cd02a8eab19e5632bf7ff0594ce743caa6124315 (patch) | |
tree | 98e0e83700a71c7073e6b6c0a0bee056b1c1eca6 | |
parent | 0ae7e1a5b57873186d60b9d9508820b1c5d86598 (diff) | |
download | module-init-tools-cd02a8eab19e5632bf7ff0594ce743caa6124315.tar.gz |
logging: tell GCC to check calls to error() etc
This warns about the modinfo segfault which Ozan found. It doesn't
find any other problems, which is good to know. It may also help
avoid future errors.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
-rw-r--r-- | logging.h | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -10,12 +10,18 @@ extern int quiet; /* Do we want informative messages as well as errors? */ extern int verbose; -extern void fatal(const char *fmt, ...); -extern void error(const char *fmt, ...); -extern void warn(const char *fmt, ...); -extern void info(const char *fmt, ...); - -typedef void (*errfn_t)(const char *fmt, ...); +#ifdef __GNUC__ +#define _printf __attribute__((format(printf, 1, 2))) +#else +#define _printf +#endif + +extern void _printf fatal(const char *fmt, ...); +extern void _printf error(const char *fmt, ...); +extern void _printf warn(const char *fmt, ...); +extern void _printf info(const char *fmt, ...); + +typedef void _printf (*errfn_t)(const char *fmt, ...); static inline void grammar(const char *cmd, const char *filename, unsigned int line) |