diff options
author | msebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-27 15:44:07 +0000 |
---|---|---|
committer | msebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-27 15:44:07 +0000 |
commit | 18e9663b86629d2002fd7931faf5bd1e0ea9aaa6 (patch) | |
tree | b79e1c27ec85ef299e88b28597203fa04eda2af9 | |
parent | 9ce22fb3138ed2fe52307cd20c1fd801acc27678 (diff) | |
download | gcc-18e9663b86629d2002fd7931faf5bd1e0ea9aaa6.tar.gz |
PR c++/69317 - [6 regression] wrong ABI version in -Wabi warnings
gcc/cp/ChangeLog:
2016-01-27 Martin Sebor <msebor@redhat.com>
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 <msebor@redhat.com>
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232881 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/Wabi-2-2.C | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/Wabi-2-3.C | 16 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/Wabi-3-2.C | 16 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/Wabi-3-3.C | 14 |
7 files changed, 77 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9f8d91a4500..6aa21763418 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-01-27 Martin Sebor <msebor@redhat.com> + + PR c++/69317 + * mangle.c (mangle_decl): Reference the correct (saved) version + of the ABI in -Wabi diagnostics. + 2016-01-27 Marek Polacek <polacek@redhat.com> PR c++/69496 diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index a8b9f37dd7a..4f1eea6335c 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 8c7f4ddb371..ad977146f18 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2016-01-27 Martin Sebor <msebor@redhat.com> + + 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 <rguenther@suse.de> 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 00000000000..d3a644b2d1c --- /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 <int &> struct S { }; + +// Expect no diagnostic. +void foo (S<N>) { } + 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 00000000000..5aadf5db7ea --- /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 <int &> 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<N>) { } // { dg-warning "the mangled name of .void foo\\(S<N>\\). 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 00000000000..c65e3b6bd47 --- /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 <int &> 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<N>) { } // { dg-warning "the mangled name of .void foo\\(S<N>\\). 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 00000000000..443497121bd --- /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 <int &> struct S { }; + +// Expect no diagnostic. +void foo (S<N>) { } + |