From 352b8babea0ef7d9995f1cb54a482cedca08987f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 1 Aug 2016 16:19:34 -0400 Subject: [PATCH] * mangle.c (mangle_decl): Fix mangled name change warning. From-SVN: r238964 --- gcc/cp/ChangeLog | 2 ++ gcc/cp/mangle.c | 7 ++++--- gcc/testsuite/g++.dg/abi/Wabi-2-3.C | 2 +- gcc/testsuite/g++.dg/abi/Wabi-3-2.C | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d792baf2475..2960579c3a2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 2016-08-01 Jason Merrill + * mangle.c (mangle_decl): Fix mangled name change warning. + PR c++/72766 * constexpr.c (cxx_eval_pointer_plus_expression): Check constancy of nelts. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index d5b26d64d8e..e0bbfc994b9 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1,4 +1,4 @@ -/* Name mangling for the 3.0 C++ ABI. +/* Name mangling for the 3.0 -*- C++ -*- ABI. Copyright (C) 2000-2016 Free Software Foundation, Inc. Written by Alex Samuel @@ -3732,6 +3732,7 @@ mangle_decl (const tree decl) id2 = mangle_decl_string (decl); id2 = targetm.mangle_decl_assembler_name (decl, id2); } + flag_abi_version = save_ver; if (id2 == id) /* OK. */; @@ -3740,8 +3741,8 @@ 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, save_ver, id2, - warn_abi_version, id); + G.entity, warn_abi_version, id2, + save_ver, id); else warning_at (DECL_SOURCE_LOCATION (G.entity), OPT_Wabi, "the mangled name of %qD changes between " diff --git a/gcc/testsuite/g++.dg/abi/Wabi-2-3.C b/gcc/testsuite/g++.dg/abi/Wabi-2-3.C index 5aadf5db7ea..96a0f22546f 100644 --- a/gcc/testsuite/g++.dg/abi/Wabi-2-3.C +++ b/gcc/testsuite/g++.dg/abi/Wabi-2-3.C @@ -12,5 +12,5 @@ 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\\)" } +void foo (S) { } // { dg-warning "the mangled name of .void foo\\(S\\). changed between -fabi-version=2 \\(_Z3foo1SILZ1NEE\\) and -fabi-version=3 \\(_Z3foo1SIL_Z1NEE\\)" } diff --git a/gcc/testsuite/g++.dg/abi/Wabi-3-2.C b/gcc/testsuite/g++.dg/abi/Wabi-3-2.C index c65e3b6bd47..46bd7135200 100644 --- a/gcc/testsuite/g++.dg/abi/Wabi-3-2.C +++ b/gcc/testsuite/g++.dg/abi/Wabi-3-2.C @@ -12,5 +12,5 @@ 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\\)" } +void foo (S) { } // { dg-warning "the mangled name of .void foo\\(S\\). changes between -fabi-version=2 \\(_Z3foo1SILZ1NEE\\) and -fabi-version=3 \\(_Z3foo1SIL_Z1NEE\\)" } -- 2.30.2