From 508f1cb51f5872f425a3d4eb3ab8bf5a76a692ac Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 15 Jun 2018 16:22:38 -0400 Subject: [PATCH] * tree.c (maybe_warn_parm_abi): Inform the location of the class. From-SVN: r261653 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/tree.c | 26 ++++++++++++-------------- gcc/testsuite/g++.dg/abi/invisiref2a.C | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f465dae..2679ca6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2018-06-15 Jason Merrill + + * tree.c (maybe_warn_parm_abi): Inform the location of the class. + 2018-06-14 Marek Polacek PR c++/86063 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 48a0ff3..a88481d 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -4074,25 +4074,23 @@ maybe_warn_parm_abi (tree t, location_t loc) if ((flag_abi_version == 12 || warn_abi_version == 12) && classtype_has_non_deleted_move_ctor (t)) { + bool w; if (flag_abi_version > 12) - warning_at (loc, OPT_Wabi, "-fabi-version=13 (GCC 8.2) fixes the " - "calling convention for %qT, which was accidentally " - "changed in 8.1", t); + w = warning_at (loc, OPT_Wabi, "-fabi-version=13 (GCC 8.2) fixes the " + "calling convention for %qT, which was accidentally " + "changed in 8.1", t); else - warning_at (loc, OPT_Wabi, "-fabi-version=12 (GCC 8.1) accidentally " - "changes the calling convention for %qT", t); + w = warning_at (loc, OPT_Wabi, "-fabi-version=12 (GCC 8.1) accident" + "ally changes the calling convention for %qT", t); + if (w) + inform (location_of (t), " declared here"); return; } - warning_at (loc, OPT_Wabi, "the calling convention for %qT changes in " - "-fabi-version=13 (GCC 8.2)", t); - static bool explained = false; - if (!explained) - { - inform (loc, " because all of its copy and move constructors " - "are deleted"); - explained = true; - } + if (warning_at (loc, OPT_Wabi, "the calling convention for %qT changes in " + "-fabi-version=13 (GCC 8.2)", t)) + inform (location_of (t), " because all of its copy and move " + "constructors are deleted"); } /* Returns true iff copying an object of type T (including via move diff --git a/gcc/testsuite/g++.dg/abi/invisiref2a.C b/gcc/testsuite/g++.dg/abi/invisiref2a.C index 0533055..127ee0a 100644 --- a/gcc/testsuite/g++.dg/abi/invisiref2a.C +++ b/gcc/testsuite/g++.dg/abi/invisiref2a.C @@ -3,7 +3,7 @@ // { dg-additional-options "-fabi-version=12 -Wabi -fdump-tree-gimple" } // { dg-final { scan-tree-dump "struct S &" "gimple" } } -struct S { +struct S { // { dg-message "" } S(S&&) = default; int i; }; -- 2.7.4