On 02/23/2011 11:56 PM, Jason Merrill wrote:
Perhaps so; I'm not sure what the right answer is for the default ABI version. For now I've just made these changes ABI v6, and I'm checking in this patch.
It occurred to me that the change in v5 hadn't been released yet, so I've changed these to be v5 as well.
commit 352205fb0f842552dde98fd887638f62586bf4ef Author: Jason Merrill <ja...@redhat.com> Date: Sat Mar 5 17:35:19 2011 -0500 * mangle.c (write_expression): Change ABI v6 to v5. (write_type): Likewise. diff --git a/gcc/common.opt b/gcc/common.opt index 2717b11..c2f2d6c 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -739,13 +739,12 @@ Driver Undocumented ; in template non-type arguments of pointer type. ; ; 4: The version of the ABI that introduces unambiguous mangling of -; vector types. +; vector types. First selectable in G++ 4.5. ; ; 5: The version of the ABI that ignores attribute const/noreturn -; in function pointer mangling. -; -; 6: The version of the ABI that corrects mangling of decltype and +; in function pointer mangling, and corrects mangling of decltype and ; function parameters used in other parameters and the return type. +; First selectable in G++ 4.6. ; ; Additional positive integers will be assigned as new versions of ; the ABI become the default version of the ABI. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 1984094..0297a2a 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1934,8 +1934,8 @@ write_type (tree type) gcc_assert (!DECLTYPE_FOR_LAMBDA_CAPTURE (type) && !DECLTYPE_FOR_LAMBDA_RETURN (type)); - /* In ABI <6, we stripped decltype of a plain decl. */ - if (!abi_version_at_least (6) + /* In ABI <5, we stripped decltype of a plain decl. */ + if (!abi_version_at_least (5) && DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (type)) { tree expr = DECLTYPE_TYPE_EXPR (type); @@ -2498,7 +2498,7 @@ write_expression (tree expr) write_char ('f'); if (delta != 0) { - if (abi_version_at_least (6)) + if (abi_version_at_least (5)) { /* Let L be the number of function prototype scopes from the innermost one (in which the parameter reference occurs) up
commit a2f33d5e8edd5fea6e2457abafdb172262762eac Author: Jason Merrill <ja...@redhat.com> Date: Sat Mar 5 19:42:41 2011 -0500 * doc/invoke.texi (C++ Dialect Options): Document ABI v5. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e642c39..6c4d633 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1846,6 +1846,10 @@ template argument. Version 4 implements a standard mangling for vector types. +Version 5 corrects the mangling of attribute const/volatile on +function pointer types, decltype of a plain decl, and use of a +function parameter in the declaration of another parameter. + See also @option{-Wabi}. @item -fno-access-control diff --git a/gcc/testsuite/g++.dg/abi/mangle39.C b/gcc/testsuite/g++.dg/abi/mangle39.C index 7b2ee01..2896356 100644 --- a/gcc/testsuite/g++.dg/abi/mangle39.C +++ b/gcc/testsuite/g++.dg/abi/mangle39.C @@ -1,5 +1,5 @@ // PR c++/42338 -// { dg-options "-std=c++0x -fabi-version=6" } +// { dg-options "-std=c++0x -fabi-version=5" } // { dg-final { scan-assembler "_Z1fIPiEDTcmppfp_Li0EET_" } } // { dg-final { scan-assembler "_Z1gIiEvRK1AIT_EDTixfL0p_Li0EE" } } diff --git a/gcc/testsuite/g++.dg/abi/mangle45.C b/gcc/testsuite/g++.dg/abi/mangle45.C index a4df773..3ce9abc 100644 --- a/gcc/testsuite/g++.dg/abi/mangle45.C +++ b/gcc/testsuite/g++.dg/abi/mangle45.C @@ -1,5 +1,5 @@ // Testcase for mangling of parameters used other than in a trailing return type -// { dg-options "-std=c++0x -fabi-version=6" } +// { dg-options "-std=c++0x -fabi-version=5" } template<class T> void f(T p, decltype(p)) { } // L = 1 template<class T> void g(T p, decltype(p) (*)()) { } // L = 1 diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing1.C b/gcc/testsuite/g++.dg/cpp0x/trailing1.C index b36d1aa..f637857 100644 --- a/gcc/testsuite/g++.dg/cpp0x/trailing1.C +++ b/gcc/testsuite/g++.dg/cpp0x/trailing1.C @@ -1,5 +1,5 @@ // Tests for late-specified return type. -// { dg-options "-std=c++0x -fabi-version=6" } +// { dg-options "-std=c++0x -fabi-version=5" } auto f() -> int {