diff options
author | Liu Hao <lh_mouse@126.com> | 2020-11-12 22:20:29 +0800 |
---|---|---|
committer | Jonathan Yong <10walls@gmail.com> | 2020-11-17 10:34:05 +0000 |
commit | c51f1e7427e6a5ae2a6d82b5a790df77a3adc99a (patch) | |
tree | 0865d2e375bc7c1f7e5bd81c3ac72734bf5639c5 /libcpp | |
parent | 200c9e865f49255ea32d4891b746d394d156a16f (diff) | |
download | gcc-c51f1e7427e6a5ae2a6d82b5a790df77a3adc99a.zip gcc-c51f1e7427e6a5ae2a6d82b5a790df77a3adc99a.tar.gz gcc-c51f1e7427e6a5ae2a6d82b5a790df77a3adc99a.tar.bz2 |
gcc: Add `ll` and `L` length modifiers for `ms_printf`
Previous code abused `FMT_LEN_L` for the `I` modifier. As `L` is a
valid modifier for `f`, `e`, `g`, etc. and `I` has the same semantics
as the C99 `z` modifier, `FMT_LEN_z` is now used instead.
First, in the Microsoft ABI, type `long double` has the same layout as
type `double`, so `%Lg` behaves identically to `%g`. Users should pass
in `double`s instead of `long double`s, as GCC uses the 10-byte format.
Second, with a CRT that is recent enough (MSVCRT since Vista, MSVCR80,
UCRT, or mingw-w64 8.0), `printf`-family functions can handle the `ll`
length modifier correctly. This ability is assumed to be available
universally. A lot of libraries (such as libgomp) that use the
`format(printf, ...)` attribute used to suffer from warnings about
unknown format specifiers.
Reference: https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/tcxf1dw6(v=vs.90)
Reference: https://docs.microsoft.com/en-us/cpp/porting/visual-cpp-what-s-new-2003-through-2015#new-crt-features
Signed-off-by: Liu Hao <lh_mouse@126.com>
gcc/ChangeLog:
* config/i386/msformat-c.c: Add more length modifiers.
gcc/testsuite/ChangeLog:
* gcc.dg/format/ms_c99-printf-3.c: Update tests.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions