From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 484F94626B; Wed, 19 Feb 2025 18:08:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC21740647; Wed, 19 Feb 2025 18:08:13 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id CE4184028B for ; Wed, 19 Feb 2025 18:08:12 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 281882043DE3; Wed, 19 Feb 2025 09:08:12 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 281882043DE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1739984892; bh=T97JhCqfkf9kMnbaYq/TYHVcQFj41XoHUlCjk2v9I/E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eDw5oOL9T6Qi/rEHV4Pw0ObVeDSrNBgWGL3jRS+k9YOI2nGheGWgOyyfPWFZcNZnV 2LukpNSYjOzEH5HOcX0OSdU6k8PrJjAAXsf9bA0CUxBNWHEJ630+mPLXyHm3hInd2d dbCYxbLXsgpbP+FfQy+boUPszfpIJ1EMg+QIB+sg= Date: Wed, 19 Feb 2025 09:08:12 -0800 From: Andre Muezerie To: Bruce Richardson Cc: dev@dpdk.org, Chengwen Feng Subject: Re: [PATCH v2 03/10] test-pmd: fix printf format string mismatch Message-ID: <20250219170812.GA10716@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1739311325-14425-1-git-send-email-andremue@linux.microsoft.com> <1739896329-1946-1-git-send-email-andremue@linux.microsoft.com> <1739896329-1946-4-git-send-email-andremue@linux.microsoft.com> <20250218170300.GA6575@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Feb 18, 2025 at 05:07:03PM +0000, Bruce Richardson wrote: > On Tue, Feb 18, 2025 at 09:03:01AM -0800, Andre Muezerie wrote: > > On Tue, Feb 18, 2025 at 04:46:56PM +0000, Bruce Richardson wrote: > > > On Tue, Feb 18, 2025 at 08:32:02AM -0800, Andre Muezerie wrote: > > > > Compiling with MSVC results in warnings like the one below: > > > > > > > > app/test-pmd/csumonly.c(1085): warning C4477: 'printf' : format string > > > > '%d' requires an argument of type 'int', > > > > but variadic argument 1 has type 'uint64_t' > > > > > > > > Signed-off-by: Andre Muezerie > > > > Signed-off-by: Chengwen Feng > > > > --- > > > > app/test-pmd/csumonly.c | 23 ++++++++++++----------- > > > > 1 file changed, 12 insertions(+), 11 deletions(-) > > > > > > > > diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c > > > > index d77a140641..8de5ad6ad9 100644 > > > > --- a/app/test-pmd/csumonly.c > > > > +++ b/app/test-pmd/csumonly.c > > > > @@ -1070,7 +1070,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) > > > > info.l2_len, rte_be_to_cpu_16(info.ethertype), > > > > info.l3_len, info.l4_proto, info.l4_len, buf); > > > > if (rx_ol_flags & RTE_MBUF_F_RX_LRO) > > > > - printf("rx: m->lro_segsz=%u\n", m->tso_segsz); > > > > + printf("rx: m->lro_segsz=%" PRIu64 "\n", (uint64_t)m->tso_segsz); > > > > > > tso_segsz is already uint64_t, so no need for the cast. > > > > The compilers differ in behavior here. tso_segsz only uses 16 bits of the uint64_t, > > and gcc tries to be smart about it and implicitly converts tso_segsz into an int > > (since it fits into an int). Msvc does not do that, and keeps the type for tso_segsz > > as uint64_t. To support both compilers it seems there's no way to avoid the cast. > > > > Ok. Then can we just keep the %u and cast to either unsigned or uint16_t? > No need to update the format char if we are casting, right? > > /Bruce Yes, I'll do that.