]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/69317 - [6 regression] wrong ABI version in -Wabi warnings
authorMartin Sebor <msebor@redhat.com>
Wed, 27 Jan 2016 15:44:07 +0000 (15:44 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 27 Jan 2016 15:44:07 +0000 (08:44 -0700)
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.

From-SVN: r232881

gcc/cp/ChangeLog
gcc/cp/mangle.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/Wabi-2-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/Wabi-2-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/Wabi-3-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/Wabi-3-3.C [new file with mode: 0644]

index 9f8d91a4500c0f0631fa2b48cda58289a3e895da..6aa2176341839178e60f0a638a4d05e53fb27dff 100644 (file)
@@ -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
index a8b9f37dd7ab7f5d7b950ee39800d7179a835704..4f1eea6335c38a5508b05a474c013c6384fc0512 100644 (file)
@@ -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);
        }
 
index 8c7f4ddb3716ad26b46d4c97c62da3d81b56c77b..ad977146f18335bce6b9b0af1772e9e151a8398b 100644 (file)
@@ -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 (file)
index 0000000..d3a644b
--- /dev/null
@@ -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 (file)
index 0000000..5aadf5d
--- /dev/null
@@ -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 (file)
index 0000000..c65e3b6
--- /dev/null
@@ -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 (file)
index 0000000..4434971
--- /dev/null
@@ -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>) { }
+