[all-commits] [llvm/llvm-project] fe0d1b: [Clang] Warn about 'z' printf modifier in old MSVC.

Simon Tatham via All-commits all-commits at lists.llvm.org
Tue Jan 28 01:04:54 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fe0d1b6a8ac5048b8007e5e7cc2aeb4e3291bda0
      https://github.com/llvm/llvm-project/commit/fe0d1b6a8ac5048b8007e5e7cc2aeb4e3291bda0
  Author: Simon Tatham <simon.tatham at arm.com>
  Date:   2020-01-28 (Tue, 28 Jan 2020)

  Changed paths:
    M clang/lib/AST/FormatString.cpp
    M clang/test/Sema/format-strings-ms.c

  Log Message:
  -----------
  [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




More information about the All-commits mailing list