Convert diagnostics to use quoting flag q 1/n

Convert diagnostics to use quoting flag q 1/n
        * error.c (locate_error): Ignore quoting flag q.
        * call.c (build_user_type_conversion_1,
        build_operator_new_call,
        build_object_call, op_error, build_conditional_expr,
        build_new_op, build_op_delete_call, enforce_access,
        convert_like_real, convert_arg_to_ellipsis, build_x_va_arg,
        convert_default_arg, build_over_call, build_new_method_call,
        joust, perform_implicit_conversion, initialize_reference): Use
        the
        quoting flag q.

From-SVN: r88465
This commit is contained in:
Gabriel Dos Reis 2004-10-03 23:02:30 +00:00 committed by Gabriel Dos Reis
parent 103b83eaf0
commit 41775162a7
3 changed files with 74 additions and 56 deletions

View File

@ -1,3 +1,15 @@
2004-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert diagnostics to use quoting flag q 1/n
* error.c (locate_error): Ignore quoting flag q.
* call.c (build_user_type_conversion_1, build_operator_new_call,
build_object_call, op_error, build_conditional_expr,
build_new_op, build_op_delete_call, enforce_access,
convert_like_real, convert_arg_to_ellipsis, build_x_va_arg,
convert_default_arg, build_over_call, build_new_method_call,
joust, perform_implicit_conversion, initialize_reference): Use the
quoting flag q.
2004-10-03 Andrew Pinski <pinskia@physics.uc.edu> 2004-10-03 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/17797 PR c++/17797

View File

@ -2600,7 +2600,7 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
{ {
if (flags & LOOKUP_COMPLAIN) if (flags & LOOKUP_COMPLAIN)
{ {
error ("conversion from `%T' to `%T' is ambiguous", error ("conversion from %qT to %qT is ambiguous",
fromtype, totype); fromtype, totype);
print_z_candidates (candidates); print_z_candidates (candidates);
} }
@ -2754,10 +2754,10 @@ build_new_function_call (tree fn, tree args)
if (TREE_CODE (fn) == TEMPLATE_ID_EXPR) if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
fn = TREE_OPERAND (fn, 0); fn = TREE_OPERAND (fn, 0);
if (!any_viable_p) if (!any_viable_p)
error ("no matching function for call to `%D(%A)'", error ("no matching function for call to %<%D(%A)%>",
DECL_NAME (OVL_CURRENT (fn)), args); DECL_NAME (OVL_CURRENT (fn)), args);
else else
error ("call of overloaded `%D(%A)' is ambiguous", error ("call of overloaded %<%D(%A)%> is ambiguous",
DECL_NAME (OVL_CURRENT (fn)), args); DECL_NAME (OVL_CURRENT (fn)), args);
if (candidates) if (candidates)
print_z_candidates (candidates); print_z_candidates (candidates);
@ -2812,10 +2812,10 @@ build_operator_new_call (tree fnname, tree args, tree *size, tree *cookie_size)
if (!cand) if (!cand)
{ {
if (!any_viable_p) if (!any_viable_p)
error ("no matching function for call to `%D(%A)'", error ("no matching function for call to %<%D(%A)%>",
DECL_NAME (OVL_CURRENT (fns)), args); DECL_NAME (OVL_CURRENT (fns)), args);
else else
error ("call of overloaded `%D(%A)' is ambiguous", error ("call of overloaded %<%D(%A)%> is ambiguous",
DECL_NAME (OVL_CURRENT (fns)), args); DECL_NAME (OVL_CURRENT (fns)), args);
if (candidates) if (candidates)
print_z_candidates (candidates); print_z_candidates (candidates);
@ -2952,7 +2952,7 @@ build_object_call (tree obj, tree args)
candidates = splice_viable (candidates, pedantic, &any_viable_p); candidates = splice_viable (candidates, pedantic, &any_viable_p);
if (!any_viable_p) if (!any_viable_p)
{ {
error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args); error ("no match for call to %<(%T) (%A)%>", TREE_TYPE (obj), args);
print_z_candidates (candidates); print_z_candidates (candidates);
result = error_mark_node; result = error_mark_node;
} }
@ -2961,7 +2961,7 @@ build_object_call (tree obj, tree args)
cand = tourney (candidates); cand = tourney (candidates);
if (cand == 0) if (cand == 0)
{ {
error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args); error ("call of %<(%T) (%A)%> is ambiguous", TREE_TYPE (obj), args);
print_z_candidates (candidates); print_z_candidates (candidates);
result = error_mark_node; result = error_mark_node;
} }
@ -2998,30 +2998,30 @@ op_error (enum tree_code code, enum tree_code code2,
switch (code) switch (code)
{ {
case COND_EXPR: case COND_EXPR:
error ("%s for ternary 'operator?:' in '%E ? %E : %E'", error ("%s for ternary %<operator?:%> in %<%E ? %E : %E%>",
problem, arg1, arg2, arg3); problem, arg1, arg2, arg3);
break; break;
case POSTINCREMENT_EXPR: case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR: case POSTDECREMENT_EXPR:
error ("%s for 'operator%s' in '%E%s'", problem, opname, arg1, opname); error ("%s for %<operator%s%> in %<%E%s%>", problem, opname, arg1, opname);
break; break;
case ARRAY_REF: case ARRAY_REF:
error ("%s for 'operator[]' in '%E[%E]'", problem, arg1, arg2); error ("%s for %<operator[]%> in %<%E[%E]%>", problem, arg1, arg2);
break; break;
case REALPART_EXPR: case REALPART_EXPR:
case IMAGPART_EXPR: case IMAGPART_EXPR:
error ("%s for '%s' in '%s %E'", problem, opname, opname, arg1); error ("%s for %qs in %<%s %E%>", problem, opname, opname, arg1);
break; break;
default: default:
if (arg2) if (arg2)
error ("%s for 'operator%s' in '%E %s %E'", error ("%s for %<operator%s%> in %<%E %s %E%>",
problem, opname, arg1, opname, arg2); problem, opname, arg1, opname, arg2);
else else
error ("%s for 'operator%s' in '%s%E'", error ("%s for %<operator%s%> in %<%s%E%>",
problem, opname, opname, arg1); problem, opname, opname, arg1);
break; break;
} }
@ -3188,7 +3188,7 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3)
result_type = void_type_node; result_type = void_type_node;
else else
{ {
error ("`%E' has type `void' and is not a throw-expression", error ("%qE has type %<void%> and is not a throw-expression",
VOID_TYPE_P (arg2_type) ? arg2 : arg3); VOID_TYPE_P (arg2_type) ? arg2 : arg3);
return error_mark_node; return error_mark_node;
} }
@ -3693,9 +3693,10 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
/* Look for an `operator++ (int)'. If they didn't have /* Look for an `operator++ (int)'. If they didn't have
one, then we fall back to the old way of doing things. */ one, then we fall back to the old way of doing things. */
if (flags & LOOKUP_COMPLAIN) if (flags & LOOKUP_COMPLAIN)
pedwarn ("no `%D(int)' declared for postfix `%s', trying prefix operator instead", pedwarn ("no %<%D(int)%> declared for postfix %qs, "
fnname, "trying prefix operator instead",
operator_name_info[code].name); fnname,
operator_name_info[code].name);
if (code == POSTINCREMENT_EXPR) if (code == POSTINCREMENT_EXPR)
code = PREINCREMENT_EXPR; code = PREINCREMENT_EXPR;
else else
@ -3745,9 +3746,9 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
&& candidates->next && candidates->next
&& ! candidates->next->next) && ! candidates->next->next)
{ {
warning ("using synthesized `%#D' for copy assignment", warning ("using synthesized %q#D for copy assignment",
cand->fn); cand->fn);
cp_warning_at (" where cfront would use `%#D'", cp_warning_at (" where cfront would use %q#D",
cand == candidates cand == candidates
? candidates->next->fn ? candidates->next->fn
: candidates->fn); : candidates->fn);
@ -3779,8 +3780,8 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
&& (TYPE_MAIN_VARIANT (TREE_TYPE (arg1)) && (TYPE_MAIN_VARIANT (TREE_TYPE (arg1))
!= TYPE_MAIN_VARIANT (TREE_TYPE (arg2)))) != TYPE_MAIN_VARIANT (TREE_TYPE (arg2))))
{ {
warning ("comparison between `%#T' and `%#T'", warning ("comparison between %q#T and %q#T",
TREE_TYPE (arg1), TREE_TYPE (arg2)); TREE_TYPE (arg1), TREE_TYPE (arg2));
} }
break; break;
default: default:
@ -4036,7 +4037,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
if (placement) if (placement)
return NULL_TREE; return NULL_TREE;
error ("no suitable `operator %s' for `%T'", error ("no suitable %<operator %s> for %qT",
operator_name_info[(int)code].name, type); operator_name_info[(int)code].name, type);
return error_mark_node; return error_mark_node;
} }
@ -4053,11 +4054,11 @@ enforce_access (tree basetype_path, tree decl)
if (!accessible_p (basetype_path, decl)) if (!accessible_p (basetype_path, decl))
{ {
if (TREE_PRIVATE (decl)) if (TREE_PRIVATE (decl))
cp_error_at ("`%+#D' is private", decl); cp_error_at ("%q+#D is private", decl);
else if (TREE_PROTECTED (decl)) else if (TREE_PROTECTED (decl))
cp_error_at ("`%+#D' is protected", decl); cp_error_at ("%q+#D is protected", decl);
else else
cp_error_at ("`%+#D' is inaccessible", decl); cp_error_at ("%q+#D is inaccessible", decl);
error ("within this context"); error ("within this context");
return false; return false;
} }
@ -4141,9 +4142,9 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
else if (t->kind == ck_identity) else if (t->kind == ck_identity)
break; break;
} }
pedwarn ("invalid conversion from `%T' to `%T'", TREE_TYPE (expr), totype); pedwarn ("invalid conversion from %qT to %qT", TREE_TYPE (expr), totype);
if (fn) if (fn)
pedwarn (" initializing argument %P of `%D'", argnum, fn); pedwarn (" initializing argument %P of %qD", argnum, fn);
return cp_convert (totype, expr); return cp_convert (totype, expr);
} }
@ -4203,11 +4204,11 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
{ {
if (fn) if (fn)
diagnostic_fn diagnostic_fn
(" initializing argument %P of `%D' from result of `%D'", (" initializing argument %P of %qD from result of %qD",
argnum, fn, convfn); argnum, fn, convfn);
else else
diagnostic_fn diagnostic_fn
(" initializing temporary from result of `%D'", convfn); (" initializing temporary from result of %qD", convfn);
} }
expr = build_cplus_new (totype, expr); expr = build_cplus_new (totype, expr);
} }
@ -4267,7 +4268,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
expr = build_temp (expr, totype, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING, expr = build_temp (expr, totype, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
&diagnostic_fn); &diagnostic_fn);
if (diagnostic_fn && fn) if (diagnostic_fn && fn)
diagnostic_fn (" initializing argument %P of `%D'", argnum, fn); diagnostic_fn (" initializing argument %P of %qD", argnum, fn);
return build_cplus_new (totype, expr); return build_cplus_new (totype, expr);
case ck_ref_bind: case ck_ref_bind:
@ -4286,13 +4287,13 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
cp_lvalue_kind lvalue = real_lvalue_p (expr); cp_lvalue_kind lvalue = real_lvalue_p (expr);
if (lvalue & clk_bitfield) if (lvalue & clk_bitfield)
error ("cannot bind bitfield `%E' to `%T'", error ("cannot bind bitfield %qE to %qT",
expr, ref_type); expr, ref_type);
else if (lvalue & clk_packed) else if (lvalue & clk_packed)
error ("cannot bind packed field `%E' to `%T'", error ("cannot bind packed field %qE to %qT",
expr, ref_type); expr, ref_type);
else else
error ("cannot bind rvalue `%E' to `%T'", expr, ref_type); error ("cannot bind rvalue %qE to %qT", expr, ref_type);
return error_mark_node; return error_mark_node;
} }
expr = build_target_expr_with_type (expr, type); expr = build_target_expr_with_type (expr, type);
@ -4377,7 +4378,7 @@ convert_arg_to_ellipsis (tree arg)
there is no need to emit a warning, since the expression won't be there is no need to emit a warning, since the expression won't be
evaluated. We keep the builtin_trap just as a safety check. */ evaluated. We keep the builtin_trap just as a safety check. */
if (!skip_evaluation) if (!skip_evaluation)
warning ("cannot pass objects of non-POD type `%#T' through `...'; " warning ("cannot pass objects of non-POD type %q#T through %<...%>; "
"call will abort at runtime", TREE_TYPE (arg)); "call will abort at runtime", TREE_TYPE (arg));
arg = call_builtin_trap (); arg = call_builtin_trap ();
arg = build2 (COMPOUND_EXPR, integer_type_node, arg, arg = build2 (COMPOUND_EXPR, integer_type_node, arg,
@ -4403,9 +4404,8 @@ build_x_va_arg (tree expr, tree type)
if (! pod_type_p (type)) if (! pod_type_p (type))
{ {
/* Undefined behavior [expr.call] 5.2.2/7. */ /* Undefined behavior [expr.call] 5.2.2/7. */
warning ("cannot receive objects of non-POD type `%#T' through `...'; \ warning ("cannot receive objects of non-POD type %q#T' through %<...%>; "
call will abort at runtime", "call will abort at runtime", type);
type);
expr = convert (build_pointer_type (type), null_node); expr = convert (build_pointer_type (type), null_node);
expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr),
call_builtin_trap (), expr); call_builtin_trap (), expr);
@ -4447,7 +4447,7 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum)
conversion cannot be performed. */ conversion cannot be performed. */
if (TREE_CODE (arg) == DEFAULT_ARG) if (TREE_CODE (arg) == DEFAULT_ARG)
{ {
error ("the default argument for parameter %d of `%D' has " error ("the default argument for parameter %d of %qD has "
"not yet been parsed", "not yet been parsed",
parmnum, fn); parmnum, fn);
return error_mark_node; return error_mark_node;
@ -4671,7 +4671,7 @@ build_over_call (struct z_candidate *cand, int flags)
/* Check that the base class is accessible. */ /* Check that the base class is accessible. */
if (!accessible_base_p (TREE_TYPE (argtype), if (!accessible_base_p (TREE_TYPE (argtype),
BINFO_TYPE (cand->conversion_path))) BINFO_TYPE (cand->conversion_path)))
error ("`%T' is not an accessible base of `%T'", error ("%qT is not an accessible base of %qT",
BINFO_TYPE (cand->conversion_path), BINFO_TYPE (cand->conversion_path),
TREE_TYPE (argtype)); TREE_TYPE (argtype));
/* If fn was found by a using declaration, the conversion path /* If fn was found by a using declaration, the conversion path
@ -4921,7 +4921,7 @@ build_java_interface_fn_ref (tree fn, tree instance)
if (!iface_ref || TREE_CODE (iface_ref) != VAR_DECL if (!iface_ref || TREE_CODE (iface_ref) != VAR_DECL
|| DECL_CONTEXT (iface_ref) != iface) || DECL_CONTEXT (iface_ref) != iface)
{ {
error ("could not find class$ field in java interface type `%T'", error ("could not find class$ field in java interface type %qT",
iface); iface);
return error_mark_node; return error_mark_node;
} }
@ -5183,7 +5183,7 @@ build_new_method_call (tree instance, tree fns, tree args,
if (!BASELINK_P (fns)) if (!BASELINK_P (fns))
{ {
error ("call to non-function `%D'", fns); error ("call to non-function %qD", fns);
return error_mark_node; return error_mark_node;
} }
@ -5208,7 +5208,8 @@ build_new_method_call (tree instance, tree fns, tree args,
if (! IS_AGGR_TYPE (basetype)) if (! IS_AGGR_TYPE (basetype))
{ {
if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node) if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node)
error ("request for member `%D' in `%E', which is of non-aggregate type `%T'", error ("request for member %qD in %qE, which is of non-aggregate "
"type %qT",
fns, instance, basetype); fns, instance, basetype);
return error_mark_node; return error_mark_node;
@ -5286,7 +5287,7 @@ build_new_method_call (tree instance, tree fns, tree args,
bool free_p; bool free_p;
pretty_name = name_as_c_string (name, basetype, &free_p); pretty_name = name_as_c_string (name, basetype, &free_p);
error ("no matching function for call to `%T::%s(%A)%#V'", error ("no matching function for call to %<%T::%s(%A)%#V%>",
basetype, pretty_name, user_args, basetype, pretty_name, user_args,
TREE_TYPE (TREE_TYPE (instance_ptr))); TREE_TYPE (TREE_TYPE (instance_ptr)));
if (free_p) if (free_p)
@ -5304,7 +5305,7 @@ build_new_method_call (tree instance, tree fns, tree args,
bool free_p; bool free_p;
pretty_name = name_as_c_string (name, basetype, &free_p); pretty_name = name_as_c_string (name, basetype, &free_p);
error ("call of overloaded `%s(%A)' is ambiguous", pretty_name, error ("call of overloaded %<%s(%A)%> is ambiguous", pretty_name,
user_args); user_args);
print_z_candidates (candidates); print_z_candidates (candidates);
if (free_p) if (free_p)
@ -5321,14 +5322,14 @@ build_new_method_call (tree instance, tree fns, tree args,
/* This is not an error, it is runtime undefined /* This is not an error, it is runtime undefined
behavior. */ behavior. */
warning ((DECL_CONSTRUCTOR_P (current_function_decl) ? warning ((DECL_CONSTRUCTOR_P (current_function_decl) ?
"abstract virtual `%#D' called from constructor" "abstract virtual %q#D called from constructor"
: "abstract virtual `%#D' called from destructor"), : "abstract virtual %q#D called from destructor"),
cand->fn); cand->fn);
if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
&& is_dummy_object (instance_ptr)) && is_dummy_object (instance_ptr))
{ {
error ("cannot call member function `%D' without object", error ("cannot call member function %qD without object",
cand->fn); cand->fn);
call = error_mark_node; call = error_mark_node;
} }
@ -5933,9 +5934,9 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
if (warn) if (warn)
{ {
warning ("passing `%T' chooses `%T' over `%T'", warning ("passing %qT chooses %qT over %qT",
type, type1, type2); type, type1, type2);
warning (" in call to `%D'", w->fn); warning (" in call to %qD", w->fn);
} }
else else
add_warning (w, l); add_warning (w, l);
@ -5992,8 +5993,8 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
tree source = source_type (w->convs[0]); tree source = source_type (w->convs[0]);
if (! DECL_CONSTRUCTOR_P (w->fn)) if (! DECL_CONSTRUCTOR_P (w->fn))
source = TREE_TYPE (source); source = TREE_TYPE (source);
warning ("choosing `%D' over `%D'", w->fn, l->fn); warning ("choosing %qD over %qD", w->fn, l->fn);
warning (" for conversion from `%T' to `%T'", warning (" for conversion from %qT to %qT",
source, w->second_conv->type); source, w->second_conv->type);
warning (" because conversion sequence for the argument is better"); warning (" because conversion sequence for the argument is better");
} }
@ -6257,7 +6258,7 @@ perform_implicit_conversion (tree type, tree expr)
LOOKUP_NORMAL); LOOKUP_NORMAL);
if (!conv) if (!conv)
{ {
error ("could not convert `%E' to `%T'", expr, type); error ("could not convert %qE to %qT", expr, type);
expr = error_mark_node; expr = error_mark_node;
} }
else else
@ -6382,11 +6383,11 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
if (!(TYPE_QUALS (TREE_TYPE (type)) & TYPE_QUAL_CONST) if (!(TYPE_QUALS (TREE_TYPE (type)) & TYPE_QUAL_CONST)
&& !real_lvalue_p (expr)) && !real_lvalue_p (expr))
error ("invalid initialization of non-const reference of " error ("invalid initialization of non-const reference of "
"type '%T' from a temporary of type '%T'", "type %qT from a temporary of type %qT",
type, TREE_TYPE (expr)); type, TREE_TYPE (expr));
else else
error ("invalid initialization of reference of type " error ("invalid initialization of reference of type "
"'%T' from expression of type '%T'", type, "%qT from expression of type %qT", type,
TREE_TYPE (expr)); TREE_TYPE (expr));
return error_mark_node; return error_mark_node;
} }

View File

@ -2332,9 +2332,14 @@ locate_error (const char *msgid, va_list ap)
plus = 0; plus = 0;
if (*f == '%') if (*f == '%')
{ {
f++; if (*++f == 'q')
++f; /* ignore quoting flag. */
if (*f == '+') if (*f == '+')
f++, plus = 1; {
++f;
plus = 1;
}
if (*f == '#') if (*f == '#')
f++; f++;