[dpdk-stable] [dpdk-dev] [PATCH] examples/rxtx_callbacks: fix port ID format specifier

Dmitry Kozlyuk dmitry.kozliuk at gmail.com
Tue May 4 08:48:22 CEST 2021


2021-05-03 17:11 (UTC-0700), Tyler Retzlaff:
> On Sun, May 02, 2021 at 05:56:56AM +0300, Dmitry Kozlyuk wrote:
> > Use "%u" and a cast as in other places when port ID is formatted.
> > This fixes -Wformat warning with clang 10.0.0 on Windows.
> > 
> > Fixes: f8244c6399d9 ("ethdev: increase port id range")
> > Cc: stable at dpdk.org
> > 
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
> > ---
> >  examples/rxtx_callbacks/main.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
> > index b57b2fc6bc..9574b6ea0d 100644
> > --- a/examples/rxtx_callbacks/main.c
> > +++ b/examples/rxtx_callbacks/main.c
> > @@ -329,8 +329,8 @@ main(int argc, char *argv[])
> >  	/* initialize all ports */
> >  	RTE_ETH_FOREACH_DEV(portid)
> >  		if (port_init(portid, mbuf_pool) != 0)
> > -			rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu8"\n",
> > -					portid);  
> 
> how come not just `% " PRIu16 "\n"' ?
> 
> what was the -Wformat clang on windows complaint?

PRIx16 would work, but I noticed that in other places where port ID is
printed, the pattern above is used. IMO uniform approach is better.


More information about the stable mailing list