From 96ac5968b36d544dcf8aa42a292afd8d38580f6c Mon Sep 17 00:00:00 2001 From: jason Date: Mon, 12 Nov 2012 17:51:26 +0000 Subject: [PATCH] * include/std/complex (real, imag): Add ABI tag in C++11 mode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193445 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 4 ++++ libstdc++-v3/include/std/complex | 8 +++++++ .../testsuite/26_numerics/complex/abi_tag.cc | 25 ++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 libstdc++-v3/testsuite/26_numerics/complex/abi_tag.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7276018f4ef..391e5d9010c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2012-11-11 Jason Merrill + + * include/std/complex (real, imag): Add ABI tag in C++11 mode. + 2012-11-11 Andreas Schwab * doc/xml/chapter.txml: Remove whitespace inside . diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index f9221a86e0b..b13b11becc5 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -141,9 +141,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. + __attribute ((__abi_tag__ ("cxx11"))) constexpr _Tp real() { return _M_real; } + __attribute ((__abi_tag__ ("cxx11"))) constexpr _Tp imag() { return _M_imag; } #else @@ -1061,9 +1063,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. + __attribute ((__abi_tag__ ("cxx11"))) constexpr float real() { return __real__ _M_value; } + __attribute ((__abi_tag__ ("cxx11"))) constexpr float imag() { return __imag__ _M_value; } #else @@ -1210,9 +1214,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. + __attribute ((__abi_tag__ ("cxx11"))) constexpr double real() { return __real__ _M_value; } + __attribute ((__abi_tag__ ("cxx11"))) constexpr double imag() { return __imag__ _M_value; } #else @@ -1360,9 +1366,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 387. std::complex over-encapsulated. + __attribute ((__abi_tag__ ("cxx11"))) constexpr long double real() { return __real__ _M_value; } + __attribute ((__abi_tag__ ("cxx11"))) constexpr long double imag() { return __imag__ _M_value; } #else diff --git a/libstdc++-v3/testsuite/26_numerics/complex/abi_tag.cc b/libstdc++-v3/testsuite/26_numerics/complex/abi_tag.cc new file mode 100644 index 00000000000..a8454667228 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/complex/abi_tag.cc @@ -0,0 +1,25 @@ +// Test that the C++11 variants of real/imag have an ABI tag +// { dg-do compile } +// { dg-options -std=c++11 } + +#include + +// { dg-final { scan-assembler "_ZNKSt7complexIfE4realB5cxx11Ev" } } +float (std::complex::*p1)() const = &std::complex::real; +// { dg-final { scan-assembler "_ZNKSt7complexIdE4realB5cxx11Ev" } } +double (std::complex::*p2)() const = &std::complex::real; +// { dg-final { scan-assembler "_ZNKSt7complexIeE4realB5cxx11Ev" } } +long double (std::complex::*p3)() const + = &std::complex::real; +// { dg-final { scan-assembler "_ZNKSt7complexIiE4realB5cxx11Ev" } } +int (std::complex::*p4)() const = &std::complex::real; + +// { dg-final { scan-assembler "_ZNKSt7complexIfE4imagB5cxx11Ev" } } +float (std::complex::*p5)() const = &std::complex::imag; +// { dg-final { scan-assembler "_ZNKSt7complexIdE4imagB5cxx11Ev" } } +double (std::complex::*p6)() const = &std::complex::imag; +// { dg-final { scan-assembler "_ZNKSt7complexIeE4imagB5cxx11Ev" } } +long double (std::complex::*p7)() const + = &std::complex::imag; +// { dg-final { scan-assembler "_ZNKSt7complexIiE4imagB5cxx11Ev" } } +int (std::complex::*p8)() const = &std::complex::imag; -- 2.11.4.GIT