From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <keith.wiles@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id C17F22BA1
 for <dev@dpdk.org>; Fri,  1 Apr 2016 21:20:29 +0200 (CEST)
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga104.fm.intel.com with ESMTP; 01 Apr 2016 12:20:28 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.24,428,1455004800"; d="scan'208";a="77482551"
Received: from steelegr-mobl2.amr.corp.intel.com ([10.252.192.74])
 by fmsmga004.fm.intel.com with ESMTP; 01 Apr 2016 12:20:28 -0700
From: Keith Wiles <keith.wiles@intel.com>
To: dev@dpdk.org
Date: Fri,  1 Apr 2016 14:20:19 -0500
Message-Id: <1459538419-81284-1-git-send-email-keith.wiles@intel.com>
X-Mailer: git-send-email 2.6.4 (Apple Git-63)
Subject: [dpdk-dev] [PATCH] gcc compiler option -Og warnings fix
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 01 Apr 2016 19:20:30 -0000

The new compiler option -Og causes a few warning on variables
being used before being set warnings. The new option allows better
debugging then -O0 without losing a lot of performance. This option
does not include -g debug symbol option.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +-
 lib/librte_lpm/rte_lpm6.c                 | 1 +
 lib/librte_vhost/vhost_rxtx.c             | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
index 068694d..89709f8 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
@@ -152,7 +152,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
 			   unsigned int buflen, int create)
 {
 	struct rte_pci_addr *loc = &dev->addr;
-	unsigned int uio_num;
+	unsigned int uio_num = 0;
 	struct dirent *e;
 	DIR *dir;
 	char dirname[PATH_MAX];
diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index 4c44cd7..36565da 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -381,6 +381,7 @@ add_step(struct rte_lpm6 *lpm, struct rte_lpm6_tbl_entry *tbl,
 	int8_t bitshift;
 	uint8_t bits_covered;
 
+	*tbl_next = NULL;
 	/*
 	 * Calculate index to the table based on the number and position
 	 * of the bytes being inspected in this step.
diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index 750821a..acf3632 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -295,7 +295,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
 	for (i = 0; i < count; i++) {
 		uint16_t desc_idx = desc_indexes[i];
 		uint16_t used_idx = (res_start_idx + i) & (vq->size - 1);
-		uint32_t copied;
+		uint32_t copied = 0;
 		int err;
 
 		err = copy_mbuf_to_desc(dev, vq, pkts[i], desc_idx, &copied);
@@ -531,7 +531,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id,
 {
 	struct vhost_virtqueue *vq;
 	uint32_t pkt_idx = 0, nr_used = 0;
-	uint16_t start, end;
+	uint16_t start = 0, end = 0;
 
 	LOG_DEBUG(VHOST_DATA, "(%"PRIu64") virtio_dev_merge_rx()\n",
 		dev->device_fh);
-- 
2.5.0