]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Merge commit 0f329e0246d1 from llvm-project (by Dimitry Andric):
authorDimitry Andric <dim@FreeBSD.org>
Thu, 25 Apr 2024 16:47:31 +0000 (18:47 +0200)
committerDimitry Andric <dim@FreeBSD.org>
Thu, 25 Apr 2024 16:47:47 +0000 (18:47 +0200)
commitf08bf5a3acf146b17794fbde41279645ddbaa086
tree069009499e9413d1e597e9ed119ac7e8830b0bcd
parent54c3aa02e926268ba5551cd7d28fddf38b3589a2
Merge commit 0f329e0246d1 from llvm-project (by Dimitry Andric):

  [sanitizer_symbolizer] Cast arguments for format strings in markup (#89815)

  When compiling the common sanitizer libraries, there are many warnings
  about format specifiers, similar to:

      compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp:31:32: warning: format specifies type 'void *' but the argument has type 'uptr' (aka 'unsigned long') [-Wformat]
         31 |   buffer->AppendF(kFormatData, DI->start);
            |                   ~~~~~~~~~~~  ^~~~~~~~~
      compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h:33:46: note: format string is defined here
         33 | constexpr const char *kFormatData = "{{{data:%p}}}";
            |                                              ^~
            |                                              %lu
      compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp:46:43: warning: format specifies type 'void *' but the argument has type 'uptr' (aka 'unsigned long') [-Wformat]
         46 |   buffer->AppendF(kFormatFrame, frame_no, address);
            |                   ~~~~~~~~~~~~            ^~~~~~~
      compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h:36:48: note: format string is defined here
         36 | constexpr const char *kFormatFrame = "{{{bt:%u:%p}}}";
            |                                                ^~
            |                                                %lu
      ...

  This is because `uptr` is dependent on the platform, and can be either
  `unsigned long long`, `unsigned long`, or `unsigned int`.

  To fix the warnings, cast the arguments to the expected type of the
  format strings.

PR: 276104
Reported by: pstef
MFC after: 3 days
contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h