]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/9858 (Extra virtual functions in ctype<char>)
authorBenjamin Kosnik <bkoz@redhat.com>
Tue, 21 Oct 2003 14:22:43 +0000 (14:22 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 21 Oct 2003 14:22:43 +0000 (14:22 +0000)
2003-10-21  Benjamin Kosnik  <bkoz@redhat.com>

PR libstdc++/9858
* include/bits/locale_facets.h (ctype<char>): Remove
__ctype_abstract_base.
(ctype<char>::do_is): Remove.
(ctype<char>::do_scan_is): Remove.
* src/ctype.cc: Same. Inline the rest.
* testsuite/22_locale/ctype/is/char/9858.cc: New.
* config/os/aix/ctype_noninline.h: Adjust ctor.
* config/os/bsd/freebsd/ctype_noninline.h: Same.
* config/os/bsd/netbsd/ctype_noninline.h: Same.
* config/os/djgpp/ctype_noninline.h: Same.
* config/os/generic/ctype_noninline.h: Same.
* config/os/gnu-linux/ctype_noninline.h: Same.
* config/os/hpux/ctype_noninline.h: Same.
* config/os/irix/irix5.2/ctype_noninline.h: Same.
* config/os/irix/irix6.5/ctype_noninline.h: Same.
* config/os/mingw32/ctype_noninline.h: Same.
* config/os/newlib/ctype_noninline.h: Same.
* config/os/qnx/qnx6.1/ctype_noninline.h: Same.
* config/os/solaris/solaris2.5/ctype_noninline.h: Same.
* config/os/solaris/solaris2.6/ctype_noninline.h: Same.
* config/os/solaris/solaris2.7/ctype_noninline.h: Same.
* config/os/windiss/ctype_noninline.h: Same.

From-SVN: r72753

20 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/config/os/aix/ctype_noninline.h
libstdc++-v3/config/os/bsd/freebsd/ctype_noninline.h
libstdc++-v3/config/os/bsd/netbsd/ctype_noninline.h
libstdc++-v3/config/os/djgpp/ctype_noninline.h
libstdc++-v3/config/os/generic/ctype_noninline.h
libstdc++-v3/config/os/gnu-linux/ctype_noninline.h
libstdc++-v3/config/os/hpux/ctype_noninline.h
libstdc++-v3/config/os/irix/irix5.2/ctype_noninline.h
libstdc++-v3/config/os/irix/irix6.5/ctype_noninline.h
libstdc++-v3/config/os/mingw32/ctype_noninline.h
libstdc++-v3/config/os/newlib/ctype_noninline.h
libstdc++-v3/config/os/qnx/qnx6.1/ctype_noninline.h
libstdc++-v3/config/os/solaris/solaris2.5/ctype_noninline.h
libstdc++-v3/config/os/solaris/solaris2.6/ctype_noninline.h
libstdc++-v3/config/os/solaris/solaris2.7/ctype_noninline.h
libstdc++-v3/config/os/windiss/ctype_noninline.h
libstdc++-v3/include/bits/locale_facets.h
libstdc++-v3/src/ctype.cc
libstdc++-v3/testsuite/22_locale/ctype/is/char/9858.cc [new file with mode: 0644]

index 286ff68cdd2a7a282de55fcdb1a6aae384c71c5e..14522c8149ca94af75941b5c311230e0c7d7d7de 100644 (file)
@@ -1,3 +1,29 @@
+2003-10-21  Benjamin Kosnik  <bkoz@redhat.com>
+       PR libstdc++/9858
+       * include/bits/locale_facets.h (ctype<char>): Remove
+       __ctype_abstract_base.
+       (ctype<char>::do_is): Remove.
+       (ctype<char>::do_scan_is): Remove.
+       * src/ctype.cc: Same. Inline the rest.
+       * testsuite/22_locale/ctype/is/char/9858.cc: New.
+       * config/os/aix/ctype_noninline.h: Adjust ctor.
+       * config/os/bsd/freebsd/ctype_noninline.h: Same.
+       * config/os/bsd/netbsd/ctype_noninline.h: Same.
+       * config/os/djgpp/ctype_noninline.h: Same.
+       * config/os/generic/ctype_noninline.h: Same.
+       * config/os/gnu-linux/ctype_noninline.h: Same.
+       * config/os/hpux/ctype_noninline.h: Same.
+       * config/os/irix/irix5.2/ctype_noninline.h: Same.
+       * config/os/irix/irix6.5/ctype_noninline.h: Same.
+       * config/os/mingw32/ctype_noninline.h: Same.
+       * config/os/newlib/ctype_noninline.h: Same.
+       * config/os/qnx/qnx6.1/ctype_noninline.h: Same.
+       * config/os/solaris/solaris2.5/ctype_noninline.h: Same.
+       * config/os/solaris/solaris2.6/ctype_noninline.h: Same.
+       * config/os/solaris/solaris2.7/ctype_noninline.h: Same.
+       * config/os/windiss/ctype_noninline.h: Same.
+
 2003-10-21  Paolo Carlini  <pcarlini@suse.de>
 
        * src/locale.cc: Tweak a comment.
index 7cf919afca97921ca13be46f56b2e0df9489c0ef..78fce2ef176a17b7f715698c005efe43c4477b60 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
                     size_t __refs)
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
+  : facet(__refs), _M_del(__table != 0 && __del),
   _M_toupper(NULL), _M_tolower(NULL),
   _M_table(__table ? __table : classic_table())
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
+  : facet(__refs), _M_del(__table != 0 && __del),
   _M_toupper(NULL), _M_tolower(NULL),
   _M_table(__table ? __table : classic_table())
   { }
index 0e108fdcf450714006229c7f436facd2b9f8ee3f..27cd28c082eb41bc20b66f91a2af881a36a64b83 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table()) 
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table()) 
   { }
index 578e0a42e314361d6d1d8a2a9bdcc2022bc39d22..0cc08aef248de497e6ac2fc9b4b4f09d9eaa4e91 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table())
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table())
   { }
index 0ec0f84aafa60b889453ff5e876b54513c71c437..848f5e2bde7806f88c4a6bf71224ad73ad48d212 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower),
   _M_table(__table ? __table : __dj_ctype_flags)  
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower),
   _M_table(__table ? __table : __dj_ctype_flags)  
   { }
index d07dc8b9d7c3275a1d253eb08cd9aa8bbf8dff1b..92e1173ed6721baae4f74fc1e75344412176d2c7 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table()) 
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table())
   { }
index 83a93cb9dfed57e014b561cf7e70b451499f5b5e..8d38627f7bdf4e17b64c2b3ba3c85ab44c735226 100644 (file)
@@ -59,7 +59,7 @@
 #if _GLIBCXX_C_LOCALE_GNU
   ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
+  : facet(__refs), _M_del(__table != 0 && __del)
   {
     _M_c_locale_ctype = _S_clone_c_locale(__cloc);
     _M_toupper = _M_c_locale_ctype->__ctype_toupper;
@@ -69,7 +69,7 @@
 #else
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
+  : facet(__refs), _M_del(__table != 0 && __del)
   {
     char* __old=strdup(setlocale(LC_CTYPE, NULL));
     setlocale(LC_CTYPE, "C");
@@ -89,8 +89,8 @@
 #endif
 
 #if _GLIBCXX_C_LOCALE_GNU
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
+  : facet(__refs), _M_del(__table != 0 && __del)
   {
     _M_c_locale_ctype = _S_get_c_locale(); 
     _M_toupper = _M_c_locale_ctype->__ctype_toupper;
@@ -98,8 +98,8 @@
     _M_table = __table ? __table : _M_c_locale_ctype->__ctype_b;
   }
 #else
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : 
-  __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+  : facet(__refs), _M_del(__table != 0 && __del)
   {
     char* __old=strdup(setlocale(LC_CTYPE, NULL));
     setlocale(LC_CTYPE, "C");
index a85bc9cff823a49e59fa5818bdb0aaf43c91cbbd..c42fd8a49eeece27876b832c70de58dc221bc141 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : (const mask *) __SB_masks) 
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : (const mask *) __SB_masks) 
   { }
index 3cb29b601aefb2b58aa7de3607b7a17355b51f1e..2268a9b9e2c2bc108f970416724aab95ef255113 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs)
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(!__table ? classic_table() : __table)
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(!__table ? classic_table() : __table)
   { }
index 009e6110b73c4b4773a36d44cdd5ea530a80ceea..c0e6e56d51529b5f37a5f2dd049dfd8b25a05ed5 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs)
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(!__table ? 
           (const mask*) (__libc_attr._ctype_tbl->_class + 1) : __table) 
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(!__table ? 
           (const mask*) (__libc_attr._ctype_tbl->_class + 1) : __table) 
index 998547c91863542dea98a2734fff3c542f1feef2..4ea7b892cca774aebbc02cc6648813060f77a951 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL),
   _M_table(__table ? __table : classic_table())  
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL),
   _M_table(__table ? __table : classic_table()) 
   { }
index b511c4a86aa75b77762e8aebb5ba21a2b1816535..7c5f053528a1db45cfd5b44e8106aaa98417375d 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table()) 
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table()) 
   { }
index cf34bd422daa73edb1c4bc05cdc6f28d34e01ac0..f4e2ca5f6c686e19082338169824d7482b882b5b 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _Ctype)
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _Ctype)
   { }
 
index a3c27b06b87dcc754578d53562a21a992475c886..25eec3418b0ccf7d42b168c12b0c01ba04da4a7a 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table()) 
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table ? __table : classic_table()) 
   { }
index f65cfe70f79f2d072c30724c3c18b2cb284e0e1c..659c81a3ffe4b71f3a64002691f4824c3f7dce31 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(__trans_upper), _M_tolower(__trans_lower), 
   _M_table(__table ? __table : classic_table()) 
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(__trans_upper), _M_tolower(__trans_lower), 
   _M_table(__table ? __table : classic_table()) 
   { }
index c8b11a9bd6b12ab41417ad28c46c058a8e16ba81..81536b5fc8777d0ba2ccad439fd15ab77908f005 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs)
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(__trans_upper), _M_tolower(__trans_lower),
   _M_table(__table ? __table : classic_table()) 
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(__trans_upper), _M_tolower(__trans_lower),
   _M_table(__table ? __table : classic_table()) 
   { }
index 0d34695287037b59d725a809c943b45d9389232d..a22b65d46d0bc42784bcb64c83a70408a9d01049 100644 (file)
 
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
                     size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table == 0 ? classic_table() : __table) 
   { }
 
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+  : facet(__refs), _M_del(__table != 0 && __del), 
   _M_toupper(NULL), _M_tolower(NULL), 
   _M_table(__table == 0 ? classic_table() : __table) 
   { }
index 96fc3a0da35d5ffe7b7359877e138e31b06704e1..13383d8d36f4af805e4e3f16a8fd4b483a7b9161 100644 (file)
@@ -334,7 +334,7 @@ namespace std
 
   // 22.2.1.3  ctype<char> specialization.
   template<>
-    class ctype<char> : public __ctype_abstract_base<char>
+    class ctype<char> : public locale::facet, public ctype_base
     {
     public:
       // Types:
@@ -371,6 +371,39 @@ namespace std
       inline const char*
       scan_not(mask __m, const char* __lo, const char* __hi) const;
      
+      char_type 
+      toupper(char_type __c) const
+      { return this->do_toupper(__c); }
+
+      const char_type*
+      toupper(char_type *__lo, const char_type* __hi) const
+      { return this->do_toupper(__lo, __hi); }
+
+      char_type 
+      tolower(char_type __c) const
+      { return this->do_tolower(__c); }
+
+      const char_type*
+      tolower(char_type* __lo, const char_type* __hi) const
+      { return this->do_tolower(__lo, __hi); }
+
+      char_type 
+      widen(char __c) const
+      { return this->do_widen(__c); }
+
+      const char*
+      widen(const char* __lo, const char* __hi, char_type* __to) const
+      { return this->do_widen(__lo, __hi, __to); }
+
+      char 
+      narrow(char_type __c, char __dfault) const
+      { return this->do_narrow(__c, __dfault); }
+
+      const char_type*
+      narrow(const char_type* __lo, const char_type* __hi,
+             char __dfault, char *__to) const
+      { return this->do_narrow(__lo, __hi, __dfault, __to); }
+
     protected:
       const mask* 
       table() const throw()
@@ -382,19 +415,6 @@ namespace std
       virtual 
       ~ctype();
 
-      virtual bool 
-      do_is(mask __m, char_type __c) const;
-
-      virtual const char_type*
-      do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
-
-      virtual const char_type*
-      do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
-
-      virtual const char_type*
-      do_scan_not(mask __m, const char_type* __lo, 
-                 const char_type* __hi) const;
-
       virtual char_type 
       do_toupper(char_type) const;
 
@@ -408,17 +428,27 @@ namespace std
       do_tolower(char_type* __lo, const char_type* __hi) const;
       
       virtual char_type 
-      do_widen(char) const;
+      do_widen(char __c) const
+      { return __c; }
 
       virtual const char*
-      do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
+      do_widen(const char* __lo, const char* __hi, char_type* __dest) const
+      {
+       memcpy(__dest, __lo, __hi - __lo);
+       return __hi;
+      }
 
       virtual char 
-      do_narrow(char_type, char __dfault) const;
+      do_narrow(char_type __c, char) const
+      { return __c; }
 
       virtual const char_type*
       do_narrow(const char_type* __lo, const char_type* __hi,
-               char __dfault, char* __dest) const;
+               char, char* __dest) const
+      {
+       memcpy(__dest, __lo, __hi - __lo);
+       return __hi;
+      }
     };
  
   template<>
@@ -492,7 +522,6 @@ namespace std
       virtual const char_type*
       do_narrow(const char_type* __lo, const char_type* __hi,
                char __dfault, char* __dest) const;
-
     };
 
   template<>
index 1a84ced453a8fdd770a65fd02c23eb0d05751a09..e97d39dfe1cbaac44df5fb2f771866a5b2dc926a 100644 (file)
 
 namespace std 
 {
-  // XXX At some point, just rename this file to ctype_members_char.cc
-  // and compile it as a separate file instead of including it here.
-  // Platform-specific initialization code for ctype tables.
-  #include <bits/ctype_noninline.h>
+  // Definitions for static const data members of ctype_base.
+  const ctype_base::mask ctype_base::space;
+  const ctype_base::mask ctype_base::print;
+  const ctype_base::mask ctype_base::cntrl;
+  const ctype_base::mask ctype_base::upper;
+  const ctype_base::mask ctype_base::lower;
+  const ctype_base::mask ctype_base::alpha;
+  const ctype_base::mask ctype_base::digit;
+  const ctype_base::mask ctype_base::punct;
+  const ctype_base::mask ctype_base::xdigit;
+  const ctype_base::mask ctype_base::alnum;
+  const ctype_base::mask ctype_base::graph;
 
   // Definitions for locale::id of standard facets that are specialized.
   locale::id ctype<char>::id;
@@ -62,18 +70,10 @@ namespace std
     }
 #endif
 
-  // Definitions for static const data members of ctype_base.
-  const ctype_base::mask ctype_base::space;
-  const ctype_base::mask ctype_base::print;
-  const ctype_base::mask ctype_base::cntrl;
-  const ctype_base::mask ctype_base::upper;
-  const ctype_base::mask ctype_base::lower;
-  const ctype_base::mask ctype_base::alpha;
-  const ctype_base::mask ctype_base::digit;
-  const ctype_base::mask ctype_base::punct;
-  const ctype_base::mask ctype_base::xdigit;
-  const ctype_base::mask ctype_base::alnum;
-  const ctype_base::mask ctype_base::graph;
+  // XXX At some point, just rename this file to ctype_configure_char.cc
+  // and compile it as a separate file instead of including it here.
+  // Platform-specific initialization code for ctype tables.
+  #include <bits/ctype_noninline.h>
 
   const size_t ctype<char>::table_size;
 
@@ -84,46 +84,6 @@ namespace std
       delete[] this->table(); 
   }
 
-  // These are dummy placeholders as these virtual functions are never called.
-  bool 
-  ctype<char>::do_is(mask, char_type) const 
-  { return false; }
-  
-  const char*
-  ctype<char>::do_is(const char_type* __c, const char_type*, mask*) const 
-  { return __c; }
-  
-  const char*
-  ctype<char>::do_scan_is(mask, const char_type* __c, const char_type*) const 
-  { return __c; }
-
-  const char* 
-  ctype<char>::do_scan_not(mask, const char_type* __c, const char_type*) const
-  { return __c; }
-
-  char
-  ctype<char>::do_widen(char __c) const
-  { return __c; }
-  
-  const char* 
-  ctype<char>::do_widen(const char* __lo, const char* __hi, char* __dest) const
-  {
-    memcpy(__dest, __lo, __hi - __lo);
-    return __hi;
-  }
-  
-  char
-  ctype<char>::do_narrow(char __c, char /*__dfault*/) const
-  { return __c; }
-  
-  const char* 
-  ctype<char>::do_narrow(const char* __lo, const char* __hi, 
-                        char /*__dfault*/, char* __dest) const
-  {
-    memcpy(__dest, __lo, __hi - __lo);
-    return __hi;
-  }
-
 #ifdef _GLIBCXX_USE_WCHAR_T
   ctype<wchar_t>::ctype(size_t __refs) 
   : __ctype_abstract_base<wchar_t>(__refs)
diff --git a/libstdc++-v3/testsuite/22_locale/ctype/is/char/9858.cc b/libstdc++-v3/testsuite/22_locale/ctype/is/char/9858.cc
new file mode 100644 (file)
index 0000000..e748225
--- /dev/null
@@ -0,0 +1,103 @@
+// Copyright (C) 2003 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 2, 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 COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 22.2.1.3 - ctype specializations [lib.facet.ctype.special]
+
+#include <locale>
+#include <testsuite_hooks.h>
+
+int called;
+
+class Derived : public std::ctype<char>
+{
+public:
+  bool 
+  do_is(mask, char_type) const { return true; }
+
+  const char_type* 
+  do_is(const char_type* lo, const char_type* hi, mask* vec) const 
+  { return hi; }
+
+  const char_type* 
+  do_scan_is(mask m, const char_type* lo, const char_type* hi) const 
+  { return hi; }
+
+  const char_type* 
+  do_scan_not(mask m, const char_type* lo, const char_type* hi) const 
+  { return hi; }
+};
+
+class Derived2 : public Derived
+{
+public:
+  bool 
+  do_is(mask, char_type) const { called = 1; return true; }
+
+  const char_type* 
+  do_is(const char_type* lo, const char_type* hi, mask* vec) const 
+  { called = 5; return hi; }
+
+  const char_type* 
+  do_scan_is(mask m, const char_type* lo, const char_type* hi) const 
+  { called = 10; return hi; }
+
+  const char_type* 
+  do_scan_not(mask m, const char_type* lo, const char_type* hi) const 
+  { called = 15; return hi; }
+};
+
+int main()
+{
+  using namespace std;
+  bool test __attribute__((unused)) = true;
+  Derived2 d2;
+  const Derived& dr = d2;
+
+  const char* lit = "jaylib champion sound";
+  ctype_base::mask m00 = static_cast<std::ctype_base::mask>(0);
+  ctype_base::mask vec[5];
+  for (std::size_t i = 0; i < 5; ++i)
+    vec[i] = m00;
+  called = 0;
+  dr.do_is(ctype_base::space, 'a');
+  VERIFY( called !=  1);
+
+  called = 0;
+  dr.do_is(lit, lit + 5, vec);
+  VERIFY( called !=  5);
+
+  called = 0;
+  dr.do_scan_is(ctype_base::space, lit, lit + 5);
+  VERIFY( called !=  10);
+
+  called = 0;
+  dr.do_scan_not(ctype_base::space, lit, lit + 5);
+  VERIFY( called !=  15);
+  
+  return 0;
+}