From 879ccaa7c581c570dbf86ffcf35239a9d9f19eee Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sat, 10 Apr 2021 19:23:57 +0200 Subject: [PATCH] console: Always add printf-format attribute to printk() The attribute was missing in case the console is disabled. Change-Id: Iee23f6f4da61cd3637441705a8d3bbd2da7a33ca Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/52231 Reviewed-by: Paul Menzel Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/include/console/console.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/include/console/console.h b/src/include/console/console.h index d06b5b36fa..fa61e9100a 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -64,7 +64,9 @@ enum { CONSOLE_LOG_NONE = 0, CONSOLE_LOG_FAST, CONSOLE_LOG_ALL }; #else static inline void console_init(void) {} static inline int console_log_level(int msg_level) { return 0; } -static inline void printk(int LEVEL, const char *fmt, ...) {} +static inline void + __attribute__((format(printf, 2, 3))) + printk(int LEVEL, const char *fmt, ...) {} static inline void vprintk(int LEVEL, const char *fmt, va_list args) {} static inline void do_putchar(unsigned char byte) {} static inline long console_time_get_and_reset(void) { return 0; }