summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-28 08:53:57 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-28 08:53:57 +0000
commit66ed189dce802c9fc8b0dcae0e6ead6046651af6 (patch)
tree2987b10cfbacbefc9e2d2add7920cf04f3aff46a /gcc/cp
parent95328f382d997be538eb74889fe80332b5e38b91 (diff)
downloadgcc-66ed189dce802c9fc8b0dcae0e6ead6046651af6.tar.gz
2015-07-28 Paolo Carlini <paolo.carlini@oracle.com>
* call.c (build_op_delete_call, convert_like_real, build_over_call): Use Use DECL_SOURCE_LOCATION and "%qD" in inform and pedwarn instead of "%q+D". * constexpr.c (explain_invalid_constexpr_fn): Likewise. * decl.c (duplicate_decls): Likewise for warning/warning_at. * except.c (maybe_noexcept_warning): Likewise. * friend.c (make_friend_class): Likewise for inform. * mangle.c (mangle_decl): Likewise for warning/warning_at. * method.c (process_subob_fn, walk_field_subobs, maybe_explain_implicit_delete): Likewise for inform. * parser.c (cp_parser_lambda_introducer): Likewise. * pt.c (check_specialization_namespace, maybe_process_partial_specialization): Likewise for permerror. (redeclare_class_template): Likewise for inform_n. (coerce_template_parms, tsubst_copy_and_build): Likewise for inform. * search.c (check_final_overrider): Likewise. * semantics.c (process_outer_var_ref): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226308 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog20
-rw-r--r--gcc/cp/call.c20
-rw-r--r--gcc/cp/constexpr.c3
-rw-r--r--gcc/cp/decl.c5
-rw-r--r--gcc/cp/except.c5
-rw-r--r--gcc/cp/friend.c6
-rw-r--r--gcc/cp/mangle.c18
-rw-r--r--gcc/cp/method.c22
-rw-r--r--gcc/cp/parser.c6
-rw-r--r--gcc/cp/pt.c24
-rw-r--r--gcc/cp/search.c2
-rw-r--r--gcc/cp/semantics.c4
12 files changed, 88 insertions, 47 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 78a6af2e0dc..0fa0926cd5c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,23 @@
+2015-07-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * call.c (build_op_delete_call, convert_like_real, build_over_call):
+ Use Use DECL_SOURCE_LOCATION and "%qD" in inform and pedwarn instead
+ of "%q+D".
+ * constexpr.c (explain_invalid_constexpr_fn): Likewise.
+ * decl.c (duplicate_decls): Likewise for warning/warning_at.
+ * except.c (maybe_noexcept_warning): Likewise.
+ * friend.c (make_friend_class): Likewise for inform.
+ * mangle.c (mangle_decl): Likewise for warning/warning_at.
+ * method.c (process_subob_fn, walk_field_subobs,
+ maybe_explain_implicit_delete): Likewise for inform.
+ * parser.c (cp_parser_lambda_introducer): Likewise.
+ * pt.c (check_specialization_namespace,
+ maybe_process_partial_specialization): Likewise for permerror.
+ (redeclare_class_template): Likewise for inform_n.
+ (coerce_template_parms, tsubst_copy_and_build): Likewise for inform.
+ * search.c (check_final_overrider): Likewise.
+ * semantics.c (process_outer_var_ref): Likewise.
+
2015-07-27 Jason Merrill <jason@redhat.com>
* constexpr.c (cxx_eval_call_expression): Don't add this call to
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 1be2527358a..3b0fd692e9f 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5843,7 +5843,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
= G_("exception cleanup for this placement new selects "
"non-placement operator delete");
const char *msg2
- = G_("%q+D is a usual (non-placement) deallocation "
+ = G_("%qD is a usual (non-placement) deallocation "
"function in C++14 (or with -fsized-deallocation)");
/* But if the class has an operator delete (void *), then that is
@@ -5865,7 +5865,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
{
if ((complain & tf_warning)
&& warning (OPT_Wc__14_compat, msg1))
- inform (0, msg2, fn);
+ inform (DECL_SOURCE_LOCATION (fn), msg2, fn);
goto ok;
}
@@ -5875,9 +5875,10 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
{
/* Only mention C++14 for namespace-scope delete. */
if (DECL_NAMESPACE_SCOPE_P (fn))
- inform (0, msg2, fn);
+ inform (DECL_SOURCE_LOCATION (fn), msg2, fn);
else
- inform (0, "%q+D is a usual (non-placement) deallocation "
+ inform (DECL_SOURCE_LOCATION (fn),
+ "%qD is a usual (non-placement) deallocation "
"function", fn);
}
}
@@ -6333,8 +6334,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
build_user_type_conversion (totype, convs->u.expr, LOOKUP_NORMAL,
complain);
if (fn)
- inform (input_location, " initializing argument %P of %q+D",
- argnum, fn);
+ inform (DECL_SOURCE_LOCATION (fn),
+ " initializing argument %P of %qD", argnum, fn);
}
return error_mark_node;
@@ -6486,8 +6487,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
gcc_unreachable ();
maybe_print_user_conv_context (convs);
if (fn)
- inform (input_location,
- " initializing argument %P of %q+D", argnum, fn);
+ inform (DECL_SOURCE_LOCATION (fn),
+ " initializing argument %P of %qD", argnum, fn);
return error_mark_node;
}
@@ -7307,7 +7308,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
pedwarn (input_location, 0, "deducing %qT as %qT",
non_reference (TREE_TYPE (patparm)),
non_reference (type));
- pedwarn (input_location, 0, " in call to %q+D", cand->fn);
+ pedwarn (DECL_SOURCE_LOCATION (cand->fn), 0,
+ " in call to %qD", cand->fn);
pedwarn (input_location, 0,
" (you can disable this with -fno-deduce-init-list)");
}
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 2799cb75328..fc4a3f75a0d 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -829,7 +829,8 @@ explain_invalid_constexpr_fn (tree fun)
save_loc = input_location;
input_location = DECL_SOURCE_LOCATION (fun);
- inform (0, "%q+D is not usable as a constexpr function because:", fun);
+ inform (input_location,
+ "%qD is not usable as a constexpr function because:", fun);
/* First check the declaration. */
if (is_valid_constexpr_fn (fun, true))
{
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index b7fe8ef1e7b..52584c51f1e 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1378,8 +1378,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* If the built-in is not ansi, then programs can override
it even globally without an error. */
else if (! DECL_BUILT_IN (olddecl))
- warning (0, "library function %q#D redeclared as non-function %q+#D",
- olddecl, newdecl);
+ warning_at (DECL_SOURCE_LOCATION (newdecl), 0,
+ "library function %q#D redeclared as non-function %q#D",
+ olddecl, newdecl);
else
error ("declaration of %q+#D conflicts with built-in "
"declaration %q#D", newdecl, olddecl);
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index f7409b5c14d..6c366464fba 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1200,8 +1200,9 @@ maybe_noexcept_warning (tree fn)
{
warning (OPT_Wnoexcept, "noexcept-expression evaluates to %<false%> "
"because of a call to %qD", fn);
- warning (OPT_Wnoexcept, "but %q+D does not throw; perhaps "
- "it should be declared %<noexcept%>", fn);
+ warning_at (DECL_SOURCE_LOCATION (fn), OPT_Wnoexcept,
+ "but %qD does not throw; perhaps "
+ "it should be declared %<noexcept%>", fn);
}
}
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index 14fc5d0b267..e107ceea494 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -329,7 +329,8 @@ make_friend_class (tree type, tree friend_type, bool complain)
{
error ("%qT is not a member class template of %qT",
name, ctype);
- inform (input_location, "%q+D declared here", decl);
+ inform (DECL_SOURCE_LOCATION (decl),
+ "%qD declared here", decl);
return;
}
if (!template_member_p && (TREE_CODE (decl) != TYPE_DECL
@@ -337,7 +338,8 @@ make_friend_class (tree type, tree friend_type, bool complain)
{
error ("%qT is not a nested class of %qT",
name, ctype);
- inform (input_location, "%q+D declared here", decl);
+ inform (DECL_SOURCE_LOCATION (decl),
+ "%qD declared here", decl);
return;
}
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index a157b2b776c..b4d4c0e5c0e 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3633,15 +3633,17 @@ mangle_decl (const tree decl)
{
if (flag_abi_compat_version != 0
&& abi_version_at_least (flag_abi_compat_version))
- warning (OPT_Wabi, "the mangled name of %q+D changed between "
- "-fabi-version=%d (%D) and -fabi-version=%d (%D)",
- G.entity, flag_abi_compat_version, id2,
- flag_abi_version, id);
+ warning_at (DECL_SOURCE_LOCATION (G.entity), OPT_Wabi,
+ "the mangled name of %qD changed between "
+ "-fabi-version=%d (%D) and -fabi-version=%d (%D)",
+ G.entity, flag_abi_compat_version, id2,
+ flag_abi_version, id);
else
- warning (OPT_Wabi, "the mangled name of %q+D changes between "
- "-fabi-version=%d (%D) and -fabi-version=%d (%D)",
- G.entity, flag_abi_version, id,
- flag_abi_compat_version, id2);
+ warning_at (DECL_SOURCE_LOCATION (G.entity), OPT_Wabi,
+ "the mangled name of %qD changes between "
+ "-fabi-version=%d (%D) and -fabi-version=%d (%D)",
+ G.entity, flag_abi_version, id,
+ flag_abi_compat_version, id2);
}
note_mangling_alias (decl, id2);
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 570f800f7c2..7d7ec7da187 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1138,8 +1138,8 @@ process_subob_fn (tree fn, tree *spec_p, bool *trivial_p,
*constexpr_p = false;
if (diag)
{
- inform (0, "defaulted constructor calls non-constexpr "
- "%q+D", fn);
+ inform (DECL_SOURCE_LOCATION (fn),
+ "defaulted constructor calls non-constexpr %qD", fn);
explain_invalid_constexpr_fn (fn);
}
}
@@ -1199,7 +1199,8 @@ walk_field_subobs (tree fields, tree fnname, special_function_kind sfk,
if (DECL_INITIAL (field))
{
if (diag && DECL_INITIAL (field) == error_mark_node)
- inform (0, "initializer for %q+#D is invalid", field);
+ inform (DECL_SOURCE_LOCATION (field),
+ "initializer for %q#D is invalid", field);
if (trivial_p)
*trivial_p = false;
/* Core 1351: If the field has an NSDMI that could throw, the
@@ -1250,8 +1251,9 @@ walk_field_subobs (tree fields, tree fnname, special_function_kind sfk,
{
*constexpr_p = false;
if (diag)
- inform (0, "defaulted default constructor does not "
- "initialize %q+#D", field);
+ inform (DECL_SOURCE_LOCATION (field),
+ "defaulted default constructor does not "
+ "initialize %q#D", field);
}
}
else if (sfk == sfk_copy_constructor)
@@ -1615,9 +1617,10 @@ maybe_explain_implicit_delete (tree decl)
&& (type_has_user_declared_move_constructor (ctype)
|| type_has_user_declared_move_assign (ctype)))
{
- inform (0, "%q+#D is implicitly declared as deleted because %qT "
- "declares a move constructor or move assignment operator",
- decl, ctype);
+ inform (DECL_SOURCE_LOCATION (decl),
+ "%q#D is implicitly declared as deleted because %qT "
+ "declares a move constructor or move assignment operator",
+ decl, ctype);
informed = true;
}
if (!informed)
@@ -1634,7 +1637,8 @@ maybe_explain_implicit_delete (tree decl)
DECL_INHERITED_CTOR_BASE (decl), parms);
if (deleted_p)
{
- inform (0, "%q+#D is implicitly deleted because the default "
+ inform (DECL_SOURCE_LOCATION (decl),
+ "%q#D is implicitly deleted because the default "
"definition would be ill-formed:", decl);
synthesized_method_walk (ctype, sfk, const_p,
NULL, NULL, NULL, NULL, true,
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 920cb61ee06..5642ea2c4aa 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -9251,7 +9251,8 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
error_at (capture_token->location,
"capture of non-variable %qD ",
capture_init_expr);
- inform (0, "%q+#D declared here", capture_init_expr);
+ inform (DECL_SOURCE_LOCATION (capture_init_expr),
+ "%q#D declared here", capture_init_expr);
continue;
}
if (VAR_P (capture_init_expr)
@@ -9260,7 +9261,8 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
if (pedwarn (capture_token->location, 0, "capture of variable "
"%qD with non-automatic storage duration",
capture_init_expr))
- inform (0, "%q+#D declared here", capture_init_expr);
+ inform (DECL_SOURCE_LOCATION (capture_init_expr),
+ "%q#D declared here", capture_init_expr);
continue;
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f15d16fe269..e92fefb416d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -793,8 +793,10 @@ check_specialization_namespace (tree tmpl)
return true;
else
{
- permerror (input_location, "specialization of %qD in different namespace", tmpl);
- permerror (input_location, " from definition of %q+#D", tmpl);
+ permerror (input_location,
+ "specialization of %qD in different namespace", tmpl);
+ permerror (DECL_SOURCE_LOCATION (tmpl),
+ " from definition of %q#D", tmpl);
return false;
}
}
@@ -920,8 +922,10 @@ maybe_process_partial_specialization (tree type)
if (current_namespace
!= decl_namespace_context (tmpl))
{
- permerror (input_location, "specializing %q#T in different namespace", type);
- permerror (input_location, " from definition of %q+#D", tmpl);
+ permerror (input_location,
+ "specializing %q#T in different namespace", type);
+ permerror (DECL_SOURCE_LOCATION (tmpl),
+ " from definition of %q#D", tmpl);
}
/* Check for invalid specialization after instantiation:
@@ -5239,9 +5243,9 @@ redeclare_class_template (tree type, tree parms)
"redeclared with %d template parameter",
"redeclared with %d template parameters",
TREE_VEC_LENGTH (parms));
- inform_n (input_location, TREE_VEC_LENGTH (tmpl_parms),
- "previous declaration %q+D used %d template parameter",
- "previous declaration %q+D used %d template parameters",
+ inform_n (DECL_SOURCE_LOCATION (tmpl), TREE_VEC_LENGTH (tmpl_parms),
+ "previous declaration %qD used %d template parameter",
+ "previous declaration %qD used %d template parameters",
tmpl, TREE_VEC_LENGTH (tmpl_parms));
return false;
}
@@ -7117,7 +7121,8 @@ coerce_template_parms (tree parms,
"(%d, should be %d)", nargs, nparms);
if (in_decl)
- inform (input_location, "provided for %q+D", in_decl);
+ inform (DECL_SOURCE_LOCATION (in_decl),
+ "provided for %qD", in_decl);
}
return error_mark_node;
@@ -15314,7 +15319,8 @@ tsubst_copy_and_build (tree t,
current_class_name, function);
}
else
- inform (0, "%q+D declared here, later in the "
+ inform (DECL_SOURCE_LOCATION (fn),
+ "%qD declared here, later in the "
"translation unit", fn);
}
function = unq;
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 646ff06a3ef..1176b3e6f4e 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1901,7 +1901,7 @@ check_final_overrider (tree overrider, tree basefn)
if (pedwarn (DECL_SOURCE_LOCATION (overrider), 0,
"invalid covariant return type for %q#D", overrider))
inform (DECL_SOURCE_LOCATION (basefn),
- " overriding %q+#D", basefn);
+ " overriding %q#D", basefn);
}
else
fail = 2;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 1277c2d6d6c..44f9f7acaa3 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3182,7 +3182,7 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain)
inform (0, "lambda in local class %q+T cannot "
"capture variables from the enclosing context",
TYPE_CONTEXT (closure));
- inform (input_location, "%q+#D declared here", decl);
+ inform (DECL_SOURCE_LOCATION (decl), "%q#D declared here", decl);
}
return error_mark_node;
}
@@ -3192,7 +3192,7 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain)
error (VAR_P (decl)
? G_("use of local variable with automatic storage from containing function")
: G_("use of parameter from containing function"));
- inform (input_location, "%q+#D declared here", decl);
+ inform (DECL_SOURCE_LOCATION (decl), "%q#D declared here", decl);
return error_mark_node;
}
return decl;