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 9239842FBA; Thu, 3 Aug 2023 00:41:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65FF3406BA; Thu, 3 Aug 2023 00:41:32 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id AFC03406B8 for ; Thu, 3 Aug 2023 00:41:31 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id DB7AA238C440; Wed, 2 Aug 2023 15:41:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DB7AA238C440 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1691016090; bh=1Hl+xoK3PWDJZT5AR6iRjCdlifU1DJCFREgV1O7K6i0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PJ4rubt6BPE24xFYSOB9zZnZv+DN5mLJYGjnsMHkUc/uVFpKIf9NodXc/PM7k1I1F aJUBmtdL5wvVUK/DdjCYF31Yx79TwOW3YPBHrbSMiFBbX9agwtdG+JaaLq8yuj6VMI fw+AaLn1qNNu68kr1w8HAlZQpnJmeZrNhDftABRo= Date: Wed, 2 Aug 2023 15:41:30 -0700 From: Tyler Retzlaff To: Dmitry Kozlyuk Cc: dev@dpdk.org, Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Subject: Re: [PATCH] eal/windows: resolve conversion and truncation warnings Message-ID: <20230802224130.GA19745@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1691009302-32551-1-git-send-email-roretzla@linux.microsoft.com> <20230803012900.57b9cb78@sovereign> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230803012900.57b9cb78@sovereign> 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 Thu, Aug 03, 2023 at 01:29:00AM +0300, Dmitry Kozlyuk wrote: > 2023-08-02 13:48 (UTC-0700), Tyler Retzlaff: > > * Initialize const int NS_PER_SEC with an integer literal instead of > > double thereby avoiding implicit conversion from double to int. > > > > * Cast the result of the expression assigned to timspec.tv_nsec to long. > > Typo: "timespec". oops > > > Windows builds generate integer truncation warning for this assignment > > since the result of the expression was 8 bytes (LONGLONG) but > > on Windows targets is 4 bytes. > > Probably "but **tv_nsec** on Windows targets is 4 bytes". thanks i'll update the wording. one thing that confuses me a little and this change won't break how the code already works (just makes the cast redundant) is that for mingw sizeof(long) is being reported as 8 bytes. this is in spec relative to the C standard but it does leave me somewhat concerned if struct timespec as defined in the windows headers crosses an abi boundary. have you ever noticed this? any thoughts on it? > > > The value produced for the expression should safely fit in the long. > > > > Signed-off-by: Tyler Retzlaff > > --- > > lib/eal/windows/include/rte_os_shim.h | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > Acked-by: Dmitry Kozlyuk thanks!