This is the mail archive of the
mailing list for the newlib project.
Regression with printf 8-bit format macros
- From: Ambroz Bizjak <ambrop7 at gmail dot com>
- To: newlib at sourceware dot org
- Date: Fri, 1 Jan 2016 12:08:30 +0100
- Subject: Regression with printf 8-bit format macros
- Authentication-results: sourceware.org; auth=none
It appears to me that commit "Fix for pri and scn formats"  broke
the 8-bit printf format macros (PRI*8), for scenarios when newlib is
configured either with --enable-newlib-nano-formatted-io or without
--enable-newlib-io-c99-format is not used. Because the new code
defines these macros to the "hh" formats, which are not supported
I think the code should be changed so that the PRI*8 macros are
defined correctly even when printf does not support hh. The previous
definitions of these format macros didn't have length modifiers (they
were just i, d, x, X, etc.) and seemed to have worked, presumably due
to default-promotion of int8_t/uint8_t to int. The way I understand
the standard, it is not correct to e.g. use PRId8 but pass to printf
something which is not an int8, so it shouldn't be a problem that e.g.
printf("%"PRId8, 1000) actually prints 1000; what matters is that it
prints all the possible int8_t values correctly when passed an int8_t.