This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Remove pod_char, prefer __gnu_cxx::character


Hi,

this is, in my opinion, a long overdue clean-up, already mentioned
some time ago.

Tested x86-linux, if nobody objects I will commit it later today.

Paolo.

/////////////
2004-08-26  Paolo Carlini  <pcarlini@suse.de>

	* testsuite/testsuite_hooks.h (struct pod_char, struct pod_int,
	struct state, struct char_traits<__gnu_test::pod_char>): Remove,
	prefer throughout __gnu_cxx::character in pod_char_traits.h.
	* testsuite/27_io/basic_filebuf/2.cc: ... here.
	* testsuite/27_io/basic_fstream/2.cc: Likewise.
	* testsuite/27_io/basic_istream/2.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_character/char/9826.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/2.cc: Likewise.
	* testsuite/27_io/basic_streambuf/2.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/2.cc: Likewise.
	* testsuite/27_io/basic_stringstream/2.cc: Likewise.
	* testsuite/27_io/fpos/1.cc: Likewise.
	* testsuite/ext/stdio_filebuf/char/1.cc: Likewise.

	* testsuite/27_io/basic_stringbuf/4.cc: Clean-up.
 
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_filebuf/2.cc libstdc++-v3/testsuite/27_io/basic_filebuf/2.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_filebuf/2.cc	2004-04-19 21:00:00.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_filebuf/2.cc	2004-08-26 11:35:33.000000000 +0200
@@ -32,10 +32,10 @@
 // should be able to instantiate basic_filebuf for non-standard types.
 namespace std
 {
-  using __gnu_test::pod_char;
+  using __gnu_test::pod_type;
   typedef short type_t;
   template class basic_filebuf<type_t, char_traits<type_t> >;
-  template class basic_filebuf<pod_char, char_traits<pod_char> >;
+  template class basic_filebuf<pod_type, char_traits<pod_type> >;
 } // test
 
 // more surf!!!
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_fstream/2.cc libstdc++-v3/testsuite/27_io/basic_fstream/2.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_fstream/2.cc	2004-04-19 21:00:01.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_fstream/2.cc	2004-08-26 11:36:24.000000000 +0200
@@ -37,9 +37,9 @@
 
 namespace std
 {
-  using __gnu_test::pod_char;
+  using __gnu_test::pod_type;
   typedef short type_t;
   template class basic_fstream<type_t, char_traits<type_t> >;
-  template class basic_fstream<pod_char, char_traits<pod_char> >;
+  template class basic_fstream<pod_type, char_traits<pod_type> >;
 } // test
 
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_istream/2.cc libstdc++-v3/testsuite/27_io/basic_istream/2.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_istream/2.cc	2004-04-19 21:00:02.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_istream/2.cc	2004-08-26 11:36:52.000000000 +0200
@@ -38,8 +38,8 @@
 
 namespace std
 {
-  using __gnu_test::pod_char;
+  using __gnu_test::pod_type;
   typedef short type_t;
   template class basic_istream<type_t, char_traits<type_t> >;
-  template class basic_istream<pod_char, char_traits<pod_char> >;
+  template class basic_istream<pod_type, char_traits<pod_type> >;
 } // test
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_istream/extractors_character/char/9826.cc libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_istream/extractors_character/char/9826.cc	2003-09-23 22:03:07.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/char/9826.cc	2004-08-26 11:38:00.000000000 +0200
@@ -1,6 +1,6 @@
 // 2002-07-25 Benjamin Kosnik <bkoz@redhat.com>
 
-// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003, 2004 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
@@ -39,15 +39,15 @@
 void test02()
 {
   using namespace std;
-  using __gnu_test::pod_char;
+  using __gnu_test::pod_type;
 
-  basic_stringstream<pod_char, char_traits<pod_char> > sstr;
+  basic_stringstream<pod_type, char_traits<pod_type> > sstr;
   // 1
-  basic_string<pod_char, char_traits<pod_char> > str;
+  basic_string<pod_type, char_traits<pod_type> > str;
   sstr >> str;
 
   // 2
-  pod_char*  chr = NULL;
+  pod_type*  chr = NULL;
   sstr >> chr;
 
   // 3
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_ostream/2.cc libstdc++-v3/testsuite/27_io/basic_ostream/2.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_ostream/2.cc	2004-04-19 21:00:03.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_ostream/2.cc	2004-08-26 11:38:39.000000000 +0200
@@ -38,8 +38,8 @@
 
 namespace std
 {
-  using __gnu_test::pod_char;
+  using __gnu_test::pod_type;
   typedef short type_t;
   template class basic_ostream<type_t, char_traits<type_t> >;
-  template class basic_ostream<pod_char, char_traits<pod_char> >;
+  template class basic_ostream<pod_type, char_traits<pod_type> >;
 } // test
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_streambuf/2.cc libstdc++-v3/testsuite/27_io/basic_streambuf/2.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_streambuf/2.cc	2004-04-19 21:00:06.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_streambuf/2.cc	2004-08-26 11:39:15.000000000 +0200
@@ -37,8 +37,8 @@
 
 namespace std
 {
-  using __gnu_test::pod_char;
+  using __gnu_test::pod_type;
   typedef short type_t;
   template class basic_streambuf<type_t, char_traits<type_t> >;
-  template class basic_streambuf<pod_char, char_traits<pod_char> >;
+  template class basic_streambuf<pod_type, char_traits<pod_type> >;
 } // test
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_stringbuf/2.cc libstdc++-v3/testsuite/27_io/basic_stringbuf/2.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_stringbuf/2.cc	2004-04-19 21:00:06.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_stringbuf/2.cc	2004-08-26 11:39:43.000000000 +0200
@@ -32,10 +32,10 @@
 // should be able to instantiate basic_stringbuf for non-standard types.
 namespace std
 {
-  using __gnu_test::pod_char;
+  using __gnu_test::pod_type;
   typedef short type_t;
   template class basic_stringbuf<type_t, char_traits<type_t> >;
-  template class basic_stringbuf<pod_char, char_traits<pod_char> >;
+  template class basic_stringbuf<pod_type, char_traits<pod_type> >;
 } // std
 
 // more surf!!!
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_stringbuf/4.cc libstdc++-v3/testsuite/27_io/basic_stringbuf/4.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_stringbuf/4.cc	2004-04-19 21:00:06.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_stringbuf/4.cc	2004-08-26 11:40:31.000000000 +0200
@@ -29,7 +29,6 @@
 
 namespace std
 {
-  using __gnu_test::pod_char;
   typedef __gnu_test::tracker_alloc<char> alloc_type;
   template class basic_stringbuf<char, char_traits<char>, alloc_type>;
 } // test
diff -urN libstdc++-v3-orig/testsuite/27_io/basic_stringstream/2.cc libstdc++-v3/testsuite/27_io/basic_stringstream/2.cc
--- libstdc++-v3-orig/testsuite/27_io/basic_stringstream/2.cc	2004-04-19 21:00:07.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/basic_stringstream/2.cc	2004-08-26 11:41:05.000000000 +0200
@@ -37,8 +37,8 @@
 
 namespace std
 {
-  using __gnu_test::pod_char;
+  using __gnu_test::pod_type;
   typedef short type_t;
   template class basic_stringstream<type_t, char_traits<type_t> >;
-  template class basic_stringstream<pod_char, char_traits<pod_char> >;
+  template class basic_stringstream<pod_type, char_traits<pod_type> >;
 } // std
diff -urN libstdc++-v3-orig/testsuite/27_io/fpos/1.cc libstdc++-v3/testsuite/27_io/fpos/1.cc
--- libstdc++-v3-orig/testsuite/27_io/fpos/1.cc	2004-04-19 21:00:08.000000000 +0200
+++ libstdc++-v3/testsuite/27_io/fpos/1.cc	2004-08-26 11:41:31.000000000 +0200
@@ -27,10 +27,10 @@
 
 namespace std
 {
-  using __gnu_test::pod_char;
+  using __gnu_test::pod_type;
   typedef short type_t;
   template class fpos<type_t>;
-  template class fpos<pod_char>;
+  template class fpos<pod_type>;
 } // std
 
 // more surf!!!
diff -urN libstdc++-v3-orig/testsuite/ext/stdio_filebuf/char/1.cc libstdc++-v3/testsuite/ext/stdio_filebuf/char/1.cc
--- libstdc++-v3-orig/testsuite/ext/stdio_filebuf/char/1.cc	2004-04-19 21:00:09.000000000 +0200
+++ libstdc++-v3/testsuite/ext/stdio_filebuf/char/1.cc	2004-08-26 11:43:05.000000000 +0200
@@ -28,7 +28,8 @@
 // libstdc++/9320
 namespace __gnu_cxx
 {
+  using __gnu_test::pod_type;
   typedef short type_t;
   template class stdio_filebuf<type_t, std::char_traits<type_t> >;
-  template class stdio_filebuf<__gnu_test::pod_char, std::char_traits<__gnu_test::pod_char> >;
+  template class stdio_filebuf<pod_type, std::char_traits<pod_type> >;
 } // __gnu_cxx
diff -urN libstdc++-v3-orig/testsuite/testsuite_hooks.h libstdc++-v3/testsuite/testsuite_hooks.h
--- libstdc++-v3-orig/testsuite/testsuite_hooks.h	2004-05-22 23:51:05.000000000 +0200
+++ libstdc++-v3/testsuite/testsuite_hooks.h	2004-08-26 11:45:48.000000000 +0200
@@ -153,26 +153,6 @@
   int
   try_mkfifo (const char* filename, mode_t mode);
 
-  // Test data types.
-  struct pod_char
-  {
-    unsigned char c;
-  };
-
-  inline bool
-  operator==(const pod_char& lhs, const pod_char& rhs)
-  { return lhs.c == rhs.c; }
-  
-  struct pod_int
-  {
-    int i;
-  };
-  
-  struct state
-  {
-    unsigned long l;
-    unsigned long l2;
-  };
 
   typedef unsigned short				value_type;
   typedef unsigned int					int_type;
@@ -365,103 +345,5 @@
     };
 } // namespace __gnu_test
 
-namespace std
-{
-  template<class _CharT>
-    struct char_traits;
-
-  // char_traits specialization
-  template<>
-    struct char_traits<__gnu_test::pod_char>
-    {
-      typedef __gnu_test::pod_char	char_type;
-      typedef __gnu_test::pod_int  	int_type;
-      typedef __gnu_test::state   	state_type;
-      typedef fpos<state_type> 		pos_type;
-      typedef streamoff 		off_type;
-      
-      static void 
-      assign(char_type& c1, const char_type& c2)
-      { c1.c = c2.c; }
-
-      static bool 
-      eq(const char_type& c1, const char_type& c2)
-      { return c1.c == c2.c; }
-
-      static bool 
-      lt(const char_type& c1, const char_type& c2)
-      { return c1.c < c2.c; }
-
-      static int 
-      compare(const char_type* s1, const char_type* s2, size_t n)
-      { return memcmp(s1, s2, n); }
-
-      static size_t
-      length(const char_type* s)
-      { return strlen(reinterpret_cast<const char*>(s)); }
-
-      static const char_type* 
-      find(const char_type* s, size_t n, const char_type& a)
-      { return static_cast<const char_type*>(memchr(s, a.c, n)); }
-
-      static char_type* 
-      move(char_type* s1, const char_type* s2, size_t n)
-      {
-	memmove(s1, s2, n);
-	return s1;
-      }
-
-      static char_type* 
-      copy(char_type* s1, const char_type* s2, size_t n)
-      {
-	memcpy(s1, s2, n);
-	return s1;
-      }
-
-      static char_type* 
-      assign(char_type* s, size_t n, char_type a)
-      {
-	memset(s, a.c, n);
-	return s;
-      }
-
-      static char_type 
-      to_char_type(const int_type& c)
-      {
-	char_type ret;
-	ret.c = static_cast<unsigned char>(c.i);
-	return ret;
-      }
-
-      static int_type 
-      to_int_type(const char_type& c)
-      {
-	int_type ret;
-	ret.i = c.c;
-	return ret;
-      }
-
-      static bool 
-      eq_int_type(const int_type& c1, const int_type& c2)
-      { return c1.i == c2.i; }
-
-      static int_type 
-      eof()
-      {
-	int_type n;
-	n.i = -10;
-	return n;
-      }
-
-      static int_type 
-      not_eof(const int_type& c)
-      {
-	if (eq_int_type(c, eof()))
-	  return int_type();
-	return c;
-      }
-    };
-} // namespace std
-
 #endif // _GLIBCXX_TESTSUITE_HOOKS_H
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]