diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3337312dc7e..09df98f7706 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2004-10-31 Gabriel Dos Reis + + Convert diagnostics to use quoting flag q 8/n + * cvt.c (cp_convert_to_pointer, warn_ref_binding, + convert_to_reference, ocp_convert, convert_to_void + cp_convert_to_pointer): + 2004-10-31 Mark Mitchell PR c++/15172 diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 7f0f64c9c46..3e84ed0ad89 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -87,8 +87,8 @@ cp_convert_to_pointer (tree type, tree expr, bool force) intype = complete_type (intype); if (!COMPLETE_TYPE_P (intype)) { - error ("can't convert from incomplete type `%T' to `%T'", - intype, type); + error ("can't convert from incomplete type %qT to %qT", + intype, type); return error_mark_node; } @@ -96,8 +96,8 @@ cp_convert_to_pointer (tree type, tree expr, bool force) if (rval) { if (rval == error_mark_node) - error ("conversion of `%E' from `%T' to `%T' is ambiguous", - expr, intype, type); + error ("conversion of %qE from %qT to %qT is ambiguous", + expr, intype, type); return rval; } } @@ -165,8 +165,8 @@ cp_convert_to_pointer (tree type, tree expr, bool force) if (TYPE_PTRMEMFUNC_P (type)) { - error ("cannot convert `%E' from type `%T' to type `%T'", - expr, intype, type); + error ("cannot convert %qE from type %qT to type %qT", + expr, intype, type); return error_mark_node; } @@ -194,12 +194,12 @@ cp_convert_to_pointer (tree type, tree expr, bool force) if (bk == bk_via_virtual) { if (force) - warning ("pointer to member cast from `%T' to `%T' is via virtual base", - intype, type); + warning ("pointer to member cast from %qT to %qT is via" + " virtual base", intype, type); else { - error ("pointer to member cast from `%T' to `%T' is via virtual base", - intype, type); + error ("pointer to member cast from %qT to %qT is" + " via virtual base", intype, type); return error_mark_node; } /* This is a reinterpret cast, whose result is unspecified. @@ -234,8 +234,8 @@ cp_convert_to_pointer (tree type, tree expr, bool force) TREE_OPERAND (expr, 1)); } } - error ("cannot convert `%E' from type `%T' to type `%T'", - expr, intype, type); + error ("cannot convert %qE from type %qT to type %qT", + expr, intype, type); return error_mark_node; } @@ -260,7 +260,7 @@ cp_convert_to_pointer (tree type, tree expr, bool force) } else if (TYPE_PTR_TO_MEMBER_P (type) && INTEGRAL_CODE_P (form)) { - error ("invalid conversion from '%T' to '%T'", intype, type); + error ("invalid conversion from %qT to %qT", intype, type); return error_mark_node; } @@ -281,8 +281,8 @@ cp_convert_to_pointer (tree type, tree expr, bool force) if (type_unknown_p (expr)) return instantiate_type (type, expr, tf_error | tf_warning); - error ("cannot convert `%E' from type `%T' to type `%T'", - expr, intype, type); + error ("cannot convert %qE from type %qT to type %qT", + expr, intype, type); return error_mark_node; } @@ -413,13 +413,17 @@ warn_ref_binding (tree reftype, tree intype, tree decl) const char *msg; if (CP_TYPE_VOLATILE_P (ttl) && decl) - msg = "initialization of volatile reference type `%#T' from rvalue of type `%T'"; + msg = "initialization of volatile reference type %q#T from" + " rvalue of type %qT"; else if (CP_TYPE_VOLATILE_P (ttl)) - msg = "conversion to volatile reference type `%#T' from rvalue of type `%T'"; + msg = "conversion to volatile reference type %q#T " + " from rvalue of type %qT"; else if (decl) - msg = "initialization of non-const reference type `%#T' from rvalue of type `%T'"; + msg = "initialization of non-const reference type %q#T from" + " rvalue of type %qT"; else - msg = "conversion to non-const reference type `%#T' from rvalue of type `%T'"; + msg = "conversion to non-const reference type %q#T from" + " rvalue of type %qT"; pedwarn (msg, reftype, intype); } @@ -492,8 +496,8 @@ convert_to_reference (tree reftype, tree expr, int convtype, if (! (convtype & CONV_CONST) && !at_least_as_qualified_p (ttl, ttr)) - pedwarn ("conversion from `%T' to `%T' discards qualifiers", - ttr, reftype); + pedwarn ("conversion from %qT to %qT discards qualifiers", + ttr, reftype); } return build_up_reference (reftype, expr, flags, decl); @@ -510,7 +514,7 @@ convert_to_reference (tree reftype, tree expr, int convtype, if (TREE_CODE (intype) == POINTER_TYPE && (comptypes (TREE_TYPE (intype), type, COMPARE_BASE | COMPARE_DERIVED))) - warning ("casting `%T' to `%T' does not dereference pointer", + warning ("casting %qT to %qT does not dereference pointer", intype, reftype); rval = build_unary_op (ADDR_EXPR, expr, 0); @@ -537,7 +541,7 @@ convert_to_reference (tree reftype, tree expr, int convtype, } if (flags & LOOKUP_COMPLAIN) - error ("cannot convert type `%T' to type `%T'", intype, reftype); + error ("cannot convert type %qT to type %qT", intype, reftype); return error_mark_node; } @@ -661,7 +665,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags) && ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC)) || (TREE_CODE (intype) == POINTER_TYPE))) { - pedwarn ("conversion from `%#T' to `%#T'", intype, type); + pedwarn ("conversion from %q#T to %q#T", intype, type); if (flag_pedantic_errors) return error_mark_node; @@ -673,7 +677,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags) if (rval) return rval; if (flags & LOOKUP_COMPLAIN) - error ("`%#T' used where a `%T' was expected", intype, type); + error ("%q#T used where a %qT was expected", intype, type); return error_mark_node; } if (code == BOOLEAN_TYPE) @@ -693,7 +697,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags) if (ret_val) return ret_val; if (flags & LOOKUP_COMPLAIN) - error ("`%#T' used where a `%T' was expected", in_vtype, type); + error ("%q#T used where a %qT was expected", in_vtype, type); return error_mark_node; } return fold_if_not_in_template (convert_to_vector (type, e)); @@ -708,7 +712,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags) return rval; else if (flags & LOOKUP_COMPLAIN) - error ("`%#T' used where a floating point value was expected", + error ("%q#T used where a floating point value was expected", TREE_TYPE (e)); } if (code == REAL_TYPE) @@ -755,8 +759,8 @@ ocp_convert (tree type, tree expr, int convtype, int flags) } if (flags & LOOKUP_COMPLAIN) - error ("conversion from `%T' to non-scalar type `%T' requested", - TREE_TYPE (expr), type); + error ("conversion from %qT to non-scalar type %qT requested", + TREE_TYPE (expr), type); return error_mark_node; } @@ -843,12 +847,12 @@ convert_to_void (tree expr, const char *implicit) int is_complete = COMPLETE_TYPE_P (complete_type (type)); if (is_volatile && !is_complete) - warning ("object of incomplete type `%T' will not be accessed in %s", - type, implicit ? implicit : "void context"); + warning ("object of incomplete type %qT will not be accessed in %s", + type, implicit ? implicit : "void context"); else if (is_reference && is_volatile) - warning ("object of type `%T' will not be accessed in %s", - TREE_TYPE (TREE_OPERAND (expr, 0)), - implicit ? implicit : "void context"); + warning ("object of type %qT will not be accessed in %s", + TREE_TYPE (TREE_OPERAND (expr, 0)), + implicit ? implicit : "void context"); if (is_reference || !is_volatile || !is_complete) expr = TREE_OPERAND (expr, 0); @@ -862,8 +866,8 @@ convert_to_void (tree expr, const char *implicit) int is_complete = COMPLETE_TYPE_P (complete_type (type)); if (TYPE_VOLATILE (type) && !is_complete) - warning ("object `%E' of incomplete type `%T' will not be accessed in %s", - expr, type, implicit ? implicit : "void context"); + warning ("object %qE of incomplete type %qT will not be accessed in %s", + expr, type, implicit ? implicit : "void context"); break; } @@ -884,7 +888,7 @@ convert_to_void (tree expr, const char *implicit) } else if (implicit && probe == expr && is_overloaded_fn (probe)) /* Only warn when there is no &. */ - warning ("%s is a reference, not call, to function `%E'", + warning ("%s is a reference, not call, to function %qE", implicit, expr); } @@ -1076,10 +1080,10 @@ build_expr_type_conversion (int desires, tree expr, bool complain) { if (complain) { - error ("ambiguous default type conversion from `%T'", - basetype); - error (" candidate conversions include `%D' and `%D'", - winner, cand); + error ("ambiguous default type conversion from %qT", + basetype); + error (" candidate conversions include %qD and %qD", + winner, cand); } return error_mark_node; }