[all-commits] [llvm/llvm-project] 79fa75: [sanitizer_symbolizer] Use correct format strings ...
Dimitry Andric via All-commits
all-commits at lists.llvm.org
Tue Apr 23 12:44:36 PDT 2024
Branch: refs/heads/users/DimitryAndric/sanitizer-fix-symbolizer-markup-constants-1
Home: https://github.com/llvm/llvm-project
Commit: 79fa752ff1df4ff3aa48493cf1abecf3fc3c7d94
https://github.com/llvm/llvm-project/commit/79fa752ff1df4ff3aa48493cf1abecf3fc3c7d94
Author: Dimitry Andric <dimitry at andric.com>
Date: 2024-04-23 (Tue, 23 Apr 2024)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h
Log Message:
-----------
[sanitizer_symbolizer] Use correct format strings for uptr
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, define the correct printf modifier for `uptr` and
`sptr` as `SANITIZER_PTR_MOD`, and use it in the various format strings
in `sanitizer_symbolizer_markup_constants.h`.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list