From 3d800ab3af749cfaf79f436bf3d134325a25ebf1 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 25 Oct 2019 17:32:53 -0400 Subject: [PATCH] Fix -Wduplicated-cond warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes this: CC libctf_parser_la-parser.lo /home/smarchi/src/babeltrace/src/plugins/ctf/common/metadata/parser.y: In function ‘yyparse’: /home/smarchi/src/babeltrace/src/plugins/ctf/common/metadata/parser.y:1313:50: error: duplicated ‘if’ condition [-Werror=duplicated-cond] } else if ($$->u.unary_expression.type == UNARY_UNSIGNED_CONSTANT) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /home/smarchi/src/babeltrace/src/plugins/ctf/common/metadata/parser.y:1309:43: note: previously used here if ($$->u.unary_expression.type == UNARY_UNSIGNED_CONSTANT) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ I am pretty sure that this line should use UNARY_SIGNED_CONSTANT. Change-Id: Icb17d79422ed78a214fb88a3a0787fcd760822d6 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/2260 Reviewed-by: Francis Deslauriers --- configure.ac | 1 - src/plugins/ctf/common/metadata/parser.y | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 35e50c8a..cbbb6631 100644 --- a/configure.ac +++ b/configure.ac @@ -680,7 +680,6 @@ AX_COMPILER_FLAGS( -Wno-null-dereference dnl -Wno-jump-misses-init dnl -Wno-missing-include-dirs dnl - -Wno-duplicated-cond dnl -Wno-double-promotion dnl -Wno-cast-align dnl ]) diff --git a/src/plugins/ctf/common/metadata/parser.y b/src/plugins/ctf/common/metadata/parser.y index b270a83c..16868179 100644 --- a/src/plugins/ctf/common/metadata/parser.y +++ b/src/plugins/ctf/common/metadata/parser.y @@ -1310,7 +1310,7 @@ unary_expression: $$->u.unary_expression.type = UNARY_SIGNED_CONSTANT; $$->u.unary_expression.u.signed_constant = -($$->u.unary_expression.u.unsigned_constant); - } else if ($$->u.unary_expression.type == UNARY_UNSIGNED_CONSTANT) { + } else if ($$->u.unary_expression.type == UNARY_SIGNED_CONSTANT) { $$->u.unary_expression.u.signed_constant = -($$->u.unary_expression.u.signed_constant); } else { -- 2.34.1