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

Dimitry Andric via All-commits all-commits at lists.llvm.org
Mon Jul 29 23:37:11 PDT 2024


  Branch: refs/heads/release/19.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 9536b026ac46c34d607c0a277c8fbdc183d53b9d
      https://github.com/llvm/llvm-project/commit/9536b026ac46c34d607c0a277c8fbdc183d53b9d
  Author: Dimitry Andric <dimitry at andric.com>
  Date:   2024-07-30 (Tue, 30 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.

(cherry picked from commit 62bd08acedc88d8976a017f7f6818f3167dfa697)



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