This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3, v7-branch] Minor tweaks to string
- From: Paolo Carlini <pcarlini at suse dot de>
- To: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 16 Jun 2005 21:29:03 +0200
- Subject: [v3, v7-branch] Minor tweaks to string
Hi,
a couple of small clean-ups, also useful in preparation of the port to
mainline as an extension.
Tested x86-linux, --enable-libstdcxx-string=sso/rc.
Paolo.
////////////////
2005-06-16 Paolo Carlini <pcarlini@suse.de>
* include/std/std_string.h: Don't include <algorithm>.
* include/ext/sso_string.h: Move all the includes (besides
atomicity.h) to string_util.h.
* include/ext/rc_string.h: Likewise.
* include/ext/string_util.h: Adjust accordingly.
* include/ext/sso_string.h: Change inheritance from
__string_utility to protected; change _S_terminal to private.
* include/ext/rc_string.h: Likewise.
Index: include/ext/rc_string.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/Attic/rc_string.h,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 rc_string.h
--- include/ext/rc_string.h 12 Jun 2005 20:43:32 -0000 1.1.2.5
+++ include/ext/rc_string.h 16 Jun 2005 19:13:10 -0000
@@ -34,16 +34,8 @@
#ifndef _RC_STRING_H
#define _RC_STRING_H 1
-#include <bits/functexcept.h>
-#include <bits/atomicity.h>
-#include <bits/stringfwd.h>
-#include <cstddef>
-#include <bits/stl_iterator_base_types.h>
-#include <bits/stl_iterator.h>
-#include <bits/cpp_type_traits.h>
-#include <algorithm>
-
#include <ext/string_util.h>
+#include <bits/atomicity.h>
namespace __gnu_cxx
{
@@ -92,7 +84,7 @@
*/
template<typename _CharT, typename _Traits, typename _Alloc>
class __rc_string
- : public __string_utility<_CharT, _Traits, _Alloc>
+ : protected __string_utility<_CharT, _Traits, _Alloc>
{
public:
typedef _Traits traits_type;
@@ -115,9 +107,10 @@
// m = ((npos - sizeof(_Rep))/sizeof(CharT)) - 1
// In addition, this implementation quarters this amount.
static const size_type _S_max_size;
- static const _CharT _S_terminal;
private:
+ static const _CharT _S_terminal;
+
// _Rep: string representation
// Invariants:
// 1. String really contains _M_length + 1 characters: due to 21.3.4
Index: include/ext/sso_string.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/Attic/sso_string.h,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 sso_string.h
--- include/ext/sso_string.h 14 Jun 2005 17:36:01 -0000 1.1.2.4
+++ include/ext/sso_string.h 16 Jun 2005 19:13:10 -0000
@@ -34,14 +34,6 @@
#ifndef _SSO_STRING_H
#define _SSO_STRING_H 1
-#include <bits/functexcept.h>
-#include <bits/stringfwd.h>
-#include <cstddef>
-#include <bits/stl_iterator_base_types.h>
-#include <bits/stl_iterator.h>
-#include <bits/cpp_type_traits.h>
-#include <algorithm>
-
#include <ext/string_util.h>
namespace __gnu_cxx
@@ -79,7 +71,7 @@
template<typename _CharT, typename _Traits, typename _Alloc>
class __sso_string
- : public __string_utility<_CharT, _Traits, _Alloc>,
+ : protected __string_utility<_CharT, _Traits, _Alloc>,
private __sso_string_base<_CharT, _Alloc>
{
typedef __sso_string_base<_CharT, _Alloc> _Base;
@@ -105,9 +97,10 @@
// m = npos / sizeof(CharT) - 1
// In addition, this implementation quarters this amount.
static const size_type _S_max_size;
- static const _CharT _S_terminal;
private:
+ static const _CharT _S_terminal;
+
using _Base::_S_local_capacity;
using _Base::_M_local_data;
using _Base::_M_allocated_capacity;
Index: include/ext/string_util.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/Attic/string_util.h,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 string_util.h
--- include/ext/string_util.h 5 Jun 2005 12:22:43 -0000 1.1.2.2
+++ include/ext/string_util.h 16 Jun 2005 19:13:10 -0000
@@ -34,6 +34,14 @@
#ifndef _STRING_UTIL_H
#define _STRING_UTIL_H 1
+#include <bits/functexcept.h>
+#include <bits/stringfwd.h>
+#include <cstddef>
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_iterator.h>
+#include <bits/cpp_type_traits.h>
+#include <algorithm> // For std::distance, srd::search.
+
namespace __gnu_cxx
{
template<typename _Type>
Index: include/std/std_string.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/std/std_string.h,v
retrieving revision 1.5.18.2
diff -u -r1.5.18.2 std_string.h
--- include/std/std_string.h 1 Feb 2005 16:07:27 -0000 1.5.18.2
+++ include/std/std_string.h 16 Jun 2005 19:13:10 -0000
@@ -52,7 +52,6 @@
#include <bits/basic_string.h>
#ifndef _GLIBCXX_EXPORT_TEMPLATE
-# include <algorithm> // for find_if
# include <bits/basic_string.tcc>
#endif