Changed in v2: use %qH and %qI rather than %H and %I. This is the second half of the kit, which uses %qH and %qI throughout the C++ frontend whenever describing type mismatches between a pair of %qT.
gcc/cp/ChangeLog: * call.c (print_conversion_rejection): Replace pairs of %qT with %qH and %qI in various places. (build_user_type_conversion_1): Likewise. (build_integral_nontype_arg_conv): Likewise. (build_conditional_expr_1): Likewise. (convert_like_real): Likewise. (convert_arg_to_ellipsis): Likewise. (joust): Likewise. (initialize_reference): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (cp_convert_to_pointer): Likewise. (convert_to_reference): Likewise. (ocp_convert): Likewise. * typeck.c (cp_build_binary_op): Likewise. (convert_member_func_to_ptr): Likewise. (build_reinterpret_cast_1): Likewise. (convert_for_assignment): Likewise. * typeck2.c (check_narrowing): Likewise. --- gcc/cp/call.c | 38 +++++++++++++++++++------------------- gcc/cp/cvt.c | 18 +++++++++--------- gcc/cp/typeck.c | 22 +++++++++++----------- gcc/cp/typeck2.c | 6 +++--- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f1b6bf4..a7882e6 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3402,7 +3402,7 @@ print_conversion_rejection (location_t loc, struct conversion_info *info) from); else inform (loc, " no known conversion for implicit " - "%<this%> parameter from %qT to %qT", + "%<this%> parameter from %qH to %qI", from, info->to_type); } else if (!TYPE_P (info->from)) @@ -3415,10 +3415,10 @@ print_conversion_rejection (location_t loc, struct conversion_info *info) } else if (info->n_arg == -2) /* Conversion of conversion function return value failed. */ - inform (loc, " no known conversion from %qT to %qT", + inform (loc, " no known conversion from %qH to %qI", from, info->to_type); else - inform (loc, " no known conversion for argument %d from %qT to %qT", + inform (loc, " no known conversion for argument %d from %qH to %qI", info->n_arg + 1, from, info->to_type); } @@ -3925,7 +3925,7 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags, { if (complain & tf_error) { - error ("conversion from %qT to %qT is ambiguous", + error ("conversion from %qH to %qI is ambiguous", fromtype, totype); print_z_candidates (location_of (expr), candidates); } @@ -4052,7 +4052,7 @@ build_integral_nontype_arg_conv (tree type, tree expr, tsubst_flags_t complain) break; if (complain & tf_error) - error_at (loc, "conversion from %qT to %qT not considered for " + error_at (loc, "conversion from %qH to %qI not considered for " "non-type template argument", t, type); /* fall through. */ @@ -4833,14 +4833,14 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, if (unsafe_conversion_p (loc, stype, arg2, false)) { if (complain & tf_error) - error_at (loc, "conversion of scalar %qT to vector %qT " + error_at (loc, "conversion of scalar %qH to vector %qI " "involves truncation", arg2_type, vtype); return error_mark_node; } if (unsafe_conversion_p (loc, stype, arg3, false)) { if (complain & tf_error) - error_at (loc, "conversion of scalar %qT to vector %qT " + error_at (loc, "conversion of scalar %qH to vector %qI " "involves truncation", arg3_type, vtype); return error_mark_node; } @@ -5229,7 +5229,7 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, arg3_type); if (complain & tf_warning) do_warn_double_promotion (result_type, arg2_type, arg3_type, - "implicit conversion from %qT to %qT to " + "implicit conversion from %qH to %qI to " "match other result of conditional", loc); @@ -6603,7 +6603,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, from std::nullptr_t requires direct-initialization. */ if (NULLPTR_TYPE_P (TREE_TYPE (expr)) && TREE_CODE (totype) == BOOLEAN_TYPE) - complained = permerror (loc, "converting to %qT from %qT requires " + complained = permerror (loc, "converting to %qH from %qI requires " "direct-initialization", totype, TREE_TYPE (expr)); @@ -6612,7 +6612,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, if (t->kind == ck_user && t->cand->reason) { complained = permerror (loc, "invalid user-defined conversion " - "from %qT to %qT", TREE_TYPE (expr), + "from %qH to %qI", TREE_TYPE (expr), totype); if (complained) print_z_candidate (loc, "candidate is:", t->cand); @@ -6648,7 +6648,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, break; } if (!complained) - complained = permerror (loc, "invalid conversion from %qT to %qT", + complained = permerror (loc, "invalid conversion from %qH to %qI", TREE_TYPE (expr), totype); if (complained && fn) inform (DECL_SOURCE_LOCATION (fn), @@ -6924,14 +6924,14 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, tree extype = TREE_TYPE (expr); if (TYPE_REF_IS_RVALUE (ref_type) && lvalue_p (expr)) - error_at (loc, "cannot bind rvalue reference of type %qT to " - "lvalue of type %qT", totype, extype); + error_at (loc, "cannot bind rvalue reference of type %qH to " + "lvalue of type %qI", totype, extype); else if (!TYPE_REF_IS_RVALUE (ref_type) && !lvalue_p (expr) && !CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (ref_type))) error_at (loc, "cannot bind non-const lvalue reference of " - "type %qT to an rvalue of type %qT", totype, extype); + "type %qH to an rvalue of type %qI", totype, extype); else if (!reference_compatible_p (TREE_TYPE (totype), extype)) - error_at (loc, "binding reference of type %qT to %qT " + error_at (loc, "binding reference of type %qH to %qI " "discards qualifiers", totype, extype); else gcc_unreachable (); @@ -7083,7 +7083,7 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain) if ((complain & tf_warning) && warn_double_promotion && !c_inhibit_evaluation_warnings) warning_at (loc, OPT_Wdouble_promotion, - "implicit conversion from %qT to %qT when passing " + "implicit conversion from %qH to %qI when passing " "argument to function", arg_type, double_type_node); arg = convert_to_real_nofold (double_type_node, arg); @@ -9643,7 +9643,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn, if (! DECL_CONSTRUCTOR_P (w->fn)) source = TREE_TYPE (source); if (warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn) - && warning (OPT_Wconversion, " for conversion from %qT to %qT", + && warning (OPT_Wconversion, " for conversion from %qH to %qI", source, w->second_conv->type)) { inform (input_location, " because conversion sequence for the argument is better"); @@ -10417,11 +10417,11 @@ initialize_reference (tree type, tree expr, && !TYPE_REF_IS_RVALUE (type) && !lvalue_p (expr)) error_at (loc, "invalid initialization of non-const reference of " - "type %qT from an rvalue of type %qT", + "type %qH from an rvalue of type %qI", type, TREE_TYPE (expr)); else error_at (loc, "invalid initialization of reference of type " - "%qT from expression of type %qT", type, + "%qH from expression of type %qI", type, TREE_TYPE (expr)); } return error_mark_node; diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 5f4b5e3..9ea8084 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -86,7 +86,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold, if (!COMPLETE_TYPE_P (intype)) { if (complain & tf_error) - error_at (loc, "can%'t convert from incomplete type %qT to %qT", + error_at (loc, "can%'t convert from incomplete type %qH to %qI", intype, type); return error_mark_node; } @@ -96,7 +96,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold, { if ((complain & tf_error) && rval == error_mark_node) - error_at (loc, "conversion of %qE from %qT to %qT is ambiguous", + error_at (loc, "conversion of %qE from %qH to %qI is ambiguous", expr, intype, type); return rval; } @@ -168,7 +168,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold, if (TYPE_PTRMEMFUNC_P (type)) { if (complain & tf_error) - error_at (loc, "cannot convert %qE from type %qT to type %qT", + error_at (loc, "cannot convert %qE from type %qH to type %qI", expr, intype, type); return error_mark_node; } @@ -195,7 +195,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold, } } if (complain & tf_error) - error_at (loc, "cannot convert %qE from type %qT to type %qT", + error_at (loc, "cannot convert %qE from type %qH to type %qI", expr, intype, type); return error_mark_node; } @@ -221,7 +221,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold, else if (TYPE_PTRMEM_P (type) && INTEGRAL_CODE_P (form)) { if (complain & tf_error) - error_at (loc, "invalid conversion from %qT to %qT", intype, type); + error_at (loc, "invalid conversion from %qH to %qI", intype, type); return error_mark_node; } @@ -244,7 +244,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold, return instantiate_type (type, expr, complain); if (complain & tf_error) - error_at (loc, "cannot convert %qE from type %qT to type %qT", + error_at (loc, "cannot convert %qE from type %qH to type %qI", expr, intype, type); return error_mark_node; } @@ -464,7 +464,7 @@ convert_to_reference (tree reftype, tree expr, int convtype, && !at_least_as_qualified_p (ttl, ttr)) { if (complain & tf_error) - permerror (loc, "conversion from %qT to %qT discards qualifiers", + permerror (loc, "conversion from %qH to %qI discards qualifiers", ttr, reftype); else return error_mark_node; @@ -514,7 +514,7 @@ convert_to_reference (tree reftype, tree expr, int convtype, } if (complain & tf_error) - error_at (loc, "cannot convert type %qT to type %qT", intype, reftype); + error_at (loc, "cannot convert type %qH to type %qI", intype, reftype); return error_mark_node; } @@ -907,7 +907,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags, if (invalid_nonstatic_memfn_p (loc, expr, complain)) /* We displayed the error message. */; else - error_at (loc, "conversion from %qT to non-scalar type %qT requested", + error_at (loc, "conversion from %qH to non-scalar type %qI requested", TREE_TYPE (expr), type); } return error_mark_node; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 7aee0d6..ccb5495 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5011,7 +5011,7 @@ cp_build_binary_op (location_t location, result_type = cp_common_type (type0, type1); if (complain & tf_warning) do_warn_double_promotion (result_type, type0, type1, - "implicit conversion from %qT to %qT " + "implicit conversion from %qH to %qI " "to match other operand of binary " "expression", location); @@ -7028,7 +7028,7 @@ convert_member_func_to_ptr (tree type, tree expr, tsubst_flags_t complain) if (pedantic || warn_pmf2ptr) pedwarn (input_location, pedantic ? OPT_Wpedantic : OPT_Wpmf_conversions, - "converting from %qT to %qT", intype, type); + "converting from %qH to %qI", intype, type); if (TREE_CODE (intype) == METHOD_TYPE) expr = build_addr_func (expr, complain); @@ -7150,7 +7150,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, if (TYPE_PRECISION (type) < TYPE_PRECISION (intype)) { if (complain & tf_error) - permerror (input_location, "cast from %qT to %qT loses precision", + permerror (input_location, "cast from %qH to %qI loses precision", intype, type); else return error_mark_node; @@ -7190,7 +7190,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, && COMPLETE_TYPE_P (TREE_TYPE (type)) && COMPLETE_TYPE_P (TREE_TYPE (intype)) && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (intype))) - warning (OPT_Wcast_align, "cast from %qT to %qT " + warning (OPT_Wcast_align, "cast from %qH to %qI " "increases required alignment of target type", intype, type); /* We need to strip nops here, because the front end likes to @@ -8504,33 +8504,33 @@ convert_for_assignment (tree type, tree rhs, return r; } else if (fndecl) - error ("cannot convert %qT to %qT for argument %qP to %qD", + error ("cannot convert %qH to %qI for argument %qP to %qD", rhstype, type, parmnum, fndecl); else switch (errtype) { case ICR_DEFAULT_ARGUMENT: - error ("cannot convert %qT to %qT in default argument", + error ("cannot convert %qH to %qI in default argument", rhstype, type); break; case ICR_ARGPASS: - error ("cannot convert %qT to %qT in argument passing", + error ("cannot convert %qH to %qI in argument passing", rhstype, type); break; case ICR_CONVERTING: - error ("cannot convert %qT to %qT", + error ("cannot convert %qH to %qI", rhstype, type); break; case ICR_INIT: - error ("cannot convert %qT to %qT in initialization", + error ("cannot convert %qH to %qI in initialization", rhstype, type); break; case ICR_RETURN: - error ("cannot convert %qT to %qT in return", + error ("cannot convert %qH to %qI in return", rhstype, type); break; case ICR_ASSIGN: - error ("cannot convert %qT to %qT in assignment", + error ("cannot convert %qH to %qI in assignment", rhstype, type); break; default: diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 1f0eb45..40328cd 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -954,7 +954,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain) { if (complain & tf_warning) warning_at (loc, OPT_Wnarrowing, "narrowing conversion of %qE " - "from %qT to %qT inside { } is ill-formed in C++11", + "from %qH to %qI inside { } is ill-formed in C++11", init, ftype, type); ok = true; } @@ -965,7 +965,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain) if ((!almost_ok || pedantic) && pedwarn (loc, OPT_Wnarrowing, "narrowing conversion of %qE " - "from %qT to %qT inside { }", + "from %qH to %qI inside { }", init, ftype, type) && almost_ok) inform (loc, " the expression has a constant value but is not " @@ -978,7 +978,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain) int savederrorcount = errorcount; global_dc->pedantic_errors = 1; pedwarn (loc, OPT_Wnarrowing, - "narrowing conversion of %qE from %qT to %qT " + "narrowing conversion of %qE from %qH to %qI " "inside { }", init, ftype, type); if (errorcount == savederrorcount) ok = true; -- 1.8.5.3