X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fmetadata%2Fctf-parser.y;h=58ea245b8d30f2b43b17cb26b7a8a72594bd0dc2;hp=76125677c94d4c30bfcfd5e3543e0700a825b8e2;hb=f9c67088c31c4e211e4ea9655c231d0b908a6290;hpb=c55adfb925d39fb1bfee34a5008f19cfa01be30d diff --git a/formats/ctf/metadata/ctf-parser.y b/formats/ctf/metadata/ctf-parser.y index 76125677..58ea245b 100644 --- a/formats/ctf/metadata/ctf-parser.y +++ b/formats/ctf/metadata/ctf-parser.y @@ -1225,21 +1225,25 @@ unary_expression: postfix_expression { $$ = $1; } | PLUS postfix_expression - { $$ = $2; } - | MINUS postfix_expression { $$ = $2; - if ($$->u.unary_expression.type != UNARY_SIGNED_CONSTANT - && $$->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) + if ($$->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT + && $$->u.unary_expression.type != UNARY_SIGNED_CONSTANT) { reparent_error(scanner, "expecting numeric constant"); - + } + } + | MINUS postfix_expression + { + $$ = $2; 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"); } } ;