DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org, alialnu@nvidia.com
Subject: [dpdk-dev] [PATCH] pipeline: prevent some compiler warnings
Date: Wed, 21 Apr 2021 14:57:44 +0100	[thread overview]
Message-ID: <20210421135744.21114-1-cristian.dumitrescu@intel.com> (raw)

Some older versions of the GCC compiler may trigger the
-Werror=maybe-uninitialized warning if some local variables are not
initialized.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_pipeline.c | 30 +++++++++++++-------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c
index 4e358bbda..1cc08659d 100644
--- a/lib/librte_pipeline/rte_swx_pipeline.c
+++ b/lib/librte_pipeline/rte_swx_pipeline.c
@@ -3624,7 +3624,7 @@ instr_mov_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -3889,7 +3889,7 @@ instr_alu_add_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -3942,7 +3942,7 @@ instr_alu_sub_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4072,7 +4072,7 @@ instr_alu_shl_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4125,7 +4125,7 @@ instr_alu_shr_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4178,7 +4178,7 @@ instr_alu_and_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4231,7 +4231,7 @@ instr_alu_or_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -4284,7 +4284,7 @@ instr_alu_xor_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *src = tokens[2];
 	struct field *fdst, *fsrc;
 	uint64_t src_val;
-	uint32_t dst_struct_id, src_struct_id;
+	uint32_t dst_struct_id = 0, src_struct_id = 0;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -5162,7 +5162,7 @@ instr_regprefetch_translate(struct rte_swx_pipeline *p,
 	char *regarray = tokens[1], *idx = tokens[2];
 	struct regarray *r;
 	struct field *fidx;
-	uint32_t idx_struct_id, idx_val;
+	uint32_t idx_struct_id = 0, idx_val;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -5206,7 +5206,7 @@ instr_regrd_translate(struct rte_swx_pipeline *p,
 	char *dst = tokens[1], *regarray = tokens[2], *idx = tokens[3];
 	struct regarray *r;
 	struct field *fdst, *fidx;
-	uint32_t dst_struct_id, idx_struct_id, idx_val;
+	uint32_t dst_struct_id = 0, idx_struct_id = 0, idx_val;
 
 	CHECK(n_tokens == 4, EINVAL);
 
@@ -5265,7 +5265,7 @@ instr_regwr_translate(struct rte_swx_pipeline *p,
 	struct regarray *r;
 	struct field *fidx, *fsrc;
 	uint64_t src_val;
-	uint32_t idx_struct_id, idx_val, src_struct_id;
+	uint32_t idx_struct_id = 0, idx_val, src_struct_id = 0;
 
 	CHECK(n_tokens == 4, EINVAL);
 
@@ -5354,7 +5354,7 @@ instr_regadd_translate(struct rte_swx_pipeline *p,
 	struct regarray *r;
 	struct field *fidx, *fsrc;
 	uint64_t src_val;
-	uint32_t idx_struct_id, idx_val, src_struct_id;
+	uint32_t idx_struct_id = 0, idx_val, src_struct_id = 0;
 
 	CHECK(n_tokens == 4, EINVAL);
 
@@ -6064,7 +6064,7 @@ instr_metprefetch_translate(struct rte_swx_pipeline *p,
 	char *metarray = tokens[1], *idx = tokens[2];
 	struct metarray *m;
 	struct field *fidx;
-	uint32_t idx_struct_id, idx_val;
+	uint32_t idx_struct_id = 0, idx_val;
 
 	CHECK(n_tokens == 3, EINVAL);
 
@@ -6107,8 +6107,8 @@ instr_meter_translate(struct rte_swx_pipeline *p,
 	char *color_in = tokens[4], *color_out = tokens[5];
 	struct metarray *m;
 	struct field *fidx, *flength, *fcin, *fcout;
-	uint32_t idx_struct_id, length_struct_id;
-	uint32_t color_in_struct_id, color_out_struct_id;
+	uint32_t idx_struct_id = 0, length_struct_id = 0;
+	uint32_t color_in_struct_id = 0, color_out_struct_id = 0;
 
 	CHECK(n_tokens == 6, EINVAL);
 
-- 
2.17.1


                 reply	other threads:[~2021-04-21 13:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210421135744.21114-1-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=alialnu@nvidia.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).