[v9,05/10] pci: fix format warning on Windows

Message ID 20200624082847.21344-6-talshn@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Windows bus/pci support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Tal Shnaiderman June 24, 2020, 8:28 a.m. UTC
  From: Tal Shnaiderman <talshn@mellanox.com>

the struct rte_pci_addr defines domain as uint32_t variable however
the PCI_PRI_FMT macro used for logging the struct sets the format
of domain to uint16_t.

The mismatch causes the following warning messages
in Windows clang build:

format specifies type 'unsigned short' but the argument
has type 'uint32_t' (aka 'unsigned int') [-Wformat]

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 lib/librte_pci/rte_pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon June 25, 2020, 12:54 p.m. UTC | #1
24/06/2020 10:28, talshn@mellanox.com:
> From: Tal Shnaiderman <talshn@mellanox.com>
> 
> the struct rte_pci_addr defines domain as uint32_t variable however
> the PCI_PRI_FMT macro used for logging the struct sets the format
> of domain to uint16_t.
> 
> The mismatch causes the following warning messages
> in Windows clang build:
> 
> format specifies type 'unsigned short' but the argument
> has type 'uint32_t' (aka 'unsigned int') [-Wformat]
> 
> Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
  

Patch

diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
index 9337079178..104b2bb858 100644
--- a/lib/librte_pci/rte_pci.h
+++ b/lib/librte_pci/rte_pci.h
@@ -23,7 +23,7 @@  extern "C" {
 #include <sys/types.h>
 
 /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
-#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
+#define PCI_PRI_FMT "%.4" PRIx32 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
 #define PCI_PRI_STR_SIZE sizeof("XXXXXXXX:XX:XX.X")
 
 /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */