]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++config (_GLIBCXX_ABI_TAG_CXX11): Add.
authorBenjamin Kosnik <bkoz@redhat.com>
Mon, 10 Jun 2013 23:11:05 +0000 (23:11 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Mon, 10 Jun 2013 23:11:05 +0000 (23:11 +0000)
2013-06-10  Benjamin Kosnik  <bkoz@redhat.com>

* include/bits/c++config (_GLIBCXX_ABI_TAG_CXX11): Add.
* include/bits/stl_map.h (erase): Use abi_tag when C++11.
* include/bits/stl_multimap.h: Same.
* include/bits/stl_multiset.h: Same.
* include/bits/stl_set.h: Same.
* include/bits/stl_tree.h: Same.
* include/std/complex (real, imag): Use macro for abi_tag.

* testsuite/lib/libstdc++.exp: Disable inlinling with -fno-inline.
* testsuite/util/testsuite_containers.h (erase_external): New
declarations.
(erase_external_iterators): Same.
(linkage_check_cxx98_cxx11_erase): Same.
(linkage_check_cxx98_cxx11_erase_iterators): Same.
* testsuite/util/testsuite_shared.cc: Define.
* testsuite/23_containers/map/modifiers/erase/abi_tag.cc: New.
* testsuite/23_containers/map/modifiers/erase/
dr130-linkage-check.cc: New.
* testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc: New.
* testsuite/23_containers/multimap/modifiers/erase/
dr130-linkage-check.cc: New.
* testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc: New.
* testsuite/23_containers/multiset/modifiers/erase/
dr130-linkage-check.cc: New.
* testsuite/23_containers/set/modifiers/erase/abi_tag.cc: New.
* testsuite/23_containers/set/modifiers/erase/dr130-linkage-check.cc:
New.
* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line number.

* testsuite/23_containers/map/dr130.cc: Move...
* testsuite/23_containers/map/modifiers/dr130.cc: ...here.
* testsuite/23_containers/multimap/dr130.cc: Move ...
* testsuite/23_containers/multimap/modifiers/dr130.cc: ...here.
* testsuite/23_containers/multiset/dr130.cc: Move...
* testsuite/23_containers/multiset/modifiers/dr130.cc: ...here.
* testsuite/23_containers/set/dr130.cc: Move...
* testsuite/23_containers/set/modifiers/dr130.cc: ...here.

From-SVN: r199924

24 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/c++config
libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_multimap.h
libstdc++-v3/include/bits/stl_multiset.h
libstdc++-v3/include/bits/stl_set.h
libstdc++-v3/include/bits/stl_tree.h
libstdc++-v3/include/std/complex
libstdc++-v3/testsuite/23_containers/map/modifiers/dr130.cc [moved from libstdc++-v3/testsuite/23_containers/map/dr130.cc with 100% similarity]
libstdc++-v3/testsuite/23_containers/map/modifiers/erase/abi_tag.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/map/modifiers/erase/dr130-linkage-check.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multimap/modifiers/dr130.cc [moved from libstdc++-v3/testsuite/23_containers/multimap/dr130.cc with 100% similarity]
libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/dr130-linkage-check.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multiset/modifiers/dr130.cc [moved from libstdc++-v3/testsuite/23_containers/multiset/dr130.cc with 100% similarity]
libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/dr130-linkage-check.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/set/modifiers/dr130.cc [moved from libstdc++-v3/testsuite/23_containers/set/dr130.cc with 100% similarity]
libstdc++-v3/testsuite/23_containers/set/modifiers/erase/abi_tag.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/set/modifiers/erase/dr130-linkage-check.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
libstdc++-v3/testsuite/lib/libstdc++.exp
libstdc++-v3/testsuite/util/testsuite_containers.h
libstdc++-v3/testsuite/util/testsuite_shared.cc

index 27d7a02cfeb35a773dd6a417e474410b2a7ce2e6..ec9bfd2bd2b896616f17b74c0bb79c5550891a08 100644 (file)
@@ -1,3 +1,43 @@
+2013-06-10  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * include/bits/c++config (_GLIBCXX_ABI_TAG_CXX11): Add.
+       * include/bits/stl_map.h (erase): Use abi_tag when C++11.
+       * include/bits/stl_multimap.h: Same.
+       * include/bits/stl_multiset.h: Same.
+       * include/bits/stl_set.h: Same.
+       * include/bits/stl_tree.h: Same.
+       * include/std/complex (real, imag): Use macro for abi_tag.
+
+       * testsuite/lib/libstdc++.exp: Disable inlinling with -fno-inline.
+       * testsuite/util/testsuite_containers.h (erase_external): New
+       declarations.
+       (erase_external_iterators): Same.
+       (linkage_check_cxx98_cxx11_erase): Same.
+       (linkage_check_cxx98_cxx11_erase_iterators): Same.
+       * testsuite/util/testsuite_shared.cc: Define.
+       * testsuite/23_containers/map/modifiers/erase/abi_tag.cc: New.
+       * testsuite/23_containers/map/modifiers/erase/
+       dr130-linkage-check.cc: New.
+       * testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc: New.
+       * testsuite/23_containers/multimap/modifiers/erase/
+       dr130-linkage-check.cc: New.
+       * testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc: New.
+       * testsuite/23_containers/multiset/modifiers/erase/
+       dr130-linkage-check.cc: New.
+       * testsuite/23_containers/set/modifiers/erase/abi_tag.cc: New.
+       * testsuite/23_containers/set/modifiers/erase/dr130-linkage-check.cc:
+       New.
+       * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust line number.
+
+       * testsuite/23_containers/map/dr130.cc: Move...
+       * testsuite/23_containers/map/modifiers/dr130.cc: ...here.
+       * testsuite/23_containers/multimap/dr130.cc: Move ...
+       * testsuite/23_containers/multimap/modifiers/dr130.cc: ...here.
+       * testsuite/23_containers/multiset/dr130.cc: Move...
+       * testsuite/23_containers/multiset/modifiers/dr130.cc: ...here.
+       * testsuite/23_containers/set/dr130.cc: Move...
+       * testsuite/23_containers/set/modifiers/dr130.cc: ...here.
+
 2013-06-10  Thomas Schwinge  <thomas@codesourcery.com>
 
        * testsuite/17_intro/headers/c++1998/49745.cc: Extend current
index 04ae4cb7c3a48f4eafa47470a022fe71a38a6534..aca8484e222fee1a98f5d3117797437322ebbbd2 100644 (file)
 # define _GLIBCXX_DEPRECATED
 #endif
 
+// Macros for ABI tag attributes.
+#ifndef _GLIBCXX_ABI_TAG_CXX11
+# define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11")))
+#endif
+
+
 #if __cplusplus
 
 // Macro for constexpr, to support in mixed 03/0x mode.
index 1f6763cd244ec7353fba1813921cb2355e795b3e..d05e4b9ab7d939c25f6f36fc14a52c909fed6348 100644 (file)
@@ -690,7 +690,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       erase(const_iterator __position)
       { return _M_t.erase(__position); }
 
-      // LWG 2059.
+      // LWG 2059
+      _GLIBCXX_ABI_TAG_CXX11
       iterator
       erase(iterator __position)
       { return _M_t.erase(__position); }
index 696e298aa8be18d61b5e5bbd7e217828e41dc444..809ea540b8a87a840082051a1add3dddeff5fed6 100644 (file)
@@ -596,6 +596,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _M_t.erase(__position); }
 
       // LWG 2059.
+      _GLIBCXX_ABI_TAG_CXX11
       iterator
       erase(iterator __position)
       { return _M_t.erase(__position); }
index ea22f4c8057f3ae95bed01e8d75133e0959d1d3e..8ceb02ac65fd3bb5e40c9c3c733e76e7ae0ccd7b 100644 (file)
@@ -532,6 +532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  not touched in any way.  Managing the pointer is the user's
        *  responsibility.
        */
+      _GLIBCXX_ABI_TAG_CXX11
       iterator
       erase(const_iterator __position)
       { return _M_t.erase(__position); }
@@ -583,6 +584,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  touched in any way.  Managing the pointer is the user's
        *  responsibility.
        */
+      _GLIBCXX_ABI_TAG_CXX11
       iterator
       erase(const_iterator __first, const_iterator __last)
       { return _M_t.erase(__first, __last); }
index 14f9f5a18237a64b976344a9ab9c3ec74c2ad57d..44eb5897f0ec314d1ca31eb77687b2fef9797a1e 100644 (file)
@@ -546,6 +546,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  touched in any way.  Managing the pointer is the user's
        *  responsibility.
        */
+      _GLIBCXX_ABI_TAG_CXX11
       iterator
       erase(const_iterator __position)
       { return _M_t.erase(__position); }
@@ -597,6 +598,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  the element is itself a pointer, the pointed-to memory is not touched
        *  in any way.  Managing the pointer is the user's responsibility.
        */
+      _GLIBCXX_ABI_TAG_CXX11
       iterator
       erase(const_iterator __first, const_iterator __last)
       { return _M_t.erase(__first, __last); }
index cb5a8eff800e7ea414020deb5ba81b9b7bc15594..91bf4df451144efe7250d1375da60685d94a2267 100644 (file)
@@ -336,21 +336,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
               _Node_allocator;
 
     protected:
-      typedef _Rb_tree_node_base* _Base_ptr;
-      typedef const _Rb_tree_node_base* _Const_Base_ptr;
+      typedef _Rb_tree_node_base*              _Base_ptr;
+      typedef const _Rb_tree_node_base*        _Const_Base_ptr;
 
     public:
-      typedef _Key key_type;
-      typedef _Val value_type;
-      typedef value_type* pointer;
-      typedef const value_type* const_pointer;
-      typedef value_type& reference;
-      typedef const value_type& const_reference;
-      typedef _Rb_tree_node<_Val>* _Link_type;
-      typedef const _Rb_tree_node<_Val>* _Const_Link_type;
-      typedef size_t size_type;
-      typedef ptrdiff_t difference_type;
-      typedef _Alloc allocator_type;
+      typedef _Key                             key_type;
+      typedef _Val                             value_type;
+      typedef value_type*                      pointer;
+      typedef const value_type*                const_pointer;
+      typedef value_type&                      reference;
+      typedef const value_type&                const_reference;
+      typedef _Rb_tree_node<_Val>*             _Link_type;
+      typedef const _Rb_tree_node<_Val>*       _Const_Link_type;
+      typedef size_t                           size_type;
+      typedef ptrdiff_t                        difference_type;
+      typedef _Alloc                           allocator_type;
 
       _Node_allocator&
       _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
@@ -800,6 +800,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #if __cplusplus >= 201103L
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // DR 130. Associative erase should return an iterator.
+      _GLIBCXX_ABI_TAG_CXX11
       iterator
       erase(const_iterator __position)
       {
@@ -810,6 +811,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       }
 
       // LWG 2059.
+      _GLIBCXX_ABI_TAG_CXX11
       iterator
       erase(iterator __position)
       {
@@ -833,6 +835,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #if __cplusplus >= 201103L
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // DR 130. Associative erase should return an iterator.
+      _GLIBCXX_ABI_TAG_CXX11
       iterator
       erase(const_iterator __first, const_iterator __last)
       {
index b31e8b18d71b21e7c75187c1f4820d28e2a25393..7f100a0420d5d51f73ba89fee40de2fb514c8fd6 100644 (file)
@@ -142,11 +142,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #if __cplusplus >= 201103L
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // DR 387. std::complex over-encapsulated.
-      __attribute ((__abi_tag__ ("cxx11")))
+      _GLIBCXX_ABI_TAG_CXX11
       constexpr _Tp 
       real() { return _M_real; }
 
-      __attribute ((__abi_tag__ ("cxx11")))
+      _GLIBCXX_ABI_TAG_CXX11
       constexpr _Tp 
       imag() { return _M_imag; }
 #else
diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/abi_tag.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/abi_tag.cc
new file mode 100644 (file)
index 0000000..0a17c56
--- /dev/null
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options -std=c++11 }
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Test that the C++11 variants have an ABI tag
+
+#include <map>
+
+using container = std::map<int, int>;
+using iterator = typename container::iterator;
+using const_iterator = typename container::const_iterator;
+
+// { dg-final { scan-assembler "_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS4_E" } }
+iterator (container::*p1)(iterator) = &container::erase;
diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/dr130-linkage-check.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/erase/dr130-linkage-check.cc
new file mode 100644 (file)
index 0000000..9d7cde9
--- /dev/null
@@ -0,0 +1,40 @@
+// { dg-require-effective-target ia32 }
+// { dg-require-sharedlib "" }
+// { dg-options "-fno-inline -std=gnu++11 ./testsuite_shared.so" }
+// 2013-06-03  Benjamin Kosnik  <bkoz@redhat..com>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_containers.h>
+
+int main()
+{
+  typedef std::map<int, int>           container_type;
+
+  {
+    container_type s { {0,0} , {1,1} , {2,2} };
+    __gnu_test::linkage_check_cxx98_cxx11_erase(s);
+  }
+
+  {
+    container_type s { {0,0} , {1,1} , {2,2} };
+    __gnu_test::linkage_check_cxx98_cxx11_erase_iterators(s);
+  }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/abi_tag.cc
new file mode 100644 (file)
index 0000000..7bd26a3
--- /dev/null
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options -std=c++11 }
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Test that the C++11 variants have an ABI tag
+
+#include <map>
+
+using container = std::multimap<int, int>;
+using iterator = typename container::iterator;
+using const_iterator = typename container::const_iterator;
+
+// { dg-final { scan-assembler "_ZNSt8multimapIiiSt4lessIiESaISt4pairIKiiEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS4_E" } }
+iterator (container::*p1)(iterator) = &container::erase;
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/dr130-linkage-check.cc b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/erase/dr130-linkage-check.cc
new file mode 100644 (file)
index 0000000..236100c
--- /dev/null
@@ -0,0 +1,40 @@
+// { dg-require-effective-target ia32 }
+// { dg-require-sharedlib "" }
+// { dg-options "-fno-inline -std=gnu++11 ./testsuite_shared.so" }
+// 2013-06-03  Benjamin Kosnik  <bkoz@redhat..com>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_containers.h>
+
+int main()
+{
+  typedef std::multimap<int, int>              container_type;
+
+  {
+    container_type s { {0,0} , {1,1} , {2,2} };
+    __gnu_test::linkage_check_cxx98_cxx11_erase(s);
+  }
+
+  {
+    container_type s { {0,0} , {1,1} , {2,2} };
+    __gnu_test::linkage_check_cxx98_cxx11_erase_iterators(s);
+  }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/abi_tag.cc
new file mode 100644 (file)
index 0000000..bbe2d05
--- /dev/null
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// { dg-options -std=c++11 }
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Test that the C++11 variants have an ABI tag
+
+#include <set>
+
+using container = std::multiset<int>;
+using iterator = typename container::iterator;
+using const_iterator = typename container::const_iterator;
+
+// { dg-final { scan-assembler "_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE" } }
+iterator (container::*p1)(const_iterator) = &container::erase;
+
+// { dg-final { scan-assembler "_ZNSt8multisetIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiES5_" } }
+iterator (container::*p2)(const_iterator, const_iterator) = &container::erase;
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/dr130-linkage-check.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/erase/dr130-linkage-check.cc
new file mode 100644 (file)
index 0000000..9155b64
--- /dev/null
@@ -0,0 +1,40 @@
+// { dg-require-effective-target ia32 }
+// { dg-require-sharedlib "" }
+// { dg-options "-fno-inline -std=gnu++11 ./testsuite_shared.so" }
+// 2013-06-03  Benjamin Kosnik  <bkoz@redhat..com>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_containers.h>
+
+int main()
+{
+  typedef std::multiset<int>                   container_type;
+
+  {
+    container_type s { 0, 1, 2 };
+    __gnu_test::linkage_check_cxx98_cxx11_erase(s);
+  }
+
+  {
+    container_type s { 0, 1, 2 };
+    __gnu_test::linkage_check_cxx98_cxx11_erase_iterators(s);
+  }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/abi_tag.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/abi_tag.cc
new file mode 100644 (file)
index 0000000..e612b2c
--- /dev/null
@@ -0,0 +1,38 @@
+// { dg-do compile }
+// { dg-options -std=c++11 }
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// Test that the C++11 variants have an ABI tag
+
+#include <set>
+
+using container = std::set<int>;
+using iterator = typename container::iterator;
+using const_iterator = typename container::const_iterator;
+
+// { dg-final { scan-assembler "_ZNSt3setIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiE" } }
+iterator (container::*p1)(const_iterator) = &container::erase;
+
+// { dg-final { scan-assembler "_ZNSt3setIiSt4lessIiESaIiEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIiES5_" } }
+iterator (container::*p2)(const_iterator, const_iterator) = &container::erase;
diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/dr130-linkage-check.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/erase/dr130-linkage-check.cc
new file mode 100644 (file)
index 0000000..a894f0c
--- /dev/null
@@ -0,0 +1,40 @@
+// { dg-require-effective-target ia32 }
+// { dg-require-sharedlib "" }
+// { dg-options "-fno-inline -std=gnu++11 ./testsuite_shared.so" }
+// 2013-06-03  Benjamin Kosnik  <bkoz@redhat..com>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <testsuite_containers.h>
+
+int main()
+{
+  typedef std::set<int>                        container_type;
+
+  {
+    container_type s { 0, 1, 2 };
+    __gnu_test::linkage_check_cxx98_cxx11_erase(s);
+  }
+
+  {
+    container_type s { 0, 1, 2 };
+    __gnu_test::linkage_check_cxx98_cxx11_erase_iterators(s);
+  }
+
+  return 0;
+}
index d77c712499011faacd62b2533eb664eac92abfc8..23c551b0b6ef3b2677baa735a570b1e0017aa499 100644 (file)
@@ -25,4 +25,4 @@
 
 #include <vector>
 
-// { dg-error "multiple inlined namespaces" "" { target *-*-* } 269 }
+// { dg-error "multiple inlined namespaces" "" { target *-*-* } 275 }
index 562410eb1115ed973acac7897e65dc0ba001cf2c..c339044a656d6fcf0715736deb41769c8286569e 100644 (file)
@@ -628,7 +628,7 @@ proc v3-build_support { } {
            # Compile with "-w" so that warnings issued by the compiler
            # do not prevent compilation.
            if { [v3_target_compile $srcdir/util/$f $object_file "sharedlib" \
-            [list "incdir=$srcdir" "additional_flags=-w -shared -fPIC -DPIC"]]
+            [list "incdir=$srcdir" "additional_flags=-fno-inline -w -shared -fPIC -DPIC"]]
                 != "" } {
                error "could not compile $f"
            }
index 723f8adaf8025e063130fceea7a7101433d76840..7e41d05ef433758c0f661aa3029bc68d95c5ba03 100644 (file)
@@ -223,6 +223,58 @@ namespace __gnu_test
   template<typename _Tp>
   _Tp citerator<_Tp>::_S_container;
 
+  // DR 130 vs. C++98 vs. C++11.
+  // Defined in testsuite_shared.cc.
+  void 
+  erase_external(std::set<int>& s);
+
+  void 
+  erase_external(std::multiset<int>& s);
+
+  void 
+  erase_external(std::map<int, int>& s);
+
+  void 
+  erase_external(std::multimap<int, int>& s);
+
+  void 
+  erase_external_iterators(std::set<int>& s);
+
+  void 
+  erase_external_iterators(std::multiset<int>& s);
+
+  void 
+  erase_external_iterators(std::map<int, int>& s);
+
+  void 
+  erase_external_iterators(std::multimap<int, int>& s);
+
+// NB: "must be compiled with C++11"
+#if __cplusplus >= 201103L
+template<typename _Tp>
+  void 
+  linkage_check_cxx98_cxx11_erase(_Tp& container)
+  {
+    // Crashing when exteral reference and internal reference symbols are
+    // equivalently mangled but have different size return types in C++98
+    // and C++11 signatures.
+    erase_external(container);                 // C++98
+    container.erase(container.begin());        // C++11
+  }
+
+template<typename _Tp>
+  void 
+  linkage_check_cxx98_cxx11_erase_iterators(_Tp& container)
+  {
+    // Crashing when exteral reference and internal reference symbols are
+    // equivalently mangled but have different size return types in C++98
+    // and C++11 signatures.
+    erase_external_iterators(container);// C++98
+
+    auto iter = container.begin();
+    container.erase(iter, ++iter);     // C++11
+  }
+#endif
 
 } // namespace __gnu_test
 
index ed7f4716f86cf8eee1aed4e4ae6a4811ca57c916..e07a03e6a477271f156fece6c82a648a6c4a97d9 100644 (file)
 #include <stdexcept>
 #include <iostream>
 #include <sstream>
+#include <set>
+#include <map>
 #include <ext/mt_allocator.h>
 #include <bits/functexcept.h>
 
+namespace __gnu_test
+{
 // libstdc++/22309
 extern "C" void
 try_allocation()
@@ -70,3 +74,57 @@ try_function_random_fail()
   // Randomly throw. See if other threads cleanup.
   std::__throw_bad_exception();
 }
+
+#if __cplusplus < 201103L
+// "must be compiled with C++98"
+  void 
+  erase_external(std::set<int>& s)
+  { s.erase(s.begin()); }
+
+  void 
+  erase_external(std::multiset<int>& s)
+  { s.erase(s.begin()); }
+  
+  void 
+  erase_external(std::map<int, int>& s)
+  { s.erase(s.begin()); }
+  
+  void 
+  erase_external(std::multimap<int, int>& s)
+  { s.erase(s.begin()); }
+
+  void 
+  erase_external_iterators(std::set<int>& s)
+  {
+    typedef typename std::set<int>::iterator iterator_type;
+    iterator_type iter = s.begin();
+    s.erase(iter, ++iter);
+  }
+
+  void 
+  erase_external_iterators(std::multiset<int>& s)
+  {
+    typedef typename std::multiset<int>::iterator iterator_type;
+    iterator_type iter = s.begin();
+    s.erase(iter, ++iter);
+  }
+
+  void 
+  erase_external_iterators(std::map<int, int>& s)
+  {
+    typedef typename std::map<int, int>::iterator iterator_type;
+    iterator_type iter = s.begin();
+    s.erase(iter, ++iter);
+  }
+
+  
+  void 
+  erase_external_iterators(std::multimap<int, int>& s)
+  {
+    typedef typename std::multimap<int, int>::iterator iterator_type;
+    iterator_type iter = s.begin();
+    s.erase(iter, ++iter);
+  }
+#endif
+
+} // end namepace __gnu_test