[PATCH] D114466: cfi: fix more -Wformat warnings
Dimitry Andric via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 23 12:13:41 PST 2021
dim created this revision.
dim added reviewers: dvyukov, emaste, marxin, vitalybuka.
dim requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
Building cfi with recent clang on a 64-bit system results in the
following warnings:
compiler-rt/lib/cfi/cfi.cpp:233:64: warning: format specifies type 'void *' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
VReport(1, "Can not handle: symtab > strtab (%p > %zx)\n", symtab, strtab);
~~ ^~~~~~
%lu
compiler-rt/lib/sanitizer_common/sanitizer_common.h:231:46: note: expanded from macro 'VReport'
if ((uptr)Verbosity() >= (level)) Report(__VA_ARGS__); \
^~~~~~~~~~~
compiler-rt/lib/cfi/cfi.cpp:253:59: warning: format specifies type 'void *' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
VReport(1, "Can not handle: symtab %p, strtab %zx\n", symtab, strtab);
~~ ^~~~~~
%lu
compiler-rt/lib/sanitizer_common/sanitizer_common.h:231:46: note: expanded from macro 'VReport'
if ((uptr)Verbosity() >= (level)) Report(__VA_ARGS__); \
^~~~~~~~~~~
Since `__sanitizer::uptr` has the same size as `size_t`, consistently
use `%z` as a printf specifier.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114466
Files:
compiler-rt/lib/cfi/cfi.cpp
Index: compiler-rt/lib/cfi/cfi.cpp
===================================================================
--- compiler-rt/lib/cfi/cfi.cpp
+++ compiler-rt/lib/cfi/cfi.cpp
@@ -230,7 +230,7 @@
}
if (symtab > strtab) {
- VReport(1, "Can not handle: symtab > strtab (%p > %zx)\n", symtab, strtab);
+ VReport(1, "Can not handle: symtab > strtab (%zx > %zx)\n", symtab, strtab);
return 0;
}
@@ -250,7 +250,7 @@
if (phdr_idx == info->dlpi_phnum) {
// Nope, either different segments or just bogus pointers.
// Can not handle this.
- VReport(1, "Can not handle: symtab %p, strtab %zx\n", symtab, strtab);
+ VReport(1, "Can not handle: symtab %zx, strtab %zx\n", symtab, strtab);
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114466.389278.patch
Type: text/x-patch
Size: 732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211123/6b7bf08a/attachment.bin>
More information about the llvm-commits
mailing list