From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 01DE21B03D for ; Mon, 21 May 2018 14:13:21 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 05:13:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,426,1520924400"; d="scan'208";a="42937039" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.55]) by orsmga008.jf.intel.com with SMTP; 21 May 2018 05:13:18 -0700 Received: by (sSMTP sendmail emulation); Mon, 21 May 2018 13:13:18 +0100 Date: Mon, 21 May 2018 13:13:17 +0100 From: Bruce Richardson To: Andy Green Cc: dev@dpdk.org, thomas@monjalon.net Message-ID: <20180521121317.GC22944@bricha3-MOBL.ger.corp.intel.com> References: <152686781484.58694.14737673447518527445.stgit@localhost.localdomain> <152686806834.58694.15827888464125197583.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152686806834.58694.15827888464125197583.stgit@localhost.localdomain> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v6 3/8] rte_ip.h: cast type decided by sizeof to uint32 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 12:13:22 -0000 On Mon, May 21, 2018 at 10:01:08AM +0800, Andy Green wrote: > /projects/lagopus/src/dpdk/build/include/rte_ip.h: > In function 'rte_ipv4_udptcp_cksum': > /projects/lagopus/src/dpdk/build/include/rte_byteorder.h: > 51:24: warning: conversion from 'long unsigned int' to > 'uint32_t' {aka 'unsigned int'} may change value > [-Wconversion] > #define rte_bswap16(x) ((uint16_t) > (__builtin_constant_p(x) ? \ > ^ > /projects/lagopus/src/dpdk/build/include/rte_byteorder.h: > 85:29: note: in expansion of macro 'rte_bswap16' > #define rte_be_to_cpu_16(x) rte_bswap16(x) > ^~~~~~~~~~~ > /projects/lagopus/src/dpdk/build/include/rte_ip.h:321:11: > note: in expansion of macro 'rte_be_to_cpu_16' > l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) - > ^~~~~~~~~~~~~~~~ > > Also with this one, it is a cast that always occurred > and is just being done explicitly, with no changes to > the generated code. > > The warning stack is misleading, it points to the last > element in the macro that produced the lhs of the subtraction > above. But the only "unsigned long int" in the expression is > the result of the sizeof() on the rhs, it promotes the > subtraction result to unsigned long. So the error actually > relates to the result of the outer subtraction. > > The actual error is "you are trying to put an unsigned long > into a uint32_t". We always did so, the fix is just to inform > the compiler it is intentional with an explicit cast. > > Fixes: 6006818cfb ("net: new checksum functions") > Signed-off-by: Andy Green > --- > lib/librte_net/rte_ip.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Acked-by: Bruce Richardson