From patchwork Mon Jun 4 19:40:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eads, Gage" X-Patchwork-Id: 40631 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5DFEA5F3C; Mon, 4 Jun 2018 21:40:06 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id DB2CE5F32 for ; Mon, 4 Jun 2018 21:40:04 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2018 12:40:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,476,1520924400"; d="scan'208";a="234314409" Received: from txasoft-yocto.an.intel.com ([10.123.72.192]) by fmsmga005.fm.intel.com with ESMTP; 04 Jun 2018 12:40:02 -0700 From: Gage Eads To: dev@dpdk.org Cc: olivier.matz@6wind.com Date: Mon, 4 Jun 2018 14:40:00 -0500 Message-Id: <20180604194000.12632-1-gage.eads@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] net: rename u16 to fix shadowed declaration warning 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch renames u16 to u16_buf. u16 as a variable name causes a shadowed declaration warning if, for example, the application also typedefs u16 (e.g. by including a header containing "typedef unsigned short u16") and the application is built with -Wshadow. Signed-off-by: Gage Eads Acked-by: Olivier Matz --- lib/librte_net/rte_ip.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index 72dc2456a..f2a8904a2 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -108,25 +108,25 @@ __rte_raw_cksum(const void *buf, size_t len, uint32_t sum) /* workaround gcc strict-aliasing warning */ uintptr_t ptr = (uintptr_t)buf; typedef uint16_t __attribute__((__may_alias__)) u16_p; - const u16_p *u16 = (const u16_p *)ptr; - - while (len >= (sizeof(*u16) * 4)) { - sum += u16[0]; - sum += u16[1]; - sum += u16[2]; - sum += u16[3]; - len -= sizeof(*u16) * 4; - u16 += 4; + const u16_p *u16_buf = (const u16_p *)ptr; + + while (len >= (sizeof(*u16_buf) * 4)) { + sum += u16_buf[0]; + sum += u16_buf[1]; + sum += u16_buf[2]; + sum += u16_buf[3]; + len -= sizeof(*u16_buf) * 4; + u16_buf += 4; } - while (len >= sizeof(*u16)) { - sum += *u16; - len -= sizeof(*u16); - u16 += 1; + while (len >= sizeof(*u16_buf)) { + sum += *u16_buf; + len -= sizeof(*u16_buf); + u16_buf += 1; } /* if length is in odd bytes */ if (len == 1) - sum += *((const uint8_t *)u16); + sum += *((const uint8_t *)u16_buf); return sum; }