[all-commits] [llvm/llvm-project] d9e430: [mlir][NFC] Fix format specifier warning on Windows

Markus Böck via All-commits all-commits at lists.llvm.org
Fri Feb 23 03:50:43 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d9e4309b451c1b24d4e0a6304057663b877e5266
      https://github.com/llvm/llvm-project/commit/d9e4309b451c1b24d4e0a6304057663b877e5266
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2024-02-23 (Fri, 23 Feb 2024)

  Changed paths:
    M mlir/test/CAPI/llvm.c

  Log Message:
  -----------
  [mlir][NFC] Fix format specifier warning on Windows

`%ld` specifier is defined to work on values of type `long`. The parameter given to `fprintf` is of type `intptr_t` whose actual underlying integer type is unspecified. On Unix systems it happens to commonly be `long` but on 64-bit Windows it is defined as `long long`.

The cross-platform way to print a `intptr_t` is to use `PRIdPTR` which expands to the correct format specifier for `intptr_t`. This avoids any undefined behaviour and compiler warnings.



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