Fix unary constant use after error
authorEtienne Bergeron <etienneb@google.com>
Tue, 2 Apr 2013 23:24:22 +0000 (19:24 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 2 Apr 2013 23:30:28 +0000 (19:30 -0400)
Signed-off-by: Etienne Bergeron <etienneb@google.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/metadata/ctf-parser.y

index 76125677c94d4c30bfcfd5e3543e0700a825b8e2..188f8cd44e0c1d9cce191b9a6ccb37450ffb08f7 100644 (file)
@@ -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");
                        }
                }
        ;
This page took 0.025744 seconds and 4 git commands to generate.