Hi, other bits. Tested x86_64-linux.
Thanks, Paolo. //////////////////////
2015-07-28 Paolo Carlini <paolo.carl...@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.
Index: call.c =================================================================== --- call.c (revision 226260) +++ call.c (working copy) @@ -5843,7 +5843,7 @@ build_op_delete_call (enum tree_code code, tree ad = 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 ad { 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 ad { /* 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, t 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, t 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 fla 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)"); } Index: constexpr.c =================================================================== --- constexpr.c (revision 226260) +++ constexpr.c (working copy) @@ -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)) { Index: decl.c =================================================================== --- decl.c (revision 226260) +++ decl.c (working copy) @@ -1378,8 +1378,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool /* 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); Index: except.c =================================================================== --- except.c (revision 226260) +++ except.c (working copy) @@ -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); } } Index: friend.c =================================================================== --- friend.c (revision 226260) +++ friend.c (working copy) @@ -329,7 +329,8 @@ make_friend_class (tree type, tree friend_type, bo { 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, bo { 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; } Index: mangle.c =================================================================== --- mangle.c (revision 226260) +++ mangle.c (working copy) @@ -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); Index: method.c =================================================================== --- method.c (revision 226260) +++ method.c (working copy) @@ -1138,8 +1138,8 @@ process_subob_fn (tree fn, tree *spec_p, bool *tri *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, speci 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, speci { *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, Index: parser.c =================================================================== --- parser.c (revision 226260) +++ parser.c (working copy) @@ -9251,7 +9251,8 @@ cp_parser_lambda_introducer (cp_parser* parser, tr 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, tr 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; } Index: pt.c =================================================================== --- pt.c (revision 226260) +++ pt.c (working copy) @@ -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; Index: search.c =================================================================== --- search.c (revision 226260) +++ search.c (working copy) @@ -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; Index: semantics.c =================================================================== --- semantics.c (revision 226260) +++ semantics.c (working copy) @@ -3182,7 +3182,7 @@ process_outer_var_ref (tree decl, tsubst_flags_t c 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 c 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;