pipeline: prevent some compiler warnings

Message ID 20210421135744.21114-1-cristian.dumitrescu@intel.com (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers
Series pipeline: prevent some compiler warnings |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/Intel-compilation fail apply issues
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS

Commit Message

Cristian Dumitrescu April 21, 2021, 1:57 p.m. UTC
  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(-)
  

Patch

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);