Check the printk format string against the matching arguments. We have
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tue, 20 Jan 2009 18:37:26 +0000 (18:37 +0000)
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Tue, 20 Jan 2009 18:37:26 +0000 (18:37 +0000)
this type of checking in the v3 code since ages, but v2 will happily
compile any code with bogus printk format strings and/or parameters.
This can cause real bugs and at least needs to emit a warning, if not
an
error. Go with a warning for now since most of the flagged format
strings are wrong but harmless in a 32-bit x86 environment.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3872 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/include/console/console.h

index 1707ee8f532a7ac0cb4a3b6c88aedb2ec5d85468..3e1607b2a7c7657da4b7585621d01edb101bdb55 100644 (file)
@@ -27,7 +27,7 @@ extern struct console_driver console_drivers[];
 extern struct console_driver econsole_drivers[];
 
 extern int console_loglevel;
-int do_printk(int msg_level, const char *fmt, ...);
+int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 
 #define printk_emerg(fmt, arg...)   do_printk(BIOS_EMERG   ,fmt, ##arg)
 #define printk_alert(fmt, arg...)   do_printk(BIOS_ALERT   ,fmt, ##arg)