public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fix #69317 - [6 regression] wrong ABI version in -Wabi warnings
@ 2016-01-17  0:42 Martin Sebor
  2016-01-25 16:56 ` Martin Sebor
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Sebor @ 2016-01-17  0:42 UTC (permalink / raw)
  To: Gcc Patch List, Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

While adding an ABI warning in the patch for bug 69277 I noticed
that the ABI version printed by GCC 6.0 in some -Wabi diagnostics
is incorrect:  while 5.1.0 prints the versions of the ABI given
by the -Wabi=X and -fabi-version=Y options (i.e., it mentions
both X and Y), 6.0 prints the same version twice (just Y).

The attached patch fixes this and adds tests to verify that the
referenced versions are as expected (it uses ABIs 2 and 3 but
tests exercising the other ABI changes should be added as well).

Martin

[-- Attachment #2: gcc-69317.patch --]
[-- Type: text/x-patch, Size: 4467 bytes --]

gcc/cp/ChangeLog:
2016-01-16  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-16  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.

Index: gcc/cp/mangle.c
===================================================================
--- gcc/cp/mangle.c	(revision 232296)
+++ gcc/cp/mangle.c	(working copy)
@@ -3657,13 +3669,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: gcc/testsuite/g++.dg/abi/Wabi-2-2.C
===================================================================
--- gcc/testsuite/g++.dg/abi/Wabi-2-2.C	(revision 0)
+++ gcc/testsuite/g++.dg/abi/Wabi-2-2.C	(working copy)
@@ -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>) { }
+
Index: gcc/testsuite/g++.dg/abi/Wabi-2-3.C
===================================================================
--- gcc/testsuite/g++.dg/abi/Wabi-2-3.C	(revision 0)
+++ gcc/testsuite/g++.dg/abi/Wabi-2-3.C	(working copy)
@@ -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\\)" }
+
Index: gcc/testsuite/g++.dg/abi/Wabi-3-2.C
===================================================================
--- gcc/testsuite/g++.dg/abi/Wabi-3-2.C	(revision 0)
+++ gcc/testsuite/g++.dg/abi/Wabi-3-2.C	(working copy)
@@ -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\\)" }
+
Index: gcc/testsuite/g++.dg/abi/Wabi-3-3.C
===================================================================
--- gcc/testsuite/g++.dg/abi/Wabi-3-3.C	(revision 0)
+++ gcc/testsuite/g++.dg/abi/Wabi-3-3.C	(working copy)
@@ -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>) { }
+

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix #69317 - [6 regression] wrong ABI version in -Wabi warnings
  2016-01-17  0:42 [PATCH] fix #69317 - [6 regression] wrong ABI version in -Wabi warnings Martin Sebor
@ 2016-01-25 16:56 ` Martin Sebor
  2016-01-27  6:50   ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Sebor @ 2016-01-25 16:56 UTC (permalink / raw)
  To: Gcc Patch List, Jason Merrill

Ping: I'm looking a review/approval of the almost trivial patch
below:

    https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01206.html

On 01/16/2016 05:42 PM, Martin Sebor wrote:
> While adding an ABI warning in the patch for bug 69277 I noticed
> that the ABI version printed by GCC 6.0 in some -Wabi diagnostics
> is incorrect:  while 5.1.0 prints the versions of the ABI given
> by the -Wabi=X and -fabi-version=Y options (i.e., it mentions
> both X and Y), 6.0 prints the same version twice (just Y).
>
> The attached patch fixes this and adds tests to verify that the
> referenced versions are as expected (it uses ABIs 2 and 3 but
> tests exercising the other ABI changes should be added as well).
>
> Martin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix #69317 - [6 regression] wrong ABI version in -Wabi warnings
  2016-01-25 16:56 ` Martin Sebor
@ 2016-01-27  6:50   ` Jeff Law
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Law @ 2016-01-27  6:50 UTC (permalink / raw)
  To: Martin Sebor, Gcc Patch List, Jason Merrill

On 01/25/2016 09:56 AM, Martin Sebor wrote:
> Ping: I'm looking a review/approval of the almost trivial patch
> below:
>
>     https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01206.html
>
> On 01/16/2016 05:42 PM, Martin Sebor wrote:
>> While adding an ABI warning in the patch for bug 69277 I noticed
>> that the ABI version printed by GCC 6.0 in some -Wabi diagnostics
>> is incorrect:  while 5.1.0 prints the versions of the ABI given
>> by the -Wabi=X and -fabi-version=Y options (i.e., it mentions
>> both X and Y), 6.0 prints the same version twice (just Y).
>>
>> The attached patch fixes this and adds tests to verify that the
>> referenced versions are as expected (it uses ABIs 2 and 3 but
>> tests exercising the other ABI changes should be added as well).
OK.

Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-27  6:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-17  0:42 [PATCH] fix #69317 - [6 regression] wrong ABI version in -Wabi warnings Martin Sebor
2016-01-25 16:56 ` Martin Sebor
2016-01-27  6:50   ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).