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

Thomas Monjalon thomas at monjalon.net
Wed May 5 23:39:23 CEST 2021


05/05/2021 18:00, Tyler Retzlaff:
> On Tue, May 04, 2021 at 09:48:22AM +0300, Dmitry Kozlyuk wrote:
> > 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>
[...]
> > > > -			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.
> 
> ah, consistency. yes i'll have some of that. maybe one day in the future
> we can change them all in one shot, but not today.
> 
> Acked-By: Tyler Retzlaff <roretzla at linux.microsoft.com>

I think PRIu16 is more appropriate.
Consistency doesn't matter if an approach is better.






More information about the stable mailing list