summaryrefslogtreecommitdiff
path: root/include/console.h
diff options
context:
space:
mode:
authorEvan Green <evgreen@chromium.org>2019-09-23 13:23:09 -0700
committerCommit Bot <commit-bot@chromium.org>2019-10-05 00:47:53 +0000
commit44c473cdeae53aba84fc2ababeaeb7d022ea4dd7 (patch)
tree21e6b57ad698970f64c0e38cbf79cbd8e2f39e73 /include/console.h
parent7200037dfc674977bffc3d58a15547d97f3ef681 (diff)
downloadchrome-ec-44c473cdeae53aba84fc2ababeaeb7d022ea4dd7.tar.gz
printf: Enable compile-time format checking
Add annotations to allow the compiler to check printf-style format strings in the EC. BUG=chromium:984041 TEST=make -j buildall BRANCH=None Change-Id: Ic39f37f8362372de7d289becea684d9da535599a Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733101 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'include/console.h')
-rw-r--r--include/console.h2
1 files changed, 2 insertions, 0 deletions
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, ...);
/**