summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/g/loader/debug_printf.h1
-rw-r--r--chip/stm32/debug_printf.h1
-rw-r--r--extra/i2c_pseudo/anprintf.h1
-rw-r--r--include/console.h2
-rw-r--r--include/panic.h1
-rw-r--r--include/printf.h1
-rw-r--r--include/uart.h1
-rw-r--r--util/genvif.c1
8 files changed, 9 insertions, 0 deletions
diff --git a/chip/g/loader/debug_printf.h b/chip/g/loader/debug_printf.h
index 73e04a9e0c..d34a18c9ba 100644
--- a/chip/g/loader/debug_printf.h
+++ b/chip/g/loader/debug_printf.h
@@ -5,6 +5,7 @@
#ifndef __EC_CHIP_G_LOADER_DEBUG_PRINTF_H
#define __EC_CHIP_G_LOADER_DEBUG_PRINTF_H
+__attribute__((__format__(__printf__, 1, 2)))
void debug_printf(const char *format, ...);
#ifdef DEBUG
diff --git a/chip/stm32/debug_printf.h b/chip/stm32/debug_printf.h
index 8738bc66cd..6091cfc7fc 100644
--- a/chip/stm32/debug_printf.h
+++ b/chip/stm32/debug_printf.h
@@ -8,6 +8,7 @@
#define __CROS_EC_DEBUG_H
#ifdef CONFIG_DEBUG_PRINTF
+__attribute__((__format__(__printf__, 1, 2)))
void debug_printf(const char *format, ...);
#else
#define debug_printf(...)
diff --git a/extra/i2c_pseudo/anprintf.h b/extra/i2c_pseudo/anprintf.h
index c73eb24c6c..c2d66c494b 100644
--- a/extra/i2c_pseudo/anprintf.h
+++ b/extra/i2c_pseudo/anprintf.h
@@ -130,6 +130,7 @@ static ssize_t vanprintf(char **out, ssize_t max_size, gfp_t gfp,
* ENOTRECOVERABLE: An unexpected condition occurred. This may indicate
* a bug.
*/
+__attribute__((__format__(__printf__, 4, 5)))
static ssize_t anprintf(char **out, ssize_t max_size, gfp_t gfp,
const char *fmt, ...)
{
diff --git a/include/console.h b/include/console.h
index 9246e92b25..555bd1588f 100644
--- a/include/console.h
+++ b/include/console.h
@@ -115,6 +115,7 @@ int cputs(enum console_channel channel, const char *outstr);
*
* @return non-zero if output was truncated.
*/
+__attribute__((__format__(__printf__, 2, 3)))
int cprintf(enum console_channel channel, const char *format, ...);
/**
@@ -126,6 +127,7 @@ int cprintf(enum console_channel channel, const char *format, ...);
*
* @return non-zero if output was truncated.
*/
+__attribute__((__format__(__printf__, 2, 3)))
int cprints(enum console_channel channel, const char *format, ...);
/**
diff --git a/include/panic.h b/include/panic.h
index e25a68eccd..80a8fe1125 100644
--- a/include/panic.h
+++ b/include/panic.h
@@ -132,6 +132,7 @@ void panic_puts(const char *s);
* @param format printf-style format string
* @param ... Arguments to process
*/
+__attribute__((__format__(__printf__, 1, 2)))
void panic_printf(const char *format, ...);
/*
diff --git a/include/printf.h b/include/printf.h
index ccd477cfbd..60baba629d 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -86,6 +86,7 @@ __stdlib_compat int vfnprintf(int (*addchar)(void *context, int c),
* @param format Format string
* @return EC_SUCCESS, or EC_ERROR_OVERFLOW if the output was truncated.
*/
+__attribute__((__format__(__printf__, 3, 4)))
__stdlib_compat int snprintf(char *str, int size, const char *format, ...);
/**
diff --git a/include/uart.h b/include/uart.h
index a55c8fce2f..e333196d4a 100644
--- a/include/uart.h
+++ b/include/uart.h
@@ -63,6 +63,7 @@ int uart_put(const char *out, int len);
*
* @return EC_SUCCESS, or non-zero if output was truncated.
*/
+__attribute__((__format__(__printf__, 1, 2)))
int uart_printf(const char *format, ...);
/**
diff --git a/util/genvif.c b/util/genvif.c
index 4891568ed7..ba217a4acf 100644
--- a/util/genvif.c
+++ b/util/genvif.c
@@ -274,6 +274,7 @@ static uint32_t bcddevice_sop(void)
}
/* Application exits on failure */
+__attribute__((__format__(__printf__, 2, 3)))
static void append(char **buf, const char *fmt, ...)
{
va_list ap1, ap2;