mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] printf: handle the L modifier for integers
@ 2018-05-31 21:56 Andrei Vagin
  2018-06-01  6:01 ` Markus Wichmann
  0 siblings, 1 reply; 2+ messages in thread
From: Andrei Vagin @ 2018-05-31 21:56 UTC (permalink / raw)
  To: musl; +Cc: Andrei Vagin

The L modifier is usually used for floating-point numbers, but
glibc allows to use this modifier for integers too.

I think here is nothing wrong if we will be compatible with glibc here.

It is not often when a error code of printf is checked, so we may have
a situation when a code works with glibc and doesn't work with musl.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
---
 src/stdio/vfprintf.c  | 3 +++
 src/stdio/vfwprintf.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 50fb55c1..7f6c4f39 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -82,6 +82,9 @@ static const unsigned char states[]['z'-'A'+1] = {
 	}, { /* 5: L-prefixed */
 		S('e') = LDBL, S('f') = LDBL, S('g') = LDBL, S('a') = LDBL,
 		S('E') = LDBL, S('F') = LDBL, S('G') = LDBL, S('A') = LDBL,
+		S('d') = LLONG, S('i') = LLONG,
+		S('o') = ULLONG, S('u') = ULLONG,
+		S('x') = ULLONG, S('X') = ULLONG,
 		S('n') = PTR,
 	}, { /* 6: z- or t-prefixed (assumed to be same size) */
 		S('d') = PDIFF, S('i') = PDIFF,
diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
index e87ad42a..c6ce82ea 100644
--- a/src/stdio/vfwprintf.c
+++ b/src/stdio/vfwprintf.c
@@ -73,6 +73,9 @@ static const unsigned char states[]['z'-'A'+1] = {
 	}, { /* 5: L-prefixed */
 		S('e') = LDBL, S('f') = LDBL, S('g') = LDBL, S('a') = LDBL,
 		S('E') = LDBL, S('F') = LDBL, S('G') = LDBL, S('A') = LDBL,
+		S('d') = LLONG, S('i') = LLONG,
+		S('o') = ULLONG, S('u') = ULLONG,
+		S('x') = ULLONG, S('X') = ULLONG,
 		S('n') = PTR,
 	}, { /* 6: z- or t-prefixed (assumed to be same size) */
 		S('d') = PDIFF, S('i') = PDIFF,
-- 
2.14.3



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-01  6:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-31 21:56 [PATCH] printf: handle the L modifier for integers Andrei Vagin
2018-06-01  6:01 ` Markus Wichmann

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).