From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id CFFE3385E442; Wed, 21 Apr 2021 08:21:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CFFE3385E442 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-18] Remove pedantic_non_lvalue_loc X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: b67778b59932fdc64dc89a97550349e973ca0352 X-Git-Newrev: 8ce9ce6b16b3988f60bb92a916ea50dd3237a532 Message-Id: <20210421082104.CFFE3385E442@sourceware.org> Date: Wed, 21 Apr 2021 08:21:04 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 08:21:04 -0000 https://gcc.gnu.org/g:8ce9ce6b16b3988f60bb92a916ea50dd3237a532 commit r12-18-g8ce9ce6b16b3988f60bb92a916ea50dd3237a532 Author: Richard Biener Date: Mon Apr 19 14:38:03 2021 +0200 Remove pedantic_non_lvalue_loc This removes pedantic_non_lvalue_loc which doesn't do what it says since quite some time in favor of what it actually does and where that's not a duplicate (protected_set_expr_location_unshare). 2021-04-19 Richard Biener * fold-const.c (pedantic_non_lvalue_loc): Remove. (fold_binary_loc): Adjust. (fold_ternary_loc): Likewise. Diff: --- gcc/fold-const.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 2834278fd76..5a41524702b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2619,15 +2619,6 @@ non_lvalue_loc (location_t loc, tree x) return x; return build1_loc (loc, NON_LVALUE_EXPR, TREE_TYPE (x), x); } - -/* When pedantic, return an expr equal to X but certainly not valid as a - pedantic lvalue. Otherwise, return X. */ - -static tree -pedantic_non_lvalue_loc (location_t loc, tree x) -{ - return protected_set_expr_location_unshare (x, loc); -} /* Given a tree comparison code, return the code that is the logical inverse. It is generally not safe to do this for floating-point comparisons, except @@ -12532,9 +12523,9 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type, if (TREE_SIDE_EFFECTS (arg0) || TREE_CONSTANT (arg1)) return NULL_TREE; /* Don't let (0, 0) be null pointer constant. */ - tem = integer_zerop (arg1) ? build1 (NOP_EXPR, type, arg1) + tem = integer_zerop (arg1) ? build1_loc (loc, NOP_EXPR, type, arg1) : fold_convert_loc (loc, type, arg1); - return pedantic_non_lvalue_loc (loc, tem); + return tem; case ASSERT_EXPR: /* An ASSERT_EXPR should never be passed to fold_binary. */ @@ -12781,7 +12772,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, || !contains_label_p (unused_op)) && (! VOID_TYPE_P (TREE_TYPE (tem)) || VOID_TYPE_P (type))) - return pedantic_non_lvalue_loc (loc, tem); + return protected_set_expr_location_unshare (tem, loc); return NULL_TREE; } else if (TREE_CODE (arg0) == VECTOR_CST) @@ -12864,7 +12855,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, a COND, which will recurse. In that case, the COND_EXPR is probably the best choice, so leave it alone. */ && type == TREE_TYPE (arg0)) - return pedantic_non_lvalue_loc (loc, arg0); + return protected_set_expr_location_unshare (arg0, loc); /* Convert A ? 0 : 1 to !A. This prefers the use of NOT_EXPR over COND_EXPR in cases such as floating point comparisons. */ @@ -12873,10 +12864,8 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, && integer_onep (op2) && !VECTOR_TYPE_P (type) && truth_value_p (TREE_CODE (arg0))) - return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, - invert_truthvalue_loc (loc, - arg0))); + return fold_convert_loc (loc, type, + invert_truthvalue_loc (loc, arg0)); /* A < 0 ? : 0 is simply (A & ). */ if (TREE_CODE (arg0) == LT_EXPR @@ -12982,10 +12971,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, second operand 32-bit -128, which is not a power of two (or vice versa. */ && integer_pow2p (TREE_OPERAND (TREE_OPERAND (arg0, 0), 1))) - return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, - TREE_OPERAND (arg0, - 0))); + return fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0)); /* Disable the transformations below for vectors, since fold_binary_op_with_conditional_arg may undo them immediately,