From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id A0CFB1DB8 for ; Mon, 21 May 2018 14:10:14 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 05:10:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,426,1520924400"; d="scan'208";a="42936509" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.55]) by orsmga008.jf.intel.com with SMTP; 21 May 2018 05:10:10 -0700 Received: by (sSMTP sendmail emulation); Mon, 21 May 2018 13:10:09 +0100 Date: Mon, 21 May 2018 13:10:09 +0100 From: Bruce Richardson To: Andy Green Cc: dev@dpdk.org, thomas@monjalon.net Message-ID: <20180521121008.GB22944@bricha3-MOBL.ger.corp.intel.com> References: <152686781484.58694.14737673447518527445.stgit@localhost.localdomain> <152686806330.58694.1166818586734360461.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152686806330.58694.1166818586734360461.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 2/8] rte_rwlock.h: gcc8 sign conversion warnings 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:10:15 -0000 On Mon, May 21, 2018 at 10:01:03AM +0800, Andy Green wrote: > In file included from /projects/lagopus/src/dpdk/ > build/include/rte_rwlock.h:12, > from ./mgr/lock.h:24, > from ./mgr/sock_io.c:54: > /projects/lagopus/src/dpdk/build/include/generic/ > rte_rwlock.h: In function 'rte_rwlock_read_lock': > /projects/lagopus/src/dpdk/build/include/generic/ > rte_rwlock.h:74:12: warning: conversion to 'uint32_t' > {aka 'unsigned int'} from 'int32_t' {aka 'int'} may > change the sign of the result [-Wsign-conversion] > x, x + 1); > ^ > /projects/lagopus/src/dpdk/build/include/generic/ > rte_rwlock.h:74:17: warning: conversion to 'uint32_t' > {aka 'unsigned int'} from 'int' may change the sign > of the result [-Wsign-conversion] > x, x + 1); > ~~^~~ > /projects/lagopus/src/dpdk/build/include/generic/ > rte_rwlock.h: In function 'rte_rwlock_write_lock': > /projects/lagopus/src/dpdk/build/include/generic/ > rte_rwlock.h:110:15: warning: unsigned conversion > from 'int' to 'uint32_t' {aka 'unsigned int'} > changes value from '-1' to '4294967295' > [-Wsign-conversion] > 0, -1); > ^~ > > Again in this case we are making explicit the exact cast > that was always happening implicitly. The patch does not > change the generated code. > > The int32_t temp "x" is required to be signed to detect > a < 0 error condition from the lock status. Afterwards, > it has always been implicitly cast to uint32_t when it > is used in the arguments to rte_atomic32_cmpset()... > gcc8.1 objects to the implicit cast now and requires us > to cast it explicitly. > > Fixes: af75078fec ("first public release") > Signed-off-by: Andy Green > --- Acked-by: Bruce Richardson