Author: hailfinger
Date: Sat Jun  5 01:20:21 2010
New Revision: 1032
URL: http://flashrom.org/trac/coreboot/changeset/1032

Log:
gcc and clang can check format strings of printf-like functions. Since
we don't support any other compilers right now, enable that extension
unconditionally.

Fix the bugs found by format string checking.

Signed-off-by: Carl-Daniel Hailfinger <[email protected]>
Acked-by: Sean Nelson <[email protected]>

Modified:
   trunk/flash.h
   trunk/flashrom.c
   trunk/udelay.c

Modified: trunk/flash.h
==============================================================================
--- trunk/flash.h       Fri Jun  4 21:05:39 2010        (r1031)
+++ trunk/flash.h       Sat Jun  5 01:20:21 2010        (r1032)
@@ -591,7 +591,8 @@
 #define NT 1    /* Not tested */
 
 /* cli_output.c */
-int print(int type, const char *fmt, ...);
+/* Let gcc and clang check for correct printf-style format strings. */
+int print(int type, const char *fmt, ...) __attribute__((format(printf, 2, 
3)));
 #define MSG_ERROR      0
 #define MSG_INFO       1
 #define MSG_DEBUG      2

Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c    Fri Jun  4 21:05:39 2010        (r1031)
+++ trunk/flashrom.c    Sat Jun  5 01:20:21 2010        (r1032)
@@ -394,7 +394,7 @@
 int register_shutdown(void (*function) (void *data), void *data)
 {
        if (shutdown_fn_count >= SHUTDOWN_MAXFN) {
-               msg_perr("Tried to register more than %n shutdown functions.\n",
+               msg_perr("Tried to register more than %i shutdown functions.\n",
                         SHUTDOWN_MAXFN);
                return 1;
        }

Modified: trunk/udelay.c
==============================================================================
--- trunk/udelay.c      Fri Jun  4 21:05:39 2010        (r1031)
+++ trunk/udelay.c      Sat Jun  5 01:20:21 2010        (r1032)
@@ -91,7 +91,7 @@
        msg_pinfo("Calibrating delay loop... ");
        resolution = measure_os_delay_resolution();
        if (resolution) {
-               msg_pdbg("OS timer resolution is %u usecs, ", resolution);
+               msg_pdbg("OS timer resolution is %lu usecs, ", resolution);
        } else {
                msg_pinfo("OS timer resolution is unusable. ");
        }

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to