diff options
author | Evan Green <evgreen@chromium.org> | 2019-10-01 14:14:13 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-05 00:47:51 +0000 |
commit | 2eade31e87a7662dc03dcead556917dfa13d0983 (patch) | |
tree | 5a2747f5fd859d842e034e13e349a9f0e76234e1 | |
parent | 0c2d7b648e1ea433aad8123538632d4edff6eb85 (diff) | |
download | chrome-ec-2eade31e87a7662dc03dcead556917dfa13d0983.tar.gz |
printf: Correct semantics of %l
In the standard, %l[dioux] takes an integer of type long. In the EC
up until now, we had been using it as shorthand for a 64-bit long.
Now that we're enabling the compile-time printf format checker, it's
time to correct the semantics of %l.
This is a breaking change. I would advise against cherry-picking this
commit into any firmware branches. The reasoning is that the specifier
now swallows a different number of arguments, causing any subsequent
specifiers to be wrong.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=None
Change-Id: Ia5630e59611097dc0deda648498c7f43b9c62ac9
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1829576
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r-- | common/printf.c | 11 | ||||
-rw-r--r-- | include/printf.h | 2 |
2 files changed, 1 insertions, 12 deletions
diff --git a/common/printf.c b/common/printf.c index 68f66815b9..1f6733e552 100644 --- a/common/printf.c +++ b/common/printf.c @@ -230,17 +230,6 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context, * %z - size_t */ if (c == 'l') { - - /* - * For just this commit, allow both %l and %ll - * to be 64-bit. This is obviously wrong, but - * enables this change to be cherry-picked - * into firmware branches without changing - * semantics for any existing printf calls. - * This is removed in the subsequent commit on - * master. - */ - flags |= PF_64BIT; if (sizeof(long) == sizeof(uint64_t)) flags |= PF_64BIT; diff --git a/include/printf.h b/include/printf.h index 9ae284cecc..ccd477cfbd 100644 --- a/include/printf.h +++ b/include/printf.h @@ -35,7 +35,7 @@ * useful for printing times, voltages, and currents. * * Length may be: - * - 'l' = integer is 64-bit instead of native 32-bit + * - 'l' = integer is sizeof(long) (still 32 bits on 32-bit ECs) * - 'll' = integer is 64-bit * - 'z' = integer is sizeof(size_t) * |