From ff427880716866273b4ae2a7bd69747e8969ab6b Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Fri, 17 Aug 2012 07:37:56 +1200 Subject: [PATCH] printc: add printf attribute. --- drivers/fet.c | 2 +- drivers/tilib.c | 6 +++--- simio/simio_tracer.c | 2 +- util/output.h | 9 ++++++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/fet.c b/drivers/fet.c index 05daf4e..cff37ed 100644 --- a/drivers/fet.c +++ b/drivers/fet.c @@ -575,7 +575,7 @@ static int identify_new(struct fet_device *dev, const char *force_id) LE_LONG(r->msg29_data, 0x02) - LE_WORD(r->msg29_data, 0) + 1; - printc_dbg(" Code size : %lu byte = %lu kb\n", + printc_dbg(" Code size : %u byte = %u kb\n", codeSize, codeSize / 1024); diff --git a/drivers/tilib.c b/drivers/tilib.c index e77665a..e90f266 100644 --- a/drivers/tilib.c +++ b/drivers/tilib.c @@ -233,7 +233,7 @@ static void report_error(struct tilib_device *dev, const char *what) long err = dev->MSP430_Error_Number(); const char *desc = dev->MSP430_Error_String(err); - printc_err("tilib: %s: %s (error = %d)\n", what, desc, err); + printc_err("tilib: %s: %s (error = %ld)\n", what, desc, err); } static int tilib_readmem(device_t dev_base, address_t addr, @@ -508,7 +508,7 @@ static void fw_progress(unsigned int msg_id, unsigned long w_param, if (w_param > 100) w_param = 100; - printc(" %3d percent done\n", w_param); + printc(" %3lu percent done\n", w_param); break; case BL_UPDATE_ERROR: @@ -591,7 +591,7 @@ static int do_init(struct tilib_device *dev, const struct device_args *args) return -1; } } else { - printc_dbg("Firmware version is %d\n", version); + printc_dbg("Firmware version is %ld\n", version); } printc_dbg("MSP430_VCC: %d mV\n", args->vcc_mv); diff --git a/simio/simio_tracer.c b/simio/simio_tracer.c index 92f9969..fcbaac1 100644 --- a/simio/simio_tracer.c +++ b/simio/simio_tracer.c @@ -79,7 +79,7 @@ static void event_print(const struct event *e) break; case EVENT_READ_16: - printc("read.w => %s 0x%04x\n", name); + printc("read.w => %s\n", name); break; case EVENT_WRITE_8: diff --git a/util/output.h b/util/output.h index ab1b33b..1fd548e 100644 --- a/util/output.h +++ b/util/output.h @@ -27,9 +27,12 @@ * Returns the number of characters printed (not including colour * codes). */ -int printc(const char *fmt, ...); -int printc_dbg(const char *fmt, ...); -int printc_err(const char *fmt, ...); +int printc(const char *fmt, ...) + __attribute__((format (printf, 1, 2))); +int printc_dbg(const char *fmt, ...) + __attribute__((format (printf, 1, 2))); +int printc_err(const char *fmt, ...) + __attribute__((format (printf, 1, 2))); void pr_error(const char *prefix);