diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-21 17:17:13 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-21 17:17:13 +0000 |
commit | 431580068c2a2c6e74279131bb748c92857f8a12 (patch) | |
tree | 4af8030719296e992a9c12adcef79ed4833b2ff8 /gcc/c-parser.c | |
parent | 013b1310cd3e62827430952889db00716c19bdd0 (diff) | |
download | gcc-431580068c2a2c6e74279131bb748c92857f8a12.tar.gz |
* c-common.c (c_common_truthvalue_conversion): Use LOCATION to build
NE_EXPR operations as well.
* c-parser.c (c_parser_condition): Do not set location information on
the condition.
(c_parser_conditional_expression): Likewise.
(c_parser_binary_expression): Set location information on operators.
* c-typeck.c (build_unary_op) <TRUTH_NOT_EXPR>: Reset the location if
TRUTH_NOT_EXPR has been folded.
* fold-const.c (fold_truth_not_expr): Copy location information from
the incoming expression to the outgoing one.
* gimplify.c (shortcut_cond_r): Add locus parameter. Pass it to
recursive calls on the LHS of the operator but pass that of the
operator to recursive calls on the RHS of the operator. Set it
on the COND_EXPR.
(shortcut_cond_expr): Set the locus of the operator on the second
COND_EXPR and that of the expression on the first in degenerate cases.
Pass the locus of the expression to calls to shortcut_cond_r.
Set the locus of the 'then' block on the associated jump, if any.
(gimplify_boolean_expr): Add locus parameter. Set it on the COND_EXPR.
(gimplify_expr) <TRUTH_ANDIF_EXPR>: Pass the locus of the outer
expression to call to gimplify_boolean_expr.
ada/
* gcc-interface/trans.c (gnat_to_gnu): Do not overwrite location info.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146532 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index ca51d95eed5..676c709cdf2 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -3835,7 +3835,6 @@ c_parser_condition (c_parser *parser) cond = c_parser_expression_conv (parser).value; cond = c_objc_common_truthvalue_conversion (loc, cond); cond = c_fully_fold (cond, false, NULL); - protected_set_expr_location (cond, loc); if (warn_sequence_point) verify_sequence_points (cond); return cond; @@ -4479,7 +4478,6 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after) cond_loc = c_parser_peek_token (parser)->location; cond = c_parser_binary_expression (parser, after); - protected_set_expr_location (cond.value, cond_loc); if (c_parser_next_token_is_not (parser, CPP_QUERY)) return cond; @@ -4651,6 +4649,8 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after) enum prec prec; /* The operation on its left. */ enum tree_code op; + /* The source location of this operation. */ + location_t loc; } stack[NUM_PRECS]; int sp; /* Location of the binary operator. */ @@ -4672,13 +4672,14 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after) = default_function_array_conversion (stack[sp - 1].expr); \ stack[sp].expr \ = default_function_array_conversion (stack[sp].expr); \ - stack[sp - 1].expr = parser_build_binary_op (binary_loc, \ + stack[sp - 1].expr = parser_build_binary_op (stack[sp].loc, \ stack[sp].op, \ stack[sp - 1].expr, \ stack[sp].expr); \ sp--; \ } while (0) gcc_assert (!after || c_dialect_objc ()); + stack[0].loc = c_parser_peek_token (parser)->location; stack[0].expr = c_parser_cast_expression (parser, after); stack[0].prec = PREC_NONE; sp = 0; @@ -4777,20 +4778,21 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after) stack[sp].expr = default_function_array_conversion (stack[sp].expr); stack[sp].expr.value = c_objc_common_truthvalue_conversion - (binary_loc, default_conversion (stack[sp].expr.value)); + (stack[sp].loc, default_conversion (stack[sp].expr.value)); skip_evaluation += stack[sp].expr.value == truthvalue_false_node; break; case TRUTH_ORIF_EXPR: stack[sp].expr = default_function_array_conversion (stack[sp].expr); stack[sp].expr.value = c_objc_common_truthvalue_conversion - (binary_loc, default_conversion (stack[sp].expr.value)); + (stack[sp].loc, default_conversion (stack[sp].expr.value)); skip_evaluation += stack[sp].expr.value == truthvalue_true_node; break; default: break; } sp++; + stack[sp].loc = binary_loc; stack[sp].expr = c_parser_cast_expression (parser, NULL); stack[sp].prec = oprec; stack[sp].op = ocode; |