[Clang] Warn about 'z' printf modifier in old MSVC.
authorSimon Tatham <simon.tatham@arm.com>
Tue, 28 Jan 2020 09:03:31 +0000 (09:03 +0000)
committerSimon Tatham <simon.tatham@arm.com>
Tue, 28 Jan 2020 09:04:45 +0000 (09:04 +0000)
commitfe0d1b6a8ac5048b8007e5e7cc2aeb4e3291bda0
tree4ce449e22bc873fe16a2802f822bd2fdc7ddb50b
parent422dfea577796765382963e595f0c14cd298a02e
[Clang] Warn about 'z' printf modifier in old MSVC.

Summary:
The 'z' length modifier, signalling that an integer format specifier
takes a `size_t` sized integer, is only supported by the C library of
MSVC 2015 and later. Earlier versions don't recognize the 'z' at all,
and respond to `printf("%zu", x)` by just printing "zu".

So, if the MS compatibility version is set to a value earlier than
MSVC2015, it's useful to warn about 'z' modifiers in printf format
strings we check.

Reviewers: aaron.ballman, lebedev.ri, rnk, majnemer, zturner

Reviewed By: aaron.ballman

Subscribers: amccarth, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73457
clang/lib/AST/FormatString.cpp
clang/test/Sema/format-strings-ms.c