[all-commits] [llvm/llvm-project] 6ee219: [sanitizer_symbolizer] Cast arguments for format s...
Dimitry Andric via All-commits
all-commits at lists.llvm.org
Wed Apr 24 15:00:36 PDT 2024
Branch: refs/heads/users/DimitryAndric/sanitizer-fix-symbolizer-markup-constants-1
Home: https://github.com/llvm/llvm-project
Commit: 6ee2190e3a06da6f6397ec71dc0c501d668b6eb6
https://github.com/llvm/llvm-project/commit/6ee2190e3a06da6f6397ec71dc0c501d668b6eb6
Author: Dimitry Andric <dimitry at andric.com>
Date: 2024-04-24 (Wed, 24 Apr 2024)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h
Log Message:
-----------
[sanitizer_symbolizer] Cast arguments for format strings in markup
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.
Commit: ebb6f7e1c35b9f23346dc326c47eab237367669c
https://github.com/llvm/llvm-project/commit/ebb6f7e1c35b9f23346dc326c47eab237367669c
Author: Dimitry Andric <dimitry at andric.com>
Date: 2024-04-24 (Wed, 24 Apr 2024)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp
M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup_constants.h
Log Message:
-----------
Use size_t for uptr differences, and adjust format strings.
Compare: https://github.com/llvm/llvm-project/compare/409b4070c6ad...ebb6f7e1c35b
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