From cdbc1695a93910df5729779de31912a3b4b4172b Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 19 Jul 2026 17:09:40 +0200 Subject: Support unary plus operation --- gcc/gcc/elna-generic.cc | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'gcc') diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc index ae04be9..b13fd2f 100644 --- a/gcc/gcc/elna-generic.cc +++ b/gcc/gcc/elna-generic.cc @@ -659,36 +659,24 @@ namespace elna::gcc this->current_expression = build1_loc(location, TRUTH_NOT_EXPR, boolean_type_node, this->current_expression); } - else if (is_integral_type(operand_type)) + else { this->current_expression = build1_loc(location, BIT_NOT_EXPR, operand_type, this->current_expression); } - else - { - error_at(location, "type '%s' cannot be negated", - print_type(operand_type).c_str()); - this->current_expression = error_mark_node; - } break; } case boot::unary_operator::minus: { tree operand_type = TREE_TYPE(this->current_expression); - if (is_integral_type(operand_type)) - { - this->current_expression = fold_build1_loc(location, NEGATE_EXPR, - operand_type, this->current_expression); - } - else - { - error_at(location, "type '%s' cannot be negated", - print_type(operand_type).c_str()); - this->current_expression = error_mark_node; - } + this->current_expression = fold_build1_loc(location, NEGATE_EXPR, + operand_type, this->current_expression); break; } + case boot::unary_operator::plus: + // Identity: operand already in current_expression. + break; } } -- cgit v1.2.3