+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
= 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
{
if ((complain & tf_warning)
&& warning (OPT_Wc__14_compat, msg1))
- inform (0, msg2, fn);
+ inform (DECL_SOURCE_LOCATION (fn), msg2, fn);
goto ok;
}
{
/* 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);
}
}
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;
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;
}
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)");
}
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))
{
/* 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);
{
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);
}
}
{
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
{
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;
}
{
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);
*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);
}
}
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
{
*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)
&& (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)
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,
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)
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;
}
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;
}
}
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:
"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;
}
"(%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;
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;
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;
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;
}
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;