Commit a82e1a7d by Gabriel Dos Reis Committed by Gabriel Dos Reis

Convert diagnostics to use quoting flag q 7/n

cp/
        Convert diagnostics to use quoting flag q 7/n
        * typeck.c (composite_pointer_type_r, composite_pointer_type,
        cxx_sizeof_or_alignof_type, cxx_sizeof_or_alignof_expr,
        string_conv_p, build_class_member_access_expr,
        build_class_member_access_expr, lookup_destructor,
        finish_class_member_access_expr, build_indirect_ref,
        get_member_function_from_ptrfunc, build_function_call,
        convert_arguments, build_binary_op, pointer_diff,
        build_unary_op,
        check_for_casting_away_constness, build_static_cast,
        build_reinterpret_cast, build_const_cast, build_c_cast,
        build_modify_expr, get_delta_difference, build_ptrmemfunc,
        dubious_conversion_warnings, convert_for_assignment,
        convert_for_initialization,
        maybe_warn_about_returning_address_of_local,
        check_return_expr):
        Use quoting marks.

        * typeck2.c (error_not_base_type, readonly_error,
        abstract_virtuals_error, cxx_incomplete_type_diagnostic,
        store_init_value, digest_init, build_x_arrow,
        build_m_component_ref, require_complete_eh_spec_types):
        Likewise.

        * tree.c (cp_build_qualified_type_real,
        handle_java_interface_attribute,
        handle_init_priority_attribute):
        Likewise.

        * semantics.c (finish_asm_stmt, finish_non_static_data_member,
        finish_pseudo_destructor_expr,
        check_template_template_default_arg, begin_class_definition,
        finish_base_specifier, qualified_name_lookup_error,
        finish_id_expression, finish_typeof): Likewise.

        * search.c (lookup_base, check_final_overrider,
        look_for_overrides_r): Likewise.

        * rtti.c (get_tinfo_decl, build_dynamic_cast_1): Likewise.
testsuite/
        * g++.dg/overload/pmf1.C: Adjust quoting marks.
        * g++.dg/warn/incomplete1.C: Likewise.
        * g++.dg/template/qualttp20.C: Likewise.

From-SVN: r88854
parent bba5733f
2004-10-10 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert diagnostics to use quoting flag q 7/n
* typeck.c (composite_pointer_type_r, composite_pointer_type,
cxx_sizeof_or_alignof_type, cxx_sizeof_or_alignof_expr,
string_conv_p, build_class_member_access_expr,
build_class_member_access_expr, lookup_destructor,
finish_class_member_access_expr, build_indirect_ref,
get_member_function_from_ptrfunc, build_function_call,
convert_arguments, build_binary_op, pointer_diff, build_unary_op,
check_for_casting_away_constness, build_static_cast,
build_reinterpret_cast, build_const_cast, build_c_cast,
build_modify_expr, get_delta_difference, build_ptrmemfunc,
dubious_conversion_warnings, convert_for_assignment,
convert_for_initialization,
maybe_warn_about_returning_address_of_local, check_return_expr):
Use quoting marks.
* typeck2.c (error_not_base_type, readonly_error,
abstract_virtuals_error, cxx_incomplete_type_diagnostic,
store_init_value, digest_init, build_x_arrow,
build_m_component_ref, require_complete_eh_spec_types): Likewise.
* tree.c (cp_build_qualified_type_real,
handle_java_interface_attribute, handle_init_priority_attribute):
Likewise.
* semantics.c (finish_asm_stmt, finish_non_static_data_member,
finish_pseudo_destructor_expr,
check_template_template_default_arg, begin_class_definition,
finish_base_specifier, qualified_name_lookup_error,
finish_id_expression, finish_typeof): Likewise.
* search.c (lookup_base, check_final_overrider,
look_for_overrides_r): Likewise.
* rtti.c (get_tinfo_decl, build_dynamic_cast_1): Likewise.
2004-10-09 Mark Mitchell <mark@codesourcery.com> 2004-10-09 Mark Mitchell <mark@codesourcery.com>
PR c++/17867 PR c++/17867
......
...@@ -318,7 +318,8 @@ get_tinfo_decl (tree type) ...@@ -318,7 +318,8 @@ get_tinfo_decl (tree type)
if (COMPLETE_TYPE_P (type) if (COMPLETE_TYPE_P (type)
&& TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
{ {
error ("cannot create type information for type `%T' because its size is variable", error ("cannot create type information for type %qT because "
"its size is variable",
type); type);
return error_mark_node; return error_mark_node;
} }
...@@ -570,8 +571,8 @@ build_dynamic_cast_1 (tree type, tree expr) ...@@ -570,8 +571,8 @@ build_dynamic_cast_1 (tree type, tree expr)
&& TREE_CODE (TREE_TYPE (old_expr)) == RECORD_TYPE) && TREE_CODE (TREE_TYPE (old_expr)) == RECORD_TYPE)
{ {
tree expr = throw_bad_cast (); tree expr = throw_bad_cast ();
warning ("dynamic_cast of `%#D' to `%#T' can never succeed", warning ("dynamic_cast of %q#D to %q#T can never succeed",
old_expr, type); old_expr, type);
/* Bash it to the expected type. */ /* Bash it to the expected type. */
TREE_TYPE (expr) = type; TREE_TYPE (expr) = type;
return expr; return expr;
...@@ -584,8 +585,8 @@ build_dynamic_cast_1 (tree type, tree expr) ...@@ -584,8 +585,8 @@ build_dynamic_cast_1 (tree type, tree expr)
if (TREE_CODE (op) == VAR_DECL if (TREE_CODE (op) == VAR_DECL
&& TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE) && TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE)
{ {
warning ("dynamic_cast of `%#D' to `%#T' can never succeed", warning ("dynamic_cast of %q#D to %q#T can never succeed",
op, type); op, type);
retval = build_int_cst (type, 0); retval = build_int_cst (type, 0);
return retval; return retval;
} }
...@@ -663,8 +664,8 @@ build_dynamic_cast_1 (tree type, tree expr) ...@@ -663,8 +664,8 @@ build_dynamic_cast_1 (tree type, tree expr)
errstr = "source type is not polymorphic"; errstr = "source type is not polymorphic";
fail: fail:
error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T' (%s)", error ("cannot dynamic_cast %qE (of type %q#T) to type %q#T (%s)",
expr, exprtype, type, errstr); expr, exprtype, type, errstr);
return error_mark_node; return error_mark_node;
} }
......
...@@ -234,7 +234,7 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) ...@@ -234,7 +234,7 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr)
binfo = NULL_TREE; binfo = NULL_TREE;
if (!(access & ba_quiet)) if (!(access & ba_quiet))
{ {
error ("`%T' is an ambiguous base of `%T'", base, t); error ("%qT is an ambiguous base of %qT", base, t);
binfo = error_mark_node; binfo = error_mark_node;
} }
break; break;
...@@ -252,7 +252,7 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) ...@@ -252,7 +252,7 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr)
{ {
if (!(access & ba_quiet)) if (!(access & ba_quiet))
{ {
error ("`%T' is an inaccessible base of `%T'", base, t); error ("%qT is an inaccessible base of %qT", base, t);
binfo = error_mark_node; binfo = error_mark_node;
} }
else else
...@@ -1740,14 +1740,14 @@ check_final_overrider (tree overrider, tree basefn) ...@@ -1740,14 +1740,14 @@ check_final_overrider (tree overrider, tree basefn)
{ {
if (fail == 1) if (fail == 1)
{ {
cp_error_at ("invalid covariant return type for `%#D'", overrider); cp_error_at ("invalid covariant return type for %q#D", overrider);
cp_error_at (" overriding `%#D'", basefn); cp_error_at (" overriding %q#D", basefn);
} }
else else
{ {
cp_error_at ("conflicting return type specified for `%#D'", cp_error_at ("conflicting return type specified for %q#D",
overrider); overrider);
cp_error_at (" overriding `%#D'", basefn); cp_error_at (" overriding %q#D", basefn);
} }
DECL_INVALID_OVERRIDER_P (overrider) = 1; DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0; return 0;
...@@ -1756,8 +1756,8 @@ check_final_overrider (tree overrider, tree basefn) ...@@ -1756,8 +1756,8 @@ check_final_overrider (tree overrider, tree basefn)
/* Check throw specifier is at least as strict. */ /* Check throw specifier is at least as strict. */
if (!comp_except_specs (base_throw, over_throw, 0)) if (!comp_except_specs (base_throw, over_throw, 0))
{ {
cp_error_at ("looser throw specifier for `%#F'", overrider); cp_error_at ("looser throw specifier for %q#F", overrider);
cp_error_at (" overriding `%#F'", basefn); cp_error_at (" overriding %q#F", basefn);
DECL_INVALID_OVERRIDER_P (overrider) = 1; DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0; return 0;
} }
...@@ -1850,8 +1850,8 @@ look_for_overrides_r (tree type, tree fndecl) ...@@ -1850,8 +1850,8 @@ look_for_overrides_r (tree type, tree fndecl)
{ {
/* A static member function cannot match an inherited /* A static member function cannot match an inherited
virtual member function. */ virtual member function. */
cp_error_at ("`%#D' cannot be declared", fndecl); cp_error_at ("%q#D cannot be declared", fndecl);
cp_error_at (" since `%#D' declared in base class", fn); cp_error_at (" since %q#D declared in base class", fn);
} }
else else
{ {
......
...@@ -1130,8 +1130,8 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands, ...@@ -1130,8 +1130,8 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
resolve the overloading. */ resolve the overloading. */
if (TREE_TYPE (converted_operand) == unknown_type_node) if (TREE_TYPE (converted_operand) == unknown_type_node)
{ {
error ("type of asm operand `%E' could not be determined", error ("type of asm operand %qE could not be determined",
TREE_VALUE (t)); TREE_VALUE (t));
converted_operand = error_mark_node; converted_operand = error_mark_node;
} }
TREE_VALUE (t) = converted_operand; TREE_VALUE (t) = converted_operand;
...@@ -1263,10 +1263,10 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope) ...@@ -1263,10 +1263,10 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
{ {
if (current_function_decl if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl)) && DECL_STATIC_FUNCTION_P (current_function_decl))
cp_error_at ("invalid use of member `%D' in static member function", cp_error_at ("invalid use of member %qD in static member function",
decl); decl);
else else
cp_error_at ("invalid use of non-static data member `%D'", decl); cp_error_at ("invalid use of non-static data member %qD", decl);
error ("from this location"); error ("from this location");
return error_mark_node; return error_mark_node;
...@@ -1305,7 +1305,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope) ...@@ -1305,7 +1305,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
if (!access_type) if (!access_type)
{ {
cp_error_at ("object missing in reference to `%D'", decl); cp_error_at ("object missing in reference to %qD", decl);
error ("from this location"); error ("from this location");
return error_mark_node; return error_mark_node;
} }
...@@ -1886,7 +1886,7 @@ finish_pseudo_destructor_expr (tree object, tree scope, tree destructor) ...@@ -1886,7 +1886,7 @@ finish_pseudo_destructor_expr (tree object, tree scope, tree destructor)
if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (object), if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (object),
destructor)) destructor))
{ {
error ("`%E' is not of type `%T'", object, destructor); error ("%qE is not of type %qT", object, destructor);
return error_mark_node; return error_mark_node;
} }
} }
...@@ -2024,10 +2024,10 @@ check_template_template_default_arg (tree argument) ...@@ -2024,10 +2024,10 @@ check_template_template_default_arg (tree argument)
that the user is using a template instantiation. */ that the user is using a template instantiation. */
if (CLASSTYPE_TEMPLATE_INFO (t) if (CLASSTYPE_TEMPLATE_INFO (t)
&& CLASSTYPE_TEMPLATE_INSTANTIATION (t)) && CLASSTYPE_TEMPLATE_INSTANTIATION (t))
error ("invalid use of type `%T' as a default value for a " error ("invalid use of type %qT as a default value for a "
"template template-parameter", t); "template template-parameter", t);
else else
error ("invalid use of `%D' as a default value for a template " error ("invalid use of %qD as a default value for a template "
"template-parameter", argument); "template-parameter", argument);
} }
else else
...@@ -2048,7 +2048,7 @@ begin_class_definition (tree t) ...@@ -2048,7 +2048,7 @@ begin_class_definition (tree t)
if (processing_template_parmlist) if (processing_template_parmlist)
{ {
error ("definition of `%#T' inside template parameter list", t); error ("definition of %q#T inside template parameter list", t);
return error_mark_node; return error_mark_node;
} }
/* A non-implicit typename comes from code like: /* A non-implicit typename comes from code like:
...@@ -2059,7 +2059,7 @@ begin_class_definition (tree t) ...@@ -2059,7 +2059,7 @@ begin_class_definition (tree t)
This is erroneous. */ This is erroneous. */
else if (TREE_CODE (t) == TYPENAME_TYPE) else if (TREE_CODE (t) == TYPENAME_TYPE)
{ {
error ("invalid definition of qualified type `%T'", t); error ("invalid definition of qualified type %qT", t);
t = error_mark_node; t = error_mark_node;
} }
...@@ -2073,8 +2073,8 @@ begin_class_definition (tree t) ...@@ -2073,8 +2073,8 @@ begin_class_definition (tree t)
that's an error. */ that's an error. */
if (COMPLETE_TYPE_P (t)) if (COMPLETE_TYPE_P (t))
{ {
error ("redefinition of `%#T'", t); error ("redefinition of %q#T", t);
cp_error_at ("previous definition of `%#T'", t); cp_error_at ("previous definition of %q#T", t);
return error_mark_node; return error_mark_node;
} }
...@@ -2259,7 +2259,7 @@ finish_base_specifier (tree base, tree access, bool virtual_p) ...@@ -2259,7 +2259,7 @@ finish_base_specifier (tree base, tree access, bool virtual_p)
{ {
if (cp_type_quals (base) != 0) if (cp_type_quals (base) != 0)
{ {
error ("base class `%T' has cv qualifiers", base); error ("base class %qT has cv qualifiers", base);
base = TYPE_MAIN_VARIANT (base); base = TYPE_MAIN_VARIANT (base);
} }
result = build_tree_list (access, base); result = build_tree_list (access, base);
...@@ -2304,19 +2304,19 @@ qualified_name_lookup_error (tree scope, tree name, tree decl) ...@@ -2304,19 +2304,19 @@ qualified_name_lookup_error (tree scope, tree name, tree decl)
if (TYPE_P (scope)) if (TYPE_P (scope))
{ {
if (!COMPLETE_TYPE_P (scope)) if (!COMPLETE_TYPE_P (scope))
error ("incomplete type `%T' used in nested name specifier", scope); error ("incomplete type %qT used in nested name specifier", scope);
else if (TREE_CODE (decl) == TREE_LIST) else if (TREE_CODE (decl) == TREE_LIST)
{ {
error ("reference to `%T::%D' is ambiguous", scope, name); error ("reference to %<%T::%D%> is ambiguous", scope, name);
print_candidates (decl); print_candidates (decl);
} }
else else
error ("`%D' is not a member of `%T'", name, scope); error ("%qD is not a member of %qT", name, scope);
} }
else if (scope != global_namespace) else if (scope != global_namespace)
error ("`%D' is not a member of `%D'", name, scope); error ("%qD is not a member of %qD", name, scope);
else else
error ("`::%D' has not been declared", name); error ("%<::%D%> has not been declared", name);
} }
/* ID_EXPRESSION is a representation of parsed, but unprocessed, /* ID_EXPRESSION is a representation of parsed, but unprocessed,
...@@ -2439,7 +2439,7 @@ finish_id_expression (tree id_expression, ...@@ -2439,7 +2439,7 @@ finish_id_expression (tree id_expression,
&& !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl))) && !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl)))
{ {
if (!allow_non_integral_constant_expression_p) if (!allow_non_integral_constant_expression_p)
error ("template parameter `%D' of type `%T' is not allowed in " error ("template parameter %qD of type %qT is not allowed in "
"an integral constant expression because it is not of " "an integral constant expression because it is not of "
"integral or enumeration type", decl, TREE_TYPE (decl)); "integral or enumeration type", decl, TREE_TYPE (decl));
*non_integral_constant_expression_p = true; *non_integral_constant_expression_p = true;
...@@ -2583,7 +2583,7 @@ finish_id_expression (tree id_expression, ...@@ -2583,7 +2583,7 @@ finish_id_expression (tree id_expression,
{ {
if (!allow_non_integral_constant_expression_p) if (!allow_non_integral_constant_expression_p)
{ {
error ("`%D' cannot appear in a constant-expression", decl); error ("%qD cannot appear in a constant-expression", decl);
return error_mark_node; return error_mark_node;
} }
*non_integral_constant_expression_p = true; *non_integral_constant_expression_p = true;
...@@ -2591,18 +2591,18 @@ finish_id_expression (tree id_expression, ...@@ -2591,18 +2591,18 @@ finish_id_expression (tree id_expression,
if (TREE_CODE (decl) == NAMESPACE_DECL) if (TREE_CODE (decl) == NAMESPACE_DECL)
{ {
error ("use of namespace `%D' as expression", decl); error ("use of namespace %qD as expression", decl);
return error_mark_node; return error_mark_node;
} }
else if (DECL_CLASS_TEMPLATE_P (decl)) else if (DECL_CLASS_TEMPLATE_P (decl))
{ {
error ("use of class template `%T' as expression", decl); error ("use of class template %qT as expression", decl);
return error_mark_node; return error_mark_node;
} }
else if (TREE_CODE (decl) == TREE_LIST) else if (TREE_CODE (decl) == TREE_LIST)
{ {
/* Ambiguous reference to base members. */ /* Ambiguous reference to base members. */
error ("request for member `%D' is ambiguous in " error ("request for member %qD is ambiguous in "
"multiple inheritance lattice", id_expression); "multiple inheritance lattice", id_expression);
print_candidates (decl); print_candidates (decl);
return error_mark_node; return error_mark_node;
...@@ -2665,8 +2665,8 @@ finish_id_expression (tree id_expression, ...@@ -2665,8 +2665,8 @@ finish_id_expression (tree id_expression,
{ {
error ("use of %s from containing function", error ("use of %s from containing function",
(TREE_CODE (decl) == VAR_DECL (TREE_CODE (decl) == VAR_DECL
? "`auto' variable" : "parameter")); ? "%<auto%> variable" : "parameter"));
cp_error_at (" `%#D' declared here", decl); cp_error_at (" %q#D declared here", decl);
return error_mark_node; return error_mark_node;
} }
} }
...@@ -2717,7 +2717,7 @@ finish_typeof (tree expr) ...@@ -2717,7 +2717,7 @@ finish_typeof (tree expr)
if (!type || type == unknown_type_node) if (!type || type == unknown_type_node)
{ {
error ("type of `%E' is unknown", expr); error ("type of %qE is unknown", expr);
return error_mark_node; return error_mark_node;
} }
......
...@@ -536,7 +536,7 @@ cp_build_qualified_type_real (tree type, ...@@ -536,7 +536,7 @@ cp_build_qualified_type_real (tree type,
tree bad_type = build_qualified_type (ptr_type_node, bad_quals); tree bad_type = build_qualified_type (ptr_type_node, bad_quals);
if (!(complain & tf_ignore_bad_quals)) if (!(complain & tf_ignore_bad_quals))
error ("`%V' qualifiers cannot be applied to `%T'", error ("%qV qualifiers cannot be applied to %qT",
bad_type, type); bad_type, type);
} }
} }
...@@ -1771,7 +1771,7 @@ handle_java_interface_attribute (tree* node, ...@@ -1771,7 +1771,7 @@ handle_java_interface_attribute (tree* node,
|| !CLASS_TYPE_P (*node) || !CLASS_TYPE_P (*node)
|| !TYPE_FOR_JAVA (*node)) || !TYPE_FOR_JAVA (*node))
{ {
error ("`%E' attribute can only be applied to Java class definitions", error ("%qE attribute can only be applied to Java class definitions",
name); name);
*no_add_attrs = true; *no_add_attrs = true;
return NULL_TREE; return NULL_TREE;
...@@ -1800,13 +1800,12 @@ handle_com_interface_attribute (tree* node, ...@@ -1800,13 +1800,12 @@ handle_com_interface_attribute (tree* node,
|| !CLASS_TYPE_P (*node) || !CLASS_TYPE_P (*node)
|| *node != TYPE_MAIN_VARIANT (*node)) || *node != TYPE_MAIN_VARIANT (*node))
{ {
warning ("`%E' attribute can only be applied to class definitions", warning ("%qE attribute can only be applied to class definitions", name);
name);
return NULL_TREE; return NULL_TREE;
} }
if (!warned++) if (!warned++)
warning ("`%E' is obsolete; g++ vtables are now COM-compatible by default", warning ("%qE is obsolete; g++ vtables are now COM-compatible by default",
name); name);
return NULL_TREE; return NULL_TREE;
...@@ -1851,7 +1850,7 @@ handle_init_priority_attribute (tree* node, ...@@ -1851,7 +1850,7 @@ handle_init_priority_attribute (tree* node,
init_priority value, so don't allow it. */ init_priority value, so don't allow it. */
|| current_function_decl) || current_function_decl)
{ {
error ("can only use `%E' attribute on file-scope definitions " error ("can only use %qE attribute on file-scope definitions "
"of objects of class type", name); "of objects of class type", name);
*no_add_attrs = true; *no_add_attrs = true;
return NULL_TREE; return NULL_TREE;
...@@ -1879,7 +1878,7 @@ handle_init_priority_attribute (tree* node, ...@@ -1879,7 +1878,7 @@ handle_init_priority_attribute (tree* node,
} }
else else
{ {
error ("`%E' attribute is not supported on this platform", name); error ("%qE attribute is not supported on this platform", name);
*no_add_attrs = true; *no_add_attrs = true;
return NULL_TREE; return NULL_TREE;
} }
......
...@@ -431,7 +431,7 @@ composite_pointer_type_r (tree t1, tree t2, const char* location) ...@@ -431,7 +431,7 @@ composite_pointer_type_r (tree t1, tree t2, const char* location)
result_type = composite_pointer_type_r (pointee1, pointee2, location); result_type = composite_pointer_type_r (pointee1, pointee2, location);
else else
{ {
pedwarn ("%s between distinct pointer types `%T' and `%T' " pedwarn ("%s between distinct pointer types %qT and %qT "
"lacks a cast", "lacks a cast",
location, t1, t2); location, t1, t2);
result_type = void_type_node; result_type = void_type_node;
...@@ -445,7 +445,7 @@ composite_pointer_type_r (tree t1, tree t2, const char* location) ...@@ -445,7 +445,7 @@ composite_pointer_type_r (tree t1, tree t2, const char* location)
{ {
if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1), if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
TYPE_PTRMEM_CLASS_TYPE (t2))) TYPE_PTRMEM_CLASS_TYPE (t2)))
pedwarn ("%s between distinct pointer types `%T' and `%T' " pedwarn ("%s between distinct pointer types %qT and %qT "
"lacks a cast", "lacks a cast",
location, t1, t2); location, t1, t2);
result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1), result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1),
...@@ -507,7 +507,8 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2, ...@@ -507,7 +507,8 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
tree result_type; tree result_type;
if (pedantic && TYPE_PTRFN_P (t2)) if (pedantic && TYPE_PTRFN_P (t2))
pedwarn ("ISO C++ forbids %s between pointer of type `void *' and pointer-to-function", location); pedwarn ("ISO C++ forbids %s between pointer of type %<void *%> "
"and pointer-to-function", location);
result_type result_type
= cp_build_qualified_type (void_type_node, = cp_build_qualified_type (void_type_node,
(cp_type_quals (TREE_TYPE (t1)) (cp_type_quals (TREE_TYPE (t1))
...@@ -537,7 +538,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2, ...@@ -537,7 +538,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
(cp_build_qualified_type (class2, TYPE_QUALS (class1)))); (cp_build_qualified_type (class2, TYPE_QUALS (class1))));
else else
{ {
error ("%s between distinct pointer types `%T' and `%T' " error ("%s between distinct pointer types %qT and %qT "
"lacks a cast", location, t1, t2); "lacks a cast", location, t1, t2);
return error_mark_node; return error_mark_node;
} }
...@@ -557,7 +558,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2, ...@@ -557,7 +558,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
t2 = build_ptrmem_type (class1, TYPE_PTRMEM_POINTED_TO_TYPE (t2)); t2 = build_ptrmem_type (class1, TYPE_PTRMEM_POINTED_TO_TYPE (t2));
else else
{ {
error ("%s between distinct pointer-to-member types `%T' and `%T' " error ("%s between distinct pointer-to-member types %qT and %qT "
"lacks a cast", location, t1, t2); "lacks a cast", location, t1, t2);
return error_mark_node; return error_mark_node;
} }
...@@ -1244,7 +1245,7 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain) ...@@ -1244,7 +1245,7 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain)
if (type_code == METHOD_TYPE) if (type_code == METHOD_TYPE)
{ {
if (complain && (pedantic || warn_pointer_arith)) if (complain && (pedantic || warn_pointer_arith))
pedwarn ("invalid application of `%s' to a member function", op_name); pedwarn ("invalid application of %qs to a member function", op_name);
value = size_one_node; value = size_one_node;
} }
else else
...@@ -1277,12 +1278,13 @@ cxx_sizeof_or_alignof_expr (tree e, enum tree_code op) ...@@ -1277,12 +1278,13 @@ cxx_sizeof_or_alignof_expr (tree e, enum tree_code op)
&& TREE_CODE (TREE_OPERAND (e, 1)) == FIELD_DECL && TREE_CODE (TREE_OPERAND (e, 1)) == FIELD_DECL
&& DECL_C_BIT_FIELD (TREE_OPERAND (e, 1))) && DECL_C_BIT_FIELD (TREE_OPERAND (e, 1)))
{ {
error ("invalid application of `%s' to a bit-field", op_name); error ("invalid application of %qs to a bit-field", op_name);
e = char_type_node; e = char_type_node;
} }
else if (is_overloaded_fn (e)) else if (is_overloaded_fn (e))
{ {
pedwarn ("ISO C++ forbids applying `%s' to an expression of function type", op_name); pedwarn ("ISO C++ forbids applying %qs to an expression of "
"function type", op_name);
e = char_type_node; e = char_type_node;
} }
else if (type_unknown_p (e)) else if (type_unknown_p (e))
...@@ -1503,7 +1505,7 @@ string_conv_p (tree totype, tree exp, int warn) ...@@ -1503,7 +1505,7 @@ string_conv_p (tree totype, tree exp, int warn)
/* This warning is not very useful, as it complains about printf. */ /* This warning is not very useful, as it complains about printf. */
if (warn && warn_write_strings) if (warn && warn_write_strings)
warning ("deprecated conversion from string constant to `%T'", totype); warning ("deprecated conversion from string constant to %qT'", totype);
return 1; return 1;
} }
...@@ -1617,7 +1619,7 @@ build_class_member_access_expr (tree object, tree member, ...@@ -1617,7 +1619,7 @@ build_class_member_access_expr (tree object, tree member,
return error_mark_node; return error_mark_node;
if (!CLASS_TYPE_P (object_type)) if (!CLASS_TYPE_P (object_type))
{ {
error ("request for member `%D' in `%E', which is of non-class type `%T'", error ("request for member %qD in %qE, which is of non-class type %qT",
member, object, object_type); member, object, object_type);
return error_mark_node; return error_mark_node;
} }
...@@ -1644,9 +1646,9 @@ build_class_member_access_expr (tree object, tree member, ...@@ -1644,9 +1646,9 @@ build_class_member_access_expr (tree object, tree member,
if (!member_scope || !DERIVED_FROM_P (member_scope, object_type)) if (!member_scope || !DERIVED_FROM_P (member_scope, object_type))
{ {
if (TREE_CODE (member) == FIELD_DECL) if (TREE_CODE (member) == FIELD_DECL)
error ("invalid use of nonstatic data member '%E'", member); error ("invalid use of nonstatic data member %qE", member);
else else
error ("`%D' is not a member of `%T'", member, object_type); error ("%qD is not a member of %qT", member, object_type);
return error_mark_node; return error_mark_node;
} }
...@@ -1696,9 +1698,10 @@ build_class_member_access_expr (tree object, tree member, ...@@ -1696,9 +1698,10 @@ build_class_member_access_expr (tree object, tree member,
offsetof macro. */ offsetof macro. */
if (null_object_p && kind == bk_via_virtual) if (null_object_p && kind == bk_via_virtual)
{ {
error ("invalid access to non-static data member `%D' of NULL object", error ("invalid access to non-static data member %qD of "
"NULL object",
member); member);
error ("(perhaps the `offsetof' macro was used incorrectly)"); error ("(perhaps the %<offsetof%> macro was used incorrectly)");
return error_mark_node; return error_mark_node;
} }
...@@ -1723,9 +1726,9 @@ build_class_member_access_expr (tree object, tree member, ...@@ -1723,9 +1726,9 @@ build_class_member_access_expr (tree object, tree member,
&& !DECL_FIELD_IS_BASE (member) && !DECL_FIELD_IS_BASE (member)
&& !skip_evaluation) && !skip_evaluation)
{ {
warning ("invalid access to non-static data member `%D' of NULL object", warning ("invalid access to non-static data member %qD of NULL object",
member); member);
warning ("(perhaps the `offsetof' macro was used incorrectly)"); warning ("(perhaps the %<offsetof%> macro was used incorrectly)");
} }
/* If MEMBER is from an anonymous aggregate, we have converted /* If MEMBER is from an anonymous aggregate, we have converted
...@@ -1810,7 +1813,7 @@ build_class_member_access_expr (tree object, tree member, ...@@ -1810,7 +1813,7 @@ build_class_member_access_expr (tree object, tree member,
} }
else else
{ {
error ("invalid use of `%D'", member); error ("invalid use of %qD", member);
return error_mark_node; return error_mark_node;
} }
...@@ -1836,13 +1839,13 @@ lookup_destructor (tree object, tree scope, tree dtor_name) ...@@ -1836,13 +1839,13 @@ lookup_destructor (tree object, tree scope, tree dtor_name)
if (scope && !check_dtor_name (scope, dtor_name)) if (scope && !check_dtor_name (scope, dtor_name))
{ {
error ("qualified type `%T' does not match destructor name `~%T'", error ("qualified type %qT does not match destructor name ~%qT",
scope, dtor_type); scope, dtor_type);
return error_mark_node; return error_mark_node;
} }
if (!DERIVED_FROM_P (dtor_type, TYPE_MAIN_VARIANT (object_type))) if (!DERIVED_FROM_P (dtor_type, TYPE_MAIN_VARIANT (object_type)))
{ {
error ("the type being destroyed is `%T', but the destructor refers to `%T'", error ("the type being destroyed is %qT, but the destructor refers to %qT",
TYPE_MAIN_VARIANT (object_type), dtor_type); TYPE_MAIN_VARIANT (object_type), dtor_type);
return error_mark_node; return error_mark_node;
} }
...@@ -1915,7 +1918,7 @@ finish_class_member_access_expr (tree object, tree name) ...@@ -1915,7 +1918,7 @@ finish_class_member_access_expr (tree object, tree name)
return error_mark_node; return error_mark_node;
if (!CLASS_TYPE_P (object_type)) if (!CLASS_TYPE_P (object_type))
{ {
error ("request for member `%D' in `%E', which is of non-class type `%T'", error ("request for member %qD in %qE, which is of non-class type %qT",
name, object, object_type); name, object, object_type);
return error_mark_node; return error_mark_node;
} }
...@@ -1961,7 +1964,7 @@ finish_class_member_access_expr (tree object, tree name) ...@@ -1961,7 +1964,7 @@ finish_class_member_access_expr (tree object, tree name)
name a member of OBJECT_TYPE. */ name a member of OBJECT_TYPE. */
if (TREE_CODE (scope) == NAMESPACE_DECL) if (TREE_CODE (scope) == NAMESPACE_DECL)
{ {
error ("`%D::%D' is not a member of `%T'", error ("%<%D::%D%> is not a member of %qT",
scope, name, object_type); scope, name, object_type);
return error_mark_node; return error_mark_node;
} }
...@@ -1972,7 +1975,7 @@ finish_class_member_access_expr (tree object, tree name) ...@@ -1972,7 +1975,7 @@ finish_class_member_access_expr (tree object, tree name)
return error_mark_node; return error_mark_node;
if (!access_path) if (!access_path)
{ {
error ("`%T' is not a base of `%T'", scope, object_type); error ("%qT is not a base of %qT", scope, object_type);
return error_mark_node; return error_mark_node;
} }
} }
...@@ -1991,7 +1994,7 @@ finish_class_member_access_expr (tree object, tree name) ...@@ -1991,7 +1994,7 @@ finish_class_member_access_expr (tree object, tree name)
/*want_type=*/false); /*want_type=*/false);
if (member == NULL_TREE) if (member == NULL_TREE)
{ {
error ("'%D' has no member named '%E'", object_type, name); error ("%qD has no member named %qE", object_type, name);
return error_mark_node; return error_mark_node;
} }
if (member == error_mark_node) if (member == error_mark_node)
...@@ -2006,7 +2009,7 @@ finish_class_member_access_expr (tree object, tree name) ...@@ -2006,7 +2009,7 @@ finish_class_member_access_expr (tree object, tree name)
template = lookup_template_function (template, template_args); template = lookup_template_function (template, template_args);
else else
{ {
error ("`%D' is not a member template function", name); error ("%qD is not a member template function", name);
return error_mark_node; return error_mark_node;
} }
} }
...@@ -2113,7 +2116,7 @@ build_indirect_ref (tree ptr, const char *errorstring) ...@@ -2113,7 +2116,7 @@ build_indirect_ref (tree ptr, const char *errorstring)
{ {
/* A pointer to incomplete type (other than cv void) can be /* A pointer to incomplete type (other than cv void) can be
dereferenced [expr.unary.op]/1 */ dereferenced [expr.unary.op]/1 */
error ("`%T' is not a pointer-to-object type", type); error ("%qT is not a pointer-to-object type", type);
return error_mark_node; return error_mark_node;
} }
else if (TREE_CODE (pointer) == ADDR_EXPR else if (TREE_CODE (pointer) == ADDR_EXPR
...@@ -2138,11 +2141,11 @@ build_indirect_ref (tree ptr, const char *errorstring) ...@@ -2138,11 +2141,11 @@ build_indirect_ref (tree ptr, const char *errorstring)
/* `pointer' won't be an error_mark_node if we were given a /* `pointer' won't be an error_mark_node if we were given a
pointer to member, so it's cool to check for this here. */ pointer to member, so it's cool to check for this here. */
else if (TYPE_PTR_TO_MEMBER_P (type)) else if (TYPE_PTR_TO_MEMBER_P (type))
error ("invalid use of `%s' on pointer to member", errorstring); error ("invalid use of %qs on pointer to member", errorstring);
else if (pointer != error_mark_node) else if (pointer != error_mark_node)
{ {
if (errorstring) if (errorstring)
error ("invalid type argument of `%s'", errorstring); error ("invalid type argument of %qs", errorstring);
else else
error ("invalid type argument"); error ("invalid type argument");
} }
...@@ -2208,7 +2211,7 @@ build_array_ref (tree array, tree idx) ...@@ -2208,7 +2211,7 @@ build_array_ref (tree array, tree idx)
must have done so deliberately. */ must have done so deliberately. */
if (warn_char_subscripts if (warn_char_subscripts
&& TYPE_MAIN_VARIANT (TREE_TYPE (idx)) == char_type_node) && TYPE_MAIN_VARIANT (TREE_TYPE (idx)) == char_type_node)
warning ("array subscript has type `char'"); warning ("array subscript has type %<char%>");
if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (idx))) if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (idx)))
{ {
...@@ -2260,7 +2263,7 @@ build_array_ref (tree array, tree idx) ...@@ -2260,7 +2263,7 @@ build_array_ref (tree array, tree idx)
while (TREE_CODE (foo) == COMPONENT_REF) while (TREE_CODE (foo) == COMPONENT_REF)
foo = TREE_OPERAND (foo, 0); foo = TREE_OPERAND (foo, 0);
if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo)) if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo))
warning ("subscripting array declared `register'"); warning ("subscripting array declared %<register%>");
} }
type = TREE_TYPE (TREE_TYPE (array)); type = TREE_TYPE (TREE_TYPE (array));
...@@ -2343,7 +2346,7 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function) ...@@ -2343,7 +2346,7 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
} }
else else
{ {
error ("object missing in use of `%E'", function); error ("object missing in use of %qE", function);
return error_mark_node; return error_mark_node;
} }
} }
...@@ -2444,7 +2447,7 @@ build_function_call (tree function, tree params) ...@@ -2444,7 +2447,7 @@ build_function_call (tree function, tree params)
/* Convert anything with function type to a pointer-to-function. */ /* Convert anything with function type to a pointer-to-function. */
if (pedantic && DECL_MAIN_P (function)) if (pedantic && DECL_MAIN_P (function))
pedwarn ("ISO C++ forbids calling `::main' from within program"); pedwarn ("ISO C++ forbids calling %<::main%> from within program");
/* Differs from default_conversion by not setting TREE_ADDRESSABLE /* Differs from default_conversion by not setting TREE_ADDRESSABLE
(because calling an inline function does not mean the function (because calling an inline function does not mean the function
...@@ -2469,8 +2472,9 @@ build_function_call (tree function, tree params) ...@@ -2469,8 +2472,9 @@ build_function_call (tree function, tree params)
if (TYPE_PTRMEMFUNC_P (fntype)) if (TYPE_PTRMEMFUNC_P (fntype))
{ {
error ("must use .* or ->* to call pointer-to-member function in `%E (...)'", error ("must use %<.*%> or %<->*%> to call pointer-to-member "
original); "function in %<%E (...)%>",
original);
return error_mark_node; return error_mark_node;
} }
...@@ -2482,7 +2486,7 @@ build_function_call (tree function, tree params) ...@@ -2482,7 +2486,7 @@ build_function_call (tree function, tree params)
|| is_method || is_method
|| TREE_CODE (function) == TEMPLATE_ID_EXPR)) || TREE_CODE (function) == TEMPLATE_ID_EXPR))
{ {
error ("`%E' cannot be used as a function", original); error ("%qE cannot be used as a function", original);
return error_mark_node; return error_mark_node;
} }
...@@ -2561,7 +2565,7 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags) ...@@ -2561,7 +2565,7 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags)
{ {
if (fndecl) if (fndecl)
{ {
cp_error_at ("too many arguments to %s `%+#D'", called_thing, cp_error_at ("too many arguments to %s %q+#D", called_thing,
fndecl); fndecl);
error ("at this point in file"); error ("at this point in file");
} }
...@@ -2600,10 +2604,10 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags) ...@@ -2600,10 +2604,10 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags)
if (!COMPLETE_TYPE_P (complete_type (type))) if (!COMPLETE_TYPE_P (complete_type (type)))
{ {
if (fndecl) if (fndecl)
error ("parameter %P of `%D' has incomplete type `%T'", error ("parameter %P of %qD has incomplete type %qT",
i, fndecl, type); i, fndecl, type);
else else
error ("parameter %P has incomplete type `%T'", i, type); error ("parameter %P has incomplete type %qT", i, type);
parmval = error_mark_node; parmval = error_mark_node;
} }
else else
...@@ -2667,7 +2671,7 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags) ...@@ -2667,7 +2671,7 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags)
{ {
if (fndecl) if (fndecl)
{ {
cp_error_at ("too few arguments to %s `%+#D'", cp_error_at ("too few arguments to %s %q+#D",
called_thing, fndecl); called_thing, fndecl);
error ("at this point in file"); error ("at this point in file");
} }
...@@ -2819,8 +2823,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -2819,8 +2823,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
tree t = instantiate_type (TREE_TYPE (op1), op0, tf_none); tree t = instantiate_type (TREE_TYPE (op1), op0, tf_none);
if (t != error_mark_node) if (t != error_mark_node)
{ {
pedwarn ("assuming cast to type `%T' from overloaded function", pedwarn ("assuming cast to type %qT from overloaded function",
TREE_TYPE (t)); TREE_TYPE (t));
op0 = t; op0 = t;
} }
} }
...@@ -2829,8 +2833,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -2829,8 +2833,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
tree t = instantiate_type (TREE_TYPE (op0), op1, tf_none); tree t = instantiate_type (TREE_TYPE (op0), op1, tf_none);
if (t != error_mark_node) if (t != error_mark_node)
{ {
pedwarn ("assuming cast to type `%T' from overloaded function", pedwarn ("assuming cast to type %qT from overloaded function",
TREE_TYPE (t)); TREE_TYPE (t));
op1 = t; op1 = t;
} }
} }
...@@ -2890,9 +2894,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -2890,9 +2894,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
|| code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE)) || code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE))
{ {
if (TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1)) if (TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1))
warning ("division by zero in `%E / 0'", op0); warning ("division by zero in %<%E / 0%>", op0);
else if (TREE_CODE (op1) == REAL_CST && real_zerop (op1)) else if (TREE_CODE (op1) == REAL_CST && real_zerop (op1))
warning ("division by zero in `%E / 0.'", op0); warning ("division by zero in %<%E / 0.%>", op0);
if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE) if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE)
code0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0))); code0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0)));
...@@ -2926,9 +2930,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -2926,9 +2930,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
case TRUNC_MOD_EXPR: case TRUNC_MOD_EXPR:
case FLOOR_MOD_EXPR: case FLOOR_MOD_EXPR:
if (code1 == INTEGER_TYPE && integer_zerop (op1)) if (code1 == INTEGER_TYPE && integer_zerop (op1))
warning ("division by zero in `%E %% 0'", op0); warning ("division by zero in %<%E %% 0%>", op0);
else if (code1 == REAL_TYPE && real_zerop (op1)) else if (code1 == REAL_TYPE && real_zerop (op1))
warning ("division by zero in `%E %% 0.'", op0); warning ("division by zero in %<%E %% 0.%>", op0);
if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
{ {
...@@ -3187,7 +3191,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -3187,7 +3191,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
if (!result_type) if (!result_type)
{ {
error ("invalid operands of types `%T' and `%T' to binary `%O'", error ("invalid operands of types %qT and %qT to binary %qO",
TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), code); TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), code);
return error_mark_node; return error_mark_node;
} }
...@@ -3349,8 +3353,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -3349,8 +3353,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
&& TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0)) && TYPE_MAIN_VARIANT (TREE_TYPE (orig_op0))
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1))) != TYPE_MAIN_VARIANT (TREE_TYPE (orig_op1)))
{ {
warning ("comparison between types `%#T' and `%#T'", warning ("comparison between types %q#T and %q#T",
TREE_TYPE (orig_op0), TREE_TYPE (orig_op1)); TREE_TYPE (orig_op0), TREE_TYPE (orig_op1));
} }
/* Give warnings for comparisons between signed and unsigned /* Give warnings for comparisons between signed and unsigned
...@@ -3522,7 +3526,7 @@ pointer_diff (tree op0, tree op1, tree ptrtype) ...@@ -3522,7 +3526,7 @@ pointer_diff (tree op0, tree op1, tree ptrtype)
if (pedantic || warn_pointer_arith) if (pedantic || warn_pointer_arith)
{ {
if (TREE_CODE (target_type) == VOID_TYPE) if (TREE_CODE (target_type) == VOID_TYPE)
pedwarn ("ISO C++ forbids using pointer of type `void *' in subtraction"); pedwarn ("ISO C++ forbids using pointer of type %<void *%> in subtraction");
if (TREE_CODE (target_type) == FUNCTION_TYPE) if (TREE_CODE (target_type) == FUNCTION_TYPE)
pedwarn ("ISO C++ forbids using pointer to a function in subtraction"); pedwarn ("ISO C++ forbids using pointer to a function in subtraction");
if (TREE_CODE (target_type) == METHOD_TYPE) if (TREE_CODE (target_type) == METHOD_TYPE)
...@@ -3884,16 +3888,16 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) ...@@ -3884,16 +3888,16 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
tree type = complete_type (TREE_TYPE (argtype)); tree type = complete_type (TREE_TYPE (argtype));
if (!COMPLETE_OR_VOID_TYPE_P (type)) if (!COMPLETE_OR_VOID_TYPE_P (type))
error ("cannot %s a pointer to incomplete type `%T'", error ("cannot %s a pointer to incomplete type %qT",
((code == PREINCREMENT_EXPR ((code == PREINCREMENT_EXPR
|| code == POSTINCREMENT_EXPR) || code == POSTINCREMENT_EXPR)
? "increment" : "decrement"), TREE_TYPE (argtype)); ? "increment" : "decrement"), TREE_TYPE (argtype));
else if ((pedantic || warn_pointer_arith) else if ((pedantic || warn_pointer_arith)
&& !TYPE_PTROB_P (argtype)) && !TYPE_PTROB_P (argtype))
pedwarn ("ISO C++ forbids %sing a pointer of type `%T'", pedwarn ("ISO C++ forbids %sing a pointer of type %qT",
((code == PREINCREMENT_EXPR ((code == PREINCREMENT_EXPR
|| code == POSTINCREMENT_EXPR) || code == POSTINCREMENT_EXPR)
? "increment" : "decrement"), argtype); ? "increment" : "decrement"), argtype);
inc = cxx_sizeof_nowarn (TREE_TYPE (argtype)); inc = cxx_sizeof_nowarn (TREE_TYPE (argtype));
} }
else else
...@@ -3950,7 +3954,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) ...@@ -3950,7 +3954,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
{ {
if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR) if (code == POSTDECREMENT_EXPR || code == PREDECREMENT_EXPR)
{ {
error ("invalid use of `--' on bool variable `%D'", arg); error ("invalid use of %<--%> on bool variable %qD", arg);
return error_mark_node; return error_mark_node;
} }
val = boolean_increment (code, arg); val = boolean_increment (code, arg);
...@@ -3979,7 +3983,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) ...@@ -3979,7 +3983,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
} }
else if (pedantic && DECL_MAIN_P (arg)) else if (pedantic && DECL_MAIN_P (arg))
/* ARM $3.4 */ /* ARM $3.4 */
pedwarn ("ISO C++ forbids taking address of function `::main'"); pedwarn ("ISO C++ forbids taking address of function %<::main%>");
/* Let &* cancel out to simplify resulting code. */ /* Let &* cancel out to simplify resulting code. */
if (TREE_CODE (arg) == INDIRECT_REF) if (TREE_CODE (arg) == INDIRECT_REF)
...@@ -4035,12 +4039,12 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) ...@@ -4035,12 +4039,12 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
/* An expression like &memfn. */ /* An expression like &memfn. */
pedwarn ("ISO C++ forbids taking the address of an unqualified" pedwarn ("ISO C++ forbids taking the address of an unqualified"
" or parenthesized non-static member function to form" " or parenthesized non-static member function to form"
" a pointer to member function. Say `&%T::%D'", " a pointer to member function. Say %<&%T::%D%>",
base, name); base, name);
else else
pedwarn ("ISO C++ forbids taking the address of a bound member" pedwarn ("ISO C++ forbids taking the address of a bound member"
" function to form a pointer to member function." " function to form a pointer to member function."
" Say `&%T::%D'", " Say %<&%T::%D%>",
base, name); base, name);
} }
arg = build_offset_ref (base, name, /*address_p=*/true); arg = build_offset_ref (base, name, /*address_p=*/true);
...@@ -4086,7 +4090,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) ...@@ -4086,7 +4090,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
is an error. */ is an error. */
else if (TREE_CODE (argtype) != FUNCTION_TYPE else if (TREE_CODE (argtype) != FUNCTION_TYPE
&& TREE_CODE (argtype) != METHOD_TYPE && TREE_CODE (argtype) != METHOD_TYPE
&& !lvalue_or_else (arg, "unary `&'")) && !lvalue_or_else (arg, "unary %<&$>"))
return error_mark_node; return error_mark_node;
if (argtype != error_mark_node) if (argtype != error_mark_node)
...@@ -4118,7 +4122,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) ...@@ -4118,7 +4122,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
} }
else if (DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1))) else if (DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1)))
{ {
error ("attempt to take address of bit-field structure member `%D'", error ("attempt to take address of bit-field structure member %qD",
TREE_OPERAND (arg, 1)); TREE_OPERAND (arg, 1));
return error_mark_node; return error_mark_node;
} }
...@@ -4251,7 +4255,7 @@ unary_complex_lvalue (enum tree_code code, tree arg) ...@@ -4251,7 +4255,7 @@ unary_complex_lvalue (enum tree_code code, tree arg)
if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE) if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
{ {
error ("cannot create pointer to reference member `%D'", t); error ("cannot create pointer to reference member %qD", t);
return error_mark_node; return error_mark_node;
} }
...@@ -4333,8 +4337,8 @@ cxx_mark_addressable (tree exp) ...@@ -4333,8 +4337,8 @@ cxx_mark_addressable (tree exp)
case RESULT_DECL: case RESULT_DECL:
if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x) if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
&& !DECL_ARTIFICIAL (x) && extra_warnings) && !DECL_ARTIFICIAL (x) && extra_warnings)
warning ("address requested for `%D', which is declared `register'", warning ("address requested for %qD, which is declared `register'",
x); x);
TREE_ADDRESSABLE (x) = 1; TREE_ADDRESSABLE (x) = 1;
return true; return true;
...@@ -4473,7 +4477,7 @@ check_for_casting_away_constness (tree src_type, tree dest_type, ...@@ -4473,7 +4477,7 @@ check_for_casting_away_constness (tree src_type, tree dest_type,
const char *description) const char *description)
{ {
if (casts_away_constness (src_type, dest_type)) if (casts_away_constness (src_type, dest_type))
error ("%s from type `%T' to type `%T' casts away constness", error ("%s from type %qT to type %qT casts away constness",
description, src_type, dest_type); description, src_type, dest_type);
} }
...@@ -4675,7 +4679,7 @@ build_static_cast (tree type, tree expr) ...@@ -4675,7 +4679,7 @@ build_static_cast (tree type, tree expr)
return build_nop (type, expr); return build_nop (type, expr);
} }
error ("invalid static_cast from type `%T' to type `%T'", intype, type); error ("invalid static_cast from type %qT to type %qT", intype, type);
return error_mark_node; return error_mark_node;
} }
...@@ -4718,7 +4722,8 @@ build_reinterpret_cast (tree type, tree expr) ...@@ -4718,7 +4722,8 @@ build_reinterpret_cast (tree type, tree expr)
{ {
if (! real_lvalue_p (expr)) if (! real_lvalue_p (expr))
{ {
error ("invalid reinterpret_cast of an rvalue expression of type `%T' to type `%T'", intype, type); error ("invalid reinterpret_cast of an rvalue expression of type "
"%qT to type %qT", intype, type);
return error_mark_node; return error_mark_node;
} }
expr = build_unary_op (ADDR_EXPR, expr, 0); expr = build_unary_op (ADDR_EXPR, expr, 0);
...@@ -4738,8 +4743,8 @@ build_reinterpret_cast (tree type, tree expr) ...@@ -4738,8 +4743,8 @@ build_reinterpret_cast (tree type, tree expr)
else if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PTR_P (intype)) else if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PTR_P (intype))
{ {
if (TYPE_PRECISION (type) < TYPE_PRECISION (intype)) if (TYPE_PRECISION (type) < TYPE_PRECISION (intype))
pedwarn ("reinterpret_cast from `%T' to `%T' loses precision", pedwarn ("reinterpret_cast from %qT to %qT loses precision",
intype, type); intype, type);
} }
else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype)) else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype))) || (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
...@@ -4763,8 +4768,8 @@ build_reinterpret_cast (tree type, tree expr) ...@@ -4763,8 +4768,8 @@ build_reinterpret_cast (tree type, tree expr)
} }
else else
{ {
error ("invalid reinterpret_cast from type `%T' to type `%T'", error ("invalid reinterpret_cast from type %qT to type %qT",
intype, type); intype, type);
return error_mark_node; return error_mark_node;
} }
...@@ -4791,10 +4796,12 @@ build_const_cast (tree type, tree expr) ...@@ -4791,10 +4796,12 @@ build_const_cast (tree type, tree expr)
} }
if (!POINTER_TYPE_P (type) && !TYPE_PTRMEM_P (type)) if (!POINTER_TYPE_P (type) && !TYPE_PTRMEM_P (type))
error ("invalid use of const_cast with type `%T', which is not a pointer, reference, nor a pointer-to-data-member type", type); error ("invalid use of const_cast with type %qT, which is not a pointer, "
"reference, nor a pointer-to-data-member type", type);
else if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) else if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
{ {
error ("invalid use of const_cast with type `%T', which is a pointer or reference to a function type", type); error ("invalid use of const_cast with type %qT, which is a pointer "
"or reference to a function type", type);
return error_mark_node; return error_mark_node;
} }
...@@ -4817,7 +4824,8 @@ build_const_cast (tree type, tree expr) ...@@ -4817,7 +4824,8 @@ build_const_cast (tree type, tree expr)
{ {
if (! real_lvalue_p (expr)) if (! real_lvalue_p (expr))
{ {
error ("invalid const_cast of an rvalue of type `%T' to type `%T'", intype, type); error ("invalid const_cast of an rvalue of type %qT to type %qT",
intype, type);
return error_mark_node; return error_mark_node;
} }
...@@ -4834,7 +4842,7 @@ build_const_cast (tree type, tree expr) ...@@ -4834,7 +4842,7 @@ build_const_cast (tree type, tree expr)
&& comp_ptr_ttypes_const (TREE_TYPE (type), TREE_TYPE (intype))) && comp_ptr_ttypes_const (TREE_TYPE (type), TREE_TYPE (intype)))
return cp_convert (type, expr); return cp_convert (type, expr);
error ("invalid const_cast from type `%T' to type `%T'", intype, type); error ("invalid const_cast from type %qT to type %qT", intype, type);
return error_mark_node; return error_mark_node;
} }
...@@ -4881,12 +4889,12 @@ build_c_cast (tree type, tree expr) ...@@ -4881,12 +4889,12 @@ build_c_cast (tree type, tree expr)
NIHCL uses it. It is not valid ISO C++ however. */ NIHCL uses it. It is not valid ISO C++ however. */
if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE) if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
{ {
pedwarn ("ISO C++ forbids casting to an array type `%T'", type); pedwarn ("ISO C++ forbids casting to an array type %qT", type);
type = build_pointer_type (TREE_TYPE (type)); type = build_pointer_type (TREE_TYPE (type));
} }
else else
{ {
error ("ISO C++ forbids casting to an array type `%T'", type); error ("ISO C++ forbids casting to an array type %qT", type);
return error_mark_node; return error_mark_node;
} }
} }
...@@ -4894,7 +4902,7 @@ build_c_cast (tree type, tree expr) ...@@ -4894,7 +4902,7 @@ build_c_cast (tree type, tree expr)
if (TREE_CODE (type) == FUNCTION_TYPE if (TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE) || TREE_CODE (type) == METHOD_TYPE)
{ {
error ("invalid cast to function type `%T'", type); error ("invalid cast to function type %qT", type);
return error_mark_node; return error_mark_node;
} }
...@@ -4950,8 +4958,9 @@ build_c_cast (tree type, tree expr) ...@@ -4950,8 +4958,9 @@ build_c_cast (tree type, tree expr)
&& TREE_CODE (otype) == POINTER_TYPE && TREE_CODE (otype) == POINTER_TYPE
&& !at_least_as_qualified_p (TREE_TYPE (type), && !at_least_as_qualified_p (TREE_TYPE (type),
TREE_TYPE (otype))) TREE_TYPE (otype)))
warning ("cast from `%T' to `%T' discards qualifiers from pointer target type", warning ("cast from %qT to %qT discards qualifiers from pointer "
otype, type); "target type",
otype, type);
if (TREE_CODE (type) == INTEGER_TYPE if (TREE_CODE (type) == INTEGER_TYPE
&& TYPE_PTR_P (otype) && TYPE_PTR_P (otype)
...@@ -4998,8 +5007,9 @@ build_c_cast (tree type, tree expr) ...@@ -4998,8 +5007,9 @@ build_c_cast (tree type, tree expr)
&& COMPLETE_TYPE_P (TREE_TYPE (otype)) && COMPLETE_TYPE_P (TREE_TYPE (otype))
&& COMPLETE_TYPE_P (TREE_TYPE (type)) && COMPLETE_TYPE_P (TREE_TYPE (type))
&& TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype))) && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
warning ("cast from `%T' to `%T' increases required alignment of target type", warning ("cast from %qT to %qT increases required alignment of "
otype, type); "target type",
otype, type);
/* Always produce some operator for an explicit cast, /* Always produce some operator for an explicit cast,
so we can tell (for -pedantic) that the cast is no lvalue. */ so we can tell (for -pedantic) that the cast is no lvalue. */
...@@ -5183,7 +5193,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) ...@@ -5183,7 +5193,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
newrhs = cp_build_binary_op (modifycode, lhs, rhs); newrhs = cp_build_binary_op (modifycode, lhs, rhs);
if (newrhs == error_mark_node) if (newrhs == error_mark_node)
{ {
error (" in evaluation of `%Q(%#T, %#T)'", modifycode, error (" in evaluation of %<%Q(%#T, %#T)%>", modifycode,
TREE_TYPE (lhs), TREE_TYPE (rhs)); TREE_TYPE (lhs), TREE_TYPE (rhs));
return error_mark_node; return error_mark_node;
} }
...@@ -5252,7 +5262,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) ...@@ -5252,7 +5262,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
if (!same_or_base_type_p (TYPE_MAIN_VARIANT (lhstype), if (!same_or_base_type_p (TYPE_MAIN_VARIANT (lhstype),
TYPE_MAIN_VARIANT (TREE_TYPE (rhs)))) TYPE_MAIN_VARIANT (TREE_TYPE (rhs))))
{ {
error ("incompatible types in assignment of `%T' to `%T'", error ("incompatible types in assignment of %qT to %qT",
TREE_TYPE (rhs), lhstype); TREE_TYPE (rhs), lhstype);
return error_mark_node; return error_mark_node;
} }
...@@ -5398,10 +5408,10 @@ get_delta_difference (tree from, tree to, int force) ...@@ -5398,10 +5408,10 @@ get_delta_difference (tree from, tree to, int force)
{ {
/* This is a reinterpret cast, we choose to do nothing. */ /* This is a reinterpret cast, we choose to do nothing. */
if (force) if (force)
warning ("pointer to member cast via virtual base `%T'", warning ("pointer to member cast via virtual base %qT",
BINFO_TYPE (virt_binfo)); BINFO_TYPE (virt_binfo));
else else
error ("pointer to member conversion via virtual base `%T'", error ("pointer to member conversion via virtual base %qT",
BINFO_TYPE (virt_binfo)); BINFO_TYPE (virt_binfo));
} }
} }
...@@ -5474,8 +5484,8 @@ build_ptrmemfunc (tree type, tree pfn, int force) ...@@ -5474,8 +5484,8 @@ build_ptrmemfunc (tree type, tree pfn, int force)
if (!force if (!force
&& !can_convert_arg (to_type, TREE_TYPE (pfn), pfn)) && !can_convert_arg (to_type, TREE_TYPE (pfn), pfn))
error ("invalid conversion to type `%T' from type `%T'", error ("invalid conversion to type %qT from type %qT",
to_type, pfn_type); to_type, pfn_type);
n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type), n = get_delta_difference (TYPE_PTRMEMFUNC_OBJECT_TYPE (pfn_type),
TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type), TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type),
...@@ -5636,10 +5646,10 @@ dubious_conversion_warnings (tree type, tree expr, ...@@ -5636,10 +5646,10 @@ dubious_conversion_warnings (tree type, tree expr,
if (ARITHMETIC_TYPE_P (type) && expr == null_node) if (ARITHMETIC_TYPE_P (type) && expr == null_node)
{ {
if (fndecl) if (fndecl)
warning ("passing NULL used for non-pointer %s %P of `%D'", warning ("passing NULL used for non-pointer %s %P of %qD",
errtype, parmnum, fndecl); errtype, parmnum, fndecl);
else else
warning ("%s to non-pointer type `%T' from NULL", errtype, type); warning ("%s to non-pointer type %qT from NULL", errtype, type);
} }
/* Warn about assigning a floating-point type to an integer type. */ /* Warn about assigning a floating-point type to an integer type. */
...@@ -5647,10 +5657,10 @@ dubious_conversion_warnings (tree type, tree expr, ...@@ -5647,10 +5657,10 @@ dubious_conversion_warnings (tree type, tree expr,
&& TREE_CODE (type) == INTEGER_TYPE) && TREE_CODE (type) == INTEGER_TYPE)
{ {
if (fndecl) if (fndecl)
warning ("passing `%T' for %s %P of `%D'", warning ("passing %qT for %s %P of %qD",
TREE_TYPE (expr), errtype, parmnum, fndecl); TREE_TYPE (expr), errtype, parmnum, fndecl);
else else
warning ("%s to `%T' from `%T'", errtype, type, TREE_TYPE (expr)); warning ("%s to %qT from %qT", errtype, type, TREE_TYPE (expr));
} }
/* And warn about assigning a negative value to an unsigned /* And warn about assigning a negative value to an unsigned
variable. */ variable. */
...@@ -5659,11 +5669,10 @@ dubious_conversion_warnings (tree type, tree expr, ...@@ -5659,11 +5669,10 @@ dubious_conversion_warnings (tree type, tree expr,
if (TREE_CODE (expr) == INTEGER_CST && TREE_NEGATED_INT (expr)) if (TREE_CODE (expr) == INTEGER_CST && TREE_NEGATED_INT (expr))
{ {
if (fndecl) if (fndecl)
warning ("passing negative value `%E' for %s %P of `%D'", warning ("passing negative value %qE for %s %P of %qD",
expr, errtype, parmnum, fndecl); expr, errtype, parmnum, fndecl);
else else
warning ("%s of negative value `%E' to `%T'", warning ("%s of negative value %qE to %qT", errtype, expr, type);
errtype, expr, type);
} }
overflow_warning (expr); overflow_warning (expr);
...@@ -5749,11 +5758,10 @@ convert_for_assignment (tree type, tree rhs, ...@@ -5749,11 +5758,10 @@ convert_for_assignment (tree type, tree rhs,
if (rhstype == unknown_type_node) if (rhstype == unknown_type_node)
instantiate_type (type, rhs, tf_error | tf_warning); instantiate_type (type, rhs, tf_error | tf_warning);
else if (fndecl) else if (fndecl)
error ("cannot convert `%T' to `%T' for argument `%P' to `%D'", error ("cannot convert %qT to %qT for argument %qP to %qD",
rhstype, type, parmnum, fndecl); rhstype, type, parmnum, fndecl);
else else
error ("cannot convert `%T' to `%T' in %s", rhstype, type, error ("cannot convert %qT to %qT in %s", rhstype, type, errtype);
errtype);
return error_mark_node; return error_mark_node;
} }
} }
...@@ -5829,9 +5837,9 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags, ...@@ -5829,9 +5837,9 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags,
if (fndecl) if (fndecl)
{ {
if (warningcount > savew) if (warningcount > savew)
cp_warning_at ("in passing argument %P of `%+D'", parmnum, fndecl); cp_warning_at ("in passing argument %P of %q+D", parmnum, fndecl);
else if (errorcount > savee) else if (errorcount > savee)
cp_error_at ("in passing argument %P of `%+D'", parmnum, fndecl); cp_error_at ("in passing argument %P of %q+D", parmnum, fndecl);
} }
return rhs; return rhs;
} }
...@@ -5900,10 +5908,10 @@ maybe_warn_about_returning_address_of_local (tree retval) ...@@ -5900,10 +5908,10 @@ maybe_warn_about_returning_address_of_local (tree retval)
|| TREE_PUBLIC (whats_returned))) || TREE_PUBLIC (whats_returned)))
{ {
if (TREE_CODE (valtype) == REFERENCE_TYPE) if (TREE_CODE (valtype) == REFERENCE_TYPE)
cp_warning_at ("reference to local variable `%D' returned", cp_warning_at ("reference to local variable %qD returned",
whats_returned); whats_returned);
else else
cp_warning_at ("address of local variable `%D' returned", cp_warning_at ("address of local variable %qD returned",
whats_returned); whats_returned);
return; return;
} }
...@@ -6006,7 +6014,8 @@ check_return_expr (tree retval) ...@@ -6006,7 +6014,8 @@ check_return_expr (tree retval)
&& !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl)) && !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl))
&& ! flag_check_new && ! flag_check_new
&& null_ptr_cst_p (retval)) && null_ptr_cst_p (retval))
warning ("`operator new' must not return NULL unless it is declared `throw()' (or -fcheck-new is in effect)"); warning ("%<operator new%> must not return NULL unless it is "
"declared %<throw()%> (or -fcheck-new is in effect)");
/* Effective C++ rule 15. See also start_function. */ /* Effective C++ rule 15. See also start_function. */
if (warn_ecpp if (warn_ecpp
...@@ -6031,7 +6040,7 @@ check_return_expr (tree retval) ...@@ -6031,7 +6040,7 @@ check_return_expr (tree retval)
} }
if (warn) if (warn)
warning ("`operator=' should return a reference to `*this'"); warning ("%<operator=%> should return a reference to %<*this%>");
} }
/* The fabled Named Return Value optimization, as per [class.copy]/15: /* The fabled Named Return Value optimization, as per [class.copy]/15:
......
...@@ -49,7 +49,7 @@ error_not_base_type (tree basetype, tree type) ...@@ -49,7 +49,7 @@ error_not_base_type (tree basetype, tree type)
{ {
if (TREE_CODE (basetype) == FUNCTION_DECL) if (TREE_CODE (basetype) == FUNCTION_DECL)
basetype = DECL_CONTEXT (basetype); basetype = DECL_CONTEXT (basetype);
error ("type `%T' is not a base type for type `%T'", basetype, type); error ("type %qT is not a base type for type %qT", basetype, type);
return error_mark_node; return error_mark_node;
} }
...@@ -84,9 +84,9 @@ readonly_error (tree arg, const char* string, int soft) ...@@ -84,9 +84,9 @@ readonly_error (tree arg, const char* string, int soft)
if (TREE_CODE (arg) == COMPONENT_REF) if (TREE_CODE (arg) == COMPONENT_REF)
{ {
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0)))) if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
fmt = "%s of data-member `%D' in read-only structure"; fmt = "%s of data-member %qD in read-only structure";
else else
fmt = "%s of read-only data-member `%D'"; fmt = "%s of read-only data-member %qD";
(*fn) (fmt, string, TREE_OPERAND (arg, 1)); (*fn) (fmt, string, TREE_OPERAND (arg, 1));
} }
else if (TREE_CODE (arg) == VAR_DECL) else if (TREE_CODE (arg) == VAR_DECL)
...@@ -94,22 +94,22 @@ readonly_error (tree arg, const char* string, int soft) ...@@ -94,22 +94,22 @@ readonly_error (tree arg, const char* string, int soft)
if (DECL_LANG_SPECIFIC (arg) if (DECL_LANG_SPECIFIC (arg)
&& DECL_IN_AGGR_P (arg) && DECL_IN_AGGR_P (arg)
&& !TREE_STATIC (arg)) && !TREE_STATIC (arg))
fmt = "%s of constant field `%D'"; fmt = "%s of constant field %qD";
else else
fmt = "%s of read-only variable `%D'"; fmt = "%s of read-only variable %qD";
(*fn) (fmt, string, arg); (*fn) (fmt, string, arg);
} }
else if (TREE_CODE (arg) == PARM_DECL) else if (TREE_CODE (arg) == PARM_DECL)
(*fn) ("%s of read-only parameter `%D'", string, arg); (*fn) ("%s of read-only parameter %qD", string, arg);
else if (TREE_CODE (arg) == INDIRECT_REF else if (TREE_CODE (arg) == INDIRECT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE && TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE
&& (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL && (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
|| TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL)) || TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
(*fn) ("%s of read-only reference `%D'", string, TREE_OPERAND (arg, 0)); (*fn) ("%s of read-only reference %qD", string, TREE_OPERAND (arg, 0));
else if (TREE_CODE (arg) == RESULT_DECL) else if (TREE_CODE (arg) == RESULT_DECL)
(*fn) ("%s of read-only named return value `%D'", string, arg); (*fn) ("%s of read-only named return value %qD", string, arg);
else if (TREE_CODE (arg) == FUNCTION_DECL) else if (TREE_CODE (arg) == FUNCTION_DECL)
(*fn) ("%s of function `%D'", string, arg); (*fn) ("%s of function %qD", string, arg);
else else
(*fn) ("%s of read-only location", string); (*fn) ("%s of read-only location", string);
} }
...@@ -289,30 +289,30 @@ abstract_virtuals_error (tree decl, tree type) ...@@ -289,30 +289,30 @@ abstract_virtuals_error (tree decl, tree type)
return 0; return 0;
if (TREE_CODE (decl) == VAR_DECL) if (TREE_CODE (decl) == VAR_DECL)
cp_error_at ("cannot declare variable `%+D' to be of abstract " cp_error_at ("cannot declare variable %q+D to be of abstract "
"type `%T'", decl, type); "type %qT", decl, type);
else if (TREE_CODE (decl) == PARM_DECL) else if (TREE_CODE (decl) == PARM_DECL)
cp_error_at ("cannot declare parameter `%+D' to be of abstract " cp_error_at ("cannot declare parameter %q+D to be of abstract "
"type `%T'", decl, type); "type %qT", decl, type);
else if (TREE_CODE (decl) == FIELD_DECL) else if (TREE_CODE (decl) == FIELD_DECL)
cp_error_at ("cannot declare field `%+D' to be of abstract " cp_error_at ("cannot declare field %q+D to be of abstract "
"type `%T'", decl, type); "type %qT", decl, type);
else if (TREE_CODE (decl) == FUNCTION_DECL else if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE) && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
cp_error_at ("invalid abstract return type for member function `%+#D'", cp_error_at ("invalid abstract return type for member function %q+#D",
decl); decl);
else if (TREE_CODE (decl) == FUNCTION_DECL) else if (TREE_CODE (decl) == FUNCTION_DECL)
cp_error_at ("invalid abstract return type for function `%+#D'", cp_error_at ("invalid abstract return type for function %q+#D",
decl); decl);
else if (TREE_CODE (decl) == IDENTIFIER_NODE) else if (TREE_CODE (decl) == IDENTIFIER_NODE)
/* Here we do not have location information, so use error instead /* Here we do not have location information, so use error instead
of cp_error_at. */ of cp_error_at. */
error ("invalid abstract type `%T' for `%E'", type, decl); error ("invalid abstract type %qT for %qE", type, decl);
else else
cp_error_at ("invalid abstract type for `%+D'", decl); cp_error_at ("invalid abstract type for %q+D", decl);
} }
else else
error ("cannot allocate an object of abstract type `%T'", type); error ("cannot allocate an object of abstract type %qT", type);
/* Only go through this once. */ /* Only go through this once. */
if (VEC_length (tree, pure)) if (VEC_length (tree, pure))
...@@ -321,7 +321,7 @@ abstract_virtuals_error (tree decl, tree type) ...@@ -321,7 +321,7 @@ abstract_virtuals_error (tree decl, tree type)
tree fn; tree fn;
inform ("%J because the following virtual functions are pure " inform ("%J because the following virtual functions are pure "
"within `%T':", TYPE_MAIN_DECL (type), type); "within %qT:", TYPE_MAIN_DECL (type), type);
for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++) for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++)
inform ("%J\t%#D", fn, fn); inform ("%J\t%#D", fn, fn);
...@@ -331,7 +331,7 @@ abstract_virtuals_error (tree decl, tree type) ...@@ -331,7 +331,7 @@ abstract_virtuals_error (tree decl, tree type)
VEC_truncate (tree, pure, 0); VEC_truncate (tree, pure, 0);
} }
else else
inform ("%J since type `%T' has pure virtual functions", inform ("%J since type %qT has pure virtual functions",
TYPE_MAIN_DECL (type), type); TYPE_MAIN_DECL (type), type);
return 1; return 1;
...@@ -374,7 +374,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) ...@@ -374,7 +374,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
|| TREE_CODE (value) == PARM_DECL || TREE_CODE (value) == PARM_DECL
|| TREE_CODE (value) == FIELD_DECL)) || TREE_CODE (value) == FIELD_DECL))
{ {
(*p_msg_at) ("`%D' has incomplete type", value); (*p_msg_at) ("%qD has incomplete type", value);
decl = 1; decl = 1;
} }
retry: retry:
...@@ -386,15 +386,15 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) ...@@ -386,15 +386,15 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
case UNION_TYPE: case UNION_TYPE:
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
if (!decl) if (!decl)
(*p_msg) ("invalid use of undefined type `%#T'", type); (*p_msg) ("invalid use of undefined type %q#T", type);
if (!TYPE_TEMPLATE_INFO (type)) if (!TYPE_TEMPLATE_INFO (type))
(*p_msg_at) ("forward declaration of `%#T'", type); (*p_msg_at) ("forward declaration of %q#T", type);
else else
(*p_msg_at) ("declaration of `%#T'", type); (*p_msg_at) ("declaration of %q#T", type);
break; break;
case VOID_TYPE: case VOID_TYPE:
(*p_msg) ("invalid use of `%T'", type); (*p_msg) ("invalid use of %qT", type);
break; break;
case ARRAY_TYPE: case ARRAY_TYPE:
...@@ -408,7 +408,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) ...@@ -408,7 +408,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
case OFFSET_TYPE: case OFFSET_TYPE:
bad_member: bad_member:
(*p_msg) ("invalid use of member (did you forget the `&' ?)"); (*p_msg) ("invalid use of member (did you forget the %<&%> ?)");
break; break;
case TEMPLATE_TYPE_PARM: case TEMPLATE_TYPE_PARM:
...@@ -419,7 +419,8 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) ...@@ -419,7 +419,8 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
if (value && TREE_CODE (value) == COMPONENT_REF) if (value && TREE_CODE (value) == COMPONENT_REF)
goto bad_member; goto bad_member;
else if (value && TREE_CODE (value) == ADDR_EXPR) else if (value && TREE_CODE (value) == ADDR_EXPR)
(*p_msg) ("address of overloaded function with no contextual type information"); (*p_msg) ("address of overloaded function with no contextual "
"type information");
else if (value && TREE_CODE (value) == OVERLOAD) else if (value && TREE_CODE (value) == OVERLOAD)
(*p_msg) ("overloaded function with no contextual type information"); (*p_msg) ("overloaded function with no contextual type information");
else else
...@@ -577,7 +578,8 @@ store_init_value (tree decl, tree init) ...@@ -577,7 +578,8 @@ store_init_value (tree decl, tree init)
if (TREE_CODE (init) == TREE_LIST) if (TREE_CODE (init) == TREE_LIST)
{ {
error ("constructor syntax used, but no constructor declared for type `%T'", type); error ("constructor syntax used, but no constructor declared "
"for type %qT", type);
init = build_constructor (NULL_TREE, nreverse (init)); init = build_constructor (NULL_TREE, nreverse (init));
} }
} }
...@@ -752,10 +754,10 @@ digest_init (tree type, tree init, tree* tail) ...@@ -752,10 +754,10 @@ digest_init (tree type, tree init, tree* tail)
} }
while (BRACE_ENCLOSED_INITIALIZER_P (init)) while (BRACE_ENCLOSED_INITIALIZER_P (init))
{ {
pedwarn ("braces around scalar initializer for `%T'", type); pedwarn ("braces around scalar initializer for %qT", type);
init = CONSTRUCTOR_ELTS (init); init = CONSTRUCTOR_ELTS (init);
if (TREE_CHAIN (init)) if (TREE_CHAIN (init))
pedwarn ("ignoring extra initializers for `%T'", type); pedwarn ("ignoring extra initializers for %qT", type);
init = TREE_VALUE (init); init = TREE_VALUE (init);
} }
...@@ -767,7 +769,7 @@ digest_init (tree type, tree init, tree* tail) ...@@ -767,7 +769,7 @@ digest_init (tree type, tree init, tree* tail)
if (COMPLETE_TYPE_P (type) && ! TREE_CONSTANT (TYPE_SIZE (type))) if (COMPLETE_TYPE_P (type) && ! TREE_CONSTANT (TYPE_SIZE (type)))
{ {
error ("variable-sized object of type `%T' may not be initialized", error ("variable-sized object of type %qT may not be initialized",
type); type);
return error_mark_node; return error_mark_node;
} }
...@@ -778,7 +780,8 @@ digest_init (tree type, tree init, tree* tail) ...@@ -778,7 +780,8 @@ digest_init (tree type, tree init, tree* tail)
{ {
if (TYPE_NON_AGGREGATE_CLASS (type)) if (TYPE_NON_AGGREGATE_CLASS (type))
{ {
error ("subobject of type `%T' must be initialized by constructor, not by `%E'", error ("subobject of type %qT must be initialized by "
"constructor, not by %qE",
type, init); type, init);
return error_mark_node; return error_mark_node;
} }
...@@ -1009,23 +1012,22 @@ process_init_constructor (tree type, tree init, tree* elts) ...@@ -1009,23 +1012,22 @@ process_init_constructor (tree type, tree init, tree* elts)
/* Warn when some struct elements are implicitly initialized. */ /* Warn when some struct elements are implicitly initialized. */
if (warn_missing_field_initializers if (warn_missing_field_initializers
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init))) && (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
warning ("missing initializer for member `%D'", field); warning ("missing initializer for member %qD", field);
} }
else else
{ {
if (TREE_READONLY (field)) if (TREE_READONLY (field))
error ("uninitialized const member `%D'", field); error ("uninitialized const member %qD", field);
else if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (TREE_TYPE (field))) else if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (TREE_TYPE (field)))
error ("member `%D' with uninitialized const fields", error ("member %qD with uninitialized const fields", field);
field);
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE) else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
error ("member `%D' is uninitialized reference", field); error ("member %qD is uninitialized reference", field);
/* Warn when some struct elements are implicitly initialized /* Warn when some struct elements are implicitly initialized
to zero. */ to zero. */
if (warn_missing_field_initializers if (warn_missing_field_initializers
&& (!init || BRACE_ENCLOSED_INITIALIZER_P (init))) && (!init || BRACE_ENCLOSED_INITIALIZER_P (init)))
warning ("missing initializer for member `%D'", field); warning ("missing initializer for member %qD", field);
if (! zero_init_p (TREE_TYPE (field))) if (! zero_init_p (TREE_TYPE (field)))
next1 = build_zero_init (TREE_TYPE (field), next1 = build_zero_init (TREE_TYPE (field),
...@@ -1078,16 +1080,16 @@ process_init_constructor (tree type, tree init, tree* elts) ...@@ -1078,16 +1080,16 @@ process_init_constructor (tree type, tree init, tree* elts)
if (temp) if (temp)
field = temp, win = 1; field = temp, win = 1;
else else
error ("no field `%D' in union being initialized", error ("no field %qD in union being initialized",
TREE_PURPOSE (tail)); TREE_PURPOSE (tail));
} }
if (!win) if (!win)
TREE_VALUE (tail) = error_mark_node; TREE_VALUE (tail) = error_mark_node;
} }
else if (field == 0) else if (field == 0)
{ {
error ("union `%T' with no named members cannot be initialized", error ("union %qT with no named members cannot be initialized",
type); type);
TREE_VALUE (tail) = error_mark_node; TREE_VALUE (tail) = error_mark_node;
} }
...@@ -1248,7 +1250,7 @@ build_x_arrow (tree expr) ...@@ -1248,7 +1250,7 @@ build_x_arrow (tree expr)
if (last_rval == NULL_TREE) if (last_rval == NULL_TREE)
{ {
error ("base operand of `->' has non-pointer type `%T'", type); error ("base operand of %<->%> has non-pointer type %qT", type);
return error_mark_node; return error_mark_node;
} }
...@@ -1272,9 +1274,9 @@ build_x_arrow (tree expr) ...@@ -1272,9 +1274,9 @@ build_x_arrow (tree expr)
} }
if (types_memoized) if (types_memoized)
error ("result of `operator->()' yields non-pointer result"); error ("result of %<operator->()%> yields non-pointer result");
else else
error ("base operand of `->' is not a pointer"); error ("base operand of %<->%> is not a pointer");
return error_mark_node; return error_mark_node;
} }
...@@ -1298,7 +1300,8 @@ build_m_component_ref (tree datum, tree component) ...@@ -1298,7 +1300,8 @@ build_m_component_ref (tree datum, tree component)
ptrmem_type = TREE_TYPE (component); ptrmem_type = TREE_TYPE (component);
if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type)) if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type))
{ {
error ("`%E' cannot be used as a member pointer, since it is of type `%T'", error ("%qE cannot be used as a member pointer, since it is of "
"type %qT",
component, ptrmem_type); component, ptrmem_type);
return error_mark_node; return error_mark_node;
} }
...@@ -1306,8 +1309,9 @@ build_m_component_ref (tree datum, tree component) ...@@ -1306,8 +1309,9 @@ build_m_component_ref (tree datum, tree component)
objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum)); objtype = TYPE_MAIN_VARIANT (TREE_TYPE (datum));
if (! IS_AGGR_TYPE (objtype)) if (! IS_AGGR_TYPE (objtype))
{ {
error ("cannot apply member pointer `%E' to `%E', which is of non-aggregate type `%T'", error ("cannot apply member pointer %qE to %qE, which is of "
component, datum, objtype); "non-aggregate type %qT",
component, datum, objtype);
return error_mark_node; return error_mark_node;
} }
...@@ -1327,7 +1331,8 @@ build_m_component_ref (tree datum, tree component) ...@@ -1327,7 +1331,8 @@ build_m_component_ref (tree datum, tree component)
if (!binfo) if (!binfo)
{ {
mismatch: mismatch:
error ("pointer to member type `%T' incompatible with object type `%T'", error ("pointer to member type %qT incompatible with object "
"type %qT",
type, objtype); type, objtype);
return error_mark_node; return error_mark_node;
} }
...@@ -1549,10 +1554,10 @@ require_complete_eh_spec_types (tree fntype, tree decl) ...@@ -1549,10 +1554,10 @@ require_complete_eh_spec_types (tree fntype, tree decl)
{ {
if (decl) if (decl)
error error
("call to function `%D' which throws incomplete type `%#T'", ("call to function %qD which throws incomplete type %q#T",
decl, type); decl, type);
else else
error ("call to function which throws incomplete type `%#T'", error ("call to function which throws incomplete type %q#T",
decl); decl);
} }
} }
......
2004-10-10 Gabriel Dos Reis <gdr@integrable-solutions.net>
* g++.dg/overload/pmf1.C: Adjust quoting marks.
* g++.dg/warn/incomplete1.C: Likewise.
* g++.dg/template/qualttp20.C: Likewise.
2004-10-10 Joseph S. Myers <jsm@polyomino.org.uk> 2004-10-10 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/17881 PR c/17881
......
...@@ -17,5 +17,5 @@ void f (C) {} // even though this would be well-formed ...@@ -17,5 +17,5 @@ void f (C) {} // even though this would be well-formed
int main () int main ()
{ {
f (aip); // { dg-error "`A' is an inaccessible base of `B'" "" } f (aip); // { dg-error "'A' is an inaccessible base of 'B'" "" }
} }
...@@ -15,8 +15,8 @@ struct AS ...@@ -15,8 +15,8 @@ struct AS
template <typename T> struct B1 : T template <typename T> struct B1 : T
{ {
typedef typename T::L __restrict__ r;// { dg-error "`__restrict__' qualifiers cannot" "" } typedef typename T::L __restrict__ r;// { dg-error "'__restrict__' qualifiers cannot" "" }
typedef typename T::myT __restrict__ p;// { dg-warning "ignoring `__restrict__'" "" { xfail *-*-* } } typedef typename T::myT __restrict__ p;// { dg-warning "ignoring '__restrict__'" "" { xfail *-*-* } }
// The following are DR 295 dependent // The following are DR 295 dependent
typedef typename T::myT volatile *myvolatile; typedef typename T::myT volatile *myvolatile;
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
// (But the deletion does not constitute an ill-formed program. So the // (But the deletion does not constitute an ill-formed program. So the
// program should nevertheless compile, but it should give a warning.) // program should nevertheless compile, but it should give a warning.)
class A; // { dg-warning "forward declaration of `struct A'" "" } class A; // { dg-warning "forward declaration of 'struct A'" "" }
A *a; // { dg-warning "`a' has incomplete type" "" } A *a; // { dg-warning "'a' has incomplete type" "" }
int int
main (int argc, char **argv) main (int argc, char **argv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment