diff options
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 74d9ae5..8966bf5 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -536,7 +536,7 @@ simplify_loop_decl_cond (tree *cond_p, tree body) *cond_p = boolean_true_node; if_stmt = begin_if_stmt (); - cond = build_unary_op (TRUTH_NOT_EXPR, cond, 0); + cond = cp_build_unary_op (TRUTH_NOT_EXPR, cond, 0, tf_warning_or_error); finish_if_stmt_cond (cond, if_stmt); finish_break_stmt (); finish_then_clause (if_stmt); @@ -614,10 +614,11 @@ finish_expr_stmt (tree expr) { if (warn_sequence_point) verify_sequence_points (expr); - expr = convert_to_void (expr, "statement"); + expr = convert_to_void (expr, "statement", tf_warning_or_error); } else if (!type_dependent_expression_p (expr)) - convert_to_void (build_non_dependent_expr (expr), "statement"); + convert_to_void (build_non_dependent_expr (expr), "statement", + tf_warning_or_error); if (check_for_bare_parameter_packs (expr)) expr = error_mark_node; @@ -872,10 +873,12 @@ finish_for_expr (tree expr, tree for_stmt) { if (warn_sequence_point) verify_sequence_points (expr); - expr = convert_to_void (expr, "3rd expression in for"); + expr = convert_to_void (expr, "3rd expression in for", + tf_warning_or_error); } else if (!type_dependent_expression_p (expr)) - convert_to_void (build_non_dependent_expr (expr), "3rd expression in for"); + convert_to_void (build_non_dependent_expr (expr), "3rd expression in for", + tf_warning_or_error); expr = maybe_cleanup_point_expr_void (expr); if (check_for_bare_parameter_packs (expr)) expr = error_mark_node; @@ -1247,7 +1250,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands, otherwise we'll get an error. Gross, but ... */ STRIP_NOPS (operand); - if (!lvalue_or_else (operand, lv_asm)) + if (!lvalue_or_else (operand, lv_asm, tf_warning_or_error)) operand = error_mark_node; if (operand != error_mark_node @@ -1505,7 +1508,8 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope) return build_class_member_access_expr (object, decl, /*access_path=*/NULL_TREE, - /*preserve_reference=*/false); + /*preserve_reference=*/false, + tf_warning_or_error); } } @@ -1643,7 +1647,8 @@ finish_qualified_id_expr (tree qualifying_class, (maybe_dummy_object (qualifying_class, NULL), expr, BASELINK_ACCESS_BINFO (expr), - /*preserve_reference=*/false)); + /*preserve_reference=*/false, + tf_warning_or_error)); else if (done) /* The expression is a qualified name whose address is not being taken. */ @@ -1832,7 +1837,8 @@ perform_koenig_lookup (tree fn, tree args) Returns code for the call. */ tree -finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p) +finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p, + tsubst_flags_t complain) { tree result; tree orig_fn; @@ -1931,7 +1937,8 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p) result = build_new_method_call (object, fn, args, NULL_TREE, (disallow_virtual ? LOOKUP_NONVIRTUAL : 0), - /*fn_p=*/NULL); + /*fn_p=*/NULL, + complain); } else if (is_overloaded_fn (fn)) { @@ -1943,7 +1950,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p) if (!result) /* A call to a namespace-scope function. */ - result = build_new_function_call (fn, args, koenig_p); + result = build_new_function_call (fn, args, koenig_p, complain); } else if (TREE_CODE (fn) == PSEUDO_DTOR_EXPR) { @@ -1960,11 +1967,11 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p) /* If the "function" is really an object of class type, it might have an overloaded `operator ()'. */ result = build_new_op (CALL_EXPR, LOOKUP_NORMAL, fn, args, NULL_TREE, - /*overloaded_p=*/NULL); + /*overloaded_p=*/NULL, complain); if (!result) /* A call where the function is unknown. */ - result = build_function_call (fn, args); + result = cp_build_function_call (fn, args, complain); if (processing_template_decl) { @@ -1981,7 +1988,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p) tree finish_increment_expr (tree expr, enum tree_code code) { - return build_x_unary_op (code, expr); + return build_x_unary_op (code, expr, tf_warning_or_error); } /* Finish a use of `this'. Returns an expression for `this'. */ @@ -2070,7 +2077,7 @@ finish_pseudo_destructor_expr (tree object, tree scope, tree destructor) tree finish_unary_op_expr (enum tree_code code, tree expr) { - tree result = build_x_unary_op (code, expr); + tree result = build_x_unary_op (code, expr, tf_warning_or_error); /* Inside a template, build_x_unary_op does not fold the expression. So check whether the result is folded before setting TREE_NEGATED_INT. */ @@ -2952,7 +2959,8 @@ finish_id_expression (tree id_expression, /* A set of member functions. */ decl = maybe_dummy_object (DECL_CONTEXT (first_fn), 0); return finish_class_member_access_expr (decl, id_expression, - /*template_p=*/false); + /*template_p=*/false, + tf_warning_or_error); } decl = baselink_for_fns (decl); @@ -3119,7 +3127,8 @@ simplify_aggr_init_expr (tree *tp) SLOT. */ push_deferring_access_checks (dk_no_check); call_expr = build_aggr_init (slot, call_expr, - DIRECT_BIND | LOOKUP_ONLYCONVERTING); + DIRECT_BIND | LOOKUP_ONLYCONVERTING, + tf_warning_or_error); pop_deferring_access_checks (); call_expr = build2 (COMPOUND_EXPR, TREE_TYPE (slot), call_expr, slot); } @@ -3668,7 +3677,8 @@ finish_omp_clauses (tree clauses) } t = build_special_member_call (NULL_TREE, complete_ctor_identifier, - t, inner_type, LOOKUP_NORMAL); + t, inner_type, LOOKUP_NORMAL, + tf_warning_or_error); if (targetm.cxx.cdtor_returns_this () || errorcount) /* Because constructors and destructors return this, @@ -3690,7 +3700,8 @@ finish_omp_clauses (tree clauses) t = build_int_cst (build_pointer_type (inner_type), 0); t = build1 (INDIRECT_REF, inner_type, t); t = build_special_member_call (t, complete_dtor_identifier, - NULL, inner_type, LOOKUP_NORMAL); + NULL, inner_type, LOOKUP_NORMAL, + tf_warning_or_error); if (targetm.cxx.cdtor_returns_this () || errorcount) /* Because constructors and destructors return this, @@ -3713,7 +3724,8 @@ finish_omp_clauses (tree clauses) t = build1 (INDIRECT_REF, inner_type, t); t = build_special_member_call (t, ansi_assopname (NOP_EXPR), build_tree_list (NULL, t), - inner_type, LOOKUP_NORMAL); + inner_type, LOOKUP_NORMAL, + tf_warning_or_error); /* We'll have called convert_from_reference on the call, which may well have added an indirect_ref. It's unneeded here, @@ -3937,7 +3949,7 @@ finish_omp_for (location_t locus, tree decl, tree init, tree cond, if (!processing_template_decl) init = fold_build_cleanup_point_expr (TREE_TYPE (init), init); - init = build_modify_expr (decl, NOP_EXPR, init); + init = cp_build_modify_expr (decl, NOP_EXPR, init, tf_warning_or_error); if (cond && TREE_SIDE_EFFECTS (cond) && COMPARISON_CLASS_P (cond)) { int n = TREE_SIDE_EFFECTS (TREE_OPERAND (cond, 1)) != 0; @@ -4006,7 +4018,7 @@ void finish_omp_barrier (void) { tree fn = built_in_decls[BUILT_IN_GOMP_BARRIER]; - tree stmt = finish_call_expr (fn, NULL, false, false); + tree stmt = finish_call_expr (fn, NULL, false, false, tf_warning_or_error); finish_expr_stmt (stmt); } @@ -4014,7 +4026,7 @@ void finish_omp_flush (void) { tree fn = built_in_decls[BUILT_IN_SYNCHRONIZE]; - tree stmt = finish_call_expr (fn, NULL, false, false); + tree stmt = finish_call_expr (fn, NULL, false, false, tf_warning_or_error); finish_expr_stmt (stmt); } |