summaryrefslogtreecommitdiff
path: root/common/printf.c
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2017-12-20 10:12:06 +0100
committerchrome-bot <chrome-bot@chromium.org>2017-12-25 17:17:25 -0800
commit5e93965e944370748a9d114e6de44c8bfe09047e (patch)
tree22ec5ba6af2317a2c1936e1c81860399cb2e3fb8 /common/printf.c
parent809244140d31a24041344eefe8c82bb47240e9f0 (diff)
downloadchrome-ec-5e93965e944370748a9d114e6de44c8bfe09047e.tar.gz
printf: add %li format for compatibility
For compatibility/convenience, implement the '%li' printf format as a *32-bit* integer format, as it might be expected by non-EC code. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:70320279 TEST=run on Eve EVT with unspecified external binary and see its traces are correctly printed. Change-Id: Iac20e823c74aac4f659176416eebd804c321d47c
Diffstat (limited to 'common/printf.c')
-rw-r--r--common/printf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/printf.c b/common/printf.c
index ef3800c585..479634c7aa 100644
--- a/common/printf.c
+++ b/common/printf.c
@@ -207,6 +207,12 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context,
#endif
switch (c) {
+#ifdef CONFIG_PRINTF_LEGACY_LI_FORMAT
+ case 'i':
+ /* force 32-bit for compatibility */
+ flags &= ~PF_64BIT;
+ /* fall-through */
+#endif /* CONFIG_PRINTF_LEGACY_LI_FORMAT */
case 'd':
if (flags & PF_64BIT) {
if ((int64_t)v < 0) {