[all-commits] [llvm/llvm-project] 62bd08: [compiler-rt] Fix format string warnings in FreeBS...

Dimitry Andric via All-commits all-commits at lists.llvm.org
Mon Jul 29 13:00:28 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 62bd08acedc88d8976a017f7f6818f3167dfa697
      https://github.com/llvm/llvm-project/commit/62bd08acedc88d8976a017f7f6818f3167dfa697
  Author: Dimitry Andric <dimitry at andric.com>
  Date:   2024-07-29 (Mon, 29 Jul 2024)

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

  Log Message:
  -----------
  [compiler-rt] Fix format string warnings in FreeBSD DumpAllRegisters (#101072)

On FreeBSD amd64 (aka x86_64), registers are always defined as
`int64_t`, which in turn is equivalent to `long`. This leads to a number
of warnings in `DumpAllRegisters()`:

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2245:31: warning:
format specifies type 'unsigned long long' but the argument has type
'__register_t' (aka 'long') [-Wformat]
     2245 |   Printf("rax = 0x%016llx  ", ucontext->uc_mcontext.mc_rax);
          |                   ~~~~~~~     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |                   %016lx
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2246:31: warning:
format specifies type 'unsigned long long' but the argument has type
'__register_t' (aka 'long') [-Wformat]
     2246 |   Printf("rbx = 0x%016llx  ", ucontext->uc_mcontext.mc_rbx);
          |                   ~~~~~~~     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |                   %016lx
    ... more of these ...

Fix it by using the `lx` format.



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