]> git.ipfire.org Git - thirdparty/gcc.git/commit
Support %f in pp_format
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Nov 2018 15:31:13 +0000 (15:31 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Nov 2018 15:31:13 +0000 (15:31 +0000)
commite75dc1cba8f3b9baf737382f7b69ef43250b66aa
tree165ff5ba4d3971a53895f9ffd34e233e26a72cc2
parent95b14393e141ddad31675932aa014932d2b97f95
Support %f in pp_format

Numerous formatted messages from the inliner use %f, mostly as %f, but
occasionally with length modifiers.

This patch implements the simplest case of "%f" for pp_format (with no
modifier support) to make it easier to port these messages from fprintf
to dump_printf_loc.

The selftest has an assertion that %f on 1.0 is printed as "1.000000".
This comes from the host's sprintf, and I believe this is guaranteed by
POSIX: "If the precision is missing, it shall be taken as 6".  If this is
an issue I can drop the selftest.

gcc/c-family/ChangeLog:
* c-format.c (gcc_dump_printf_char_table): Add entry for %f.

gcc/ChangeLog:
* pretty-print.c (pp_format): Handle %f.
(selftest::test_pp_format): Add test of %f.
* pretty-print.h (pp_double): New macro.

gcc/testsuite/ChangeLog:
* gcc.dg/format/gcc_diag-10.c: Add coverage for %f.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265919 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-format.c
gcc/pretty-print.c
gcc/pretty-print.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/format/gcc_diag-10.c