[all-commits] [llvm/llvm-project] d4d2b0: sanitizer_common: support %l in format strings

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Sat Aug 14 17:57:52 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4d2b0c682c55f22978ff0eed743ebe882b3e735
      https://github.com/llvm/llvm-project/commit/d4d2b0c682c55f22978ff0eed743ebe882b3e735
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-08-14 (Sat, 14 Aug 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp
    M compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cpp

  Log Message:
  -----------
  sanitizer_common: support %l in format strings

Currently we only support %z and %ll width modifiers,
but surprisingly not %l. This makes it impossible to print longs
(sizeof(long) not necessary equal to sizeof(size_t)).
We had some printf's that printed longs with %zu,
but that's wrong and now with __attribute__((format)) in place
they are flagged by compiler. So we either have a choice of
doing static_cast<uptr>(long) everywhere or add %l.
Adding %l looks better, that's a standard modifier.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D108066




More information about the All-commits mailing list