[all-commits] [llvm/llvm-project] 5dd8ff: [asan/mac] Fix remaining -Wformat warnings

Nico Weber via All-commits all-commits at lists.llvm.org
Fri Dec 17 06:44:30 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5dd8ff73804acf5aa3917011b214bd19e3332f51
      https://github.com/llvm/llvm-project/commit/5dd8ff73804acf5aa3917011b214bd19e3332f51
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-12-17 (Fri, 17 Dec 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp

  Log Message:
  -----------
  [asan/mac] Fix remaining -Wformat warnings

AARCH64_GET_REG() is used to initialize uptrs, and after D79132
the ptrauth branch of its implementation explicitly casts to uptr.

The non-ptrauth branch returns ucontext->uc_mcontext->__ss.__fp (etc),
which has either type void* or __uint64_t (ref usr/include/mach/arm/_structs.h)
where __uint64_t is a unsigned long long (ref usr/include/arm/_types.h).
uptr is an unsigned long (ref
compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h). So explicitly
cast to uptr in this branch as well, so that AARCH64_GET_REG() has a
well-defined type.

Then change DUMPREGA64() tu use %lx instead of %llx since that's the right type
for uptr. (Most other places in compiler-rt print uptrs as %p and cast the arg
to (void*), but there are explicit 0x%016 format strings in the surroundings,
so be locally consistent with that.)

No behavior change, in the end it's just 64-bit unsigneds by slightly different
names.




More information about the All-commits mailing list