mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-23 00:51:00 +08:00
cp-tree.h (cp_expr_loc_or_input_loc): New.
2019-08-05 Paolo Carlini <paolo.carlini@oracle.com> * cp-tree.h (cp_expr_loc_or_input_loc): New. (cxx_incomplete_type_diagnostic): Use it. * call.c (build_converted_constant_expr_internal, convert_like_real, convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call, build_cxx_call, perform_implicit_conversion_flags, initialize_reference): Likewise. * constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression, eval_and_check_array_index, cxx_eval_store_expression, cxx_eval_statement_list, cxx_eval_loop_expr, cxx_eval_constant_expression, potential_constant_expression_1): Likewise. * constraint.cc (check_for_logical_overloads, satisfy_predicate_constraint): Likewise. * cp-gimplify.c (cp_gimplify_expr): Likewise. * cvt.c (cp_convert_to_pointer, convert_to_reference, cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise. * decl.c (pop_switch): Likewise. * decl2.c (delete_sanity): Likewise. * error.c (location_of): Likewise. * init.c (maybe_warn_list_ctor, build_aggr_init, warn_placement_new_too_small, build_new_1, build_vec_init): Likewise. * lex.c (unqualified_name_lookup_error): Likewise. * parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond): Likewise. * pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr, unify_arg_conversion, convert_nontype_argument, tsubst_copy_and_build, resolve_typename_type): Likewise. * semantics.c (maybe_convert_cond, finish_call_expr, cp_build_vec_convert): Likewise. * typeck.c (decay_conversion, rationalize_conditional_expr, cp_build_unary_op, build_x_compound_expr_from_list, maybe_warn_about_returning_address_of_local, maybe_warn_pessimizing_move): Likewise. * typeck2.c (check_narrowing, digest_init_r, process_init_constructor_array): Likewise. From-SVN: r274124
This commit is contained in:
parent
8744c37d54
commit
f9d0ca4043
@ -1,3 +1,41 @@
|
||||
2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* cp-tree.h (cp_expr_loc_or_input_loc): New.
|
||||
(cxx_incomplete_type_diagnostic): Use it.
|
||||
* call.c (build_converted_constant_expr_internal, convert_like_real,
|
||||
convert_arg_to_ellipsis, convert_for_arg_passing, build_over_call,
|
||||
build_cxx_call, perform_implicit_conversion_flags,
|
||||
initialize_reference): Likewise.
|
||||
* constexpr.c (cxx_eval_internal_function, cxx_eval_call_expression,
|
||||
eval_and_check_array_index, cxx_eval_store_expression,
|
||||
cxx_eval_statement_list, cxx_eval_loop_expr,
|
||||
cxx_eval_constant_expression, potential_constant_expression_1):
|
||||
Likewise.
|
||||
* constraint.cc (check_for_logical_overloads,
|
||||
satisfy_predicate_constraint): Likewise.
|
||||
* cp-gimplify.c (cp_gimplify_expr): Likewise.
|
||||
* cvt.c (cp_convert_to_pointer, convert_to_reference,
|
||||
cp_convert_and_check, ocp_convert, maybe_warn_nodiscard): Likewise.
|
||||
* decl.c (pop_switch): Likewise.
|
||||
* decl2.c (delete_sanity): Likewise.
|
||||
* error.c (location_of): Likewise.
|
||||
* init.c (maybe_warn_list_ctor, build_aggr_init,
|
||||
warn_placement_new_too_small, build_new_1, build_vec_init): Likewise.
|
||||
* lex.c (unqualified_name_lookup_error): Likewise.
|
||||
* parser.c (cp_parser_initializer_list, cp_parser_omp_for_cond):
|
||||
Likewise.
|
||||
* pt.c (check_for_bare_parameter_packs, check_valid_ptrmem_cst_expr,
|
||||
unify_arg_conversion, convert_nontype_argument,
|
||||
tsubst_copy_and_build, resolve_typename_type): Likewise.
|
||||
* semantics.c (maybe_convert_cond, finish_call_expr,
|
||||
cp_build_vec_convert): Likewise.
|
||||
* typeck.c (decay_conversion, rationalize_conditional_expr,
|
||||
cp_build_unary_op, build_x_compound_expr_from_list,
|
||||
maybe_warn_about_returning_address_of_local,
|
||||
maybe_warn_pessimizing_move): Likewise.
|
||||
* typeck2.c (check_narrowing, digest_init_r,
|
||||
process_init_constructor_array): Likewise.
|
||||
|
||||
2019-08-05 Tom Honermann <tom@honermann.net>
|
||||
|
||||
* parser.c (cp_parser_template_declaration_after_parameters): Enable
|
||||
|
@ -4184,7 +4184,7 @@ build_converted_constant_expr_internal (tree type, tree expr,
|
||||
conversion *conv;
|
||||
void *p;
|
||||
tree t;
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
|
||||
if (error_operand_p (expr))
|
||||
return error_mark_node;
|
||||
@ -6961,7 +6961,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
|
||||
tree totype = convs->type;
|
||||
diagnostic_t diag_kind;
|
||||
int flags;
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
|
||||
if (convs->bad_p && !(complain & tf_error))
|
||||
return error_mark_node;
|
||||
@ -7481,7 +7481,7 @@ tree
|
||||
convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
|
||||
{
|
||||
tree arg_type;
|
||||
location_t loc = cp_expr_loc_or_loc (arg, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (arg);
|
||||
|
||||
/* [expr.call]
|
||||
|
||||
@ -7789,7 +7789,7 @@ convert_for_arg_passing (tree type, tree val, tsubst_flags_t complain)
|
||||
"argument of function call might be a candidate "
|
||||
"for a format attribute");
|
||||
}
|
||||
maybe_warn_parm_abi (type, cp_expr_loc_or_loc (val, input_location));
|
||||
maybe_warn_parm_abi (type, cp_expr_loc_or_input_loc (val));
|
||||
}
|
||||
|
||||
if (complain & tf_warning)
|
||||
@ -8595,7 +8595,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
|
||||
tree type = TREE_TYPE (to);
|
||||
tree as_base = CLASSTYPE_AS_BASE (type);
|
||||
tree arg = argarray[1];
|
||||
location_t loc = cp_expr_loc_or_loc (arg, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (arg);
|
||||
|
||||
if (is_really_empty_class (type, /*ignore_vptr*/true))
|
||||
{
|
||||
@ -9143,7 +9143,7 @@ build_cxx_call (tree fn, int nargs, tree *argarray,
|
||||
tree fndecl;
|
||||
|
||||
/* Remember roughly where this call is. */
|
||||
location_t loc = cp_expr_loc_or_loc (fn, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (fn);
|
||||
fn = build_call_a (fn, nargs, argarray);
|
||||
SET_EXPR_LOCATION (fn, loc);
|
||||
|
||||
@ -11183,7 +11183,7 @@ perform_implicit_conversion_flags (tree type, tree expr,
|
||||
{
|
||||
conversion *conv;
|
||||
void *p;
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
|
||||
if (TYPE_REF_P (type))
|
||||
expr = mark_lvalue_use (expr);
|
||||
@ -11532,7 +11532,7 @@ initialize_reference (tree type, tree expr,
|
||||
{
|
||||
conversion *conv;
|
||||
void *p;
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
|
||||
if (type == error_mark_node || error_operand_p (expr))
|
||||
return error_mark_node;
|
||||
|
@ -1527,7 +1527,7 @@ cxx_eval_internal_function (const constexpr_ctx *ctx, tree t,
|
||||
|
||||
default:
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"call to internal function %qE", t);
|
||||
*non_constant_p = true;
|
||||
return t;
|
||||
@ -1542,7 +1542,7 @@ cxx_eval_internal_function (const constexpr_ctx *ctx, tree t,
|
||||
|
||||
if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (t, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (t);
|
||||
tree type = TREE_TYPE (TREE_TYPE (t));
|
||||
tree result = fold_binary_loc (loc, opcode, type,
|
||||
fold_convert_loc (loc, type, arg0),
|
||||
@ -1584,7 +1584,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
|
||||
bool lval,
|
||||
bool *non_constant_p, bool *overflow_p)
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (t, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (t);
|
||||
tree fun = get_function_named_in_call (t);
|
||||
constexpr_call new_call
|
||||
= { NULL, NULL, NULL, 0, ctx->manifestly_const_eval };
|
||||
@ -2580,7 +2580,7 @@ eval_and_check_array_index (const constexpr_ctx *ctx,
|
||||
tree t, bool allow_one_past,
|
||||
bool *non_constant_p, bool *overflow_p)
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (t, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (t);
|
||||
tree ary = TREE_OPERAND (t, 0);
|
||||
t = TREE_OPERAND (t, 1);
|
||||
tree index = cxx_eval_constant_expression (ctx, t, false,
|
||||
@ -3909,7 +3909,7 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
|
||||
if (cxx_dialect < cxx2a)
|
||||
{
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"change of the active member of a union "
|
||||
"from %qD to %qD",
|
||||
CONSTRUCTOR_ELT (*valp, 0)->index,
|
||||
@ -4220,7 +4220,7 @@ cxx_eval_statement_list (const constexpr_ctx *ctx, tree t,
|
||||
/* We aren't communicating the jump to our caller, so give up. We don't
|
||||
need to support evaluation of jumps out of statement-exprs. */
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (r, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (r),
|
||||
"statement is not a constant expression");
|
||||
*non_constant_p = true;
|
||||
}
|
||||
@ -4320,7 +4320,7 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t,
|
||||
if (++count >= constexpr_loop_limit)
|
||||
{
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"%<constexpr%> loop iteration count exceeds limit of %d "
|
||||
"(use %<-fconstexpr-loop-limit=%> to increase the limit)",
|
||||
constexpr_loop_limit);
|
||||
@ -4482,7 +4482,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
|
||||
if (++*ctx->constexpr_ops_count >= constexpr_ops_limit)
|
||||
{
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"%<constexpr%> evaluation operation count exceeds limit of "
|
||||
"%wd (use %<-fconstexpr-ops-limit=%> to increase the limit)",
|
||||
constexpr_ops_limit);
|
||||
@ -5036,7 +5036,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
|
||||
if (REINTERPRET_CAST_P (t))
|
||||
{
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"%<reinterpret_cast%> is not a constant expression");
|
||||
*non_constant_p = true;
|
||||
return t;
|
||||
@ -5077,7 +5077,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
|
||||
if (TYPE_REF_P (type))
|
||||
{
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"dereferencing a null pointer");
|
||||
*non_constant_p = true;
|
||||
return t;
|
||||
@ -5089,7 +5089,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
|
||||
if (!can_convert (type, from, tf_none))
|
||||
{
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"conversion of %qT null pointer to %qT "
|
||||
"is not a constant expression",
|
||||
from, type);
|
||||
@ -5104,7 +5104,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
|
||||
reinterpret_cast<void*>(sizeof 0)
|
||||
*/
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"%<reinterpret_cast<%T>(%E)%> is not "
|
||||
"a constant expression",
|
||||
type, op);
|
||||
@ -5178,7 +5178,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
|
||||
case BASELINK:
|
||||
case OFFSET_REF:
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"expression %qE is not a constant expression", t);
|
||||
*non_constant_p = true;
|
||||
break;
|
||||
@ -5196,7 +5196,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
|
||||
|| !DECL_P (get_base_address (TREE_OPERAND (obj, 0))))
|
||||
{
|
||||
if (!ctx->quiet)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"expression %qE is not a constant expression", t);
|
||||
*non_constant_p = true;
|
||||
return t;
|
||||
@ -5960,7 +5960,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
|
||||
return false;
|
||||
if (t == NULL_TREE)
|
||||
return true;
|
||||
location_t loc = cp_expr_loc_or_loc (t, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (t);
|
||||
|
||||
if (*jump_target)
|
||||
/* If we are jumping, ignore everything. This is simpler than the
|
||||
|
@ -805,7 +805,7 @@ check_for_logical_overloads (tree t)
|
||||
|
||||
if (DECL_OVERLOADED_OPERATOR_P (fn))
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (t, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (t);
|
||||
error_at (loc, "constraint %qE, uses overloaded operator", t);
|
||||
return true;
|
||||
}
|
||||
@ -2016,7 +2016,7 @@ satisfy_predicate_constraint (tree t, tree args,
|
||||
tree type = cv_unqualified (TREE_TYPE (expr));
|
||||
if (!same_type_p (type, boolean_type_node))
|
||||
{
|
||||
error_at (cp_expr_loc_or_loc (expr, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (expr),
|
||||
"constraint %qE does not have type %qT",
|
||||
expr, boolean_type_node);
|
||||
return boolean_false_node;
|
||||
|
@ -644,7 +644,7 @@ int
|
||||
cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
|
||||
{
|
||||
int saved_stmts_are_full_exprs_p = 0;
|
||||
location_t loc = cp_expr_loc_or_loc (*expr_p, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (*expr_p);
|
||||
enum tree_code code = TREE_CODE (*expr_p);
|
||||
enum gimplify_status ret;
|
||||
|
||||
|
@ -7509,11 +7509,17 @@ cp_expr_loc_or_loc (const_tree t, location_t or_loc)
|
||||
return loc;
|
||||
}
|
||||
|
||||
inline location_t
|
||||
cp_expr_loc_or_input_loc (const_tree t)
|
||||
{
|
||||
return cp_expr_loc_or_loc (t, input_location);
|
||||
}
|
||||
|
||||
inline void
|
||||
cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
|
||||
diagnostic_t diag_kind)
|
||||
{
|
||||
cxx_incomplete_type_diagnostic (cp_expr_loc_or_loc (value, input_location),
|
||||
cxx_incomplete_type_diagnostic (cp_expr_loc_or_input_loc (value),
|
||||
value, type, diag_kind);
|
||||
}
|
||||
|
||||
|
12
gcc/cp/cvt.c
12
gcc/cp/cvt.c
@ -77,7 +77,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold,
|
||||
tree intype = TREE_TYPE (expr);
|
||||
enum tree_code form;
|
||||
tree rval;
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
|
||||
if (intype == error_mark_node)
|
||||
return error_mark_node;
|
||||
@ -419,7 +419,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
|
||||
tree rval = NULL_TREE;
|
||||
tree rval_as_conversion = NULL_TREE;
|
||||
bool can_convert_intype_to_type;
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
|
||||
if (TREE_CODE (type) == FUNCTION_TYPE
|
||||
&& TREE_TYPE (expr) == unknown_type_node)
|
||||
@ -671,7 +671,7 @@ cp_convert_and_check (tree type, tree expr, tsubst_flags_t complain)
|
||||
folded_result = fold_simple (folded_result);
|
||||
if (!TREE_OVERFLOW_P (folded)
|
||||
&& folded_result != error_mark_node)
|
||||
warnings_for_convert_and_check (cp_expr_loc_or_loc (expr, input_location),
|
||||
warnings_for_convert_and_check (cp_expr_loc_or_input_loc (expr),
|
||||
type, folded, folded_result);
|
||||
}
|
||||
|
||||
@ -690,7 +690,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
|
||||
enum tree_code code = TREE_CODE (type);
|
||||
const char *invalid_conv_diag;
|
||||
tree e1;
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
bool dofold = (convtype & CONV_FOLD);
|
||||
|
||||
if (error_operand_p (e) || type == error_mark_node)
|
||||
@ -1013,7 +1013,7 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit)
|
||||
tree call = expr;
|
||||
if (TREE_CODE (expr) == TARGET_EXPR)
|
||||
call = TARGET_EXPR_INITIAL (expr);
|
||||
location_t loc = cp_expr_loc_or_loc (call, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (call);
|
||||
tree callee = cp_get_callee (call);
|
||||
if (!callee)
|
||||
return;
|
||||
@ -1093,7 +1093,7 @@ maybe_warn_nodiscard (tree expr, impl_conv_void implicit)
|
||||
tree
|
||||
convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
|
||||
if (expr == error_mark_node
|
||||
|| TREE_TYPE (expr) == error_mark_node)
|
||||
|
@ -3560,7 +3560,7 @@ pop_switch (void)
|
||||
location_t switch_location;
|
||||
|
||||
/* Emit warnings as needed. */
|
||||
switch_location = cp_expr_loc_or_loc (cs->switch_stmt, input_location);
|
||||
switch_location = cp_expr_loc_or_input_loc (cs->switch_stmt);
|
||||
const bool bool_cond_p
|
||||
= (SWITCH_STMT_TYPE (cs->switch_stmt)
|
||||
&& TREE_CODE (SWITCH_STMT_TYPE (cs->switch_stmt)) == BOOLEAN_TYPE);
|
||||
|
@ -489,7 +489,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete,
|
||||
/* An array can't have been allocated by new, so complain. */
|
||||
if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
|
||||
&& (complain & tf_warning))
|
||||
warning_at (cp_expr_loc_or_loc (exp, input_location), 0,
|
||||
warning_at (cp_expr_loc_or_input_loc (exp), 0,
|
||||
"deleting array %q#E", exp);
|
||||
|
||||
t = build_expr_type_conversion (WANT_POINTER, exp, true);
|
||||
@ -497,7 +497,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete,
|
||||
if (t == NULL_TREE || t == error_mark_node)
|
||||
{
|
||||
if (complain & tf_error)
|
||||
error_at (cp_expr_loc_or_loc (exp, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (exp),
|
||||
"type %q#T argument given to %<delete%>, expected pointer",
|
||||
TREE_TYPE (exp));
|
||||
return error_mark_node;
|
||||
@ -511,7 +511,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete,
|
||||
if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
|
||||
{
|
||||
if (complain & tf_error)
|
||||
error_at (cp_expr_loc_or_loc (exp, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (exp),
|
||||
"cannot delete a function. Only pointer-to-objects are "
|
||||
"valid arguments to %<delete%>");
|
||||
return error_mark_node;
|
||||
@ -521,8 +521,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete,
|
||||
if (VOID_TYPE_P (TREE_TYPE (type)))
|
||||
{
|
||||
if (complain & tf_warning)
|
||||
warning_at (cp_expr_loc_or_loc (exp, input_location),
|
||||
OPT_Wdelete_incomplete,
|
||||
warning_at (cp_expr_loc_or_input_loc (exp), OPT_Wdelete_incomplete,
|
||||
"deleting %qT is undefined", type);
|
||||
doing_vec = 0;
|
||||
}
|
||||
|
@ -3053,7 +3053,7 @@ location_of (tree t)
|
||||
return DECL_SOURCE_LOCATION (t);
|
||||
if (TREE_CODE (t) == DEFERRED_PARSE)
|
||||
return defparse_location (t);
|
||||
return cp_expr_loc_or_loc (t, input_location);
|
||||
return cp_expr_loc_or_input_loc (t);
|
||||
}
|
||||
|
||||
/* Now the interfaces from error et al to dump_type et al. Each takes an
|
||||
|
@ -749,7 +749,7 @@ maybe_warn_list_ctor (tree member, tree init)
|
||||
if (!begin)
|
||||
return;
|
||||
|
||||
location_t loc = cp_expr_loc_or_loc (init, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (init);
|
||||
warning_at (loc, OPT_Winit_list_lifetime,
|
||||
"initializing %qD from %qE does not extend the lifetime "
|
||||
"of the underlying array", member, begin);
|
||||
@ -1749,7 +1749,7 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain)
|
||||
return error_mark_node;
|
||||
|
||||
location_t init_loc = (init
|
||||
? cp_expr_loc_or_loc (init, input_location)
|
||||
? cp_expr_loc_or_input_loc (init)
|
||||
: location_of (exp));
|
||||
|
||||
TREE_READONLY (exp) = 0;
|
||||
@ -2578,7 +2578,7 @@ find_flexarray_init (tree t, tree init)
|
||||
static void
|
||||
warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper)
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (oper, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (oper);
|
||||
|
||||
/* The number of bytes to add to or subtract from the size of the provided
|
||||
buffer based on an offset into an array or an array element reference.
|
||||
@ -2975,7 +2975,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
|
||||
{
|
||||
if (complain & tf_error)
|
||||
{
|
||||
error_at (cp_expr_loc_or_loc (inner_nelts, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (inner_nelts),
|
||||
"array size in new-expression must be constant");
|
||||
cxx_constant_value(inner_nelts);
|
||||
}
|
||||
@ -3004,7 +3004,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
|
||||
{
|
||||
if (complain & tf_warning_or_error)
|
||||
{
|
||||
pedwarn (cp_expr_loc_or_loc (outer_nelts, input_location), OPT_Wvla,
|
||||
pedwarn (cp_expr_loc_or_input_loc (outer_nelts), OPT_Wvla,
|
||||
typedef_variant_p (orig_type)
|
||||
? G_("non-constant array new length must be specified "
|
||||
"directly, not by %<typedef%>")
|
||||
@ -4140,7 +4140,7 @@ build_vec_init (tree base, tree maxindex, tree init,
|
||||
tree obase = base;
|
||||
bool xvalue = false;
|
||||
bool errors = false;
|
||||
location_t loc = (init ? cp_expr_loc_or_loc (init, input_location)
|
||||
location_t loc = (init ? cp_expr_loc_or_input_loc (init)
|
||||
: location_of (base));
|
||||
|
||||
if (TREE_CODE (atype) == ARRAY_TYPE && TYPE_DOMAIN (atype))
|
||||
|
@ -502,7 +502,7 @@ tree
|
||||
unqualified_name_lookup_error (tree name, location_t loc)
|
||||
{
|
||||
if (loc == UNKNOWN_LOCATION)
|
||||
loc = cp_expr_loc_or_loc (name, input_location);
|
||||
loc = cp_expr_loc_or_input_loc (name);
|
||||
|
||||
if (IDENTIFIER_ANY_OP_P (name))
|
||||
error_at (loc, "%qD not defined", name);
|
||||
|
@ -23186,7 +23186,7 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p,
|
||||
{
|
||||
if (IDENTIFIER_MARKED (designator))
|
||||
{
|
||||
error_at (cp_expr_loc_or_loc (val, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (val),
|
||||
"%<.%s%> designator used multiple times in "
|
||||
"the same initializer list",
|
||||
IDENTIFIER_POINTER (designator));
|
||||
@ -36699,7 +36699,7 @@ cp_parser_omp_for_cond (cp_parser *parser, tree decl, enum tree_code code)
|
||||
|| CLASS_TYPE_P (TREE_TYPE (decl))))
|
||||
return cond;
|
||||
|
||||
return build_x_binary_op (cp_expr_loc_or_loc (cond, input_location),
|
||||
return build_x_binary_op (cp_expr_loc_or_input_loc (cond),
|
||||
TREE_CODE (cond),
|
||||
TREE_OPERAND (cond, 0), ERROR_MARK,
|
||||
TREE_OPERAND (cond, 1), ERROR_MARK,
|
||||
|
24
gcc/cp/pt.c
24
gcc/cp/pt.c
@ -4059,7 +4059,7 @@ check_for_bare_parameter_packs (tree t, location_t loc /* = UNKNOWN_LOCATION */)
|
||||
if (parameter_packs)
|
||||
{
|
||||
if (loc == UNKNOWN_LOCATION)
|
||||
loc = cp_expr_loc_or_loc (t, input_location);
|
||||
loc = cp_expr_loc_or_input_loc (t);
|
||||
error_at (loc, "parameter packs not expanded with %<...%>:");
|
||||
while (parameter_packs)
|
||||
{
|
||||
@ -6306,7 +6306,7 @@ static bool
|
||||
check_valid_ptrmem_cst_expr (tree type, tree expr,
|
||||
tsubst_flags_t complain)
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
tree orig_expr = expr;
|
||||
STRIP_NOPS (expr);
|
||||
if (null_ptr_cst_p (expr))
|
||||
@ -6525,7 +6525,7 @@ unify_arg_conversion (bool explain_p, tree to_type,
|
||||
tree from_type, tree arg)
|
||||
{
|
||||
if (explain_p)
|
||||
inform (cp_expr_loc_or_loc (arg, input_location),
|
||||
inform (cp_expr_loc_or_input_loc (arg),
|
||||
" cannot convert %qE (type %qT) to type %qT",
|
||||
arg, from_type, to_type);
|
||||
return unify_invalid (explain_p);
|
||||
@ -6765,7 +6765,7 @@ static tree
|
||||
convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
|
||||
{
|
||||
tree expr_type;
|
||||
location_t loc = cp_expr_loc_or_loc (expr, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (expr);
|
||||
|
||||
/* Detect immediately string literals as invalid non-type argument.
|
||||
This special-case is not needed for correctness (we would easily
|
||||
@ -18965,10 +18965,10 @@ tsubst_copy_and_build (tree t,
|
||||
|
||||
bool diag = true;
|
||||
if (in_lambda)
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
msg, function);
|
||||
else
|
||||
diag = permerror (cp_expr_loc_or_loc (t, input_location),
|
||||
diag = permerror (cp_expr_loc_or_input_loc (t),
|
||||
msg, function);
|
||||
if (diag)
|
||||
{
|
||||
@ -18983,8 +18983,7 @@ tsubst_copy_and_build (tree t,
|
||||
/* Can't say anything more. */;
|
||||
else if (DECL_CLASS_SCOPE_P (fn))
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (t,
|
||||
input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (t);
|
||||
inform (loc,
|
||||
"declarations in dependent base %qT are "
|
||||
"not found by unqualified lookup",
|
||||
@ -19032,14 +19031,13 @@ tsubst_copy_and_build (tree t,
|
||||
gcc_assert (nargs == 1);
|
||||
if (vec_safe_length (call_args) != 1)
|
||||
{
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"wrong number of arguments to "
|
||||
"%<__builtin_launder%>");
|
||||
ret = error_mark_node;
|
||||
}
|
||||
else
|
||||
ret = finish_builtin_launder (cp_expr_loc_or_loc (t,
|
||||
input_location),
|
||||
ret = finish_builtin_launder (cp_expr_loc_or_input_loc (t),
|
||||
(*call_args)[0], complain);
|
||||
break;
|
||||
|
||||
@ -19047,7 +19045,7 @@ tsubst_copy_and_build (tree t,
|
||||
gcc_assert (nargs == 1);
|
||||
if (vec_safe_length (call_args) != 1)
|
||||
{
|
||||
error_at (cp_expr_loc_or_loc (t, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (t),
|
||||
"wrong number of arguments to "
|
||||
"%<__builtin_convertvector%>");
|
||||
ret = error_mark_node;
|
||||
@ -26602,7 +26600,7 @@ resolve_typename_type (tree type, bool only_current_p)
|
||||
|
||||
[temp.names]: In a qualified-id of a declarator-id, the keyword
|
||||
template shall not appear at the top level. */
|
||||
pedwarn (cp_expr_loc_or_loc (fullname, input_location), OPT_Wpedantic,
|
||||
pedwarn (cp_expr_loc_or_input_loc (fullname), OPT_Wpedantic,
|
||||
"keyword %<template%> not allowed in declarator-id");
|
||||
tmpl = decl;
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ maybe_convert_cond (tree cond)
|
||||
if (TREE_CODE (cond) == MODIFY_EXPR
|
||||
&& !TREE_NO_WARNING (cond)
|
||||
&& warn_parentheses
|
||||
&& warning_at (cp_expr_loc_or_loc (cond, input_location),
|
||||
&& warning_at (cp_expr_loc_or_input_loc (cond),
|
||||
OPT_Wparentheses, "suggest parentheses around "
|
||||
"assignment used as truth value"))
|
||||
TREE_NO_WARNING (cond) = 1;
|
||||
@ -2428,7 +2428,7 @@ finish_call_expr (tree fn, vec<tree, va_gc> **args, bool disallow_virtual,
|
||||
|| any_type_dependent_arguments_p (*args))
|
||||
{
|
||||
result = build_min_nt_call_vec (orig_fn, *args);
|
||||
SET_EXPR_LOCATION (result, cp_expr_loc_or_loc (fn, input_location));
|
||||
SET_EXPR_LOCATION (result, cp_expr_loc_or_input_loc (fn));
|
||||
KOENIG_LOOKUP_P (result) = koenig_p;
|
||||
if (is_overloaded_fn (fn))
|
||||
fn = get_fns (fn);
|
||||
@ -10104,7 +10104,7 @@ cp_build_vec_convert (tree arg, location_t loc, tree type,
|
||||
|
||||
tree ret = NULL_TREE;
|
||||
if (!type_dependent_expression_p (arg) && !dependent_type_p (type))
|
||||
ret = c_build_vec_convert (cp_expr_loc_or_loc (arg, input_location), arg,
|
||||
ret = c_build_vec_convert (cp_expr_loc_or_input_loc (arg), arg,
|
||||
loc, type, (complain & tf_error) != 0);
|
||||
|
||||
if (!processing_template_decl)
|
||||
|
@ -2020,7 +2020,7 @@ decay_conversion (tree exp,
|
||||
{
|
||||
tree type;
|
||||
enum tree_code code;
|
||||
location_t loc = cp_expr_loc_or_loc (exp, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (exp);
|
||||
|
||||
type = TREE_TYPE (exp);
|
||||
if (type == error_mark_node)
|
||||
@ -2281,7 +2281,7 @@ static tree
|
||||
rationalize_conditional_expr (enum tree_code code, tree t,
|
||||
tsubst_flags_t complain)
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (t, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (t);
|
||||
|
||||
/* For MIN_EXPR or MAX_EXPR, fold-const.c has arranged things so that
|
||||
the first operand is always the one to be used if both operands
|
||||
@ -6206,7 +6206,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,
|
||||
{
|
||||
/* No default_conversion here. It causes trouble for ADDR_EXPR. */
|
||||
tree arg = xarg;
|
||||
location_t location = cp_expr_loc_or_loc (arg, input_location);
|
||||
location_t location = cp_expr_loc_or_input_loc (arg);
|
||||
tree argtype = 0;
|
||||
const char *errstring = NULL;
|
||||
tree val;
|
||||
@ -6760,7 +6760,7 @@ build_x_compound_expr_from_list (tree list, expr_list_kind exp,
|
||||
&& !CONSTRUCTOR_IS_DIRECT_INIT (expr))
|
||||
{
|
||||
if (complain & tf_error)
|
||||
pedwarn (cp_expr_loc_or_loc (expr, input_location), 0,
|
||||
pedwarn (cp_expr_loc_or_input_loc (expr), 0,
|
||||
"list-initializer for non-class type must not "
|
||||
"be parenthesized");
|
||||
else
|
||||
@ -9210,7 +9210,7 @@ maybe_warn_about_returning_address_of_local (tree retval)
|
||||
{
|
||||
tree valtype = TREE_TYPE (DECL_RESULT (current_function_decl));
|
||||
tree whats_returned = fold_for_warn (retval);
|
||||
location_t loc = cp_expr_loc_or_loc (retval, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (retval);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@ -9420,7 +9420,7 @@ maybe_warn_pessimizing_move (tree retval, tree functype)
|
||||
if (!(warn_pessimizing_move || warn_redundant_move))
|
||||
return;
|
||||
|
||||
location_t loc = cp_expr_loc_or_loc (retval, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (retval);
|
||||
|
||||
/* C++98 doesn't know move. */
|
||||
if (cxx_dialect < cxx11)
|
||||
|
@ -1006,7 +1006,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, bool const_only)
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
location_t loc = cp_expr_loc_or_loc (init, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (init);
|
||||
if (cxx_dialect == cxx98)
|
||||
{
|
||||
if (complain & tf_warning)
|
||||
@ -1085,7 +1085,7 @@ digest_init_r (tree type, tree init, int nested, int flags,
|
||||
complain))
|
||||
return error_mark_node;
|
||||
|
||||
location_t loc = cp_expr_loc_or_loc (init, input_location);
|
||||
location_t loc = cp_expr_loc_or_input_loc (init);
|
||||
|
||||
tree stripped_init = init;
|
||||
|
||||
@ -1402,7 +1402,7 @@ process_init_constructor_array (tree type, tree init, int nested, int flags,
|
||||
if (nested == 2 && !domain && !vec_safe_is_empty (v))
|
||||
{
|
||||
if (complain & tf_error)
|
||||
error_at (cp_expr_loc_or_loc (init, input_location),
|
||||
error_at (cp_expr_loc_or_input_loc (init),
|
||||
"initialization of flexible array member "
|
||||
"in a nested context");
|
||||
return PICFLAG_ERRONEOUS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user