Fix existing -Wformat warnings.
Depends on D107979.
Paths
| Differential D107980
sanitizer_common: fix format strings ClosedPublic Authored by dvyukov on Aug 12 2021, 11:19 AM.
Details
Summary Fix existing -Wformat warnings. Depends on D107979.
Diff Detail
Event Timelinedvyukov added a child revision: D107981: sanitizer_common: enable format string checking.Aug 12 2021, 11:19 AM vitalybuka added inline comments.
This revision is now accepted and ready to land.Aug 12 2021, 12:46 PM dvyukov edited parent revisions, added: D108015: sanitizer_common: declare vars more locally in VSNPrintf; removed: D107979: Revert "sanitizer_common: support printing __m128i type".Aug 12 2021, 10:41 PM
This revision was landed with ongoing or failed builds.Aug 13 2021, 4:44 AM Closed by commit rG4a91bbcc93d1: sanitizer_common: fix format strings (authored by dvyukov). · Explain Why This revision was automatically updated to reflect the committed changes. Comment Actions
I've sent https://reviews.llvm.org/D108066 to fix this. Comment Actions I'm seeing build failures like this in downstream builders: bin/clang++ --target=i386-unknown-linux-gnu -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/repo/llvm/compiler-rt/lib/gwp_asan/.. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Werror -std=c++14 -Wno-unused-parameter -O3 -DNDEBUG -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-format-pedantic -nostdinc++ -fno-rtti -fno-exceptions -nostdinc++ -pthread -fno-omit-frame-pointer -fPIC -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-format-pedantic -nostdinc++ -UNDEBUG -MD -MT compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceSanitizerCommon.i386.dir/optional/backtrace_sanitizer_common.cpp.o -MF compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceSanitizerCommon.i386.dir/optional/backtrace_sanitizer_common.cpp.o.d -o compiler-rt/lib/gwp_asan/CMakeFiles/RTGwpAsanBacktraceSanitizerCommon.i386.dir/optional/backtrace_sanitizer_common.cpp.o -c /repo/llvm/compiler-rt/lib/gwp_asan/optional/backtrace_sanitizer_common.cpp In file included from /repo/llvm/compiler-rt/lib/gwp_asan/optional/backtrace_sanitizer_common.cpp:17: /repo/llvm/compiler-rt/lib/gwp_asan/../sanitizer_common/sanitizer_flag_parser.h:141:76: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long' [-Werror,-Wformat] uptr num_symbols_should_write = internal_snprintf(buffer, size, "0x%zx", *t_); ~~~ ^~~ %lx 1 error generated. Comment Actions Hi Bjorn, Comment Actions
I've noticed that the problem resolved itself later. I think that maybe this patch fixed it: https://reviews.llvm.org/rG45138f788c9b3c4ac5d9ae4479841c411c15190e Comment Actions
Ah, right, it should fix it as well. Did not notice it.
Revision Contents
Diff 366243 compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_format.inc
compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h
compiler-rt/lib/sanitizer_common/sanitizer_libignore.cpp
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cpp
compiler-rt/lib/sanitizer_common/tests/sanitizer_common_test.cpp
compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp
|
It would be nice if we have consistency with pointers. As is we mix %p and 0x%zx but the produce different output.
Unfortunately we already have a lot of both.