Skip to contentSkip to conversation

dtc: Allow gcc format warnings for check_msg()

PATCH David Gibson 1 participant 1 message Dec 7, 2007

lore
Share & tools
lore
#0 lore raw

check_msg() takes printf() like arguments, so tell gcc to produce printf() like warnings for it.

checks.c +3 -0
Index: dtc/checks.c
===================================================================
@@ -87,6 +87,9 @@ struct check {
 #define BATCH_CHECK(nm, lvl, ...) \
 	CHECK(nm, NULL, NULL, NULL, NULL, lvl, __VA_ARGS__)
 
+#ifdef __GNUC__
+static inline void check_msg(struct check *c, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
+#endif
 static inline void check_msg(struct check *c, const char *fmt, ...)
 {
 	va_list ap;
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson