summaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-07 02:55:59 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-07 02:55:59 +0000
commit712d22976c2f8c0053865790f0e0674337864ab9 (patch)
treed34263b5ff9f1576a23b9f95e545dc831212bc84 /gcc/cp/init.c
parent975b43967f9e784e01aaf52860786c2a3cb85a28 (diff)
downloadgcc-712d22976c2f8c0053865790f0e0674337864ab9.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149312 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 26089965d0c..96dd6c1dfad 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))