From 60214d0d65c94912906108d2a1e6d04423528afc Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 27 Jan 2016 15:44:07 +0000 Subject: PR c++/69317 - [6 regression] wrong ABI version in -Wabi warnings gcc/cp/ChangeLog: 2016-01-27 Martin Sebor PR c++/69317 * mangle.c (mangle_decl): Reference the correct (saved) version of the ABI in -Wabi diagnostics. gcc/testsuite/ChangeLog: 2016-01-27 Martin Sebor PR c++/69317 * g++.dg/abi/Wabi-2-2.C: New test. * g++.dg/abi/Wabi-2-3.C: New test. * g++.dg/abi/Wabi-3-2.C: New test. * g++.dg/abi/Wabi-3-3.C: New test. From-SVN: r232881 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/mangle.c | 6 +++--- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/abi/Wabi-2-2.C | 14 ++++++++++++++ gcc/testsuite/g++.dg/abi/Wabi-2-3.C | 16 ++++++++++++++++ gcc/testsuite/g++.dg/abi/Wabi-3-2.C | 16 ++++++++++++++++ gcc/testsuite/g++.dg/abi/Wabi-3-3.C | 14 ++++++++++++++ 7 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/abi/Wabi-2-2.C create mode 100644 gcc/testsuite/g++.dg/abi/Wabi-2-3.C create mode 100644 gcc/testsuite/g++.dg/abi/Wabi-3-2.C create mode 100644 gcc/testsuite/g++.dg/abi/Wabi-3-3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9f8d91a..6aa2176 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-01-27 Martin Sebor + + PR c++/69317 + * mangle.c (mangle_decl): Reference the correct (saved) version + of the ABI in -Wabi diagnostics. + 2016-01-27 Marek Polacek PR c++/69496 diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index a8b9f37..4f1eea6 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -3657,13 +3657,13 @@ mangle_decl (const tree decl) 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, warn_abi_version, id2, - flag_abi_version, id); + G.entity, save_ver, id2, + warn_abi_version, id); else 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, + G.entity, save_ver, id, warn_abi_version, id2); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c7f4dd..ad97714 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2016-01-27 Martin Sebor + + PR c++/69317 + * g++.dg/abi/Wabi-2-2.C: New test. + * g++.dg/abi/Wabi-2-3.C: New test. + * g++.dg/abi/Wabi-3-2.C: New test. + * g++.dg/abi/Wabi-3-3.C: New test. + 2016-01-27 Richard Biener PR tree-optimization/69166 diff --git a/gcc/testsuite/g++.dg/abi/Wabi-2-2.C b/gcc/testsuite/g++.dg/abi/Wabi-2-2.C new file mode 100644 index 0000000..d3a644b --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/Wabi-2-2.C @@ -0,0 +1,14 @@ +// Verify that no diagnostic is issued when the version specified +// via -Wabi= matches the version specified by -fabi-version=. + +// { dg-options "-Werror -Wabi=2 -fabi-version=2" } +// { dg-do compile } + +// The mangling of templates with a non-type template parameter +// of reference type changed in ABI version 3: +extern int N; +template struct S { }; + +// Expect no diagnostic. +void foo (S) { } + diff --git a/gcc/testsuite/g++.dg/abi/Wabi-2-3.C b/gcc/testsuite/g++.dg/abi/Wabi-2-3.C new file mode 100644 index 0000000..5aadf5d --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/Wabi-2-3.C @@ -0,0 +1,16 @@ +// PR c++/69317 - [6 regression] wrong ABI version in -Wabi warnings +// Exercise that the correct ABI versions are referenced in the -Wabi +// diagnostic. See also the equivalent Wabi-3-2.C test. + +// { dg-options "-Wabi=2 -fabi-version=3" } +// { dg-do compile } + +// The mangling of templates with a non-type template parameter +// of reference type changed in ABI version 3: +extern int N; +template struct S { }; + +// Expect the diagnostic to reference the ABI version specified via +// -fabi-version=3 and the ABI version specified via -Wabi=2. +void foo (S) { } // { dg-warning "the mangled name of .void foo\\(S\\). changed between -fabi-version=3 \\(_Z3foo1SILZ1NEE\\) and -fabi-version=2 \\(_Z3foo1SIL_Z1NEE\\)" } + diff --git a/gcc/testsuite/g++.dg/abi/Wabi-3-2.C b/gcc/testsuite/g++.dg/abi/Wabi-3-2.C new file mode 100644 index 0000000..c65e3b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/Wabi-3-2.C @@ -0,0 +1,16 @@ +// PR c++/69317 - [6 regression] wrong ABI version in -Wabi warnings +// Exercise that the correct ABI versions are referenced in the -Wabi +// diagnostic. See also the equivalent Wabi-2-3.C test. + +// { dg-options "-Wabi=3 -fabi-version=2" } +// { dg-do compile } + +// The mangling of templates with a non-type template parameter +// of reference type changed in ABI version 3: +extern int N; +template struct S { }; + +// Expect the diagnostic to reference the ABI version specified via +// -fabi-version=2 and the ABI version specified via -Wabi=3. +void foo (S) { } // { dg-warning "the mangled name of .void foo\\(S\\). changed between -fabi-version=2 \\(_Z3foo1SIL_Z1NEE\\) and -fabi-version=3 \\(_Z3foo1SILZ1NEE\\)" } + diff --git a/gcc/testsuite/g++.dg/abi/Wabi-3-3.C b/gcc/testsuite/g++.dg/abi/Wabi-3-3.C new file mode 100644 index 0000000..4434971 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/Wabi-3-3.C @@ -0,0 +1,14 @@ +// Verify that no diagnostic is issued when the version specified +// via -Wabi= matches the version specified by -fabi-version=. + +// { dg-options "-Werror -Wabi=3 -fabi-version=3" } +// { dg-do compile } + +// The mangling of templates with a non-type template parameter +// of reference type changed in ABI version 3: +extern int N; +template struct S { }; + +// Expect no diagnostic. +void foo (S) { } + -- cgit v1.1