aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/c-common.c38
-rw-r--r--gcc/c-decl.c55
-rw-r--r--gcc/cgraphunit.c12
-rw-r--r--gcc/config/ia64/ia64.c10
-rw-r--r--gcc/config/spu/spu.c41
-rw-r--r--gcc/config/v850/v850.c5
-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
-rw-r--r--gcc/function.c3
-rw-r--r--gcc/java/ChangeLog4
-rw-r--r--gcc/java/class.c3
-rw-r--r--gcc/objc/ChangeLog5
-rw-r--r--gcc/objc/objc-act.c34
-rw-r--r--gcc/tree-cfg.c6
-rw-r--r--gcc/tree-ssa.c2
-rw-r--r--gcc/varasm.c9
21 files changed, 231 insertions, 145 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6e8a3c8..870dcea 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+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.
+
2009-07-06 DJ Delorie <dj@redhat.com>
* config/mep/mep-core.cpu (fsft, ssarb): Mark as VOLATILE.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 772d968..1c883d1 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5417,13 +5417,15 @@ match_case_to_enum_1 (tree key, tree type, tree label)
(unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (key));
if (TYPE_NAME (type) == 0)
- warning (warn_switch ? OPT_Wswitch : OPT_Wswitch_enum,
- "%Jcase value %qs not in enumerated type",
- CASE_LABEL (label), buf);
+ warning_at (DECL_SOURCE_LOCATION (CASE_LABEL (label)),
+ warn_switch ? OPT_Wswitch : OPT_Wswitch_enum,
+ "case value %qs not in enumerated type",
+ buf);
else
- warning (warn_switch ? OPT_Wswitch : OPT_Wswitch_enum,
- "%Jcase value %qs not in enumerated type %qT",
- CASE_LABEL (label), buf, type);
+ warning_at (DECL_SOURCE_LOCATION (CASE_LABEL (label)),
+ warn_switch ? OPT_Wswitch : OPT_Wswitch_enum,
+ "case value %qs not in enumerated type %qT",
+ buf, type);
}
/* Subroutine of c_do_switch_warnings, called via splay_tree_foreach.
@@ -6493,8 +6495,9 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
&& current_function_decl != NULL_TREE
&& !TREE_STATIC (decl))
{
- error ("%Jsection attribute cannot be specified for "
- "local variables", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "section attribute cannot be specified for "
+ "local variables");
*no_add_attrs = true;
}
@@ -6526,7 +6529,8 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
}
else
{
- error ("%Jsection attributes are not supported for this target", *node);
+ error_at (DECL_SOURCE_LOCATION (*node),
+ "section attributes are not supported for this target");
*no_add_attrs = true;
}
@@ -6745,8 +6749,8 @@ handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args,
else
{
if (lookup_attribute ("alias", DECL_ATTRIBUTES (*node)))
- error ("%Jweakref attribute must appear before alias attribute",
- *node);
+ error_at (DECL_SOURCE_LOCATION (*node),
+ "weakref attribute must appear before alias attribute");
/* Can't call declare_weak because it wants this to be TREE_PUBLIC,
and that isn't supported; and because it wants to add it to
@@ -6956,12 +6960,14 @@ handle_no_instrument_function_attribute (tree *node, tree name,
if (TREE_CODE (decl) != FUNCTION_DECL)
{
- error ("%J%qE attribute applies only to functions", decl, name);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "%qE attribute applies only to functions", name);
*no_add_attrs = true;
}
else if (DECL_INITIAL (decl))
{
- error ("%Jcan%'t set %qE attribute after definition", decl, name);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "can%'t set %qE attribute after definition", name);
*no_add_attrs = true;
}
else
@@ -7046,12 +7052,14 @@ handle_no_limit_stack_attribute (tree *node, tree name,
if (TREE_CODE (decl) != FUNCTION_DECL)
{
- error ("%J%qE attribute applies only to functions", decl, name);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "%qE attribute applies only to functions", name);
*no_add_attrs = true;
}
else if (DECL_INITIAL (decl))
{
- error ("%Jcan%'t set %qE attribute after definition", decl, name);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "can%'t set %qE attribute after definition", name);
*no_add_attrs = true;
}
else
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index fdceb20..fa578cb 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1890,9 +1890,10 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
DECL_ATTRIBUTES (olddecl)) != NULL;
if (newa != olda)
{
- error ("%<gnu_inline%> attribute present on %q+D",
- newa ? newdecl : olddecl);
- error ("%Jbut not here", newa ? olddecl : newdecl);
+ error_at (input_location, "%<gnu_inline%> attribute present on %q+D",
+ newa ? newdecl : olddecl);
+ error_at (DECL_SOURCE_LOCATION (newa ? olddecl : newdecl),
+ "but not here");
}
}
}
@@ -2489,7 +2490,8 @@ warn_if_shadowing (tree new_decl)
warning (OPT_Wshadow, "declaration of %q+D shadows a previous local",
new_decl);
- warning (OPT_Wshadow, "%Jshadowed declaration is here", old_decl);
+ warning_at (DECL_SOURCE_LOCATION (old_decl), OPT_Wshadow,
+ "shadowed declaration is here");
break;
}
@@ -6002,11 +6004,13 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
if (funcdef_flag)
{
if (DECL_NAME (parm))
- error ("parameter %u (%q+D) has incomplete type",
- parmno, parm);
+ error_at (input_location,
+ "parameter %u (%q+D) has incomplete type",
+ parmno, parm);
else
- error ("%Jparameter %u has incomplete type",
- parm, parmno);
+ error_at (DECL_SOURCE_LOCATION (parm),
+ "parameter %u has incomplete type",
+ parmno);
TREE_VALUE (typelt) = error_mark_node;
TREE_TYPE (parm) = error_mark_node;
@@ -6014,11 +6018,13 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
else if (VOID_TYPE_P (type))
{
if (DECL_NAME (parm))
- warning (0, "parameter %u (%q+D) has void type",
- parmno, parm);
+ warning_at (input_location, 0,
+ "parameter %u (%q+D) has void type",
+ parmno, parm);
else
- warning (0, "%Jparameter %u has void type",
- parm, parmno);
+ warning_at (DECL_SOURCE_LOCATION (parm), 0,
+ "parameter %u has void type",
+ parmno);
}
}
@@ -6722,28 +6728,27 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
if (TREE_CODE (t) == UNION_TYPE)
{
error_at (DECL_SOURCE_LOCATION (x),
- "%Jflexible array member in union", x);
+ "flexible array member in union");
TREE_TYPE (x) = error_mark_node;
}
else if (TREE_CHAIN (x) != NULL_TREE)
{
error_at (DECL_SOURCE_LOCATION (x),
- "%Jflexible array member not at end of struct", x);
+ "flexible array member not at end of struct");
TREE_TYPE (x) = error_mark_node;
}
else if (!saw_named_field)
{
error_at (DECL_SOURCE_LOCATION (x),
- "%Jflexible array member in otherwise empty struct",
- x);
+ "flexible array member in otherwise empty struct");
TREE_TYPE (x) = error_mark_node;
}
}
- if (pedantic && !in_system_header && TREE_CODE (t) == RECORD_TYPE
+ if (pedantic && TREE_CODE (t) == RECORD_TYPE
&& flexible_array_type_p (TREE_TYPE (x)))
- pedwarn (loc, OPT_pedantic,
- "%Jinvalid use of structure with flexible array member", x);
+ pedwarn (DECL_SOURCE_LOCATION (x), OPT_pedantic,
+ "invalid use of structure with flexible array member");
if (DECL_NAME (x))
saw_named_field = 1;
@@ -7465,8 +7470,9 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info)
if (current_scope->bindings)
{
- error ("%Jold-style parameter declarations in prototyped "
- "function definition", fndecl);
+ error_at (DECL_SOURCE_LOCATION (fndecl),
+ "old-style parameter declarations in prototyped "
+ "function definition");
/* Get rid of the old-style declarations. */
pop_scope ();
@@ -7478,9 +7484,8 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info)
its parameter list). */
else if (!in_system_header && !current_function_scope
&& arg_info->types != error_mark_node)
- warning (OPT_Wtraditional,
- "%Jtraditional C rejects ISO C style function definitions",
- fndecl);
+ warning_at (DECL_SOURCE_LOCATION (fndecl), OPT_Wtraditional,
+ "traditional C rejects ISO C style function definitions");
/* Now make all the parameter declarations visible in the function body.
We can bypass most of the grunt work of pushdecl. */
@@ -7496,7 +7501,7 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info)
warn_if_shadowing (decl);
}
else
- error ("%Jparameter name omitted", decl);
+ error_at (DECL_SOURCE_LOCATION (decl), "parameter name omitted");
}
/* Record the parameter list in the function declaration. */
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 97c28f4..4521f3b 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -845,9 +845,9 @@ process_function_and_variable_attributes (struct cgraph_node *first,
if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl)))
{
if (! TREE_PUBLIC (node->decl))
- warning (OPT_Wattributes,
- "%J%<externally_visible%> attribute have effect only on public objects",
- node->decl);
+ warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wattributes,
+ "%<externally_visible%>"
+ " attribute have effect only on public objects");
else
{
if (node->local.finalized)
@@ -868,9 +868,9 @@ process_function_and_variable_attributes (struct cgraph_node *first,
if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl)))
{
if (! TREE_PUBLIC (vnode->decl))
- warning (OPT_Wattributes,
- "%J%<externally_visible%> attribute have effect only on public objects",
- vnode->decl);
+ warning_at (DECL_SOURCE_LOCATION (vnode->decl), OPT_Wattributes,
+ "%<externally_visible%>"
+ " attribute have effect only on public objects");
else
{
if (vnode->finalized)
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 939ed54..b863fd3 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -593,8 +593,9 @@ ia64_handle_model_attribute (tree *node, tree name, tree args,
== FUNCTION_DECL)
&& !TREE_STATIC (decl))
{
- error ("%Jan address area attribute cannot be specified for "
- "local variables", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "an address area attribute cannot be specified for "
+ "local variables");
*no_add_attrs = true;
}
area = ia64_get_addr_area (decl);
@@ -607,8 +608,9 @@ ia64_handle_model_attribute (tree *node, tree name, tree args,
break;
case FUNCTION_DECL:
- error ("%Jaddress area attribute cannot be specified for functions",
- decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "address area attribute cannot be specified for functions",
+ decl);
*no_add_attrs = true;
break;
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index f86bda6..37488b2 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -4944,8 +4944,7 @@ array_to_constant (enum machine_mode mode, unsigned char arr[16])
static void
reloc_diagnostic (rtx x)
{
- tree loc_decl, decl = 0;
- const char *msg;
+ tree decl = 0;
if (!flag_pic || !(TARGET_WARN_RELOC || TARGET_ERROR_RELOC))
return;
@@ -4959,24 +4958,32 @@ reloc_diagnostic (rtx x)
if (decl && !DECL_P (decl))
decl = 0;
- /* We use last_assemble_variable_decl to get line information. It's
- not always going to be right and might not even be close, but will
- be right for the more common cases. */
- if (!last_assemble_variable_decl || in_section == ctors_section)
- loc_decl = decl;
- else
- loc_decl = last_assemble_variable_decl;
-
/* The decl could be a string constant. */
if (decl && DECL_P (decl))
- msg = "%Jcreating run-time relocation for %qD";
- else
- msg = "creating run-time relocation";
+ {
+ location_t loc;
+ /* We use last_assemble_variable_decl to get line information. It's
+ not always going to be right and might not even be close, but will
+ be right for the more common cases. */
+ if (!last_assemble_variable_decl || in_section == ctors_section)
+ loc = DECL_SOURCE_LOCATION (decl);
+ else
+ loc = DECL_SOURCE_LOCATION (last_assemble_variable_decl);
- if (TARGET_WARN_RELOC)
- warning (0, msg, loc_decl, decl);
- else
- error (msg, loc_decl, decl);
+ if (TARGET_WARN_RELOC)
+ warning_at (loc, 0,
+ "creating run-time relocation for %qD", decl);
+ else
+ error_at (loc,
+ "creating run-time relocation for %qD", decl);
+ }
+ else
+ {
+ if (TARGET_WARN_RELOC)
+ warning_at (input_location, 0, "creating run-time relocation");
+ else
+ error_at (input_location, "creating run-time relocation");
+ }
}
/* Hook into assemble_integer so we can generate an error for run-time
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index bd62d1e..5e1594a 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -2090,8 +2090,9 @@ v850_handle_data_area_attribute (tree* node,
case VAR_DECL:
if (current_function_decl != NULL_TREE)
{
- error ("%Jdata area attributes cannot be specified for "
- "local variables", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "data area attributes cannot be specified for "
+ "local variables");
*no_add_attrs = true;
}
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;
}
diff --git a/gcc/function.c b/gcc/function.c
index 63fe835..93244db 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -246,7 +246,8 @@ frame_offset_overflow (HOST_WIDE_INT offset, tree func)
/* Leave room for the fixed part of the frame. */
- 64 * UNITS_PER_WORD)
{
- error ("%Jtotal size of local objects too large", func);
+ error_at (DECL_SOURCE_LOCATION (func),
+ "total size of local objects too large");
return TRUE;
}
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 17c6ebf..9f90f53 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,5 +1,9 @@
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
+ * class.c: Replace %J by an explicit location. Update all calls.
+
+2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
* jcf-parse.c: Replace %H by an explicit location. Update all calls.
2009-06-29 Andrew Haley <aph@redhat.com>
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 1b594e5..db9c8a8 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1609,7 +1609,8 @@ get_dispatch_table (tree type, tree this_class_addr)
if (METHOD_ABSTRACT (method))
{
if (! abstract_p)
- warning (0, "%Jabstract method in non-abstract class", method);
+ warning_at (DECL_SOURCE_LOCATION (method), 0,
+ "abstract method in non-abstract class");
if (TARGET_VTABLE_USES_DESCRIPTORS)
for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; ++j)
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 605715c..2268413 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,5 +1,10 @@
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
+ * objc-act.c: Replace %J by an explicit location. Update all
+ calls.
+
+2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
* objc-act.c: Replace %H by an explicit location. Update all
calls.
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index e951b2a..917caf1 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -5015,8 +5015,8 @@ synth_forward_declarations (void)
static void
error_with_ivar (const char *message, tree decl)
{
- error ("%J%s %qs", decl,
- message, identifier_to_locale (gen_declaration (decl)));
+ error_at (DECL_SOURCE_LOCATION (decl), "%s %qs",
+ message, identifier_to_locale (gen_declaration (decl)));
}
@@ -6150,10 +6150,11 @@ check_duplicates (hash hsh, int methods, int is_class)
{
bool type = TREE_CODE (meth) == INSTANCE_METHOD_DECL;
- warning (0, "multiple methods named %<%c%E%> found",
- (is_class ? '+' : '-'),
- METHOD_SEL_NAME (meth));
- inform (0, "%Jusing %<%c%s%>", meth,
+ warning_at (input_location, 0,
+ "multiple methods named %<%c%E%> found",
+ (is_class ? '+' : '-'),
+ METHOD_SEL_NAME (meth));
+ inform (DECL_SOURCE_LOCATION (meth), "using %<%c%s%>",
(type ? '-' : '+'),
identifier_to_locale (gen_method_decl (meth)));
}
@@ -6161,10 +6162,11 @@ check_duplicates (hash hsh, int methods, int is_class)
{
bool type = TREE_CODE (meth) == INSTANCE_METHOD_DECL;
- warning (0, "multiple selectors named %<%c%E%> found",
- (is_class ? '+' : '-'),
- METHOD_SEL_NAME (meth));
- inform (0, "%Jfound %<%c%s%>", meth,
+ warning_at (input_location, 0,
+ "multiple selectors named %<%c%E%> found",
+ (is_class ? '+' : '-'),
+ METHOD_SEL_NAME (meth));
+ inform (DECL_SOURCE_LOCATION (meth), "found %<%c%s%>",
(type ? '-' : '+'),
identifier_to_locale (gen_method_decl (meth)));
}
@@ -6173,7 +6175,7 @@ check_duplicates (hash hsh, int methods, int is_class)
{
bool type = TREE_CODE (loop->value) == INSTANCE_METHOD_DECL;
- inform (0, "%Jalso found %<%c%s%>", loop->value,
+ inform (DECL_SOURCE_LOCATION (loop->value), "also found %<%c%s%>",
(type ? '-' : '+'),
identifier_to_locale (gen_method_decl (loop->value)));
}
@@ -8733,10 +8735,12 @@ really_start_method (tree method,
{
bool type = TREE_CODE (method) == INSTANCE_METHOD_DECL;
- warning (0, "%Jconflicting types for %<%c%s%>", method,
- (type ? '-' : '+'),
- identifier_to_locale (gen_method_decl (method)));
- inform (0, "%Jprevious declaration of %<%c%s%>", proto,
+ warning_at (DECL_SOURCE_LOCATION (method), 0,
+ "conflicting types for %<%c%s%>",
+ (type ? '-' : '+'),
+ identifier_to_locale (gen_method_decl (method)));
+ inform (DECL_SOURCE_LOCATION (proto),
+ "previous declaration of %<%c%s%>",
(type ? '-' : '+'),
identifier_to_locale (gen_method_decl (proto)));
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 34c6461..f18bb97 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7342,9 +7342,9 @@ execute_warn_function_noreturn (void)
&& !TREE_THIS_VOLATILE (cfun->decl)
&& EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 0
&& !lang_hooks.missing_noreturn_ok_p (cfun->decl))
- warning (OPT_Wmissing_noreturn, "%Jfunction might be possible candidate "
- "for attribute %<noreturn%>",
- cfun->decl);
+ warning_at (DECL_SOURCE_LOCATION (cfun->decl), OPT_Wmissing_noreturn,
+ "function might be possible candidate "
+ "for attribute %<noreturn%>");
return 0;
}
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index d63e974..c8a48a3 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1270,7 +1270,7 @@ warn_uninit (tree t, const char *gmsgid, void *data)
if (xloc.file != floc.file
|| xloc.line < floc.line
|| xloc.line > LOCATION_LINE (cfun->function_end_locus))
- inform (location, "%J%qD was declared here", var, var);
+ inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var);
}
}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index f7d1d18..f8744f7 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5465,7 +5465,8 @@ do_assemble_alias (tree decl, tree target)
#else
if (!SUPPORTS_WEAK)
{
- error ("%Jweakref is not supported in this configuration", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "weakref is not supported in this configuration");
return;
}
#endif
@@ -5605,12 +5606,14 @@ assemble_alias (tree decl, tree target)
{
#if !defined (ASM_OUTPUT_DEF)
# if !defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL)
- error ("%Jalias definitions not supported in this configuration", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "alias definitions not supported in this configuration");
return;
# else
if (!DECL_WEAK (decl))
{
- error ("%Jonly weak aliases are supported in this configuration", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "only weak aliases are supported in this configuration");
return;
}
# endif