Skip to contentSkip to conversation

examples/packet_ordering: fix format specifier for port ID

PATCH In review Aarnav JP 2 participants 5 messages Mar 27

lore
Share & tools
lore

Aarnav JP

author
#0 lore raw

PATCH 1/2 examples/packet_ordering: fix format specifier for port ID

port_id is uint16_t, use PRIu16 instead of PRIu8 to fix format specifier mismatch warning with GCC 15.

../examples/packet_ordering/main.c: In function 'main':
../examples/packet_ordering/main.c:740:46:
warning: format '%hhu' expects argument of type 'unsigned char', but argument 3 has type 'uint16_t' [-Wformat=]
740 | rte_exit(EXIT_FAILURE, "Cannot initialize port %"PRIu8"\n",
| ^

Fixes 850f3733f840 ("examples/packet_ordering: new sample app")
---
 examples/packet_ordering/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/packet_ordering/main.c +1 -1
index 5ffdf72d71..748fe0826a 100644
@@ -737,7 +737,7 @@ main(int argc, char **argv)
 		printf("Initializing port %u... done\n", port_id);
 
 		if (configure_eth_port(port_id) != 0)
-			rte_exit(EXIT_FAILURE, "Cannot initialize port %"PRIu8"\n",
+			rte_exit(EXIT_FAILURE, "Cannot initialize port %"PRIu16"\n",
 					port_id);
 	}
 
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 examples/ptpclient: fix format specifier for port ID

portid is uint16_t, use PRIu16 instead of PRIu8 to fix format specifier mismatch warning with GCC 15.

../examples/ptpclient/ptpclient.c: In function 'main':
../examples/ptpclient/ptpclient.c:797:30:
warning: format '%hhu' expects argument of type 'unsigned char', but argument 3 has type 'uint16_t' [-Wformat=]
797 | "Cannot init port %"PRIu8 "\n",
| ^

Fixes ab129e9065a5 ("examples/ptpclient: add minimal PTP client")
---
 examples/ptpclient/ptpclient.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/ptpclient/ptpclient.c +1 -1
index c344e7db1e..1fec4af767 100644
@@ -794,7 +794,7 @@ main(int argc, char *argv[])
 				ptp_enabled_port_nb++;
 			} else {
 				rte_exit(EXIT_FAILURE,
-					 "Cannot init port %"PRIu8 "\n",
+					 "Cannot init port %"PRIu16 "\n",
 					 portid);
 			}
 		} else
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] examples/ptpclient: fix format specifier for port ID

Quoted 4 lines · Aarnav JP

portid is uint16_t, use PRIu16 instead of PRIu8 to fix format specifier mismatch warning with GCC 15.

Quoted 8 lines

../examples/ptpclient/ptpclient.c: In function 'main':
../examples/ptpclient/ptpclient.c:797:30:
warning: format '%hhu' expects argument of type 'unsigned char', but argument 3 has type 'uint16_t' [-Wformat=]
797 | "Cannot init port %"PRIu8 "\n",
| ^

Fixes ab129e9065a5 ("examples/ptpclient: add minimal PTP client")

Same as previous comment, at the time this code was introduced, port_id was a uint8_t.

This can be fixed when applying:

Fixes 47523597ff6c ("examples: fix port id type")
Quoted 3 lines
Signature · 1 line
David Marchand
#3 lore raw

Re: [PATCH 2/2] examples/ptpclient: fix format specifier for port ID

Quoted 18 lines · David Marchand
Quoted 4 lines · Aarnav JP

portid is uint16_t, use PRIu16 instead of PRIu8 to fix format specifier mismatch warning with GCC 15.

Quoted 8 lines

../examples/ptpclient/ptpclient.c: In function 'main':
../examples/ptpclient/ptpclient.c:797:30:
warning: format '%hhu' expects argument of type 'unsigned char', but argument 3 has type 'uint16_t' [-Wformat=]
797 | "Cannot init port %"PRIu8 "\n",
| ^

Fixes ab129e9065a5 ("examples/ptpclient: add minimal PTP client")

Same as previous comment, at the time this code was introduced, port_id was a uint8_t.

Quoted 7 lines

This can be fixed when applying:

Fixes 47523597ff6c ("examples: fix port id type")
Quoted 3 lines

Series applied, thanks for the fixes.

Signature · 1 line
David Marchand
Reviewed-by on v1 1/2
#4 lore raw
In reply to Aarnav JP

Hello,

Quoted 4 lines · Aarnav JP

port_id is uint16_t, use PRIu16 instead of PRIu8 to fix format specifier mismatch warning with GCC 15.

Quoted 8 lines

../examples/packet_ordering/main.c: In function 'main':
../examples/packet_ordering/main.c:740:46:
warning: format '%hhu' expects argument of type 'unsigned char', but argument 3 has type 'uint16_t' [-Wformat=]
740 | rte_exit(EXIT_FAILURE, "Cannot initialize port %"PRIu8"\n",
| ^

Fixes 850f3733f840 ("examples/packet_ordering: new sample app")

At the time this code was introduced, port_id was a uint8_t.

This can be fixed when applying:

Fixes f8244c6399d9 ("ethdev: increase port id range")
Quoted 3 lines
Signature · 1 line
David Marchand