From: Etienne Bergeron Date: Tue, 2 Apr 2013 23:24:22 +0000 (-0400) Subject: Fix unary constant use after error X-Git-Tag: v1.1.1~59 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=ca3de3907d4564a32190bcb976220caed86dfcfc Fix unary constant use after error Signed-off-by: Etienne Bergeron Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/metadata/ctf-parser.y b/formats/ctf/metadata/ctf-parser.y index 76125677..188f8cd4 100644 --- a/formats/ctf/metadata/ctf-parser.y +++ b/formats/ctf/metadata/ctf-parser.y @@ -1229,17 +1229,15 @@ unary_expression: | MINUS postfix_expression { $$ = $2; - if ($$->u.unary_expression.type != UNARY_SIGNED_CONSTANT - && $$->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) - reparent_error(scanner, "expecting numeric constant"); - if ($$->u.unary_expression.type == UNARY_UNSIGNED_CONSTANT) { $$->u.unary_expression.type = UNARY_SIGNED_CONSTANT; $$->u.unary_expression.u.signed_constant = -($$->u.unary_expression.u.unsigned_constant); - } else { + } else if ($$->u.unary_expression.type == UNARY_UNSIGNED_CONSTANT) { $$->u.unary_expression.u.signed_constant = -($$->u.unary_expression.u.signed_constant); + } else { + reparent_error(scanner, "expecting numeric constant"); } } ;