Commit 04d6ccbd by Kaveh R. Ghazi Committed by Kaveh Ghazi

class.c (add_method, [...]): Fix format specifier.

	* class.c (add_method, check_field_decl): Fix format specifier.
	* decl.c (duplicate_decls, pushdecl, check_goto,
	fixup_anonymous_aggr, maybe_commonize_var, grokdeclarator,
	start_enum): Likewise.
	* decl2.c (ambiguous_decl): Likewise.
	* pt.c (redeclare_class_template): Likewise.

From-SVN: r68878
parent a11c61d2
2003-07-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* class.c (add_method, check_field_decl): Fix format specifier.
* decl.c (duplicate_decls, pushdecl, check_goto,
fixup_anonymous_aggr, maybe_commonize_var, grokdeclarator,
start_enum): Likewise.
* decl2.c (ambiguous_decl): Likewise.
* pt.c (redeclare_class_template): Likewise.
2003-07-02 Nathan Sidwell <nathan@codesourcery.com> 2003-07-02 Nathan Sidwell <nathan@codesourcery.com>
PR c++/10219 PR c++/10219
......
...@@ -927,7 +927,7 @@ add_method (tree type, tree method, int error_p) ...@@ -927,7 +927,7 @@ add_method (tree type, tree method, int error_p)
else else
{ {
cp_error_at ("`%#D' and `%#D' cannot be overloaded", cp_error_at ("`%#D' and `%#D' cannot be overloaded",
method, fn, method); method, fn);
/* We don't call duplicate_decls here to merge /* We don't call duplicate_decls here to merge
the declarations because that will confuse the declarations because that will confuse
...@@ -2961,7 +2961,7 @@ check_field_decl (tree field, ...@@ -2961,7 +2961,7 @@ check_field_decl (tree field,
/* `build_class_init_list' does not recognize /* `build_class_init_list' does not recognize
non-FIELD_DECLs. */ non-FIELD_DECLs. */
if (TREE_CODE (t) == UNION_TYPE && any_default_members != 0) if (TREE_CODE (t) == UNION_TYPE && any_default_members != 0)
cp_error_at ("multiple fields in union `%T' initialized"); error ("multiple fields in union `%T' initialized", t);
*any_default_members = 1; *any_default_members = 1;
} }
} }
......
...@@ -3138,7 +3138,8 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -3138,7 +3138,8 @@ duplicate_decls (tree newdecl, tree olddecl)
{ {
/* 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 `%#D'", newdecl);
cp_warning_at ("follows non-prototype definition here", olddecl); warning ("%Hfollows non-prototype definition here",
&DECL_SOURCE_LOCATION (olddecl));
} }
else if (TREE_CODE (olddecl) == FUNCTION_DECL else if (TREE_CODE (olddecl) == FUNCTION_DECL
&& DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl)) && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl))
...@@ -3195,8 +3196,8 @@ duplicate_decls (tree newdecl, tree olddecl) ...@@ -3195,8 +3196,8 @@ duplicate_decls (tree newdecl, tree olddecl)
{ {
warning ("`%#D' was used before it was declared inline", warning ("`%#D' was used before it was declared inline",
newdecl); newdecl);
cp_warning_at ("previous non-inline declaration here", warning ("%Hprevious non-inline declaration here",
olddecl); &DECL_SOURCE_LOCATION (olddecl));
} }
} }
} }
...@@ -3888,7 +3889,7 @@ pushdecl (tree x) ...@@ -3888,7 +3889,7 @@ pushdecl (tree x)
&& TREE_CODE (decl) == TREE_CODE (x) && TREE_CODE (decl) == TREE_CODE (x)
&& !same_type_p (TREE_TYPE (x), TREE_TYPE (decl))) && !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
{ {
pedwarn ("type mismatch with previous external decl", x); pedwarn ("type mismatch with previous external decl of `%#D'", x);
cp_pedwarn_at ("previous external decl of `%#D'", decl); cp_pedwarn_at ("previous external decl of `%#D'", decl);
} }
} }
...@@ -4925,7 +4926,7 @@ check_goto (tree decl) ...@@ -4925,7 +4926,7 @@ check_goto (tree decl)
if (u > 1 && DECL_ARTIFICIAL (b)) if (u > 1 && DECL_ARTIFICIAL (b))
/* Can't skip init of __exception_info. */ /* Can't skip init of __exception_info. */
cp_error_at (" enters catch block", b); error ("%H enters catch block", &DECL_SOURCE_LOCATION (b));
else if (u > 1) else if (u > 1)
cp_error_at (" skips initialization of `%#D'", b); cp_error_at (" skips initialization of `%#D'", b);
else else
...@@ -6692,7 +6693,8 @@ fixup_anonymous_aggr (tree t) ...@@ -6692,7 +6693,8 @@ fixup_anonymous_aggr (tree t)
/* ISO C++ 9.5.3. Anonymous unions may not have function members. */ /* ISO C++ 9.5.3. Anonymous unions may not have function members. */
if (TYPE_METHODS (t)) if (TYPE_METHODS (t))
cp_error_at ("an anonymous union cannot have function members", t); error ("%Han anonymous union cannot have function members",
&DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (t)));
/* Anonymous aggregates cannot have fields with ctors, dtors or complex /* Anonymous aggregates cannot have fields with ctors, dtors or complex
assignment operators (because they cannot have these methods themselves). assignment operators (because they cannot have these methods themselves).
...@@ -7393,7 +7395,8 @@ maybe_commonize_var (tree decl) ...@@ -7393,7 +7395,8 @@ maybe_commonize_var (tree decl)
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 data `%#D' are wrong (you'll wind up with multiple copies)", decl);
cp_warning_at (" you can work around this by removing the initializer", decl); warning ("%H you can work around this by removing the initializer",
&DECL_SOURCE_LOCATION (decl));
} }
} }
} }
...@@ -11140,8 +11143,8 @@ grokdeclarator (tree declarator, ...@@ -11140,8 +11143,8 @@ grokdeclarator (tree declarator,
{ {
decl = build_decl (TYPE_DECL, declarator, type); decl = build_decl (TYPE_DECL, declarator, type);
if (in_namespace || ctype) if (in_namespace || ctype)
cp_error_at ("typedef name may not be a nested-name-specifier", error ("%Htypedef name may not be a nested-name-specifier",
decl); &DECL_SOURCE_LOCATION (decl));
if (!current_function_decl) if (!current_function_decl)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
} }
...@@ -11187,7 +11190,8 @@ grokdeclarator (tree declarator, ...@@ -11187,7 +11190,8 @@ grokdeclarator (tree declarator,
if (ctype == NULL_TREE) if (ctype == NULL_TREE)
{ {
if (TREE_CODE (type) != METHOD_TYPE) if (TREE_CODE (type) != METHOD_TYPE)
cp_error_at ("invalid type qualifier for non-member function type", decl); error ("%Hinvalid type qualifier for non-member function type",
&DECL_SOURCE_LOCATION (decl));
else else
ctype = TYPE_METHOD_BASETYPE (type); ctype = TYPE_METHOD_BASETYPE (type);
} }
...@@ -13014,7 +13018,8 @@ start_enum (tree name) ...@@ -13014,7 +13018,8 @@ 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 `%#T'", enumtype);
cp_error_at ("previous definition here", enumtype); error ("%Hprevious definition here",
&DECL_SOURCE_LOCATION (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;
} }
......
...@@ -3664,8 +3664,10 @@ ambiguous_decl (tree name, cxx_binding *old, cxx_binding *new, int flags) ...@@ -3664,8 +3664,10 @@ ambiguous_decl (tree name, cxx_binding *old, cxx_binding *new, int flags)
if (flags & LOOKUP_COMPLAIN) if (flags & LOOKUP_COMPLAIN)
{ {
error ("`%D' denotes an ambiguous type",name); error ("`%D' denotes an ambiguous type",name);
cp_error_at (" first type here", BINDING_TYPE (old)); error ("%H first type here",
cp_error_at (" other type here", type); &DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (BINDING_TYPE (old))));
error ("%H other type here",
&DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)));
} }
} }
return old; return old;
......
...@@ -2984,7 +2984,8 @@ redeclare_class_template (tree type, tree parms) ...@@ -2984,7 +2984,8 @@ redeclare_class_template (tree type, tree parms)
A template-parameter may not be given default arguments A template-parameter may not be given default arguments
by two different declarations in the same scope. */ by two different declarations in the same scope. */
error ("redefinition of default argument for `%#D'", parm); error ("redefinition of default argument for `%#D'", parm);
cp_error_at (" original definition appeared here", tmpl_parm); error ("%H original definition appeared here",
&DECL_SOURCE_LOCATION (tmpl_parm));
return; return;
} }
......
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