Commit 2d01edd7 by Gabriel Dos Reis Committed by Gabriel Dos Reis

Convert diagnostics to use quoting flag q 3/n

cp/
        Convert diagnostics to use quoting flag q 3/n
        * decl.c (pop_label, duplicate_decls,
        redeclaration_error_message,
        redeclaration_error_message, lookup_label, check_goto,
        make_typename_type, make_unbound_class_template,
        fixup_anonymous_aggr, check_tag_decl, start_decl,
        start_decl_1,
        grok_reference_init, layout_var_decl, maybe_commonize_var,
        check_for_uninitialized_const_var, reshape_init_array,
        reshape_init, check_initializer, cp_finish_decl,
        member_function_or_else, bad_specifiers, grokfndecl,
        grokvardecl,
        check_static_variable_definition, compute_array_index_type,
        create_array_type_for_decl,
        check_special_function_return_type,
        grokdeclarator, check_default_argument, grokparms,
        grok_ctor_properties, grok_op_properties,
        check_elaborated_type_specifier, xref_tag, finish_enum,
        build_enumerator, check_function_type,
        start_preparsed_function,
        store_parm_decls): Use quoting formats.
        * decl2.c (grok_array_decl, delete_sanity,
        check_member_template,
        check_java_method, check_classfn,
        finish_static_data_member_decl,
        grokfield, grokbitfield, grok_function_init,
        build_anon_union_vars, coerce_new_type, coerce_delete_type,
        check_default_args): Likewise.
        * parser.c (cp_parser_decl_specifier_seq): Likewise.

testsuite/
        * g++.dg/template/local1.C: Adjust quoting marks in
        testing for diagnostics.
        * g++.dg/tls/diag-2.C: Likewise.
        * g++.dg/other/error8.C: Likewise.

From-SVN: r88478
parent b9e6959b
2004-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net> 2004-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert diagnostics to use quoting flag q 3/n
* decl.c (pop_label, duplicate_decls, redeclaration_error_message,
redeclaration_error_message, lookup_label, check_goto,
make_typename_type, make_unbound_class_template,
fixup_anonymous_aggr, check_tag_decl, start_decl, start_decl_1,
grok_reference_init, layout_var_decl, maybe_commonize_var,
check_for_uninitialized_const_var, reshape_init_array,
reshape_init, check_initializer, cp_finish_decl,
member_function_or_else, bad_specifiers, grokfndecl, grokvardecl,
check_static_variable_definition, compute_array_index_type,
create_array_type_for_decl, check_special_function_return_type,
grokdeclarator, check_default_argument, grokparms,
grok_ctor_properties, grok_op_properties,
check_elaborated_type_specifier, xref_tag, finish_enum,
build_enumerator, check_function_type, start_preparsed_function,
store_parm_decls): Use quoting formats.
* decl2.c (grok_array_decl, delete_sanity, check_member_template,
check_java_method, check_classfn, finish_static_data_member_decl,
grokfield, grokbitfield, grok_function_init,
build_anon_union_vars, coerce_new_type, coerce_delete_type,
check_default_args): Likewise.
* parser.c (cp_parser_decl_specifier_seq): Likewise.
2004-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert diagnostics to use quoting flag q 2/n Convert diagnostics to use quoting flag q 2/n
* class.c (build_base_path, add_method, alter_access, * class.c (build_base_path, add_method, alter_access,
handle_using_decl, check_bases, handle_using_decl, check_bases,
......
...@@ -364,7 +364,7 @@ pop_label (tree label, tree old_value) ...@@ -364,7 +364,7 @@ pop_label (tree label, tree old_value)
{ {
location_t location; location_t location;
cp_error_at ("label `%D' used but not defined", label); cp_error_at ("label %qD used but not defined", label);
#ifdef USE_MAPPED_LOCATION #ifdef USE_MAPPED_LOCATION
location = input_location; /* FIXME want (input_filename, (line)0) */ location = input_location; /* FIXME want (input_filename, (line)0) */
#else #else
...@@ -375,7 +375,7 @@ pop_label (tree label, tree old_value) ...@@ -375,7 +375,7 @@ pop_label (tree label, tree old_value)
define_label (location, DECL_NAME (label)); define_label (location, DECL_NAME (label));
} }
else if (warn_unused_label && !TREE_USED (label)) else if (warn_unused_label && !TREE_USED (label))
cp_warning_at ("label `%D' defined but not used", label); cp_warning_at ("label %qD defined but not used", label);
} }
SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), old_value); SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), old_value);
...@@ -571,7 +571,7 @@ poplevel (int keep, int reverse, int functionbody) ...@@ -571,7 +571,7 @@ poplevel (int keep, int reverse, int functionbody)
&& ! TREE_USED (decl) && ! TREE_USED (decl)
&& ! DECL_IN_SYSTEM_HEADER (decl) && ! DECL_IN_SYSTEM_HEADER (decl)
&& DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl)) && DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
warning ("%Junused variable '%D'", decl, decl); warning ("%Junused variable %qD", decl, decl);
/* Remove declarations for all the DECLs in this level. */ /* Remove declarations for all the DECLs in this level. */
for (link = decls; link; link = TREE_CHAIN (link)) for (link = decls; link; link = TREE_CHAIN (link))
...@@ -1134,8 +1134,8 @@ warn_extern_redeclared_static (tree newdecl, tree olddecl) ...@@ -1134,8 +1134,8 @@ warn_extern_redeclared_static (tree newdecl, tree olddecl)
return; return;
name = DECL_ASSEMBLER_NAME (newdecl); name = DECL_ASSEMBLER_NAME (newdecl);
pedwarn ("`%D' was declared `extern' and later `static'", newdecl); pedwarn ("%qD was declared %<extern%> and later %<static%>", newdecl);
cp_pedwarn_at ("previous declaration of `%D'", olddecl); cp_pedwarn_at ("previous declaration of %qD", olddecl);
} }
/* If NEWDECL is a redeclaration of OLDDECL, merge the declarations. /* If NEWDECL is a redeclaration of OLDDECL, merge the declarations.
...@@ -1183,17 +1183,17 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1183,17 +1183,17 @@ duplicate_decls (tree newdecl, tree olddecl)
&& DECL_UNINLINABLE (olddecl) && DECL_UNINLINABLE (olddecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl))) && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
{ {
warning ("%Jfunction '%D' redeclared as inline", newdecl, newdecl); warning ("%Jfunction %qD redeclared as inline", newdecl, newdecl);
warning ("%Jprevious declaration of '%D' with attribute noinline", warning ("%Jprevious declaration of %qD with attribute noinline",
olddecl, olddecl); olddecl, olddecl);
} }
else if (DECL_DECLARED_INLINE_P (olddecl) else if (DECL_DECLARED_INLINE_P (olddecl)
&& DECL_UNINLINABLE (newdecl) && DECL_UNINLINABLE (newdecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl))) && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
{ {
warning ("%Jfunction '%D' redeclared with attribute noinline", warning ("%Jfunction %qD redeclared with attribute noinline",
newdecl, newdecl); newdecl, newdecl);
warning ("%Jprevious declaration of '%D' was inline", warning ("%Jprevious declaration of %qD was inline",
olddecl, olddecl); olddecl, olddecl);
} }
} }
...@@ -1214,22 +1214,22 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1214,22 +1214,22 @@ duplicate_decls (tree newdecl, tree olddecl)
if (! TREE_PUBLIC (newdecl)) if (! TREE_PUBLIC (newdecl))
{ {
if (warn_shadow) if (warn_shadow)
warning ("shadowing %s function `%#D'", warning ("shadowing %s function %q#D",
DECL_BUILT_IN (olddecl) ? "built-in" : "library", DECL_BUILT_IN (olddecl) ? "built-in" : "library",
olddecl); olddecl);
/* Discard the old built-in function. */ /* Discard the old built-in function. */
return NULL_TREE; return NULL_TREE;
} }
/* If the built-in is not ansi, then programs can override /* If the built-in is not ansi, then programs can override
it even globally without an error. */ it even globally without an error. */
else if (! DECL_BUILT_IN (olddecl)) else if (! DECL_BUILT_IN (olddecl))
warning ("library function `%#D' redeclared as non-function `%#D'", warning ("library function %q#D redeclared as non-function %q#D",
olddecl, newdecl); olddecl, newdecl);
else else
{ {
error ("declaration of `%#D'", newdecl); error ("declaration of %q#D", newdecl);
error ("conflicts with built-in declaration `%#D'", error ("conflicts with built-in declaration %q#D",
olddecl); olddecl);
} }
return NULL_TREE; return NULL_TREE;
} }
...@@ -1280,14 +1280,14 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1280,14 +1280,14 @@ duplicate_decls (tree newdecl, tree olddecl)
if (TREE_PUBLIC (newdecl)) if (TREE_PUBLIC (newdecl))
{ {
warning ("new declaration `%#D'", newdecl); warning ("new declaration %q#D", newdecl);
warning ("ambiguates built-in declaration `%#D'", warning ("ambiguates built-in declaration %q#D",
olddecl); olddecl);
} }
else if (warn_shadow) else if (warn_shadow)
warning ("shadowing %s function `%#D'", warning ("shadowing %s function %q#D",
DECL_BUILT_IN (olddecl) ? "built-in" : "library", DECL_BUILT_IN (olddecl) ? "built-in" : "library",
olddecl); olddecl);
} }
else else
/* Discard the old built-in function. */ /* Discard the old built-in function. */
...@@ -1352,10 +1352,10 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1352,10 +1352,10 @@ duplicate_decls (tree newdecl, tree olddecl)
&& DECL_FUNCTION_TEMPLATE_P (newdecl))) && DECL_FUNCTION_TEMPLATE_P (newdecl)))
return NULL_TREE; return NULL_TREE;
error ("`%#D' redeclared as different kind of symbol", newdecl); error ("%q#D redeclared as different kind of symbol", newdecl);
if (TREE_CODE (olddecl) == TREE_LIST) if (TREE_CODE (olddecl) == TREE_LIST)
olddecl = TREE_VALUE (olddecl); olddecl = TREE_VALUE (olddecl);
cp_error_at ("previous declaration of `%#D'", olddecl); cp_error_at ("previous declaration of %q#D", olddecl);
return error_mark_node; return error_mark_node;
} }
...@@ -1374,8 +1374,8 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1374,8 +1374,8 @@ duplicate_decls (tree newdecl, tree olddecl)
if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL
|| TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL) || TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
{ {
error ("declaration of template `%#D'", newdecl); error ("declaration of template %q#D", newdecl);
cp_error_at ("conflicts with previous declaration `%#D'", cp_error_at ("conflicts with previous declaration %q#D",
olddecl); olddecl);
} }
else if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL else if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL
...@@ -1389,8 +1389,8 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1389,8 +1389,8 @@ duplicate_decls (tree newdecl, tree olddecl)
&& same_type_p (TREE_TYPE (TREE_TYPE (newdecl)), && same_type_p (TREE_TYPE (TREE_TYPE (newdecl)),
TREE_TYPE (TREE_TYPE (olddecl)))) TREE_TYPE (TREE_TYPE (olddecl))))
{ {
error ("new declaration `%#D'", newdecl); error ("new declaration %q#D", newdecl);
cp_error_at ("ambiguates old declaration `%#D'", olddecl); cp_error_at ("ambiguates old declaration %q#D", olddecl);
} }
return NULL_TREE; return NULL_TREE;
} }
...@@ -1398,23 +1398,23 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1398,23 +1398,23 @@ duplicate_decls (tree newdecl, tree olddecl)
{ {
if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl))
{ {
error ("declaration of C function `%#D' conflicts with", error ("declaration of C function %q#D conflicts with",
newdecl); newdecl);
cp_error_at ("previous declaration `%#D' here", olddecl); cp_error_at ("previous declaration %q#D here", olddecl);
} }
else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
{ {
error ("new declaration `%#D'", newdecl); error ("new declaration %q#D", newdecl);
cp_error_at ("ambiguates old declaration `%#D'", olddecl); cp_error_at ("ambiguates old declaration %q#D", olddecl);
} }
else else
return NULL_TREE; return NULL_TREE;
} }
else else
{ {
error ("conflicting declaration '%#D'", newdecl); error ("conflicting declaration %q#D", newdecl);
cp_error_at ("'%D' has a previous declaration as `%#D'", cp_error_at ("%qD has a previous declaration as %q#D",
olddecl, olddecl); olddecl, olddecl);
return NULL_TREE; return NULL_TREE;
} }
...@@ -1467,8 +1467,8 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1467,8 +1467,8 @@ duplicate_decls (tree newdecl, tree olddecl)
A namespace-name defined at global scope shall not be A namespace-name defined at global scope shall not be
declared as the name of any other entity in any global scope declared as the name of any other entity in any global scope
of the program. */ of the program. */
error ("declaration of `namespace %D' conflicts with", newdecl); error ("declaration of namespace %qD conflicts with", newdecl);
cp_error_at ("previous declaration of `namespace %D' here", olddecl); cp_error_at ("previous declaration of namespace %qD here", olddecl);
return error_mark_node; return error_mark_node;
} }
else else
...@@ -1480,8 +1480,8 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1480,8 +1480,8 @@ duplicate_decls (tree newdecl, tree olddecl)
if (DECL_NAME (olddecl) != NULL_TREE) if (DECL_NAME (olddecl) != NULL_TREE)
cp_error_at ((DECL_INITIAL (olddecl) cp_error_at ((DECL_INITIAL (olddecl)
&& namespace_bindings_p ()) && namespace_bindings_p ())
? "`%#D' previously defined here" ? "%q#D previously defined here"
: "`%#D' previously declared here", olddecl); : "%q#D previously declared here", olddecl);
return error_mark_node; return error_mark_node;
} }
else if (TREE_CODE (olddecl) == FUNCTION_DECL else if (TREE_CODE (olddecl) == FUNCTION_DECL
...@@ -1490,7 +1490,7 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1490,7 +1490,7 @@ duplicate_decls (tree newdecl, tree olddecl)
&& TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != NULL_TREE) && TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != NULL_TREE)
{ {
/* Prototype decl follows defn w/o prototype. */ /* Prototype decl follows defn w/o prototype. */
cp_warning_at ("prototype for `%#D'", newdecl); cp_warning_at ("prototype for %q#D", newdecl);
warning ("%Jfollows non-prototype definition here", olddecl); warning ("%Jfollows non-prototype definition here", olddecl);
} }
else if (TREE_CODE (olddecl) == FUNCTION_DECL else if (TREE_CODE (olddecl) == FUNCTION_DECL
...@@ -1503,10 +1503,10 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1503,10 +1503,10 @@ duplicate_decls (tree newdecl, tree olddecl)
SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl)); SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
else else
{ {
cp_error_at ("previous declaration of `%#D' with %L linkage", cp_error_at ("previous declaration of %q#D with %qL linkage",
olddecl, DECL_LANGUAGE (olddecl)); olddecl, DECL_LANGUAGE (olddecl));
error ("conflicts with new declaration with %L linkage", error ("conflicts with new declaration with %qL linkage",
DECL_LANGUAGE (newdecl)); DECL_LANGUAGE (newdecl));
} }
} }
...@@ -1528,16 +1528,16 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1528,16 +1528,16 @@ duplicate_decls (tree newdecl, tree olddecl)
if (1 == simple_cst_equal (TREE_PURPOSE (t1), if (1 == simple_cst_equal (TREE_PURPOSE (t1),
TREE_PURPOSE (t2))) TREE_PURPOSE (t2)))
{ {
pedwarn ("default argument given for parameter %d of `%#D'", pedwarn ("default argument given for parameter %d of %q#D",
i, newdecl); i, newdecl);
cp_pedwarn_at ("after previous specification in `%#D'", cp_pedwarn_at ("after previous specification in %q#D",
olddecl); olddecl);
} }
else else
{ {
error ("default argument given for parameter %d of `%#D'", error ("default argument given for parameter %d of %q#D",
i, newdecl); i, newdecl);
cp_error_at ("after previous specification in `%#D'", cp_error_at ("after previous specification in %q#D",
olddecl); olddecl);
} }
} }
...@@ -1546,7 +1546,7 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1546,7 +1546,7 @@ duplicate_decls (tree newdecl, tree olddecl)
&& ! DECL_DECLARED_INLINE_P (olddecl) && ! DECL_DECLARED_INLINE_P (olddecl)
&& TREE_ADDRESSABLE (olddecl) && warn_inline) && TREE_ADDRESSABLE (olddecl) && warn_inline)
{ {
warning ("`%#D' was used before it was declared inline", newdecl); warning ("%q#D was used before it was declared inline", newdecl);
warning ("%Jprevious non-inline declaration here", olddecl); warning ("%Jprevious non-inline declaration here", olddecl);
} }
} }
...@@ -1599,8 +1599,8 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1599,8 +1599,8 @@ duplicate_decls (tree newdecl, tree olddecl)
/* Don't warn about friends, let add_friend take care of it. */ /* Don't warn about friends, let add_friend take care of it. */
&& ! (DECL_FRIEND_P (newdecl) || DECL_FRIEND_P (olddecl))) && ! (DECL_FRIEND_P (newdecl) || DECL_FRIEND_P (olddecl)))
{ {
warning ("redundant redeclaration of `%D' in same scope", newdecl); warning ("redundant redeclaration of %qD in same scope", newdecl);
cp_warning_at ("previous declaration of `%D'", olddecl); cp_warning_at ("previous declaration of %qD", olddecl);
} }
} }
...@@ -1693,9 +1693,9 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1693,9 +1693,9 @@ duplicate_decls (tree newdecl, tree olddecl)
&& !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)), && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)),
TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1)) TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1))
{ {
error ("declaration of `%F' throws different exceptions", error ("declaration of %qF throws different exceptions",
newdecl); newdecl);
cp_error_at ("than previous declaration `%F'", olddecl); cp_error_at ("than previous declaration %qF", olddecl);
} }
} }
TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype; TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype;
...@@ -1927,7 +1927,7 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -1927,7 +1927,7 @@ duplicate_decls (tree newdecl, tree olddecl)
&& DECL_VISIBILITY_SPECIFIED (newdecl) && DECL_VISIBILITY_SPECIFIED (newdecl)
&& DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl)) && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
{ {
warning ("%J'%D': visibility attribute ignored because it", warning ("%J%qD: visibility attribute ignored because it",
newdecl, newdecl); newdecl, newdecl);
warning ("%Jconflicts with previous declaration here", olddecl); warning ("%Jconflicts with previous declaration here", olddecl);
} }
...@@ -2019,7 +2019,7 @@ redeclaration_error_message (tree newdecl, tree olddecl) ...@@ -2019,7 +2019,7 @@ redeclaration_error_message (tree newdecl, tree olddecl)
if (same_type_p (TREE_TYPE (newdecl), TREE_TYPE (olddecl))) if (same_type_p (TREE_TYPE (newdecl), TREE_TYPE (olddecl)))
return 0; return 0;
else else
return "redefinition of `%#D'"; return "redefinition of %q#D";
} }
else if (TREE_CODE (newdecl) == FUNCTION_DECL) else if (TREE_CODE (newdecl) == FUNCTION_DECL)
{ {
...@@ -2033,7 +2033,7 @@ redeclaration_error_message (tree newdecl, tree olddecl) ...@@ -2033,7 +2033,7 @@ redeclaration_error_message (tree newdecl, tree olddecl)
a redeclaration - this is a conflict with a used function. */ a redeclaration - this is a conflict with a used function. */
if (DECL_NAMESPACE_SCOPE_P (olddecl) if (DECL_NAMESPACE_SCOPE_P (olddecl)
&& DECL_CONTEXT (olddecl) != DECL_CONTEXT (newdecl)) && DECL_CONTEXT (olddecl) != DECL_CONTEXT (newdecl))
return "`%D' conflicts with used function"; return "%qD conflicts with used function";
/* We'll complain about linkage mismatches in /* We'll complain about linkage mismatches in
warn_extern_redeclared_static. */ warn_extern_redeclared_static. */
...@@ -2043,9 +2043,9 @@ redeclaration_error_message (tree newdecl, tree olddecl) ...@@ -2043,9 +2043,9 @@ redeclaration_error_message (tree newdecl, tree olddecl)
&& DECL_INITIAL (newdecl) != NULL_TREE) && DECL_INITIAL (newdecl) != NULL_TREE)
{ {
if (DECL_NAME (olddecl) == NULL_TREE) if (DECL_NAME (olddecl) == NULL_TREE)
return "`%#D' not declared in class"; return "%q#D not declared in class";
else else
return "redefinition of `%#D'"; return "redefinition of %q#D";
} }
return 0; return 0;
} }
...@@ -2057,7 +2057,7 @@ redeclaration_error_message (tree newdecl, tree olddecl) ...@@ -2057,7 +2057,7 @@ redeclaration_error_message (tree newdecl, tree olddecl)
{ {
if (COMPLETE_TYPE_P (TREE_TYPE (newdecl)) if (COMPLETE_TYPE_P (TREE_TYPE (newdecl))
&& COMPLETE_TYPE_P (TREE_TYPE (olddecl))) && COMPLETE_TYPE_P (TREE_TYPE (olddecl)))
return "redefinition of `%#D'"; return "redefinition of %q#D";
return NULL; return NULL;
} }
...@@ -2073,7 +2073,7 @@ redeclaration_error_message (tree newdecl, tree olddecl) ...@@ -2073,7 +2073,7 @@ redeclaration_error_message (tree newdecl, tree olddecl)
if (DECL_TEMPLATE_INFO (ot)) if (DECL_TEMPLATE_INFO (ot))
ot = DECL_TEMPLATE_RESULT (template_for_substitution (ot)); ot = DECL_TEMPLATE_RESULT (template_for_substitution (ot));
if (DECL_INITIAL (nt) && DECL_INITIAL (ot)) if (DECL_INITIAL (nt) && DECL_INITIAL (ot))
return "redefinition of `%#D'"; return "redefinition of %q#D";
return NULL; return NULL;
} }
...@@ -2084,7 +2084,7 @@ redeclaration_error_message (tree newdecl, tree olddecl) ...@@ -2084,7 +2084,7 @@ redeclaration_error_message (tree newdecl, tree olddecl)
if (DECL_EXTERNAL (newdecl) || DECL_EXTERNAL (olddecl)) if (DECL_EXTERNAL (newdecl) || DECL_EXTERNAL (olddecl))
return 0; return 0;
/* Reject two definitions. */ /* Reject two definitions. */
return "redefinition of `%#D'"; return "redefinition of %q#D";
} }
else else
{ {
...@@ -2092,7 +2092,7 @@ redeclaration_error_message (tree newdecl, tree olddecl) ...@@ -2092,7 +2092,7 @@ redeclaration_error_message (tree newdecl, tree olddecl)
/* Reject two definitions, and reject a definition /* Reject two definitions, and reject a definition
together with an external reference. */ together with an external reference. */
if (!(DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl))) if (!(DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl)))
return "redeclaration of `%#D'"; return "redeclaration of %q#D";
return 0; return 0;
} }
} }
...@@ -2157,7 +2157,7 @@ lookup_label (tree id) ...@@ -2157,7 +2157,7 @@ lookup_label (tree id)
/* You can't use labels at global scope. */ /* You can't use labels at global scope. */
if (current_function_decl == NULL_TREE) if (current_function_decl == NULL_TREE)
{ {
error ("label `%E' referenced outside of any function", id); error ("label %qE referenced outside of any function", id);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
} }
...@@ -2253,7 +2253,7 @@ check_previous_goto_1 (tree decl, ...@@ -2253,7 +2253,7 @@ check_previous_goto_1 (tree decl,
if (! identified) if (! identified)
{ {
if (decl) if (decl)
pedwarn ("jump to label `%D'", decl); pedwarn ("jump to label %qD", decl);
else else
pedwarn ("jump to case label"); pedwarn ("jump to case label");
...@@ -2263,10 +2263,10 @@ check_previous_goto_1 (tree decl, ...@@ -2263,10 +2263,10 @@ check_previous_goto_1 (tree decl,
} }
if (problem > 1) if (problem > 1)
cp_error_at (" crosses initialization of `%#D'", cp_error_at (" crosses initialization of %q#D",
new_decls); new_decls);
else else
cp_pedwarn_at (" enters scope of non-POD `%#D'", cp_pedwarn_at (" enters scope of non-POD %q#D",
new_decls); new_decls);
} }
...@@ -2277,7 +2277,7 @@ check_previous_goto_1 (tree decl, ...@@ -2277,7 +2277,7 @@ check_previous_goto_1 (tree decl,
if (! identified) if (! identified)
{ {
if (decl) if (decl)
pedwarn ("jump to label `%D'", decl); pedwarn ("jump to label %qD", decl);
else else
pedwarn ("jump to case label"); pedwarn ("jump to case label");
...@@ -2365,7 +2365,7 @@ check_goto (tree decl) ...@@ -2365,7 +2365,7 @@ check_goto (tree decl)
if ((lab->in_try_scope || lab->in_catch_scope || lab->bad_decls) if ((lab->in_try_scope || lab->in_catch_scope || lab->bad_decls)
&& !identified) && !identified)
{ {
cp_pedwarn_at ("jump to label `%D'", decl); cp_pedwarn_at ("jump to label %qD", decl);
pedwarn (" from here"); pedwarn (" from here");
identified = 1; identified = 1;
} }
...@@ -2379,9 +2379,9 @@ check_goto (tree decl) ...@@ -2379,9 +2379,9 @@ check_goto (tree decl)
/* Can't skip init of __exception_info. */ /* Can't skip init of __exception_info. */
error ("%J enters catch block", b); error ("%J enters catch block", b);
else if (u > 1) else if (u > 1)
cp_error_at (" skips initialization of `%#D'", b); cp_error_at (" skips initialization of %q#D", b);
else else
cp_pedwarn_at (" enters scope of non-POD `%#D'", b); cp_pedwarn_at (" enters scope of non-POD %q#D", b);
} }
if (lab->in_try_scope) if (lab->in_try_scope)
...@@ -2647,7 +2647,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) ...@@ -2647,7 +2647,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
} }
if (TREE_CODE (name) == TEMPLATE_DECL) if (TREE_CODE (name) == TEMPLATE_DECL)
{ {
error ("`%D' used without template parameters", name); error ("%qD used without template parameters", name);
return error_mark_node; return error_mark_node;
} }
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
...@@ -2657,8 +2657,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) ...@@ -2657,8 +2657,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
/* We can get here from typename_sub0 in the explicit_template_type /* We can get here from typename_sub0 in the explicit_template_type
expansion. Just fail. */ expansion. Just fail. */
if (complain & tf_error) if (complain & tf_error)
error ("no class template named `%#T' in `%#T'", error ("no class template named %q#T in %q#T", name, context);
name, context);
return error_mark_node; return error_mark_node;
} }
...@@ -2673,8 +2672,8 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) ...@@ -2673,8 +2672,8 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
{ {
if (complain & tf_error) if (complain & tf_error)
error ("no class template named `%#T' in `%#T'", error ("no class template named %q#T in %q#T",
name, context); name, context);
return error_mark_node; return error_mark_node;
} }
...@@ -2694,7 +2693,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) ...@@ -2694,7 +2693,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
if (!IS_AGGR_TYPE (context)) if (!IS_AGGR_TYPE (context))
{ {
if (complain & tf_error) if (complain & tf_error)
error ("no type named `%#T' in `%#T'", name, context); error ("no type named %q#T in %q#T", name, context);
return error_mark_node; return error_mark_node;
} }
...@@ -2704,7 +2703,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) ...@@ -2704,7 +2703,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
if (TREE_CODE (t) != TYPE_DECL) if (TREE_CODE (t) != TYPE_DECL)
{ {
if (complain & tf_error) if (complain & tf_error)
error ("no type named `%#T' in `%#T'", name, context); error ("no type named %q#T in %q#T", name, context);
return error_mark_node; return error_mark_node;
} }
...@@ -2724,7 +2723,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) ...@@ -2724,7 +2723,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
if (!dependent_type_p (context)) if (!dependent_type_p (context))
{ {
if (complain & tf_error) if (complain & tf_error)
error ("no type named `%#T' in `%#T'", name, context); error ("no type named %q#T in %q#T", name, context);
return error_mark_node; return error_mark_node;
} }
...@@ -2760,7 +2759,7 @@ make_unbound_class_template (tree context, tree name, tsubst_flags_t complain) ...@@ -2760,7 +2759,7 @@ make_unbound_class_template (tree context, tree name, tsubst_flags_t complain)
if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
{ {
if (complain & tf_error) if (complain & tf_error)
error ("no class template named `%#T' in `%#T'", name, context); error ("no class template named %q#T in %q#T", name, context);
return error_mark_node; return error_mark_node;
} }
...@@ -3448,13 +3447,16 @@ fixup_anonymous_aggr (tree t) ...@@ -3448,13 +3447,16 @@ fixup_anonymous_aggr (tree t)
if (CLASS_TYPE_P (type)) if (CLASS_TYPE_P (type))
{ {
if (TYPE_NEEDS_CONSTRUCTING (type)) if (TYPE_NEEDS_CONSTRUCTING (type))
cp_error_at ("member %#D' with constructor not allowed in anonymous aggregate", cp_error_at ("member %q#D with constructor not allowed "
"in anonymous aggregate",
field); field);
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)) if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
cp_error_at ("member %#D' with destructor not allowed in anonymous aggregate", cp_error_at ("member %q#D with destructor not allowed "
"in anonymous aggregate",
field); field);
if (TYPE_HAS_COMPLEX_ASSIGN_REF (type)) if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
cp_error_at ("member %#D' with copy assignment operator not allowed in anonymous aggregate", cp_error_at ("member %q#D with copy assignment operator "
"not allowed in anonymous aggregate",
field); field);
} }
} }
...@@ -3534,15 +3536,15 @@ check_tag_decl (cp_decl_specifier_seq *declspecs) ...@@ -3534,15 +3536,15 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
{ {
if (declspecs->specs[(int)ds_inline] if (declspecs->specs[(int)ds_inline]
|| declspecs->specs[(int)ds_virtual]) || declspecs->specs[(int)ds_virtual])
error ("`%s' can only be specified for functions", error ("%qs can only be specified for functions",
declspecs->specs[(int)ds_inline] declspecs->specs[(int)ds_inline]
? "inline" : "virtual"); ? "inline" : "virtual");
else if (saw_friend else if (saw_friend
&& (!current_class_type && (!current_class_type
|| current_scope () != current_class_type)) || current_scope () != current_class_type))
error ("`friend' can only be specified inside a class"); error ("%<friend%> can only be specified inside a class");
else if (declspecs->specs[(int)ds_explicit]) else if (declspecs->specs[(int)ds_explicit])
error ("`explicit' can only be specified for constructors"); error ("%<explicit%> can only be specified for constructors");
else if (declspecs->storage_class) else if (declspecs->storage_class)
error ("a storage class can only be specified for objects " error ("a storage class can only be specified for objects "
"and functions"); "and functions");
...@@ -3688,12 +3690,12 @@ start_decl (const cp_declarator *declarator, ...@@ -3688,12 +3690,12 @@ start_decl (const cp_declarator *declarator,
switch (TREE_CODE (decl)) switch (TREE_CODE (decl))
{ {
case TYPE_DECL: case TYPE_DECL:
error ("typedef `%D' is initialized (use __typeof__ instead)", decl); error ("typedef %qD is initialized (use __typeof__ instead)", decl);
initialized = 0; initialized = 0;
break; break;
case FUNCTION_DECL: case FUNCTION_DECL:
error ("function `%#D' is initialized like a variable", decl); error ("function %q#D is initialized like a variable", decl);
initialized = 0; initialized = 0;
break; break;
...@@ -3705,8 +3707,8 @@ start_decl (const cp_declarator *declarator, ...@@ -3705,8 +3707,8 @@ start_decl (const cp_declarator *declarator,
{ {
if (! toplevel_bindings_p () if (! toplevel_bindings_p ()
&& DECL_EXTERNAL (decl)) && DECL_EXTERNAL (decl))
warning ("declaration of `%#D' has `extern' and is initialized", warning ("declaration of %q#D has %<extern%> and is initialized",
decl); decl);
DECL_EXTERNAL (decl) = 0; DECL_EXTERNAL (decl) = 0;
if (toplevel_bindings_p ()) if (toplevel_bindings_p ())
TREE_STATIC (decl) = 1; TREE_STATIC (decl) = 1;
...@@ -3728,7 +3730,7 @@ start_decl (const cp_declarator *declarator, ...@@ -3728,7 +3730,7 @@ start_decl (const cp_declarator *declarator,
&& DECL_DECLARED_INLINE_P (decl) && DECL_DECLARED_INLINE_P (decl)
&& DECL_UNINLINABLE (decl) && DECL_UNINLINABLE (decl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (decl))) && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl)))
warning ("%Jinline function '%D' given attribute noinline", decl, decl); warning ("%Jinline function %qD given attribute noinline", decl, decl);
if (context && COMPLETE_TYPE_P (complete_type (context))) if (context && COMPLETE_TYPE_P (complete_type (context)))
{ {
...@@ -3736,13 +3738,14 @@ start_decl (const cp_declarator *declarator, ...@@ -3736,13 +3738,14 @@ start_decl (const cp_declarator *declarator,
{ {
tree field = lookup_field (context, DECL_NAME (decl), 0, false); tree field = lookup_field (context, DECL_NAME (decl), 0, false);
if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL) if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL)
error ("`%#D' is not a static member of `%#T'", decl, context); error ("%q#D is not a static member of %q#T", decl, context);
else else
{ {
if (DECL_CONTEXT (field) != context) if (DECL_CONTEXT (field) != context)
{ {
if (!same_type_p (DECL_CONTEXT (field), context)) if (!same_type_p (DECL_CONTEXT (field), context))
pedwarn ("ISO C++ does not permit `%T::%D' to be defined as `%T::%D'", pedwarn ("ISO C++ does not permit %<%T::%D%> "
"to be defined as %<%T::%D%>",
DECL_CONTEXT (field), DECL_NAME (decl), DECL_CONTEXT (field), DECL_NAME (decl),
context, DECL_NAME (decl)); context, DECL_NAME (decl));
DECL_CONTEXT (decl) = DECL_CONTEXT (field); DECL_CONTEXT (decl) = DECL_CONTEXT (field);
...@@ -3786,8 +3789,8 @@ start_decl (const cp_declarator *declarator, ...@@ -3786,8 +3789,8 @@ start_decl (const cp_declarator *declarator,
} }
if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl)) if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl))
pedwarn ("declaration of `%#D' outside of class is not definition", pedwarn ("declaration of %q#D outside of class is not definition",
decl); decl);
} }
/* Enter this declaration into the symbol table. */ /* Enter this declaration into the symbol table. */
...@@ -3835,15 +3838,14 @@ start_decl_1 (tree decl) ...@@ -3835,15 +3838,14 @@ start_decl_1 (tree decl)
; /* A complete type is ok. */ ; /* A complete type is ok. */
else if (TREE_CODE (type) != ARRAY_TYPE) else if (TREE_CODE (type) != ARRAY_TYPE)
{ {
error ("variable `%#D' has initializer but incomplete type", error ("variable %q#D has initializer but incomplete type", decl);
decl);
initialized = 0; initialized = 0;
type = TREE_TYPE (decl) = error_mark_node; type = TREE_TYPE (decl) = error_mark_node;
} }
else if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type)))) else if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
{ {
if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)) if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl))
error ("elements of array `%#D' have incomplete type", decl); error ("elements of array %q#D have incomplete type", decl);
/* else we already gave an error in start_decl. */ /* else we already gave an error in start_decl. */
initialized = 0; initialized = 0;
} }
...@@ -3859,7 +3861,7 @@ start_decl_1 (tree decl) ...@@ -3859,7 +3861,7 @@ start_decl_1 (tree decl)
if ((! processing_template_decl || ! uses_template_parms (type)) if ((! processing_template_decl || ! uses_template_parms (type))
&& !COMPLETE_TYPE_P (complete_type (type))) && !COMPLETE_TYPE_P (complete_type (type)))
{ {
error ("aggregate `%#D' has incomplete type and cannot be defined", error ("aggregate %q#D has incomplete type and cannot be defined",
decl); decl);
/* Change the type so that assemble_variable will give /* Change the type so that assemble_variable will give
DECL an rtl we can live with: (mem (const_int 0)). */ DECL an rtl we can live with: (mem (const_int 0)). */
...@@ -3915,7 +3917,8 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup) ...@@ -3915,7 +3917,8 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup)
if (TREE_CODE (init) == CONSTRUCTOR) if (TREE_CODE (init) == CONSTRUCTOR)
{ {
error ("ISO C++ forbids use of initializer list to initialize reference `%D'", decl); error ("ISO C++ forbids use of initializer list to "
"initialize reference %qD", decl);
return NULL_TREE; return NULL_TREE;
} }
...@@ -3943,7 +3946,7 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup) ...@@ -3943,7 +3946,7 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup)
return NULL_TREE; return NULL_TREE;
else if (tmp == NULL_TREE) else if (tmp == NULL_TREE)
{ {
error ("cannot initialize `%T' from `%T'", type, TREE_TYPE (init)); error ("cannot initialize %qT from %qT", type, TREE_TYPE (init));
return NULL_TREE; return NULL_TREE;
} }
...@@ -3975,7 +3978,7 @@ maybe_deduce_size_from_array_init (tree decl, tree init) ...@@ -3975,7 +3978,7 @@ maybe_deduce_size_from_array_init (tree decl, tree init)
int failure = complete_array_type (type, initializer, do_default); int failure = complete_array_type (type, initializer, do_default);
if (failure == 1) if (failure == 1)
error ("initializer fails to determine size of `%D'", decl); error ("initializer fails to determine size of %qD", decl);
if (failure == 2) if (failure == 2)
{ {
...@@ -3992,7 +3995,7 @@ maybe_deduce_size_from_array_init (tree decl, tree init) ...@@ -3992,7 +3995,7 @@ maybe_deduce_size_from_array_init (tree decl, tree init)
if (pedantic && TYPE_DOMAIN (type) != NULL_TREE if (pedantic && TYPE_DOMAIN (type) != NULL_TREE
&& tree_int_cst_lt (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), && tree_int_cst_lt (TYPE_MAX_VALUE (TYPE_DOMAIN (type)),
integer_zero_node)) integer_zero_node))
error ("zero-size array `%D'", decl); error ("zero-size array %qD", decl);
layout_decl (decl, 0); layout_decl (decl, 0);
} }
...@@ -4029,7 +4032,7 @@ layout_var_decl (tree decl) ...@@ -4029,7 +4032,7 @@ layout_var_decl (tree decl)
/* An automatic variable with an incomplete type: that is an error. /* An automatic variable with an incomplete type: that is an error.
Don't talk about array types here, since we took care of that Don't talk about array types here, since we took care of that
message in grokdeclarator. */ message in grokdeclarator. */
error ("storage size of `%D' isn't known", decl); error ("storage size of %qD isn't known", decl);
TREE_TYPE (decl) = error_mark_node; TREE_TYPE (decl) = error_mark_node;
} }
#if 0 #if 0
...@@ -4051,7 +4054,7 @@ layout_var_decl (tree decl) ...@@ -4051,7 +4054,7 @@ layout_var_decl (tree decl)
if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST) if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
constant_expression_warning (DECL_SIZE (decl)); constant_expression_warning (DECL_SIZE (decl));
else else
error ("storage size of `%D' isn't constant", decl); error ("storage size of %qD isn't constant", decl);
} }
if (TREE_STATIC (decl) if (TREE_STATIC (decl)
...@@ -4106,8 +4109,11 @@ maybe_commonize_var (tree decl) ...@@ -4106,8 +4109,11 @@ maybe_commonize_var (tree decl)
be merged. */ be merged. */
TREE_PUBLIC (decl) = 0; TREE_PUBLIC (decl) = 0;
DECL_COMMON (decl) = 0; DECL_COMMON (decl) = 0;
cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl); cp_warning_at ("sorry: semantics of inline function static "
warning ("%J you can work around this by removing the initializer", "data %q#D are wrong (you'll wind up "
"with multiple copies)", decl);
warning ("%J you can work around this by removing "
"the initializer",
decl); decl);
} }
} }
...@@ -4133,7 +4139,7 @@ check_for_uninitialized_const_var (tree decl) ...@@ -4133,7 +4139,7 @@ check_for_uninitialized_const_var (tree decl)
&& CP_TYPE_CONST_P (type) && CP_TYPE_CONST_P (type)
&& !TYPE_NEEDS_CONSTRUCTING (type) && !TYPE_NEEDS_CONSTRUCTING (type)
&& !DECL_INITIAL (decl)) && !DECL_INITIAL (decl))
error ("uninitialized const `%D'", decl); error ("uninitialized const %qD", decl);
} }
/* FIELD is a FIELD_DECL or NULL. In the former case, the value /* FIELD is a FIELD_DECL or NULL. In the former case, the value
...@@ -4193,8 +4199,8 @@ reshape_init_array (tree elt_type, tree max_index, ...@@ -4193,8 +4199,8 @@ reshape_init_array (tree elt_type, tree max_index,
/* Handle array designated initializers (GNU extension). */ /* Handle array designated initializers (GNU extension). */
if (TREE_CODE (designated_index) == IDENTIFIER_NODE) if (TREE_CODE (designated_index) == IDENTIFIER_NODE)
{ {
error ("name `%D' used in a GNU-style designated " error ("name %qD used in a GNU-style designated "
"initializer for an array", designated_index); "initializer for an array", designated_index);
TREE_PURPOSE (element_init) = NULL_TREE; TREE_PURPOSE (element_init) = NULL_TREE;
} }
else else
...@@ -4203,7 +4209,7 @@ reshape_init_array (tree elt_type, tree max_index, ...@@ -4203,7 +4209,7 @@ reshape_init_array (tree elt_type, tree max_index,
if (sized_array_p if (sized_array_p
&& tree_int_cst_lt (max_index, designated_index)) && tree_int_cst_lt (max_index, designated_index))
{ {
error ("Designated initializer `%E' larger than array " error ("Designated initializer %qE larger than array "
"size", designated_index); "size", designated_index);
TREE_PURPOSE (element_init) = NULL_TREE; TREE_PURPOSE (element_init) = NULL_TREE;
} }
...@@ -4274,7 +4280,7 @@ reshape_init (tree type, tree *initp) ...@@ -4274,7 +4280,7 @@ reshape_init (tree type, tree *initp)
brace-enclosed initializer. */ brace-enclosed initializer. */
if (brace_enclosed_p) if (brace_enclosed_p)
{ {
error ("brace-enclosed initializer used to initialize `%T'", error ("brace-enclosed initializer used to initialize %qT",
type); type);
if (TREE_CODE (old_init) == TREE_LIST) if (TREE_CODE (old_init) == TREE_LIST)
TREE_VALUE (old_init) = error_mark_node; TREE_VALUE (old_init) = error_mark_node;
...@@ -4337,8 +4343,7 @@ reshape_init (tree type, tree *initp) ...@@ -4337,8 +4343,7 @@ reshape_init (tree type, tree *initp)
initializer-list {}. */ initializer-list {}. */
if (!brace_enclosed_p) if (!brace_enclosed_p)
{ {
error ("initializer for `%T' must be brace-enclosed", error ("initializer for %qT must be brace-enclosed", type);
type);
return error_mark_node; return error_mark_node;
} }
} }
...@@ -4358,7 +4363,7 @@ reshape_init (tree type, tree *initp) ...@@ -4358,7 +4363,7 @@ reshape_init (tree type, tree *initp)
field = lookup_field_1 (type, TREE_PURPOSE (*initp), field = lookup_field_1 (type, TREE_PURPOSE (*initp),
/*want_type=*/false); /*want_type=*/false);
if (!field || TREE_CODE (field) != FIELD_DECL) if (!field || TREE_CODE (field) != FIELD_DECL)
error ("`%T' has no non-static data member named `%D'", error ("%qT has no non-static data member named %qD",
type, TREE_PURPOSE (*initp)); type, TREE_PURPOSE (*initp));
} }
if (!field) if (!field)
...@@ -4420,7 +4425,7 @@ reshape_init (tree type, tree *initp) ...@@ -4420,7 +4425,7 @@ reshape_init (tree type, tree *initp)
/* If this was a brace-enclosed initializer and all of the /* If this was a brace-enclosed initializer and all of the
initializers were not used up, there is a problem. */ initializers were not used up, there is a problem. */
if (brace_enclosed_p && *initp) if (brace_enclosed_p && *initp)
error ("too many initializers for `%T'", type); error ("too many initializers for %qT", type);
return new_init; return new_init;
} }
...@@ -4458,18 +4463,18 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) ...@@ -4458,18 +4463,18 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
else if (init && COMPLETE_TYPE_P (type) else if (init && COMPLETE_TYPE_P (type)
&& !TREE_CONSTANT (TYPE_SIZE (type))) && !TREE_CONSTANT (TYPE_SIZE (type)))
{ {
error ("variable-sized object `%D' may not be initialized", decl); error ("variable-sized object %qD may not be initialized", decl);
init = NULL_TREE; init = NULL_TREE;
} }
else if (TREE_CODE (type) == ARRAY_TYPE else if (TREE_CODE (type) == ARRAY_TYPE
&& !COMPLETE_TYPE_P (complete_type (TREE_TYPE (type)))) && !COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
{ {
error ("elements of array `%#D' have incomplete type", decl); error ("elements of array %q#D have incomplete type", decl);
init = NULL_TREE; init = NULL_TREE;
} }
else if (TREE_CODE (type) != ARRAY_TYPE && !COMPLETE_TYPE_P (type)) else if (TREE_CODE (type) != ARRAY_TYPE && !COMPLETE_TYPE_P (type))
{ {
error ("`%D' has incomplete type", decl); error ("%qD has incomplete type", decl);
TREE_TYPE (decl) = error_mark_node; TREE_TYPE (decl) = error_mark_node;
init = NULL_TREE; init = NULL_TREE;
} }
...@@ -4523,7 +4528,8 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) ...@@ -4523,7 +4528,8 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
{ {
if (TYPE_NON_AGGREGATE_CLASS (type)) if (TYPE_NON_AGGREGATE_CLASS (type))
{ {
error ("`%D' must be initialized by constructor, not by `{...}'", error ("%qD must be initialized by constructor, "
"not by %<{...}%>",
decl); decl);
init = error_mark_node; init = error_mark_node;
} }
...@@ -4567,10 +4573,9 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) ...@@ -4567,10 +4573,9 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
tree core_type = strip_array_types (type); tree core_type = strip_array_types (type);
if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type)) if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type))
error ("structure `%D' with uninitialized const members", decl); error ("structure %qD with uninitialized const members", decl);
if (CLASSTYPE_REF_FIELDS_NEED_INIT (core_type)) if (CLASSTYPE_REF_FIELDS_NEED_INIT (core_type))
error ("structure `%D' with uninitialized reference members", error ("structure %qD with uninitialized reference members", decl);
decl);
check_for_uninitialized_const_var (decl); check_for_uninitialized_const_var (decl);
} }
...@@ -4781,8 +4786,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags) ...@@ -4781,8 +4786,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags)
if (init && TREE_CODE (init) == NAMESPACE_DECL) if (init && TREE_CODE (init) == NAMESPACE_DECL)
{ {
error ("cannot initialize `%D' to namespace `%D'", error ("cannot initialize %qD to namespace %qD", decl, init);
decl, init);
init = NULL_TREE; init = NULL_TREE;
} }
...@@ -4825,7 +4829,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags) ...@@ -4825,7 +4829,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags)
&& IS_AGGR_TYPE (type) && DECL_NAME (decl)) && IS_AGGR_TYPE (type) && DECL_NAME (decl))
{ {
if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type) if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type)
warning ("shadowing previous type declaration of `%#D'", decl); warning ("shadowing previous type declaration of %q#D", decl);
set_identifier_type_value (DECL_NAME (decl), decl); set_identifier_type_value (DECL_NAME (decl), decl);
} }
...@@ -4862,7 +4866,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags) ...@@ -4862,7 +4866,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags)
/* Only PODs can have thread-local storage. Other types may require /* Only PODs can have thread-local storage. Other types may require
various kinds of non-trivial initialization. */ various kinds of non-trivial initialization. */
if (DECL_THREAD_LOCAL (decl) && !pod_type_p (TREE_TYPE (decl))) if (DECL_THREAD_LOCAL (decl) && !pod_type_p (TREE_TYPE (decl)))
error ("`%D' cannot be thread-local because it has non-POD type `%T'", error ("%qD cannot be thread-local because it has non-POD type %qT",
decl, TREE_TYPE (decl)); decl, TREE_TYPE (decl));
/* Convert the initializer to the type of DECL, if we have not /* Convert the initializer to the type of DECL, if we have not
already initialized DECL. */ already initialized DECL. */
...@@ -4877,7 +4881,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags) ...@@ -4877,7 +4881,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags)
/* Thread-local storage cannot be dynamically initialized. */ /* Thread-local storage cannot be dynamically initialized. */
if (DECL_THREAD_LOCAL (decl) && init) if (DECL_THREAD_LOCAL (decl) && init)
{ {
error ("`%D' is thread-local and so cannot be dynamically " error ("%qD is thread-local and so cannot be dynamically "
"initialized", decl); "initialized", decl);
init = NULL_TREE; init = NULL_TREE;
} }
...@@ -5468,11 +5472,9 @@ member_function_or_else (tree ctype, tree cur_type, enum overload_flags flags) ...@@ -5468,11 +5472,9 @@ member_function_or_else (tree ctype, tree cur_type, enum overload_flags flags)
if (ctype && ctype != cur_type) if (ctype && ctype != cur_type)
{ {
if (flags == DTOR_FLAG) if (flags == DTOR_FLAG)
error ("destructor for alien class `%T' cannot be a member", error ("destructor for alien class %qT cannot be a member", ctype);
ctype);
else else
error ("constructor for alien class `%T' cannot be a member", error ("constructor for alien class %qT cannot be a member", ctype);
ctype);
return 0; return 0;
} }
return 1; return 1;
...@@ -5493,20 +5495,21 @@ bad_specifiers (tree object, ...@@ -5493,20 +5495,21 @@ bad_specifiers (tree object,
int raises) int raises)
{ {
if (virtualp) if (virtualp)
error ("`%D' declared as a `virtual' %s", object, type); error ("%qD declared as a %<virtual%> %s", object, type);
if (inlinep) if (inlinep)
error ("`%D' declared as an `inline' %s", object, type); error ("%qD declared as an %<inline%> %s", object, type);
if (quals) if (quals)
error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration", error ("%<const%> and %<volatile%> function specifiers on "
object, type); "q%D invalid in %s declaration",
object, type);
if (friendp) if (friendp)
cp_error_at ("`%D' declared as a friend", object); cp_error_at ("%qD declared as a friend", object);
if (raises if (raises
&& (TREE_CODE (object) == TYPE_DECL && (TREE_CODE (object) == TYPE_DECL
|| (!TYPE_PTRFN_P (TREE_TYPE (object)) || (!TYPE_PTRFN_P (TREE_TYPE (object))
&& !TYPE_REFFN_P (TREE_TYPE (object)) && !TYPE_REFFN_P (TREE_TYPE (object))
&& !TYPE_PTRMEMFUNC_P (TREE_TYPE (object))))) && !TYPE_PTRMEMFUNC_P (TREE_TYPE (object)))))
cp_error_at ("`%D' declared with an exception specification", object); cp_error_at ("%qD declared with an exception specification", object);
} }
/* CTYPE is class type, or null if non-class. /* CTYPE is class type, or null if non-class.
...@@ -5589,15 +5592,15 @@ grokfndecl (tree ctype, ...@@ -5589,15 +5592,15 @@ grokfndecl (tree ctype,
if (ctype == NULL_TREE && DECL_MAIN_P (decl)) if (ctype == NULL_TREE && DECL_MAIN_P (decl))
{ {
if (processing_template_decl) if (processing_template_decl)
error ("cannot declare `::main' to be a template"); error ("cannot declare %<::main%> to be a template");
if (inlinep) if (inlinep)
error ("cannot declare `::main' to be inline"); error ("cannot declare %<::main%> to be inline");
if (!publicp) if (!publicp)
error ("cannot declare `::main' to be static"); error ("cannot declare %<::main%> to be static");
if (!same_type_p (TREE_TYPE (TREE_TYPE (decl)), if (!same_type_p (TREE_TYPE (TREE_TYPE (decl)),
integer_type_node)) integer_type_node))
{ {
error ("`::main' must return `int'"); error ("%<::main%> must return %<int%>");
TREE_TYPE (TREE_TYPE (decl)) = integer_type_node; TREE_TYPE (TREE_TYPE (decl)) = integer_type_node;
} }
inlinep = 0; inlinep = 0;
...@@ -5627,17 +5630,16 @@ grokfndecl (tree ctype, ...@@ -5627,17 +5630,16 @@ grokfndecl (tree ctype,
/* Allow this; it's pretty common in C. */; /* Allow this; it's pretty common in C. */;
else else
{ {
pedwarn ("non-local function `%#D' uses anonymous type", pedwarn ("non-local function %q#D uses anonymous type",
decl); decl);
if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
cp_pedwarn_at ("\ cp_pedwarn_at ("%q#D does not refer to the unqualified "
`%#D' does not refer to the unqualified type, so it is not used for linkage", "type, so it is not used for linkage",
TYPE_NAME (t)); TYPE_NAME (t));
} }
} }
else else
pedwarn ("non-local function `%#D' uses local type `%T'", pedwarn ("non-local function %q#D uses local type %qT", decl, t);
decl, t);
} }
} }
...@@ -5660,7 +5662,7 @@ grokfndecl (tree ctype, ...@@ -5660,7 +5662,7 @@ grokfndecl (tree ctype,
DECL_EXTERNAL (decl) = 1; DECL_EXTERNAL (decl) = 1;
if (quals && TREE_CODE (type) == FUNCTION_TYPE) if (quals && TREE_CODE (type) == FUNCTION_TYPE)
{ {
error ("%smember function `%D' cannot have cv-qualifier", error ("%smember function %qD cannot have cv-qualifier",
(ctype ? "static " : "non-"), decl); (ctype ? "static " : "non-"), decl);
quals = TYPE_UNQUALIFIED; quals = TYPE_UNQUALIFIED;
} }
...@@ -5684,7 +5686,7 @@ grokfndecl (tree ctype, ...@@ -5684,7 +5686,7 @@ grokfndecl (tree ctype,
{ {
if (funcdef_flag) if (funcdef_flag)
error error
("defining explicit specialization `%D' in friend declaration", ("defining explicit specialization %qD in friend declaration",
orig_declarator); orig_declarator);
else else
{ {
...@@ -5694,8 +5696,9 @@ grokfndecl (tree ctype, ...@@ -5694,8 +5696,9 @@ grokfndecl (tree ctype,
if (PROCESSING_REAL_TEMPLATE_DECL_P ()) if (PROCESSING_REAL_TEMPLATE_DECL_P ())
{ {
/* Something like `template <class T> friend void f<T>()'. */ /* Something like `template <class T> friend void f<T>()'. */
error ("invalid use of template-id `%D' in declaration of primary template", error ("invalid use of template-id %qD in declaration "
orig_declarator); "of primary template",
orig_declarator);
return NULL_TREE; return NULL_TREE;
} }
...@@ -5721,15 +5724,17 @@ grokfndecl (tree ctype, ...@@ -5721,15 +5724,17 @@ grokfndecl (tree ctype,
if (has_default_arg) if (has_default_arg)
{ {
error ("default arguments are not allowed in declaration of friend template specialization `%D'", error ("default arguments are not allowed in declaration "
decl); "of friend template specialization %qD",
decl);
return NULL_TREE; return NULL_TREE;
} }
if (inlinep) if (inlinep)
{ {
error ("`inline' is not allowed in declaration of friend template specialization `%D'", error ("%<inline%> is not allowed in declaration of friend "
decl); "template specialization %qD",
decl);
return NULL_TREE; return NULL_TREE;
} }
} }
...@@ -5794,7 +5799,7 @@ grokfndecl (tree ctype, ...@@ -5794,7 +5799,7 @@ grokfndecl (tree ctype,
XXX Isn't this done in start_function, too? */ XXX Isn't this done in start_function, too? */
revert_static_member_fn (decl); revert_static_member_fn (decl);
if (old_decl && DECL_ARTIFICIAL (old_decl)) if (old_decl && DECL_ARTIFICIAL (old_decl))
error ("definition of implicitly-declared `%D'", old_decl); error ("definition of implicitly-declared %qD", old_decl);
if (old_decl) if (old_decl)
{ {
...@@ -5814,7 +5819,7 @@ grokfndecl (tree ctype, ...@@ -5814,7 +5819,7 @@ grokfndecl (tree ctype,
pop_scope (ctype); pop_scope (ctype);
if (!ok) if (!ok)
{ {
error ("no `%#D' member function declared in class `%T'", error ("no %q#D member function declared in class %qT",
decl, ctype); decl, ctype);
return NULL_TREE; return NULL_TREE;
} }
...@@ -5971,17 +5976,16 @@ grokvardecl (tree type, ...@@ -5971,17 +5976,16 @@ grokvardecl (tree type,
else else
{ {
/* It's a typedef referring to an anonymous type. */ /* It's a typedef referring to an anonymous type. */
pedwarn ("non-local variable `%#D' uses anonymous type", pedwarn ("non-local variable %q#D uses anonymous type",
decl); decl);
if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
cp_pedwarn_at ("\ cp_pedwarn_at ("%q#D does not refer to the unqualified "
`%#D' does not refer to the unqualified type, so it is not used for linkage", "type, so it is not used for linkage",
TYPE_NAME (t)); TYPE_NAME (t));
} }
} }
else else
pedwarn ("non-local variable `%#D' uses local type `%T'", pedwarn ("non-local variable %q#D uses local type %qT", decl, t);
decl, t);
} }
} }
...@@ -6096,7 +6100,8 @@ check_static_variable_definition (tree decl, tree type) ...@@ -6096,7 +6100,8 @@ check_static_variable_definition (tree decl, tree type)
required. */ required. */
if (!ARITHMETIC_TYPE_P (type) && TREE_CODE (type) != ENUMERAL_TYPE) if (!ARITHMETIC_TYPE_P (type) && TREE_CODE (type) != ENUMERAL_TYPE)
{ {
error ("invalid in-class initialization of static data member of non-integral type `%T'", error ("invalid in-class initialization of static data member "
"of non-integral type %qT",
type); type);
/* If we just return the declaration, crashes will sometimes /* If we just return the declaration, crashes will sometimes
occur. We therefore return void_type_node, as if this were a occur. We therefore return void_type_node, as if this were a
...@@ -6105,10 +6110,12 @@ check_static_variable_definition (tree decl, tree type) ...@@ -6105,10 +6110,12 @@ check_static_variable_definition (tree decl, tree type)
return 1; return 1;
} }
else if (!CP_TYPE_CONST_P (type)) else if (!CP_TYPE_CONST_P (type))
error ("ISO C++ forbids in-class initialization of non-const static member `%D'", error ("ISO C++ forbids in-class initialization of non-const "
decl); "static member %qD",
decl);
else if (pedantic && !INTEGRAL_TYPE_P (type)) else if (pedantic && !INTEGRAL_TYPE_P (type))
pedwarn ("ISO C++ forbids initialization of member constant `%D' of non-integral type `%T'", decl, type); pedwarn ("ISO C++ forbids initialization of member constant "
"%qD of non-integral type %qT", decl, type);
return 0; return 0;
} }
...@@ -6127,9 +6134,9 @@ compute_array_index_type (tree name, tree size) ...@@ -6127,9 +6134,9 @@ compute_array_index_type (tree name, tree size)
if (!dependent_type_p (type) && !INTEGRAL_TYPE_P (type)) if (!dependent_type_p (type) && !INTEGRAL_TYPE_P (type))
{ {
if (name) if (name)
error ("size of array `%D' has non-integral type `%T'", name, type); error ("size of array %qD has non-integral type %qT", name, type);
else else
error ("size of array has non-integral type `%T'", type); error ("size of array has non-integral type %qT", type);
size = integer_one_node; size = integer_one_node;
type = TREE_TYPE (size); type = TREE_TYPE (size);
} }
...@@ -6165,7 +6172,7 @@ compute_array_index_type (tree name, tree size) ...@@ -6165,7 +6172,7 @@ compute_array_index_type (tree name, tree size)
if (INT_CST_LT (size, integer_zero_node)) if (INT_CST_LT (size, integer_zero_node))
{ {
if (name) if (name)
error ("size of array `%D' is negative", name); error ("size of array %qD is negative", name);
else else
error ("size of array is negative"); error ("size of array is negative");
size = integer_one_node; size = integer_one_node;
...@@ -6175,7 +6182,7 @@ compute_array_index_type (tree name, tree size) ...@@ -6175,7 +6182,7 @@ compute_array_index_type (tree name, tree size)
else if (integer_zerop (size) && pedantic && !in_system_header) else if (integer_zerop (size) && pedantic && !in_system_header)
{ {
if (name) if (name)
pedwarn ("ISO C++ forbids zero-size array `%D'", name); pedwarn ("ISO C++ forbids zero-size array %qD", name);
else else
pedwarn ("ISO C++ forbids zero-size array"); pedwarn ("ISO C++ forbids zero-size array");
} }
...@@ -6184,15 +6191,15 @@ compute_array_index_type (tree name, tree size) ...@@ -6184,15 +6191,15 @@ compute_array_index_type (tree name, tree size)
{ {
/* `(int) &fn' is not a valid array bound. */ /* `(int) &fn' is not a valid array bound. */
if (name) if (name)
error ("size of array `%D' is not an integral constant-expression", error ("size of array %qD is not an integral constant-expression",
name); name);
else else
error ("size of array is not an integral constant-expression"); error ("size of array is not an integral constant-expression");
} }
else if (pedantic) else if (pedantic)
{ {
if (name) if (name)
pedwarn ("ISO C++ forbids variable-size array `%D'", name); pedwarn ("ISO C++ forbids variable-size array %qD", name);
else else
pedwarn ("ISO C++ forbids variable-size array"); pedwarn ("ISO C++ forbids variable-size array");
} }
...@@ -6299,7 +6306,7 @@ create_array_type_for_decl (tree name, tree type, tree size) ...@@ -6299,7 +6306,7 @@ create_array_type_for_decl (tree name, tree type, tree size)
if (error_msg) if (error_msg)
{ {
if (name) if (name)
error ("declaration of `%D' as %s", name, error_msg); error ("declaration of %qD as %s", name, error_msg);
else else
error ("creating %s", error_msg); error ("creating %s", error_msg);
...@@ -6313,10 +6320,12 @@ create_array_type_for_decl (tree name, tree type, tree size) ...@@ -6313,10 +6320,12 @@ create_array_type_for_decl (tree name, tree type, tree size)
if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type)) if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type))
{ {
if (name) if (name)
error ("declaration of `%D' as multidimensional array must have bounds for all dimensions except the first", error ("declaration of %qD as multidimensional array must "
name); "have bounds for all dimensions except the first",
name);
else else
error ("multidimensional array must have bounds for all dimensions except the first"); error ("multidimensional array must have bounds for all "
"dimensions except the first");
return error_mark_node; return error_mark_node;
} }
...@@ -6373,9 +6382,9 @@ check_special_function_return_type (special_function_kind sfk, ...@@ -6373,9 +6382,9 @@ check_special_function_return_type (special_function_kind sfk,
case sfk_conversion: case sfk_conversion:
if (type && !same_type_p (type, optype)) if (type && !same_type_p (type, optype))
error ("operator `%T' declared to return `%T'", optype, type); error ("operator %qT declared to return %qT", optype, type);
else if (type) else if (type)
pedwarn ("return type specified for `operator %T'", optype); pedwarn ("return type specified for %<operator %T%>", optype);
type = optype; type = optype;
break; break;
...@@ -6545,7 +6554,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6545,7 +6554,7 @@ grokdeclarator (const cp_declarator *declarator,
&& !UNIQUELY_DERIVED_FROM_P (ctype, && !UNIQUELY_DERIVED_FROM_P (ctype,
current_class_type)) current_class_type))
{ {
error ("type `%T' is not derived from type `%T'", error ("type %qT is not derived from type %qT",
ctype, current_class_type); ctype, current_class_type);
ctype = NULL_TREE; ctype = NULL_TREE;
} }
...@@ -6590,7 +6599,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6590,7 +6599,7 @@ grokdeclarator (const cp_declarator *declarator,
if (C_IS_RESERVED_WORD (dname)) if (C_IS_RESERVED_WORD (dname))
{ {
error ("declarator-id missing; using reserved word `%D'", error ("declarator-id missing; using reserved word %qD",
dname); dname);
name = IDENTIFIER_POINTER (dname); name = IDENTIFIER_POINTER (dname);
} }
...@@ -6646,7 +6655,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6646,7 +6655,7 @@ grokdeclarator (const cp_declarator *declarator,
&& innermost_code != cdk_function && innermost_code != cdk_function
&& ! (ctype && !declspecs->any_specifiers_p)) && ! (ctype && !declspecs->any_specifiers_p))
{ {
error ("declaration of `%D' as non-function", dname); error ("declaration of %qD as non-function", dname);
return void_type_node; return void_type_node;
} }
...@@ -6679,7 +6688,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6679,7 +6688,7 @@ grokdeclarator (const cp_declarator *declarator,
/* If there were multiple types specified in the decl-specifier-seq, /* If there were multiple types specified in the decl-specifier-seq,
issue an error message. */ issue an error message. */
if (declspecs->multiple_types_p) if (declspecs->multiple_types_p)
error ("two or more data types in declaration of `%s'", name); error ("two or more data types in declaration of %qs", name);
/* Extract the basic type from the decl-specifier-seq. */ /* Extract the basic type from the decl-specifier-seq. */
type = declspecs->type; type = declspecs->type;
if (type == error_mark_node) if (type == error_mark_node)
...@@ -6720,9 +6729,9 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6720,9 +6729,9 @@ grokdeclarator (const cp_declarator *declarator,
if (ds == ds_long) if (ds == ds_long)
{ {
if (count > 2) if (count > 2)
error ("`long long long' is too long for GCC"); error ("%<long long long%> is too long for GCC");
else if (pedantic && !in_system_header && warn_long_long) else if (pedantic && !in_system_header && warn_long_long)
pedwarn ("ISO C++ does not support `long long'"); pedwarn ("ISO C++ does not support %<long long%>");
else else
longlong = 1; longlong = 1;
} }
...@@ -6744,7 +6753,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6744,7 +6753,7 @@ grokdeclarator (const cp_declarator *declarator,
"__complex", "__complex",
"__thread" "__thread"
}; };
error ("duplicate `%s'", decl_spec_names[(int)ds]); error ("duplicate %qs", decl_spec_names[(int)ds]);
} }
} }
...@@ -6782,11 +6791,9 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6782,11 +6791,9 @@ grokdeclarator (const cp_declarator *declarator,
else if (in_system_header || flag_ms_extensions) else if (in_system_header || flag_ms_extensions)
/* Allow it, sigh. */; /* Allow it, sigh. */;
else if (pedantic || ! is_main) else if (pedantic || ! is_main)
pedwarn ("ISO C++ forbids declaration of `%s' with no type", pedwarn ("ISO C++ forbids declaration of %qs with no type", name);
name);
else if (warn_return_type) else if (warn_return_type)
warning ("ISO C++ forbids declaration of `%s' with no type", warning ("ISO C++ forbids declaration of %qs with no type", name);
name);
type = integer_type_node; type = integer_type_node;
} }
...@@ -6811,23 +6818,23 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6811,23 +6818,23 @@ grokdeclarator (const cp_declarator *declarator,
int ok = 0; int ok = 0;
if (TREE_CODE (type) == REAL_TYPE) if (TREE_CODE (type) == REAL_TYPE)
error ("short, signed or unsigned invalid for `%s'", name); error ("short, signed or unsigned invalid for %qs", name);
else if (TREE_CODE (type) != INTEGER_TYPE) else if (TREE_CODE (type) != INTEGER_TYPE)
error ("long, short, signed or unsigned invalid for `%s'", name); error ("long, short, signed or unsigned invalid for %qs", name);
else if (long_p && short_p) else if (long_p && short_p)
error ("long and short specified together for `%s'", name); error ("long and short specified together for %qs", name);
else if ((long_p || short_p) && explicit_char) else if ((long_p || short_p) && explicit_char)
error ("long or short specified with char for `%s'", name); error ("long or short specified with char for %qs", name);
else if ((long_p|| short_p) && TREE_CODE (type) == REAL_TYPE) else if ((long_p|| short_p) && TREE_CODE (type) == REAL_TYPE)
error ("long or short specified with floating type for `%s'", name); error ("long or short specified with floating type for %qs", name);
else if (signed_p && unsigned_p) else if (signed_p && unsigned_p)
error ("signed and unsigned given together for `%s'", name); error ("signed and unsigned given together for %qs", name);
else else
{ {
ok = 1; ok = 1;
if (!explicit_int && !defaulted_int && !explicit_char && pedantic) if (!explicit_int && !defaulted_int && !explicit_char && pedantic)
{ {
pedwarn ("long, short, signed or unsigned used invalidly for `%s'", pedwarn ("long, short, signed or unsigned used invalidly for %qs",
name); name);
if (flag_pedantic_errors) if (flag_pedantic_errors)
ok = 0; ok = 0;
...@@ -6892,7 +6899,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6892,7 +6899,7 @@ grokdeclarator (const cp_declarator *declarator,
if (declspecs->specs[(int)ds_complex]) if (declspecs->specs[(int)ds_complex])
{ {
if (TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE) if (TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE)
error ("complex invalid for `%s'", name); error ("complex invalid for %qs", name);
/* If we just have "complex", it is equivalent to /* If we just have "complex", it is equivalent to
"complex double", but if any modifiers at all are specified it is "complex double", but if any modifiers at all are specified it is
the complex form of TYPE. E.g, "complex short" is the complex form of TYPE. E.g, "complex short" is
...@@ -6921,8 +6928,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6921,8 +6928,8 @@ grokdeclarator (const cp_declarator *declarator,
if (declspecs->specs[(int)ds_restrict]) if (declspecs->specs[(int)ds_restrict])
type_quals |= TYPE_QUAL_RESTRICT; type_quals |= TYPE_QUAL_RESTRICT;
if (sfk == sfk_conversion && type_quals != TYPE_UNQUALIFIED) if (sfk == sfk_conversion && type_quals != TYPE_UNQUALIFIED)
error ("qualifiers are not allowed on declaration of `operator %T'", error ("qualifiers are not allowed on declaration of %<operator %T%>",
ctor_return_type); ctor_return_type);
type_quals |= cp_type_quals (type); type_quals |= cp_type_quals (type);
type = cp_build_qualified_type_real type = cp_build_qualified_type_real
...@@ -6942,15 +6949,14 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6942,15 +6949,14 @@ grokdeclarator (const cp_declarator *declarator,
if (virtualp && staticp == 2) if (virtualp && staticp == 2)
{ {
error ("member `%D' cannot be declared both virtual and static", error ("member %qD cannot be declared both virtual and static", dname);
dname);
staticp = 0; staticp = 0;
} }
friendp = !! declspecs->specs[(int)ds_friend]; friendp = !! declspecs->specs[(int)ds_friend];
if (dependant_name && !friendp) if (dependant_name && !friendp)
{ {
error ("`%T::%D' is not a valid declarator", ctype, dependant_name); error ("%<%T::%D%> is not a valid declarator", ctype, dependant_name);
return void_type_node; return void_type_node;
} }
...@@ -6989,7 +6995,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -6989,7 +6995,7 @@ grokdeclarator (const cp_declarator *declarator,
&& storage_class != sc_static) && storage_class != sc_static)
|| declspecs->specs[(int)ds_typedef])) || declspecs->specs[(int)ds_typedef]))
{ {
error ("multiple storage classes in declaration of `%s'", name); error ("multiple storage classes in declaration of %qs", name);
thread_p = false; thread_p = false;
} }
else if (decl_context != NORMAL else if (decl_context != NORMAL
...@@ -7032,14 +7038,14 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7032,14 +7038,14 @@ grokdeclarator (const cp_declarator *declarator,
name = "<invalid operator>"; name = "<invalid operator>";
} }
} }
error ("storage class specified for %s `%s'", error ("storage class specified for %s %qs",
op ? "member operator" : "field", op ? "member operator" : "field",
name); name);
} }
else else
{ {
if (decl_context == PARM || decl_context == CATCHPARM) if (decl_context == PARM || decl_context == CATCHPARM)
error ("storage class specified for parameter `%s'", name); error ("storage class specified for parameter %qs", name);
else else
error ("storage class specified for typename"); error ("storage class specified for typename");
} }
...@@ -7058,24 +7064,24 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7058,24 +7064,24 @@ grokdeclarator (const cp_declarator *declarator,
/* It's common practice (and completely valid) to have a const /* It's common practice (and completely valid) to have a const
be initialized and declared extern. */ be initialized and declared extern. */
if (!(type_quals & TYPE_QUAL_CONST)) if (!(type_quals & TYPE_QUAL_CONST))
warning ("`%s' initialized and declared `extern'", name); warning ("%qs initialized and declared %<extern%>", name);
} }
else else
error ("`%s' has both `extern' and initializer", name); error ("%qs has both %<extern%> and initializer", name);
} }
else if (storage_class == sc_extern && funcdef_flag else if (storage_class == sc_extern && funcdef_flag
&& ! toplevel_bindings_p ()) && ! toplevel_bindings_p ())
error ("nested function `%s' declared `extern'", name); error ("nested function %qs declared %<extern%>", name);
else if (toplevel_bindings_p ()) else if (toplevel_bindings_p ())
{ {
if (storage_class == sc_auto) if (storage_class == sc_auto)
error ("top-level declaration of `%s' specifies `auto'", name); error ("top-level declaration of %qs specifies %<auto%>", name);
} }
else if (thread_p else if (thread_p
&& storage_class != sc_extern && storage_class != sc_extern
&& storage_class != sc_static) && storage_class != sc_static)
{ {
error ("function-scope `%s' implicitly auto and declared `__thread'", error ("function-scope %qs implicitly auto and declared %<__thread%>",
name); name);
thread_p = false; thread_p = false;
} }
...@@ -7174,12 +7180,12 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7174,12 +7180,12 @@ grokdeclarator (const cp_declarator *declarator,
if (TREE_CODE (type) == FUNCTION_TYPE) if (TREE_CODE (type) == FUNCTION_TYPE)
{ {
error ("`%s' declared as function returning a function", name); error ("%qs declared as function returning a function", name);
type = integer_type_node; type = integer_type_node;
} }
if (TREE_CODE (type) == ARRAY_TYPE) if (TREE_CODE (type) == ARRAY_TYPE)
{ {
error ("`%s' declared as function returning an array", name); error ("%qs declared as function returning an array", name);
type = integer_type_node; type = integer_type_node;
} }
...@@ -7266,7 +7272,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7266,7 +7272,7 @@ grokdeclarator (const cp_declarator *declarator,
else if (friendp) else if (friendp)
{ {
if (initialized) if (initialized)
error ("can't initialize friend function `%s'", name); error ("can't initialize friend function %qs", name);
if (virtualp) if (virtualp)
{ {
/* Cannot be both friend and virtual. */ /* Cannot be both friend and virtual. */
...@@ -7276,8 +7282,9 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7276,8 +7282,9 @@ grokdeclarator (const cp_declarator *declarator,
if (decl_context == NORMAL) if (decl_context == NORMAL)
error ("friend declaration not in class definition"); error ("friend declaration not in class definition");
if (current_function_decl && funcdef_flag) if (current_function_decl && funcdef_flag)
error ("can't define friend function `%s' in a local class definition", error ("can't define friend function %qs in a local "
name); "class definition",
name);
} }
arg_types = grokparms (declarator->u.function.parameters, arg_types = grokparms (declarator->u.function.parameters,
...@@ -7306,16 +7313,16 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7306,16 +7313,16 @@ grokdeclarator (const cp_declarator *declarator,
if (TREE_CODE (type) == REFERENCE_TYPE) if (TREE_CODE (type) == REFERENCE_TYPE)
{ {
error (declarator->kind == cdk_reference error (declarator->kind == cdk_reference
? "cannot declare reference to `%#T'" ? "cannot declare reference to %q#T"
: "cannot declare pointer to `%#T'", type); : "cannot declare pointer to %q#T", type);
type = TREE_TYPE (type); type = TREE_TYPE (type);
} }
else if (VOID_TYPE_P (type)) else if (VOID_TYPE_P (type))
{ {
if (declarator->kind == cdk_reference) if (declarator->kind == cdk_reference)
error ("cannot declare reference to `%#T'", type); error ("cannot declare reference to %q#T", type);
else if (declarator->kind == cdk_ptrmem) else if (declarator->kind == cdk_ptrmem)
error ("cannot declare pointer to `%#T' member", type); error ("cannot declare pointer to %q#T member", type);
} }
/* We now know that the TYPE_QUALS don't apply to the decl, /* We now know that the TYPE_QUALS don't apply to the decl,
...@@ -7371,7 +7378,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7371,7 +7378,7 @@ grokdeclarator (const cp_declarator *declarator,
&& TREE_CODE (type) != FUNCTION_TYPE && TREE_CODE (type) != FUNCTION_TYPE
&& TREE_CODE (type) != METHOD_TYPE) && TREE_CODE (type) != METHOD_TYPE)
{ {
error ("template-id `%D' used as a declarator", error ("template-id %qD used as a declarator",
unqualified_id); unqualified_id);
unqualified_id = dname; unqualified_id = dname;
} }
...@@ -7422,7 +7429,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7422,7 +7429,7 @@ grokdeclarator (const cp_declarator *declarator,
Is this ill-formed? */ Is this ill-formed? */
if (pedantic) if (pedantic)
pedwarn ("extra qualification `%T::' on member `%s' ignored", pedwarn ("extra qualification %<%T::%> on member %qs ignored",
ctype, name); ctype, name);
} }
else if (TREE_CODE (type) == FUNCTION_TYPE) else if (TREE_CODE (type) == FUNCTION_TYPE)
...@@ -7441,7 +7448,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7441,7 +7448,7 @@ grokdeclarator (const cp_declarator *declarator,
TYPE_ARG_TYPES (type)); TYPE_ARG_TYPES (type));
else else
{ {
error ("cannot declare member function `%T::%s' within `%T'", error ("cannot declare member function %<%T::%s%> within %<%T%>",
ctype, name, current_class_type); ctype, name, current_class_type);
return error_mark_node; return error_mark_node;
} }
...@@ -7456,7 +7463,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7456,7 +7463,7 @@ grokdeclarator (const cp_declarator *declarator,
if (current_class_type) if (current_class_type)
{ {
error ("cannot declare member `%T::%s' within `%T'", error ("cannot declare member %<%T::%s%> within %qT",
ctype, name, current_class_type); ctype, name, current_class_type);
return void_type_node; return void_type_node;
} }
...@@ -7484,7 +7491,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7484,7 +7491,7 @@ grokdeclarator (const cp_declarator *declarator,
&& COMPLETE_TYPE_P (type) && COMPLETE_TYPE_P (type)
&& TREE_OVERFLOW (TYPE_SIZE (type))) && TREE_OVERFLOW (TYPE_SIZE (type)))
{ {
error ("size of array `%s' is too large", name); error ("size of array %qs is too large", name);
/* If we proceed with the array type as it is, we'll eventually /* If we proceed with the array type as it is, we'll eventually
crash in tree_low_cst(). */ crash in tree_low_cst(). */
type = error_mark_node; type = error_mark_node;
...@@ -7495,9 +7502,9 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7495,9 +7502,9 @@ grokdeclarator (const cp_declarator *declarator,
&& variably_modified_type_p (type, NULL_TREE)) && variably_modified_type_p (type, NULL_TREE))
{ {
if (decl_context == FIELD) if (decl_context == FIELD)
error ("data member may not have variably modified type `%T'", type); error ("data member may not have variably modified type %qT", type);
else else
error ("parameter may not have variably modified type `%T'", type); error ("parameter may not have variably modified type %qT", type);
type = error_mark_node; type = error_mark_node;
} }
...@@ -7505,7 +7512,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7505,7 +7512,7 @@ grokdeclarator (const cp_declarator *declarator,
{ {
/* [dcl.fct.spec] The explicit specifier shall only be used in /* [dcl.fct.spec] The explicit specifier shall only be used in
declarations of constructors within a class definition. */ declarations of constructors within a class definition. */
error ("only declarations of constructors can be `explicit'"); error ("only declarations of constructors can be %<explicit%>");
explicitp = 0; explicitp = 0;
} }
...@@ -7513,28 +7520,28 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7513,28 +7520,28 @@ grokdeclarator (const cp_declarator *declarator,
{ {
if (decl_context != FIELD || friendp) if (decl_context != FIELD || friendp)
{ {
error ("non-member `%s' cannot be declared `mutable'", name); error ("non-member %qs cannot be declared %<mutable%>", name);
storage_class = sc_none; storage_class = sc_none;
} }
else if (decl_context == TYPENAME || declspecs->specs[(int)ds_typedef]) else if (decl_context == TYPENAME || declspecs->specs[(int)ds_typedef])
{ {
error ("non-object member `%s' cannot be declared `mutable'", name); error ("non-object member %qs cannot be declared %<mutable%>", name);
storage_class = sc_none; storage_class = sc_none;
} }
else if (TREE_CODE (type) == FUNCTION_TYPE else if (TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE) || TREE_CODE (type) == METHOD_TYPE)
{ {
error ("function `%s' cannot be declared `mutable'", name); error ("function %qs cannot be declared %<mutable%>", name);
storage_class = sc_none; storage_class = sc_none;
} }
else if (staticp) else if (staticp)
{ {
error ("static `%s' cannot be declared `mutable'", name); error ("static %qs cannot be declared %<mutable%>", name);
storage_class = sc_none; storage_class = sc_none;
} }
else if (type_quals & TYPE_QUAL_CONST) else if (type_quals & TYPE_QUAL_CONST)
{ {
error ("const `%s' cannot be declared `mutable'", name); error ("const %qs cannot be declared %<mutable%>", name);
storage_class = sc_none; storage_class = sc_none;
} }
} }
...@@ -7552,7 +7559,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7552,7 +7559,8 @@ grokdeclarator (const cp_declarator *declarator,
if (decl_context == FIELD) if (decl_context == FIELD)
{ {
if (constructor_name_p (unqualified_id, current_class_type)) if (constructor_name_p (unqualified_id, current_class_type))
pedwarn ("ISO C++ forbids nested type `%D' with same name as enclosing class", pedwarn ("ISO C++ forbids nested type %qD with same name "
"as enclosing class",
unqualified_id); unqualified_id);
decl = build_lang_decl (TYPE_DECL, unqualified_id, type); decl = build_lang_decl (TYPE_DECL, unqualified_id, type);
} }
...@@ -7674,7 +7682,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7674,7 +7682,7 @@ grokdeclarator (const cp_declarator *declarator,
} }
if (inlinep) if (inlinep)
{ {
error ("`inline' specified for friend class declaration"); error ("%<inline%> specified for friend class declaration");
inlinep = 0; inlinep = 0;
} }
...@@ -7685,11 +7693,11 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7685,11 +7693,11 @@ grokdeclarator (const cp_declarator *declarator,
pedwarn ("template parameters cannot be friends"); pedwarn ("template parameters cannot be friends");
else if (TREE_CODE (type) == TYPENAME_TYPE) else if (TREE_CODE (type) == TYPENAME_TYPE)
pedwarn ("friend declaration requires class-key, " pedwarn ("friend declaration requires class-key, "
"i.e. `friend class %T::%D'", "i.e. %<friend class %T::%D%>",
TYPE_CONTEXT (type), TYPENAME_TYPE_FULLNAME (type)); TYPE_CONTEXT (type), TYPENAME_TYPE_FULLNAME (type));
else else
pedwarn ("friend declaration requires class-key, " pedwarn ("friend declaration requires class-key, "
"i.e. `friend %#T'", "i.e. %<friend %#T%>",
type); type);
} }
...@@ -7701,8 +7709,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7701,8 +7709,8 @@ grokdeclarator (const cp_declarator *declarator,
make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type), make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type),
/*complain=*/true); /*complain=*/true);
else else
error ("trying to make class `%T' a friend of global scope", error ("trying to make class %qT a friend of global scope",
type); type);
type = void_type_node; type = void_type_node;
} }
...@@ -7731,7 +7739,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7731,7 +7739,7 @@ grokdeclarator (const cp_declarator *declarator,
&& TREE_CODE (type) != UNION_TYPE && TREE_CODE (type) != UNION_TYPE
&& ! bitfield) && ! bitfield)
{ {
error ("abstract declarator `%T' used as declaration", type); error ("abstract declarator %qT used as declaration", type);
unqualified_id = make_anon_name (); unqualified_id = make_anon_name ();
} }
...@@ -7747,7 +7755,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7747,7 +7755,7 @@ grokdeclarator (const cp_declarator *declarator,
else if (TREE_CODE (unqualified_id) == IDENTIFIER_NODE) else if (TREE_CODE (unqualified_id) == IDENTIFIER_NODE)
{ {
gcc_assert (!IDENTIFIER_OPNAME_P (unqualified_id)); gcc_assert (!IDENTIFIER_OPNAME_P (unqualified_id));
error ("variable or field `%s' declared void", name); error ("variable or field %qs declared void", name);
} }
else else
error ("variable or field declared void"); error ("variable or field declared void");
...@@ -7760,7 +7768,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7760,7 +7768,7 @@ grokdeclarator (const cp_declarator *declarator,
if (decl_context == PARM || decl_context == CATCHPARM) if (decl_context == PARM || decl_context == CATCHPARM)
{ {
if (ctype || in_namespace) if (ctype || in_namespace)
error ("cannot use `::' in parameter declaration"); error ("cannot use %<::%> in parameter declaration");
/* A parameter declared as an array of T is really a pointer to T. /* A parameter declared as an array of T is really a pointer to T.
One declared as a function is really a pointer to a function. One declared as a function is really a pointer to a function.
...@@ -7805,7 +7813,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7805,7 +7813,7 @@ grokdeclarator (const cp_declarator *declarator,
else if (in_namespace && !friendp) else if (in_namespace && !friendp)
{ {
/* Something like struct S { int N::j; }; */ /* Something like struct S { int N::j; }; */
error ("invalid use of `::'"); error ("invalid use of %<::%>");
decl = NULL_TREE; decl = NULL_TREE;
} }
else if (TREE_CODE (type) == FUNCTION_TYPE) else if (TREE_CODE (type) == FUNCTION_TYPE)
...@@ -7817,7 +7825,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7817,7 +7825,7 @@ grokdeclarator (const cp_declarator *declarator,
typedefs. */ typedefs. */
if (friendp && unqualified_id == ridpointers[(int) RID_SIGNED]) if (friendp && unqualified_id == ridpointers[(int) RID_SIGNED])
{ {
error ("function `%D' cannot be declared friend", error ("function %qD cannot be declared friend",
unqualified_id); unqualified_id);
friendp = 0; friendp = 0;
} }
...@@ -7829,7 +7837,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7829,7 +7837,7 @@ grokdeclarator (const cp_declarator *declarator,
if (ctype == NULL_TREE) if (ctype == NULL_TREE)
{ {
error ("can't make `%D' into a method -- not in a class", error ("can't make %qD into a method -- not in a class",
unqualified_id); unqualified_id);
return void_type_node; return void_type_node;
} }
...@@ -7838,7 +7846,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7838,7 +7846,7 @@ grokdeclarator (const cp_declarator *declarator,
ARM 9.5 */ ARM 9.5 */
if (virtualp && TREE_CODE (ctype) == UNION_TYPE) if (virtualp && TREE_CODE (ctype) == UNION_TYPE)
{ {
error ("function `%D' declared virtual inside a union", error ("function %qD declared virtual inside a union",
unqualified_id); unqualified_id);
return void_type_node; return void_type_node;
} }
...@@ -7847,7 +7855,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7847,7 +7855,8 @@ grokdeclarator (const cp_declarator *declarator,
{ {
if (virtualp) if (virtualp)
{ {
error ("`%D' cannot be declared virtual, since it is always static", error ("%qD cannot be declared virtual, since it "
"is always static",
unqualified_id); unqualified_id);
virtualp = 0; virtualp = 0;
} }
...@@ -7926,9 +7935,9 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7926,9 +7935,9 @@ grokdeclarator (const cp_declarator *declarator,
&& (TREE_CODE (type) != ARRAY_TYPE || initialized == 0)) && (TREE_CODE (type) != ARRAY_TYPE || initialized == 0))
{ {
if (unqualified_id) if (unqualified_id)
error ("field `%D' has incomplete type", unqualified_id); error ("field %qD has incomplete type", unqualified_id);
else else
error ("name `%T' has incomplete type", type); error ("name %qT has incomplete type", type);
/* If we're instantiating a template, tell them which /* If we're instantiating a template, tell them which
instantiation made the field's type be incomplete. */ instantiation made the field's type be incomplete. */
...@@ -7937,8 +7946,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7937,8 +7946,8 @@ grokdeclarator (const cp_declarator *declarator,
&& IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (current_class_type)) && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (current_class_type))
&& declspecs->type && declspecs->type
&& declspecs->type == type) && declspecs->type == type)
error (" in instantiation of template `%T'", error (" in instantiation of template %qT",
current_class_type); current_class_type);
type = error_mark_node; type = error_mark_node;
decl = NULL_TREE; decl = NULL_TREE;
...@@ -7947,7 +7956,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7947,7 +7956,7 @@ grokdeclarator (const cp_declarator *declarator,
{ {
if (friendp) if (friendp)
{ {
error ("`%E' is neither function nor member function; " error ("%qE is neither function nor member function; "
"cannot be declared friend", unqualified_id); "cannot be declared friend", unqualified_id);
friendp = 0; friendp = 0;
} }
...@@ -7998,9 +8007,9 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7998,9 +8007,9 @@ grokdeclarator (const cp_declarator *declarator,
the rest of the compiler does not correctly the rest of the compiler does not correctly
handle the initialization unless the member is handle the initialization unless the member is
static so we make it static below. */ static so we make it static below. */
pedwarn ("ISO C++ forbids initialization of member `%D'", pedwarn ("ISO C++ forbids initialization of member %qD",
unqualified_id); unqualified_id);
pedwarn ("making `%D' static", unqualified_id); pedwarn ("making %qD static", unqualified_id);
staticp = 1; staticp = 1;
} }
...@@ -8058,11 +8067,11 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8058,11 +8067,11 @@ grokdeclarator (const cp_declarator *declarator,
original_name = unqualified_id; original_name = unqualified_id;
if (storage_class == sc_auto) if (storage_class == sc_auto)
error ("storage class `auto' invalid for function `%s'", name); error ("storage class %<auto%> invalid for function %qs", name);
else if (storage_class == sc_register) else if (storage_class == sc_register)
error ("storage class `register' invalid for function `%s'", name); error ("storage class %<register%> invalid for function %qs", name);
else if (thread_p) else if (thread_p)
error ("storage class `__thread' invalid for function `%s'", name); error ("storage class %<__thread%> invalid for function %qs", name);
/* Function declaration not at top level. /* Function declaration not at top level.
Storage classes other than `extern' are not allowed Storage classes other than `extern' are not allowed
...@@ -8073,16 +8082,18 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8073,16 +8082,18 @@ grokdeclarator (const cp_declarator *declarator,
&& pedantic) && pedantic)
{ {
if (storage_class == sc_static) if (storage_class == sc_static)
pedwarn ("`static' specified invalid for function `%s' declared out of global scope", name); pedwarn ("%<static%> specified invalid for function %qs "
"declared out of global scope", name);
else else
pedwarn ("`inline' specifier invalid for function `%s' declared out of global scope", name); pedwarn ("%<inline%> specifier invalid for function %qs "
"declared out of global scope", name);
} }
if (ctype == NULL_TREE) if (ctype == NULL_TREE)
{ {
if (virtualp) if (virtualp)
{ {
error ("virtual non-class function `%s'", name); error ("virtual non-class function %qs", name);
virtualp = 0; virtualp = 0;
} }
} }
...@@ -8113,7 +8124,8 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8113,7 +8124,8 @@ grokdeclarator (const cp_declarator *declarator,
declaring main to be static. */ declaring main to be static. */
if (TREE_CODE (type) == METHOD_TYPE) if (TREE_CODE (type) == METHOD_TYPE)
{ {
pedwarn ("cannot declare member function `%D' to have static linkage", decl); pedwarn ("cannot declare member function %qD to have "
"static linkage", decl);
invalid_static = 1; invalid_static = 1;
} }
else if (current_function_decl) else if (current_function_decl)
...@@ -8148,19 +8160,21 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8148,19 +8160,21 @@ grokdeclarator (const cp_declarator *declarator,
DECL_CONTEXT (decl) = ctype; DECL_CONTEXT (decl) = ctype;
if (staticp == 1) if (staticp == 1)
{ {
pedwarn ("`static' may not be used when defining (as opposed to declaring) a static data member"); pedwarn ("%<static%> may not be used when defining "
"(as opposed to declaring) a static data member");
staticp = 0; staticp = 0;
storage_class = sc_none; storage_class = sc_none;
} }
if (storage_class == sc_register && TREE_STATIC (decl)) if (storage_class == sc_register && TREE_STATIC (decl))
{ {
error ("static member `%D' declared `register'", decl); error ("static member %qD declared %<register%>", decl);
storage_class = sc_none; storage_class = sc_none;
} }
if (storage_class == sc_extern && pedantic) if (storage_class == sc_extern && pedantic)
{ {
pedwarn ("cannot explicitly declare member `%#D' to have extern linkage", pedwarn ("cannot explicitly declare member %q#D to have "
decl); "extern linkage",
decl);
storage_class = sc_none; storage_class = sc_none;
} }
} }
...@@ -8299,11 +8313,11 @@ check_default_argument (tree decl, tree arg) ...@@ -8299,11 +8313,11 @@ check_default_argument (tree decl, tree arg)
|| !can_convert_arg (decl_type, TREE_TYPE (arg), arg)) || !can_convert_arg (decl_type, TREE_TYPE (arg), arg))
{ {
if (decl) if (decl)
error ("default argument for `%#D' has type `%T'", error ("default argument for %q#D has type %qT",
decl, TREE_TYPE (arg)); decl, TREE_TYPE (arg));
else else
error ("default argument for parameter of type `%T' has type `%T'", error ("default argument for parameter of type %qT has type %qT",
decl_type, TREE_TYPE (arg)); decl_type, TREE_TYPE (arg));
return error_mark_node; return error_mark_node;
} }
...@@ -8319,8 +8333,7 @@ check_default_argument (tree decl, tree arg) ...@@ -8319,8 +8333,7 @@ check_default_argument (tree decl, tree arg)
NULL); NULL);
if (var) if (var)
{ {
error ("default argument `%E' uses local variable `%D'", error ("default argument %qE uses local variable %qD", arg, var);
arg, var);
return error_mark_node; return error_mark_node;
} }
...@@ -8388,7 +8401,7 @@ grokparms (cp_parameter_declarator *first_parm, tree *parms) ...@@ -8388,7 +8401,7 @@ grokparms (cp_parameter_declarator *first_parm, tree *parms)
type = cp_build_qualified_type (type, 0); type = cp_build_qualified_type (type, 0);
if (TREE_CODE (type) == METHOD_TYPE) if (TREE_CODE (type) == METHOD_TYPE)
{ {
error ("parameter `%D' invalidly declared method type", decl); error ("parameter %qD invalidly declared method type", decl);
type = build_pointer_type (type); type = build_pointer_type (type);
TREE_TYPE (decl) = type; TREE_TYPE (decl) = type;
} }
...@@ -8412,8 +8425,9 @@ grokparms (cp_parameter_declarator *first_parm, tree *parms) ...@@ -8412,8 +8425,9 @@ grokparms (cp_parameter_declarator *first_parm, tree *parms)
t = TREE_TYPE (t); t = TREE_TYPE (t);
} }
if (TREE_CODE (t) == ARRAY_TYPE) if (TREE_CODE (t) == ARRAY_TYPE)
error ("parameter `%D' includes %s to array of unknown bound `%T'", error ("parameter %qD includes %s to array of unknown "
decl, ptr ? "pointer" : "reference", t); "bound %qT",
decl, ptr ? "pointer" : "reference", t);
} }
if (!any_error && init) if (!any_error && init)
...@@ -8569,7 +8583,7 @@ grok_ctor_properties (tree ctype, tree decl) ...@@ -8569,7 +8583,7 @@ grok_ctor_properties (tree ctype, tree decl)
or implicitly defined), there's no need to worry about their or implicitly defined), there's no need to worry about their
existence. Theoretically, they should never even be existence. Theoretically, they should never even be
instantiated, but that's hard to forestall. */ instantiated, but that's hard to forestall. */
error ("invalid constructor; you probably meant `%T (const %T&)'", error ("invalid constructor; you probably meant %<%T (const %T&)%>",
ctype, ctype); ctype, ctype);
return 0; return 0;
} }
...@@ -8693,9 +8707,9 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8693,9 +8707,9 @@ grok_op_properties (tree decl, int friendp, bool complain)
if (DECL_NAMESPACE_SCOPE_P (decl)) if (DECL_NAMESPACE_SCOPE_P (decl))
{ {
if (CP_DECL_CONTEXT (decl) != global_namespace) if (CP_DECL_CONTEXT (decl) != global_namespace)
error ("`%D' may not be declared within a namespace", decl); error ("%qD may not be declared within a namespace", decl);
else if (!TREE_PUBLIC (decl)) else if (!TREE_PUBLIC (decl))
error ("`%D' may not be declared as static", decl); error ("%qD may not be declared as static", decl);
} }
} }
...@@ -8715,13 +8729,14 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8715,13 +8729,14 @@ grok_op_properties (tree decl, int friendp, bool complain)
|| operator_code == COMPONENT_REF || operator_code == COMPONENT_REF
|| operator_code == ARRAY_REF || operator_code == ARRAY_REF
|| operator_code == NOP_EXPR) || operator_code == NOP_EXPR)
error ("`%D' must be a nonstatic member function", decl); error ("%qD must be a nonstatic member function", decl);
else else
{ {
tree p; tree p;
if (DECL_STATIC_FUNCTION_P (decl)) if (DECL_STATIC_FUNCTION_P (decl))
error ("`%D' must be either a non-static member function or a non-member function", decl); error ("%qD must be either a non-static member "
"function or a non-member function", decl);
for (p = argtypes; p && p != void_list_node; p = TREE_CHAIN (p)) for (p = argtypes; p && p != void_list_node; p = TREE_CHAIN (p))
{ {
...@@ -8738,7 +8753,7 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8738,7 +8753,7 @@ grok_op_properties (tree decl, int friendp, bool complain)
if (!complain) if (!complain)
return false; return false;
error ("`%D' must have an argument of class or " error ("%qD must have an argument of class or "
"enumerated type", "enumerated type",
decl); decl);
ok = false; ok = false;
...@@ -8773,7 +8788,8 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8773,7 +8788,8 @@ grok_op_properties (tree decl, int friendp, bool complain)
what = "a base class"; what = "a base class";
if (what && warn_conversion) if (what && warn_conversion)
warning ("conversion to %s%s will never use a type conversion operator", warning ("conversion to %s%s will never use a type "
"conversion operator",
ref ? "a reference to " : "", what); ref ? "a reference to " : "", what);
} }
} }
...@@ -8830,20 +8846,20 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8830,20 +8846,20 @@ grok_op_properties (tree decl, int friendp, bool complain)
&& ! same_type_p (TREE_VALUE (TREE_CHAIN (argtypes)), integer_type_node)) && ! same_type_p (TREE_VALUE (TREE_CHAIN (argtypes)), integer_type_node))
{ {
if (methodp) if (methodp)
error ("postfix `%D' must take `int' as its argument", error ("postfix %qD must take %<int%> as its argument",
decl); decl);
else else
error error
("postfix `%D' must take `int' as its second argument", ("postfix %qD must take %<int%> as its second argument",
decl); decl);
} }
} }
else else
{ {
if (methodp) if (methodp)
error ("`%D' must take either zero or one argument", decl); error ("%qD must take either zero or one argument", decl);
else else
error ("`%D' must take either one or two arguments", decl); error ("%qD must take either one or two arguments", decl);
} }
/* More Effective C++ rule 6. */ /* More Effective C++ rule 6. */
...@@ -8864,13 +8880,13 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8864,13 +8880,13 @@ grok_op_properties (tree decl, int friendp, bool complain)
if (TREE_CODE (ret) != REFERENCE_TYPE if (TREE_CODE (ret) != REFERENCE_TYPE
|| !same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (ret)), || !same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (ret)),
arg)) arg))
warning ("prefix `%D' should return `%T'", decl, warning ("prefix %qD should return %qT", decl,
build_reference_type (arg)); build_reference_type (arg));
} }
else else
{ {
if (!same_type_p (TYPE_MAIN_VARIANT (ret), arg)) if (!same_type_p (TYPE_MAIN_VARIANT (ret), arg))
warning ("postfix `%D' should return `%T'", decl, arg); warning ("postfix %qD should return %qT", decl, arg);
} }
} }
} }
...@@ -8879,9 +8895,9 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8879,9 +8895,9 @@ grok_op_properties (tree decl, int friendp, bool complain)
if (arity != 1) if (arity != 1)
{ {
if (methodp) if (methodp)
error ("`%D' must take `void'", decl); error ("%qD must take %<void%>", decl);
else else
error ("`%D' must take exactly one argument", decl); error ("%qD must take exactly one argument", decl);
} }
} }
else /* if (binary_op_p (operator_code)) */ else /* if (binary_op_p (operator_code)) */
...@@ -8889,9 +8905,9 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8889,9 +8905,9 @@ grok_op_properties (tree decl, int friendp, bool complain)
if (arity != 2) if (arity != 2)
{ {
if (methodp) if (methodp)
error ("`%D' must take exactly one argument", decl); error ("%qD must take exactly one argument", decl);
else else
error ("`%D' must take exactly two arguments", decl); error ("%qD must take exactly two arguments", decl);
} }
/* More Effective C++ rule 7. */ /* More Effective C++ rule 7. */
...@@ -8899,8 +8915,8 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8899,8 +8915,8 @@ grok_op_properties (tree decl, int friendp, bool complain)
&& (operator_code == TRUTH_ANDIF_EXPR && (operator_code == TRUTH_ANDIF_EXPR
|| operator_code == TRUTH_ORIF_EXPR || operator_code == TRUTH_ORIF_EXPR
|| operator_code == COMPOUND_EXPR)) || operator_code == COMPOUND_EXPR))
warning ("user-defined `%D' always evaluates both arguments", warning ("user-defined %qD always evaluates both arguments",
decl); decl);
} }
/* Effective C++ rule 23. */ /* Effective C++ rule 23. */
...@@ -8913,7 +8929,7 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8913,7 +8929,7 @@ grok_op_properties (tree decl, int friendp, bool complain)
|| operator_code == MULT_EXPR || operator_code == MULT_EXPR
|| operator_code == TRUNC_MOD_EXPR) || operator_code == TRUNC_MOD_EXPR)
&& TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == REFERENCE_TYPE) && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == REFERENCE_TYPE)
warning ("`%D' should return by value", decl); warning ("%qD should return by value", decl);
/* [over.oper]/8 */ /* [over.oper]/8 */
for (; argtypes && argtypes != void_list_node; for (; argtypes && argtypes != void_list_node;
...@@ -8925,10 +8941,10 @@ grok_op_properties (tree decl, int friendp, bool complain) ...@@ -8925,10 +8941,10 @@ grok_op_properties (tree decl, int friendp, bool complain)
|| operator_code == POSTDECREMENT_EXPR) || operator_code == POSTDECREMENT_EXPR)
{ {
if (pedantic) if (pedantic)
pedwarn ("`%D' cannot have default arguments", decl); pedwarn ("%qD cannot have default arguments", decl);
} }
else else
error ("`%D' cannot have default arguments", decl); error ("%qD cannot have default arguments", decl);
} }
} }
...@@ -8988,13 +9004,13 @@ check_elaborated_type_specifier (enum tag_types tag_code, ...@@ -8988,13 +9004,13 @@ check_elaborated_type_specifier (enum tag_types tag_code,
the type is declared. */ the type is declared. */
if (!DECL_IMPLICIT_TYPEDEF_P (decl)) if (!DECL_IMPLICIT_TYPEDEF_P (decl))
{ {
error ("using typedef-name `%D' after `%s'", decl, tag_name (tag_code)); error ("using typedef-name %qD after %qs", decl, tag_name (tag_code));
return IS_AGGR_TYPE (type) ? type : error_mark_node; return IS_AGGR_TYPE (type) ? type : error_mark_node;
} }
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
{ {
error ("using template type parameter `%T' after `%s'", error ("using template type parameter %qT after %qs",
type, tag_name (tag_code)); type, tag_name (tag_code));
return error_mark_node; return error_mark_node;
} }
...@@ -9002,13 +9018,13 @@ check_elaborated_type_specifier (enum tag_types tag_code, ...@@ -9002,13 +9018,13 @@ check_elaborated_type_specifier (enum tag_types tag_code,
&& TREE_CODE (type) != UNION_TYPE && TREE_CODE (type) != UNION_TYPE
&& tag_code != enum_type) && tag_code != enum_type)
{ {
error ("`%T' referred to as `%s'", type, tag_name (tag_code)); error ("%qT referred to as %qs", type, tag_name (tag_code));
return error_mark_node; return error_mark_node;
} }
else if (TREE_CODE (type) != ENUMERAL_TYPE else if (TREE_CODE (type) != ENUMERAL_TYPE
&& tag_code == enum_type) && tag_code == enum_type)
{ {
error ("`%T' referred to as enum", type); error ("%qT referred to as enum", type);
return error_mark_node; return error_mark_node;
} }
else if (!allow_template_p else if (!allow_template_p
...@@ -9023,7 +9039,7 @@ check_elaborated_type_specifier (enum tag_types tag_code, ...@@ -9023,7 +9039,7 @@ check_elaborated_type_specifier (enum tag_types tag_code,
then the required template argument is missing. */ then the required template argument is missing. */
error ("template argument required for `%s %T'", error ("template argument required for %<%s %T%>",
tag_name (tag_code), tag_name (tag_code),
DECL_NAME (CLASSTYPE_TI_TEMPLATE (type))); DECL_NAME (CLASSTYPE_TI_TEMPLATE (type)));
return error_mark_node; return error_mark_node;
...@@ -9168,7 +9184,7 @@ xref_tag (enum tag_types tag_code, tree name, ...@@ -9168,7 +9184,7 @@ xref_tag (enum tag_types tag_code, tree name,
the forward-reference will be altered into a real type. */ the forward-reference will be altered into a real type. */
if (code == ENUMERAL_TYPE) if (code == ENUMERAL_TYPE)
{ {
error ("use of enum `%#D' without previous declaration", name); error ("use of enum %q#D without previous declaration", name);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
} }
else else
...@@ -9186,7 +9202,7 @@ xref_tag (enum tag_types tag_code, tree name, ...@@ -9186,7 +9202,7 @@ xref_tag (enum tag_types tag_code, tree name,
&& CLASS_TYPE_P (t) && CLASS_TYPE_P (t)
&& CLASSTYPE_IS_TEMPLATE (t)) && CLASSTYPE_IS_TEMPLATE (t))
{ {
error ("redeclaration of `%T' as a non-template", t); error ("redeclaration of %qT as a non-template", t);
t = error_mark_node; t = error_mark_node;
} }
} }
...@@ -9279,13 +9295,13 @@ xref_basetypes (tree ref, tree base_list) ...@@ -9279,13 +9295,13 @@ xref_basetypes (tree ref, tree base_list)
CLASSTYPE_NON_AGGREGATE (ref) = 1; CLASSTYPE_NON_AGGREGATE (ref) = 1;
if (TREE_CODE (ref) == UNION_TYPE) if (TREE_CODE (ref) == UNION_TYPE)
error ("derived union `%T' invalid", ref); error ("derived union %qT invalid", ref);
} }
if (max_bases > 1) if (max_bases > 1)
{ {
if (TYPE_FOR_JAVA (ref)) if (TYPE_FOR_JAVA (ref))
error ("Java class '%T' cannot have multiple bases", ref); error ("Java class %qT cannot have multiple bases", ref);
} }
if (max_vbases) if (max_vbases)
...@@ -9293,7 +9309,7 @@ xref_basetypes (tree ref, tree base_list) ...@@ -9293,7 +9309,7 @@ xref_basetypes (tree ref, tree base_list)
CLASSTYPE_VBASECLASSES (ref) = VEC_alloc (tree, max_vbases); CLASSTYPE_VBASECLASSES (ref) = VEC_alloc (tree, max_vbases);
if (TYPE_FOR_JAVA (ref)) if (TYPE_FOR_JAVA (ref))
error ("Java class '%T' cannot have virtual bases", ref); error ("Java class %qT cannot have virtual bases", ref);
} }
for (igo_prev = binfo; base_list; base_list = TREE_CHAIN (base_list)) for (igo_prev = binfo; base_list; base_list = TREE_CHAIN (base_list))
...@@ -9312,7 +9328,7 @@ xref_basetypes (tree ref, tree base_list) ...@@ -9312,7 +9328,7 @@ xref_basetypes (tree ref, tree base_list)
&& TREE_CODE (basetype) != TEMPLATE_TYPE_PARM && TREE_CODE (basetype) != TEMPLATE_TYPE_PARM
&& TREE_CODE (basetype) != BOUND_TEMPLATE_TEMPLATE_PARM) && TREE_CODE (basetype) != BOUND_TEMPLATE_TEMPLATE_PARM)
{ {
error ("base type `%T' fails to be a struct or class type", error ("base type %qT fails to be a struct or class type",
basetype); basetype);
continue; continue;
} }
...@@ -9345,9 +9361,9 @@ xref_basetypes (tree ref, tree base_list) ...@@ -9345,9 +9361,9 @@ xref_basetypes (tree ref, tree base_list)
if (TYPE_MARKED_P (basetype)) if (TYPE_MARKED_P (basetype))
{ {
if (basetype == ref) if (basetype == ref)
error ("recursive type `%T' undefined", basetype); error ("recursive type %qT undefined", basetype);
else else
error ("duplicate base type `%T' invalid", basetype); error ("duplicate base type %qT invalid", basetype);
continue; continue;
} }
TYPE_MARKED_P (basetype) = 1; TYPE_MARKED_P (basetype) = 1;
...@@ -9415,7 +9431,7 @@ start_enum (tree name) ...@@ -9415,7 +9431,7 @@ start_enum (tree name)
if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE) if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE)
{ {
error ("multiple definition of `%#T'", enumtype); error ("multiple definition of %q#T", enumtype);
error ("%Jprevious definition here", TYPE_MAIN_DECL (enumtype)); error ("%Jprevious definition here", TYPE_MAIN_DECL (enumtype));
/* Clear out TYPE_VALUES, and start again. */ /* Clear out TYPE_VALUES, and start again. */
TYPE_VALUES (enumtype) = NULL_TREE; TYPE_VALUES (enumtype) = NULL_TREE;
...@@ -9542,7 +9558,7 @@ finish_enum (tree enumtype) ...@@ -9542,7 +9558,7 @@ finish_enum (tree enumtype)
IF no integral type can represent all the enumerator values, the IF no integral type can represent all the enumerator values, the
enumeration is ill-formed. */ enumeration is ill-formed. */
error ("no integral type can represent all of the enumerator values " error ("no integral type can represent all of the enumerator values "
"for `%T'", enumtype); "for %qT", enumtype);
precision = TYPE_PRECISION (long_long_integer_type_node); precision = TYPE_PRECISION (long_long_integer_type_node);
underlying_type = integer_types[itk_unsigned_long_long]; underlying_type = integer_types[itk_unsigned_long_long];
} }
...@@ -9642,7 +9658,7 @@ build_enumerator (tree name, tree value, tree enumtype) ...@@ -9642,7 +9658,7 @@ build_enumerator (tree name, tree value, tree enumtype)
} }
else else
{ {
error ("enumerator value for `%D' not integer constant", name); error ("enumerator value for %qD not integer constant", name);
value = NULL_TREE; value = NULL_TREE;
} }
} }
...@@ -9669,7 +9685,7 @@ build_enumerator (tree name, tree value, tree enumtype) ...@@ -9669,7 +9685,7 @@ build_enumerator (tree name, tree value, tree enumtype)
overflowed |= !int_fits_type_p (value, TREE_TYPE (prev_value)); overflowed |= !int_fits_type_p (value, TREE_TYPE (prev_value));
if (overflowed) if (overflowed)
error ("overflow in enumeration values at `%D'", name); error ("overflow in enumeration values at %qD", name);
} }
else else
value = integer_zero_node; value = integer_zero_node;
...@@ -9740,7 +9756,7 @@ check_function_type (tree decl, tree current_function_parms) ...@@ -9740,7 +9756,7 @@ check_function_type (tree decl, tree current_function_parms)
if (!COMPLETE_OR_VOID_TYPE_P (return_type)) if (!COMPLETE_OR_VOID_TYPE_P (return_type))
{ {
error ("return type `%#T' is incomplete", TREE_TYPE (fntype)); error ("return type %q#T is incomplete", TREE_TYPE (fntype));
/* Make it return void instead, but don't change the /* Make it return void instead, but don't change the
type of the DECL_RESULT, in case we have a named return value. */ type of the DECL_RESULT, in case we have a named return value. */
...@@ -9818,7 +9834,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) ...@@ -9818,7 +9834,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
if (DECL_DECLARED_INLINE_P (decl1) if (DECL_DECLARED_INLINE_P (decl1)
&& lookup_attribute ("noinline", attrs)) && lookup_attribute ("noinline", attrs))
warning ("%Jinline function '%D' given attribute noinline", decl1, decl1); warning ("%Jinline function %qD given attribute noinline", decl1, decl1);
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl1)) if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl1))
/* This is a constructor, we must ensure that any default args /* This is a constructor, we must ensure that any default args
...@@ -9855,7 +9871,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) ...@@ -9855,7 +9871,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
if (warn_ecpp if (warn_ecpp
&& DECL_OVERLOADED_OPERATOR_P (decl1) == NOP_EXPR && DECL_OVERLOADED_OPERATOR_P (decl1) == NOP_EXPR
&& TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE) && TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE)
warning ("`operator=' should return a reference to `*this'"); warning ("%<operator=%> should return a reference to %<*this%>");
/* Make the init_value nonzero so pushdecl knows this is not tentative. /* Make the init_value nonzero so pushdecl knows this is not tentative.
error_mark_node is replaced below (in poplevel) with the BLOCK. */ error_mark_node is replaced below (in poplevel) with the BLOCK. */
...@@ -10179,7 +10195,7 @@ store_parm_decls (tree current_function_parms) ...@@ -10179,7 +10195,7 @@ store_parm_decls (tree current_function_parms)
|| TREE_CODE (parm) != VOID_TYPE) || TREE_CODE (parm) != VOID_TYPE)
pushdecl (parm); pushdecl (parm);
else else
error ("parameter `%D' declared void", parm); error ("parameter %qD declared void", parm);
} }
else else
{ {
...@@ -10676,7 +10692,7 @@ start_method (cp_decl_specifier_seq *declspecs, ...@@ -10676,7 +10692,7 @@ start_method (cp_decl_specifier_seq *declspecs,
{ {
if (DECL_CONTEXT (fndecl) if (DECL_CONTEXT (fndecl)
&& TREE_CODE( DECL_CONTEXT (fndecl)) != NAMESPACE_DECL) && TREE_CODE( DECL_CONTEXT (fndecl)) != NAMESPACE_DECL)
error ("`%D' is already defined in class `%T'", fndecl, error ("%qD is already defined in class %qT", fndecl,
DECL_CONTEXT (fndecl)); DECL_CONTEXT (fndecl));
return void_type_node; return void_type_node;
} }
......
...@@ -378,8 +378,8 @@ grok_array_decl (tree array_expr, tree index_exp) ...@@ -378,8 +378,8 @@ grok_array_decl (tree array_expr, tree index_exp)
array_expr = p2, index_exp = i1; array_expr = p2, index_exp = i1;
else else
{ {
error ("invalid types `%T[%T]' for array subscript", error ("invalid types %<%T[%T]%> for array subscript",
type, TREE_TYPE (index_exp)); type, TREE_TYPE (index_exp));
return error_mark_node; return error_mark_node;
} }
...@@ -423,14 +423,14 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete) ...@@ -423,14 +423,14 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete)
/* An array can't have been allocated by new, so complain. */ /* An array can't have been allocated by new, so complain. */
if (TREE_CODE (exp) == VAR_DECL if (TREE_CODE (exp) == VAR_DECL
&& TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE) && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
warning ("deleting array `%#D'", exp); warning ("deleting array %q#D", exp);
t = build_expr_type_conversion (WANT_POINTER, exp, true); t = build_expr_type_conversion (WANT_POINTER, exp, true);
if (t == NULL_TREE || t == error_mark_node) if (t == NULL_TREE || t == error_mark_node)
{ {
error ("type `%#T' argument given to `delete', expected pointer", error ("type %q#T argument given to %<delete%>, expected pointer",
TREE_TYPE (exp)); TREE_TYPE (exp));
return error_mark_node; return error_mark_node;
} }
...@@ -441,14 +441,15 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete) ...@@ -441,14 +441,15 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete)
/* You can't delete functions. */ /* You can't delete functions. */
if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
{ {
error ("cannot delete a function. Only pointer-to-objects are valid arguments to `delete'"); error ("cannot delete a function. Only pointer-to-objects are "
"valid arguments to %<delete%>");
return error_mark_node; return error_mark_node;
} }
/* Deleting ptr to void is undefined behavior [expr.delete/3]. */ /* Deleting ptr to void is undefined behavior [expr.delete/3]. */
if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE) if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
{ {
warning ("deleting `%T' is undefined", type); warning ("deleting %qT is undefined", type);
doing_vec = 0; doing_vec = 0;
} }
...@@ -484,8 +485,8 @@ check_member_template (tree tmpl) ...@@ -484,8 +485,8 @@ check_member_template (tree tmpl)
/* 14.5.2.2 [temp.mem] /* 14.5.2.2 [temp.mem]
A local class shall not have member templates. */ A local class shall not have member templates. */
error ("invalid declaration of member template `%#D' in local class", error ("invalid declaration of member template %q#D in local class",
decl); decl);
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl)) if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
{ {
...@@ -493,7 +494,7 @@ check_member_template (tree tmpl) ...@@ -493,7 +494,7 @@ check_member_template (tree tmpl)
A member function template shall not be virtual. */ A member function template shall not be virtual. */
error error
("invalid use of `virtual' in template declaration of `%#D'", ("invalid use of %<virtual%> in template declaration of %q#D",
decl); decl);
DECL_VIRTUAL_P (decl) = 0; DECL_VIRTUAL_P (decl) = 0;
} }
...@@ -503,7 +504,7 @@ check_member_template (tree tmpl) ...@@ -503,7 +504,7 @@ check_member_template (tree tmpl)
DECL_IGNORED_P (tmpl) = 1; DECL_IGNORED_P (tmpl) = 1;
} }
else else
error ("template declaration of `%#D'", decl); error ("template declaration of %q#D", decl);
} }
/* Return true iff TYPE is a valid Java parameter or return type. */ /* Return true iff TYPE is a valid Java parameter or return type. */
...@@ -552,8 +553,8 @@ check_java_method (tree method) ...@@ -552,8 +553,8 @@ check_java_method (tree method)
if (!acceptable_java_type (ret_type)) if (!acceptable_java_type (ret_type))
{ {
error ("Java method '%D' has non-Java return type `%T'", error ("Java method %qD has non-Java return type %qT",
method, ret_type); method, ret_type);
jerr = true; jerr = true;
} }
...@@ -568,8 +569,8 @@ check_java_method (tree method) ...@@ -568,8 +569,8 @@ check_java_method (tree method)
tree type = TREE_VALUE (arg_types); tree type = TREE_VALUE (arg_types);
if (!acceptable_java_type (type)) if (!acceptable_java_type (type))
{ {
error ("Java method '%D' has non-Java parameter type `%T'", error ("Java method %qD has non-Java parameter type %qT",
method, type); method, type);
jerr = true; jerr = true;
} }
} }
...@@ -715,7 +716,7 @@ check_classfn (tree ctype, tree function, tree template_parms) ...@@ -715,7 +716,7 @@ check_classfn (tree ctype, tree function, tree template_parms)
else if (!COMPLETE_TYPE_P (ctype)) else if (!COMPLETE_TYPE_P (ctype))
cxx_incomplete_type_error (function, ctype); cxx_incomplete_type_error (function, ctype);
else else
error ("no `%#D' member function declared in class `%T'", error ("no %q#D member function declared in class %qT",
function, ctype); function, ctype);
/* If we did not find the method in the class, add it to avoid /* If we did not find the method in the class, add it to avoid
...@@ -778,7 +779,7 @@ finish_static_data_member_decl (tree decl, tree init, tree asmspec_tree, ...@@ -778,7 +779,7 @@ finish_static_data_member_decl (tree decl, tree init, tree asmspec_tree,
note_vague_linkage_var (decl); note_vague_linkage_var (decl);
if (LOCAL_CLASS_P (current_class_type)) if (LOCAL_CLASS_P (current_class_type))
pedwarn ("local class `%#T' shall not have static data member `%#D'", pedwarn ("local class %q#T shall not have static data member %q#D",
current_class_type, decl); current_class_type, decl);
/* Static consts need not be initialized in the class definition. */ /* Static consts need not be initialized in the class definition. */
...@@ -853,7 +854,7 @@ grokfield (const cp_declarator *declarator, ...@@ -853,7 +854,7 @@ grokfield (const cp_declarator *declarator,
if (TREE_CODE (value) == TYPE_DECL && init) if (TREE_CODE (value) == TYPE_DECL && init)
{ {
error ("typedef `%D' is initialized (use __typeof__ instead)", value); error ("typedef %qD is initialized (use __typeof__ instead)", value);
init = NULL_TREE; init = NULL_TREE;
} }
...@@ -870,8 +871,8 @@ grokfield (const cp_declarator *declarator, ...@@ -870,8 +871,8 @@ grokfield (const cp_declarator *declarator,
if (DECL_NAME (value) != NULL_TREE if (DECL_NAME (value) != NULL_TREE
&& IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_' && IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
&& ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr")) && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr"))
error ("member `%D' conflicts with virtual function table field name", error ("member %qD conflicts with virtual function table field name",
value); value);
/* Stash away type declarations. */ /* Stash away type declarations. */
if (TREE_CODE (value) == TYPE_DECL) if (TREE_CODE (value) == TYPE_DECL)
...@@ -887,8 +888,7 @@ grokfield (const cp_declarator *declarator, ...@@ -887,8 +888,7 @@ grokfield (const cp_declarator *declarator,
if (DECL_IN_AGGR_P (value)) if (DECL_IN_AGGR_P (value))
{ {
error ("`%D' is already defined in `%T'", value, error ("%qD is already defined in %qT", value, DECL_CONTEXT (value));
DECL_CONTEXT (value));
return void_type_node; return void_type_node;
} }
...@@ -1008,7 +1008,7 @@ grokbitfield (const cp_declarator *declarator, ...@@ -1008,7 +1008,7 @@ grokbitfield (const cp_declarator *declarator,
if (TREE_CODE (value) == TYPE_DECL) if (TREE_CODE (value) == TYPE_DECL)
{ {
error ("cannot declare `%D' to be a bit-field type", value); error ("cannot declare %qD to be a bit-field type", value);
return NULL_TREE; return NULL_TREE;
} }
...@@ -1018,21 +1018,21 @@ grokbitfield (const cp_declarator *declarator, ...@@ -1018,21 +1018,21 @@ grokbitfield (const cp_declarator *declarator,
check here. */ check here. */
if (TREE_CODE (value) == FUNCTION_DECL) if (TREE_CODE (value) == FUNCTION_DECL)
{ {
error ("cannot declare bit-field `%D' with function type", error ("cannot declare bit-field %qD with function type",
DECL_NAME (value)); DECL_NAME (value));
return NULL_TREE; return NULL_TREE;
} }
if (DECL_IN_AGGR_P (value)) if (DECL_IN_AGGR_P (value))
{ {
error ("`%D' is already defined in the class %T", value, error ("%qD is already defined in the class %qT", value,
DECL_CONTEXT (value)); DECL_CONTEXT (value));
return void_type_node; return void_type_node;
} }
if (TREE_STATIC (value)) if (TREE_STATIC (value))
{ {
error ("static member `%D' cannot be a bit-field", value); error ("static member %qD cannot be a bit-field", value);
return NULL_TREE; return NULL_TREE;
} }
cp_finish_decl (value, NULL_TREE, NULL_TREE, 0); cp_finish_decl (value, NULL_TREE, NULL_TREE, 0);
...@@ -1091,11 +1091,11 @@ grok_function_init (tree decl, tree init) ...@@ -1091,11 +1091,11 @@ grok_function_init (tree decl, tree init)
tree type = TREE_TYPE (decl); tree type = TREE_TYPE (decl);
if (TREE_CODE (type) == FUNCTION_TYPE) if (TREE_CODE (type) == FUNCTION_TYPE)
error ("initializer specified for non-member function `%D'", decl); error ("initializer specified for non-member function %qD", decl);
else if (integer_zerop (init)) else if (integer_zerop (init))
DECL_PURE_VIRTUAL_P (decl) = 1; DECL_PURE_VIRTUAL_P (decl) = 1;
else else
error ("invalid initializer for virtual method `%D'", decl); error ("invalid initializer for virtual method %qD", decl);
} }
void void
...@@ -1140,16 +1140,16 @@ build_anon_union_vars (tree object) ...@@ -1140,16 +1140,16 @@ build_anon_union_vars (tree object)
continue; continue;
if (TREE_CODE (field) != FIELD_DECL) if (TREE_CODE (field) != FIELD_DECL)
{ {
cp_pedwarn_at ("\ cp_pedwarn_at ("%q#D invalid; an anonymous union can only "
`%#D' invalid; an anonymous union can only have non-static data members", "have non-static data members",
field); field);
continue; continue;
} }
if (TREE_PRIVATE (field)) if (TREE_PRIVATE (field))
cp_pedwarn_at ("private member `%#D' in anonymous union", field); cp_pedwarn_at ("private member %q#D in anonymous union", field);
else if (TREE_PROTECTED (field)) else if (TREE_PROTECTED (field))
cp_pedwarn_at ("protected member `%#D' in anonymous union", field); cp_pedwarn_at ("protected member %q#D in anonymous union", field);
if (processing_template_decl) if (processing_template_decl)
ref = build_min_nt (COMPONENT_REF, object, ref = build_min_nt (COMPONENT_REF, object,
...@@ -1239,7 +1239,10 @@ coerce_new_type (tree type) ...@@ -1239,7 +1239,10 @@ coerce_new_type (tree type)
gcc_assert (TREE_CODE (type) == FUNCTION_TYPE); gcc_assert (TREE_CODE (type) == FUNCTION_TYPE);
if (!same_type_p (TREE_TYPE (type), ptr_type_node)) if (!same_type_p (TREE_TYPE (type), ptr_type_node))
e = 1, error ("`operator new' must return type `%T'", ptr_type_node); {
e = 1;
error ("%<operator new%> must return type %qT", ptr_type_node);
}
if (!args || args == void_list_node if (!args || args == void_list_node
|| !same_type_p (TREE_VALUE (args), size_type_node)) || !same_type_p (TREE_VALUE (args), size_type_node))
...@@ -1247,7 +1250,8 @@ coerce_new_type (tree type) ...@@ -1247,7 +1250,8 @@ coerce_new_type (tree type)
e = 2; e = 2;
if (args && args != void_list_node) if (args && args != void_list_node)
args = TREE_CHAIN (args); args = TREE_CHAIN (args);
pedwarn ("`operator new' takes type `size_t' (`%T') as first parameter", size_type_node); pedwarn ("%<operator new%> takes type %<size_t%> (%qT) "
"as first parameter", size_type_node);
} }
switch (e) switch (e)
{ {
...@@ -1273,7 +1277,10 @@ coerce_delete_type (tree type) ...@@ -1273,7 +1277,10 @@ coerce_delete_type (tree type)
gcc_assert (TREE_CODE (type) == FUNCTION_TYPE); gcc_assert (TREE_CODE (type) == FUNCTION_TYPE);
if (!same_type_p (TREE_TYPE (type), void_type_node)) if (!same_type_p (TREE_TYPE (type), void_type_node))
e = 1, error ("`operator delete' must return type `%T'", void_type_node); {
e = 1;
error ("%<operator delete%> must return type %qT", void_type_node);
}
if (!args || args == void_list_node if (!args || args == void_list_node
|| !same_type_p (TREE_VALUE (args), ptr_type_node)) || !same_type_p (TREE_VALUE (args), ptr_type_node))
...@@ -1281,7 +1288,8 @@ coerce_delete_type (tree type) ...@@ -1281,7 +1288,8 @@ coerce_delete_type (tree type)
e = 2; e = 2;
if (args && args != void_list_node) if (args && args != void_list_node)
args = TREE_CHAIN (args); args = TREE_CHAIN (args);
error ("`operator delete' takes type `%T' as first parameter", ptr_type_node); error ("%<operator delete%> takes type %qT as first parameter",
ptr_type_node);
} }
switch (e) switch (e)
{ {
...@@ -3167,7 +3175,7 @@ check_default_args (tree x) ...@@ -3167,7 +3175,7 @@ check_default_args (tree x)
saw_def = true; saw_def = true;
else if (saw_def) else if (saw_def)
{ {
cp_error_at ("default argument missing for parameter %P of `%+#D'", cp_error_at ("default argument missing for parameter %P of %q+#D",
i, x); i, x);
break; break;
} }
......
...@@ -7157,7 +7157,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser, ...@@ -7157,7 +7157,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
if (decl_specs->specs[(int) ds_thread]) if (decl_specs->specs[(int) ds_thread])
{ {
error ("`__thread' before `static'"); error ("%<__thread%> before %<static%>");
decl_specs->specs[(int) ds_thread] = 0; decl_specs->specs[(int) ds_thread] = 0;
} }
cp_parser_set_storage_class (decl_specs, sc_static); cp_parser_set_storage_class (decl_specs, sc_static);
...@@ -7167,7 +7167,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser, ...@@ -7167,7 +7167,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
if (decl_specs->specs[(int) ds_thread]) if (decl_specs->specs[(int) ds_thread])
{ {
error ("`__thread' before `extern'"); error ("%<__thread%> before %<extern%>");
decl_specs->specs[(int) ds_thread] = 0; decl_specs->specs[(int) ds_thread] = 0;
} }
cp_parser_set_storage_class (decl_specs, sc_extern); cp_parser_set_storage_class (decl_specs, sc_extern);
......
2004-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
* g++.dg/template/local1.C: Adjust quoting marks in
testing for diagnostics.
* g++.dg/tls/diag-2.C: Likewise.
* g++.dg/other/error8.C: Likewise.
2004-10-03 Andrew Pinski <pinskia@physics.uc.edu> 2004-10-03 Andrew Pinski <pinskia@physics.uc.edu>
PR c/17178 PR c/17178
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
void foo(void) void foo(void)
{ {
union { int alpha; int beta; }; // { dg-error "previous declaration of `int alpha'" } union { int alpha; int beta; }; // { dg-error "previous declaration of 'int alpha'" }
double alpha; // { dg-error "redeclared" } double alpha; // { dg-error "redeclared" }
} }
......
...@@ -14,7 +14,7 @@ template<class T> void A::f() ...@@ -14,7 +14,7 @@ template<class T> void A::f()
struct B struct B
{ {
void g() {} void g() {}
static int x; // { dg-error "static.*`int A::f\\(\\)::B::x'" "" } static int x; // { dg-error "static.*int A::f\\(\\)::B::x" "" }
}; };
} }
......
/* Invalid __thread specifiers. */ /* Invalid __thread specifiers. */
__thread extern int g1; /* { dg-error "`__thread' before `extern'" } */ __thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */
__thread static int g2; /* { dg-error "`__thread' before `static'" } */ __thread static int g2; /* { dg-error "'__thread' before 'static'" } */
__thread __thread int g3; /* { dg-error "duplicate `__thread'" } */ __thread __thread int g3; /* { dg-error "duplicate '__thread'" } */
typedef __thread int g4; /* { dg-error "multiple storage classes" } */ typedef __thread int g4; /* { dg-error "multiple storage classes" } */
void foo() void foo()
{ {
__thread int l1; /* { dg-error "implicitly auto and declared `__thread'" } */ __thread int l1; /* { dg-error "implicitly auto and declared '__thread'" } */
auto __thread int l2; /* { dg-error "multiple storage classes" } */ auto __thread int l2; /* { dg-error "multiple storage classes" } */
__thread extern int l3; /* { dg-error "`__thread' before `extern'" } */ __thread extern int l3; /* { dg-error "'__thread' before 'extern'" } */
register __thread int l4; /* { dg-error "multiple storage classes" } */ register __thread int l4; /* { dg-error "multiple storage classes" } */
} }
......
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