Skip to content

Commit 187d997

Browse files
committed
cfi: fix more -Wformat warnings
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. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D114466
1 parent 2897b67 commit 187d997

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler-rt/lib/cfi/cfi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ uptr find_cfi_check_in_dso(dl_phdr_info *info) {
230230
}
231231

232232
if (symtab > strtab) {
233-
VReport(1, "Can not handle: symtab > strtab (%p > %zx)\n", symtab, strtab);
233+
VReport(1, "Can not handle: symtab > strtab (%zx > %zx)\n", symtab, strtab);
234234
return 0;
235235
}
236236

@@ -250,7 +250,7 @@ uptr find_cfi_check_in_dso(dl_phdr_info *info) {
250250
if (phdr_idx == info->dlpi_phnum) {
251251
// Nope, either different segments or just bogus pointers.
252252
// Can not handle this.
253-
VReport(1, "Can not handle: symtab %p, strtab %zx\n", symtab, strtab);
253+
VReport(1, "Can not handle: symtab %zx, strtab %zx\n", symtab, strtab);
254254
return 0;
255255
}
256256

0 commit comments

Comments
 (0)