aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2009-07-07 02:55:59 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2009-07-07 02:55:59 +0000
commitc5d753640d06e51da60056f0ee354b5134cad1f7 (patch)
treed34263b5ff9f1576a23b9f95e545dc831212bc84 /gcc/cp
parentb932c20b25c7516eb5fa2a813b8bfa786569c0b4 (diff)
downloadgcc-c5d753640d06e51da60056f0ee354b5134cad1f7.zip
gcc-c5d753640d06e51da60056f0ee354b5134cad1f7.tar.gz
gcc-c5d753640d06e51da60056f0ee354b5134cad1f7.tar.bz2
cgraphunit.c: Replace %J by an explicit location.
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org> * cgraphunit.c: Replace %J by an explicit location. Update all calls. * c-decl.c: Likewise. * function.c: Likewise. * varasm.c: Likewise. * tree-ssa.c: Likewise. * c-common.c: Likewise. * tree-cfg.c: Likewise. * config/spu/spu.c: Likewise. * config/ia64/ia64.c: Likewise. * config/v850/v850.c: Likewise. java/ * class.c: Replace %J by an explicit location. Update all calls. objc/ * objc-act.c: Replace %J by an explicit location. Update all calls. cp/ * init.c: Replace %J by an explicit location. Update all calls. * decl.c: Likewise. * typeck2.c: Likewise. * pt.c: Likewise. * name-lookup.c: Likewise. From-SVN: r149312
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/decl.c42
-rw-r--r--gcc/cp/init.c51
-rw-r--r--gcc/cp/name-lookup.c19
-rw-r--r--gcc/cp/pt.c5
-rw-r--r--gcc/cp/typeck2.c10
6 files changed, 83 insertions, 52 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f76561e..1540827 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * init.c: Replace %J by an explicit location. Update all calls.
+ * decl.c: Likewise.
+ * typeck2.c: Likewise.
+ * pt.c: Likewise.
+ * name-lookup.c: Likewise.
+
2009-07-06 Manuel López-Ibáñez <manu@gcc.gnu.org>
* decl.c: Replace %H by an explicit location. Update all calls.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6d15783..c0dccdc 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1469,8 +1469,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
&& TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != NULL_TREE)
{
/* Prototype decl follows defn w/o prototype. */
- warning (0, "prototype for %q+#D", newdecl);
- warning (0, "%Jfollows non-prototype definition here", olddecl);
+ warning_at (input_location, 0, "prototype for %q+#D", newdecl);
+ warning_at (DECL_SOURCE_LOCATION (olddecl), 0,
+ "follows non-prototype definition here");
}
else if ((TREE_CODE (olddecl) == FUNCTION_DECL
|| TREE_CODE (olddecl) == VAR_DECL)
@@ -2051,10 +2052,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
&& DECL_VISIBILITY_SPECIFIED (newdecl)
&& DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
{
- warning (OPT_Wattributes, "%q+D: visibility attribute ignored "
- "because it", newdecl);
- warning (OPT_Wattributes, "%Jconflicts with previous "
- "declaration here", olddecl);
+ warning_at (input_location, OPT_Wattributes,
+ "%q+D: visibility attribute ignored because it", newdecl);
+ warning_at (DECL_SOURCE_LOCATION (olddecl), OPT_Wattributes,
+ "conflicts with previous declaration here");
}
/* Choose the declaration which specified visibility. */
if (DECL_VISIBILITY_SPECIFIED (olddecl))
@@ -2641,7 +2642,7 @@ check_goto (tree decl)
if (u > 1 && DECL_ARTIFICIAL (b))
{
/* Can't skip init of __exception_info. */
- error ("%J enters catch block", b);
+ error_at (DECL_SOURCE_LOCATION (b), " enters catch block");
saw_catch = true;
}
else if (u > 1)
@@ -3795,9 +3796,11 @@ fixup_anonymous_aggr (tree t)
tree decl = TYPE_MAIN_DECL (t);
if (TREE_CODE (t) != UNION_TYPE)
- error ("%Jan anonymous struct cannot have function members", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "an anonymous struct cannot have function members");
else
- error ("%Jan anonymous union cannot have function members", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "an anonymous union cannot have function members");
}
/* Anonymous aggregates cannot have fields with ctors, dtors or complex
@@ -4629,12 +4632,13 @@ maybe_commonize_var (tree decl)
be merged. */
TREE_PUBLIC (decl) = 0;
DECL_COMMON (decl) = 0;
- warning (0, "sorry: semantics of inline function static "
- "data %q+#D are wrong (you'll wind up "
- "with multiple copies)", decl);
- warning (0, "%J you can work around this by removing "
- "the initializer",
- decl);
+ warning_at (input_location, 0,
+ "sorry: semantics of inline function static "
+ "data %q+#D are wrong (you'll wind up "
+ "with multiple copies)", decl);
+ warning_at (DECL_SOURCE_LOCATION (decl), 0,
+ " you can work around this by removing "
+ "the initializer");
}
}
}
@@ -8815,7 +8819,8 @@ grokdeclarator (const cp_declarator *declarator,
else
decl = build_decl (input_location, TYPE_DECL, unqualified_id, type);
if (id_declarator && declarator->u.id.qualifying_scope) {
- error ("%Jtypedef name may not be a nested-name-specifier", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "typedef name may not be a nested-name-specifier");
TREE_TYPE (decl) = error_mark_node;
}
@@ -10996,8 +11001,9 @@ start_enum (tree name, tree underlying_type, bool scoped_enum_p)
if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE)
{
- error ("multiple definition of %q#T", enumtype);
- error ("%Jprevious definition here", TYPE_MAIN_DECL (enumtype));
+ error_at (input_location, "multiple definition of %q#T", enumtype);
+ error_at (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
+ "previous definition here");
/* Clear out TYPE_VALUES, and start again. */
TYPE_VALUES (enumtype) = NULL_TREE;
}
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 2608996..96dd6c1 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -426,8 +426,9 @@ perform_member_init (tree member, tree init)
/* Effective C++ rule 12 requires that all data members be
initialized. */
if (warn_ecpp && init == NULL_TREE && TREE_CODE (type) != ARRAY_TYPE)
- warning (OPT_Weffc__, "%J%qD should be initialized in the member initialization "
- "list", current_function_decl, member);
+ warning_at (DECL_SOURCE_LOCATION (current_function_decl), OPT_Weffc__,
+ "%qD should be initialized in the member initialization list",
+ member);
/* Get an lvalue for the data member. */
decl = build_class_member_access_expr (current_class_ref, member,
@@ -451,9 +452,9 @@ perform_member_init (tree member, tree init)
else
{
if (TREE_CODE (type) == REFERENCE_TYPE)
- permerror (input_location, "%Jvalue-initialization of %q#D, "
- "which has reference type",
- current_function_decl, member);
+ permerror (DECL_SOURCE_LOCATION (current_function_decl),
+ "value-initialization of %q#D, which has reference type",
+ member);
else
{
init = build2 (INIT_EXPR, type, decl, build_value_init (type));
@@ -492,8 +493,9 @@ perform_member_init (tree member, tree init)
&& !type_has_user_provided_default_constructor (type))
/* TYPE_NEEDS_CONSTRUCTING can be set just because we have a
vtable; still give this diagnostic. */
- permerror (input_location, "%Juninitialized member %qD with %<const%> type %qT",
- current_function_decl, member, type);
+ permerror (DECL_SOURCE_LOCATION (current_function_decl),
+ "uninitialized member %qD with %<const%> type %qT",
+ member, type);
finish_expr_stmt (build_aggr_init (decl, init, 0,
tf_warning_or_error));
}
@@ -504,11 +506,13 @@ perform_member_init (tree member, tree init)
{
/* member traversal: note it leaves init NULL */
if (TREE_CODE (type) == REFERENCE_TYPE)
- permerror (input_location, "%Juninitialized reference member %qD",
- current_function_decl, member);
+ permerror (DECL_SOURCE_LOCATION (current_function_decl),
+ "uninitialized reference member %qD",
+ member);
else if (CP_TYPE_CONST_P (type))
- permerror (input_location, "%Juninitialized member %qD with %<const%> type %qT",
- current_function_decl, member, type);
+ permerror (DECL_SOURCE_LOCATION (current_function_decl),
+ "uninitialized member %qD with %<const%> type %qT",
+ member, type);
}
else if (TREE_CODE (init) == TREE_LIST)
/* There was an explicit member initialization. Do some work
@@ -661,7 +665,8 @@ sort_mem_initializers (tree t, tree mem_inits)
warning (OPT_Wreorder, " %q+#D", subobject);
else
warning (OPT_Wreorder, " base %qT", subobject);
- warning (OPT_Wreorder, "%J when initialized here", current_function_decl);
+ warning_at (DECL_SOURCE_LOCATION (current_function_decl),
+ OPT_Wreorder, " when initialized here");
}
/* Look again, from the beginning of the list. */
@@ -677,11 +682,13 @@ sort_mem_initializers (tree t, tree mem_inits)
if (TREE_VALUE (subobject_init))
{
if (TREE_CODE (subobject) == FIELD_DECL)
- error ("%Jmultiple initializations given for %qD",
- current_function_decl, subobject);
+ error_at (DECL_SOURCE_LOCATION (current_function_decl),
+ "multiple initializations given for %qD",
+ subobject);
else
- error ("%Jmultiple initializations given for base %qT",
- current_function_decl, subobject);
+ error_at (DECL_SOURCE_LOCATION (current_function_decl),
+ "multiple initializations given for base %qT",
+ subobject);
}
/* Record the initialization. */
@@ -747,8 +754,9 @@ sort_mem_initializers (tree t, tree mem_inits)
if (same_type_p (last_field_type, field_type))
{
if (TREE_CODE (field_type) == UNION_TYPE)
- error ("%Jinitializations for multiple members of %qT",
- current_function_decl, last_field_type);
+ error_at (DECL_SOURCE_LOCATION (current_function_decl),
+ "initializations for multiple members of %qT",
+ last_field_type);
done = 1;
break;
}
@@ -810,9 +818,10 @@ emit_mem_initializers (tree mem_inits)
if (extra_warnings && !arguments
&& DECL_COPY_CONSTRUCTOR_P (current_function_decl)
&& type_has_user_nondefault_constructor (BINFO_TYPE (subobject)))
- warning (OPT_Wextra, "%Jbase class %q#T should be explicitly initialized in the "
- "copy constructor",
- current_function_decl, BINFO_TYPE (subobject));
+ warning_at (DECL_SOURCE_LOCATION (current_function_decl), OPT_Wextra,
+ "base class %q#T should be explicitly initialized in the "
+ "copy constructor",
+ BINFO_TYPE (subobject));
/* Initialize the base. */
if (BINFO_VIRTUAL_P (subobject))
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 69ee8bf..c1032e3 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1044,8 +1044,10 @@ pushdecl_maybe_friend (tree x, bool is_friend)
if (warn_shadow && !err)
{
- warning (OPT_Wshadow, "declaration of %q#D shadows a parameter", x);
- warning (OPT_Wshadow, "%Jshadowed declaration is here", oldlocal);
+ warning_at (input_location, OPT_Wshadow,
+ "declaration of %q#D shadows a parameter", x);
+ warning_at (DECL_SOURCE_LOCATION (oldlocal), OPT_Wshadow,
+ "shadowed declaration is here");
}
}
@@ -1075,16 +1077,19 @@ pushdecl_maybe_friend (tree x, bool is_friend)
else if (oldlocal != NULL_TREE
&& TREE_CODE (oldlocal) == VAR_DECL)
{
- warning (OPT_Wshadow, "declaration of %qD shadows a previous local", x);
- warning (OPT_Wshadow, "%Jshadowed declaration is here", oldlocal);
+ warning_at (input_location, OPT_Wshadow,
+ "declaration of %qD shadows a previous local", x);
+ warning_at (DECL_SOURCE_LOCATION (oldlocal), OPT_Wshadow,
+ "shadowed declaration is here");
}
else if (oldglobal != NULL_TREE
&& TREE_CODE (oldglobal) == VAR_DECL)
/* XXX shadow warnings in outer-more namespaces */
{
- warning (OPT_Wshadow, "declaration of %qD shadows a global declaration",
- x);
- warning (OPT_Wshadow, "%Jshadowed declaration is here", oldglobal);
+ warning_at (input_location, OPT_Wshadow,
+ "declaration of %qD shadows a global declaration", x);
+ warning_at (DECL_SOURCE_LOCATION (oldglobal), OPT_Wshadow,
+ "shadowed declaration is here");
}
}
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f1104e2..2fc2223 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4430,8 +4430,9 @@ redeclare_class_template (tree type, tree parms)
A template-parameter may not be given default arguments
by two different declarations in the same scope. */
- error ("redefinition of default argument for %q#D", parm);
- inform (input_location, "%Joriginal definition appeared here", tmpl_parm);
+ error_at (input_location, "redefinition of default argument for %q#D", parm);
+ inform (DECL_SOURCE_LOCATION (tmpl_parm),
+ "original definition appeared here");
return false;
}
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 8bec221..c43fd76 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -312,8 +312,9 @@ abstract_virtuals_error (tree decl, tree type)
unsigned ix;
tree fn;
- inform (input_location, "%J because the following virtual functions are pure "
- "within %qT:", TYPE_MAIN_DECL (type), type);
+ inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)),
+ " because the following virtual functions are pure within %qT:",
+ type);
for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++)
inform (input_location, "\t%+#D", fn);
@@ -323,8 +324,9 @@ abstract_virtuals_error (tree decl, tree type)
VEC_truncate (tree, pure, 0);
}
else
- inform (input_location, "%J since type %qT has pure virtual functions",
- TYPE_MAIN_DECL (type), type);
+ inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)),
+ " since type %qT has pure virtual functions",
+ type);
return 1;
}