[PATCH] logging: tell GCC to check calls to error() etc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
logging.h |   18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/logging.h b/logging.h
index c01187b..fb11df0 100644
--- a/logging.h
+++ b/logging.h
@@ -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)
--
1.5.6.5



--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux