mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
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. Corresponding to flashrom svn r1032. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Sean Nelson <audiohacked@gmail.com>
This commit is contained in:
parent
b5b161b260
commit
9f5f2158a7
3
flash.h
3
flash.h
@ -591,7 +591,8 @@ int doit(struct flashchip *flash, int force, char *filename, int read_it, int wr
|
|||||||
#define NT 1 /* Not tested */
|
#define NT 1 /* Not tested */
|
||||||
|
|
||||||
/* cli_output.c */
|
/* 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_ERROR 0
|
||||||
#define MSG_INFO 1
|
#define MSG_INFO 1
|
||||||
#define MSG_DEBUG 2
|
#define MSG_DEBUG 2
|
||||||
|
@ -394,7 +394,7 @@ struct shutdown_func_data {
|
|||||||
int register_shutdown(void (*function) (void *data), void *data)
|
int register_shutdown(void (*function) (void *data), void *data)
|
||||||
{
|
{
|
||||||
if (shutdown_fn_count >= SHUTDOWN_MAXFN) {
|
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);
|
SHUTDOWN_MAXFN);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
2
udelay.c
2
udelay.c
@ -91,7 +91,7 @@ void myusec_calibrate_delay(void)
|
|||||||
msg_pinfo("Calibrating delay loop... ");
|
msg_pinfo("Calibrating delay loop... ");
|
||||||
resolution = measure_os_delay_resolution();
|
resolution = measure_os_delay_resolution();
|
||||||
if (resolution) {
|
if (resolution) {
|
||||||
msg_pdbg("OS timer resolution is %u usecs, ", resolution);
|
msg_pdbg("OS timer resolution is %lu usecs, ", resolution);
|
||||||
} else {
|
} else {
|
||||||
msg_pinfo("OS timer resolution is unusable. ");
|
msg_pinfo("OS timer resolution is unusable. ");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user