aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-05-31 14:14:42 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-05-31 14:14:42 +0000
commit1e2c0906eeaf6050034a17d06c9d40c16a3f29cd (patch)
tree7e03ee0ccbc4d0692ccc1eb272a0551cde8653f2
parent877a19bfb8f34344702b206a549c61f7466fdf01 (diff)
downloadgcc-1e2c0906eeaf6050034a17d06c9d40c16a3f29cd.zip
gcc-1e2c0906eeaf6050034a17d06c9d40c16a3f29cd.tar.gz
gcc-1e2c0906eeaf6050034a17d06c9d40c16a3f29cd.tar.bz2
basic_string.h (front, back): Add.
2010-05-31 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/basic_string.h (front, back): Add. * include/debug/string: Adjust. * include/ext/vstring.h (front, back): Tweak the implementation to follow more closely the letter of the specs. * testsuite/21_strings/basic_string/element_access/char/ front_back.cc: New. * testsuite/21_strings/basic_string/element_access/wchar_t/ front_back.cc: Likewise. * config/abi/pre/gnu.ver: Export new symbols. * testsuite/util/testsuite_abi.cc: Adjust. * configure.ac: Bump minor version to 6:15:0. * configure: Regenerate. From-SVN: r160071
-rw-r--r--libstdc++-v3/ChangeLog15
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver37
-rwxr-xr-xlibstdc++-v3/configure2
-rw-r--r--libstdc++-v3/configure.ac2
-rw-r--r--libstdc++-v3/include/bits/basic_string.h34
-rw-r--r--libstdc++-v3/include/debug/string5
-rw-r--r--libstdc++-v3/include/ext/vstring.h12
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/front_back.cc43
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/front_back.cc43
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_abi.cc4
10 files changed, 182 insertions, 15 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 5e6702b..4932edd 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,18 @@
+2010-05-31 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/basic_string.h (front, back): Add.
+ * include/debug/string: Adjust.
+ * include/ext/vstring.h (front, back): Tweak the implementation
+ to follow more closely the letter of the specs.
+ * testsuite/21_strings/basic_string/element_access/char/
+ front_back.cc: New.
+ * testsuite/21_strings/basic_string/element_access/wchar_t/
+ front_back.cc: Likewise.
+ * config/abi/pre/gnu.ver: Export new symbols.
+ * testsuite/util/testsuite_abi.cc: Adjust.
+ * configure.ac: Bump minor version to 6:15:0.
+ * configure: Regenerate.
+
2010-05-28 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_vector.h (vector<>::data): Fix return type
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 998b651..6375b88 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -185,7 +185,10 @@ GLIBCXX_3.4 {
# where it is used for size_type on LLP64 platforms.
_ZNSsC[12][EI][PRjmvyN]*;
_ZNSsD*;
- _ZNSs[0-58-9][a-z]*;
+ _ZNSs[0-58-9]a*;
+ _ZNSs5beginEv;
+ _ZNSs[0-58-9][c-e]*;
+ _ZNSs[0-58-9][g-z]*;
# _ZNSs[67][a-z]*E[PRcjmvy]*;
_ZNSs6appendE[PRcjmvy]*;
_ZNSs6assignE[PRcjmvy]*;
@@ -219,9 +222,12 @@ GLIBCXX_3.4 {
_ZNSsaSE[PRc]*;
_ZNSsixE*;
_ZNSspLE[PRc]*;
- _ZNKSs[0-9][a-b]*;
- _ZNKSs[0-9][d-z]*;
+ _ZNKSs[0-3][a-b]*;
+ _ZNKSs[5-9][a-b]*;
+ _ZNKSs[0-9][d-e]*;
+ _ZNKSs[0-9][g-z]*;
_ZNKSs[0-9][0-9][a-z]*;
+ _ZNKSs4find*;
_ZNKSs[a-z]*;
_ZNKSs4_Rep12_M_is_leakedEv;
_ZNKSs4_Rep12_M_is_sharedEv;
@@ -240,7 +246,10 @@ GLIBCXX_3.4 {
# std::wstring
_ZNSbIwSt11char_traitsIwESaIwEEC[12][EI][PRjmvyN]*;
_ZNSbIwSt11char_traitsIwESaIwEED*;
- _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][a-z]*;
+ _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9]a*;
+ _ZNSbIwSt11char_traitsIwESaIwEE5beginEv;
+ _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][c-e]*;
+ _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][g-z]*;
# _ZNSbIwSt11char_traitsIwESaIwEE[67][a-b]*E[PRwjmvy]*;
_ZNSbIwSt11char_traitsIwESaIwEE6appendE[PRwjmvy]*;
_ZNSbIwSt11char_traitsIwESaIwEE6assignE[PRwjmvy]*;
@@ -274,10 +283,13 @@ GLIBCXX_3.4 {
_ZNSbIwSt11char_traitsIwESaIwEEaSE[PRw]*;
_ZNSbIwSt11char_traitsIwESaIwEEixE*;
_ZNSbIwSt11char_traitsIwESaIwEEpLE[PRw]*;
- _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][a-b]*;
- _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][d-z]*;
+ _ZNKSbIwSt11char_traitsIwESaIwEE[0-3][a-b]*;
+ _ZNKSbIwSt11char_traitsIwESaIwEE[5-9][a-b]*;
+ _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][d-e]*;
+ _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][g-z]*;
_ZNKSbIwSt11char_traitsIwESaIwEE[0-9][0-9][a-z]*;
_ZNKSbIwSt11char_traitsIwESaIwEE[a-z]*;
+ _ZNKSbIwSt11char_traitsIwESaIwEE4find*;
_ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_leakedEv;
_ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_sharedEv;
_ZNKSbIwSt11char_traitsIwESaIwEE6_M_repEv;
@@ -1150,6 +1162,19 @@ GLIBCXX_3.4.14 {
} GLIBCXX_3.4.13;
+GLIBCXX_3.4.15 {
+
+ # string|wstring front and back member functions
+ _ZNSs5frontEv;
+ _ZNKSs5frontEv;
+ _ZNSbIwSt11char_traitsIwESaIwEE5frontEv;
+ _ZNKSbIwSt11char_traitsIwESaIwEE5frontEv;
+ _ZNSs4backEv;
+ _ZNKSs4backEv;
+ _ZNSbIwSt11char_traitsIwESaIwEE4backEv;
+ _ZNKSbIwSt11char_traitsIwESaIwEE4backEv;
+
+} GLIBCXX_3.4.14;
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 16f2185..9fee000 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -2789,7 +2789,7 @@ ac_config_headers="$ac_config_headers config.h"
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:14:0
+libtool_VERSION=6:15:0
# Find the rest of the source tree framework.
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 7d7f7a9..2d99a23 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -12,7 +12,7 @@ AC_CONFIG_HEADER(config.h)
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:14:0
+libtool_VERSION=6:15:0
AC_SUBST(libtool_VERSION)
# Find the rest of the source tree framework.
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index d6d9989..fe9e1a3 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -851,6 +851,40 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return _M_data()[__n];
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * Returns a read/write reference to the data at the first
+ * element of the %string.
+ */
+ reference
+ front()
+ { return operator[](0); }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the first
+ * element of the %string.
+ */
+ const_reference
+ front() const
+ { return operator[](0); }
+
+ /**
+ * Returns a read/write reference to the data at the last
+ * element of the %string.
+ */
+ reference
+ back()
+ { return operator[](this->size() - 1); }
+
+ /**
+ * Returns a read-only (constant) reference to the data at the
+ * last element of the %string.
+ */
+ const_reference
+ back() const
+ { return operator[](this->size() - 1); }
+#endif
+
/**
* @brief Provides access to the data contained in the %string.
* @param n The index of the character to access.
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index 160488e..fe31ffb 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -262,6 +262,11 @@ namespace __gnu_debug
using _Base::at;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ using _Base::front;
+ using _Base::back;
+#endif
+
// 21.3.5 modifiers:
basic_string&
operator+=(const basic_string& __str)
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index fc469cb..dffd35a 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -62,8 +62,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef _Alloc allocator_type;
typedef typename _CharT_alloc_type::size_type size_type;
typedef typename _CharT_alloc_type::difference_type difference_type;
- typedef typename _CharT_alloc_type::reference reference;
- typedef typename _CharT_alloc_type::const_reference const_reference;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
typedef typename _CharT_alloc_type::pointer pointer;
typedef typename _CharT_alloc_type::const_pointer const_pointer;
typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator;
@@ -598,7 +598,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
*/
reference
front()
- { return *begin(); }
+ { return operator[](0); }
/**
* Returns a read-only (constant) reference to the data at the first
@@ -606,7 +606,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
*/
const_reference
front() const
- { return *begin(); }
+ { return operator[](0); }
/**
* Returns a read/write reference to the data at the last
@@ -614,7 +614,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
*/
reference
back()
- { return *(end() - 1); }
+ { return operator[](this->size() - 1); }
/**
* Returns a read-only (constant) reference to the data at the
@@ -622,7 +622,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
*/
const_reference
back() const
- { return *(end() - 1); }
+ { return operator[](this->size() - 1); }
#endif
// Modifiers:
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/front_back.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/front_back.cc
new file mode 100644
index 0000000..a7c1386
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/front_back.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// 2010-05-31 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation
+//
+// 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 <string>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::string str("ramifications");
+ const std::string cstr("melodien");
+
+ VERIFY( str.front() == 'r' );
+ VERIFY( str.back() == 's' );
+ VERIFY( cstr.front() == 'm' );
+ VERIFY( cstr.back() == 'n' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/front_back.cc b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/front_back.cc
new file mode 100644
index 0000000..60b0960
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/front_back.cc
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// 2010-05-31 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation
+//
+// 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 <string>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wstring str(L"ramifications");
+ const std::wstring cstr(L"melodien");
+
+ VERIFY( str.front() == L'r' );
+ VERIFY( str.back() == L's' );
+ VERIFY( cstr.front() == L'm' );
+ VERIFY( cstr.back() == L'n' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc
index c7166c6..d3c73f6 100644
--- a/libstdc++-v3/testsuite/util/testsuite_abi.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc
@@ -1,6 +1,7 @@
// -*- C++ -*-
-// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Free Software Foundation, Inc.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@@ -186,6 +187,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("GLIBCXX_3.4.12");
known_versions.push_back("GLIBCXX_3.4.13");
known_versions.push_back("GLIBCXX_3.4.14");
+ known_versions.push_back("GLIBCXX_3.4.15");
known_versions.push_back("GLIBCXX_LDBL_3.4");
known_versions.push_back("GLIBCXX_LDBL_3.4.7");
known_versions.push_back("GLIBCXX_LDBL_3.4.10");