diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d8ada879324d736bb2da9a6352db565dc2404f4b..16dc9b3e08816ca634e4b5c02ebd2d555a04233a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,35 @@ +2002-01-20 Benjamin Kosnik <bkoz@redhat.com> + + * include/bits/locale_facets.h (ctype<char>::classic_table): + Remove definition. + (ctype<char>::_S_ctable): Remove. + * config/os/gnu-linux/bits/ctype_noninline.h + (ctype<char>::_S_table): Remove definition. + (ctype<char>::classic_table): Define. + (ctype<char>::ctype): Replace _S_ctable with classic_table(). + * config/os/aix/bits/ctype_noninline.h: Same. + * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. + * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. + * config/os/djgpp/bits/ctype_noninline.h: Same. + * config/os/generic/bits/ctype_noninline.h: Same. + * config/os/gnu-linux/bits/ctype_noninline.h: Same. + * config/os/hpux/bits/ctype_noninline.h: Same. + * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. + * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. + * config/os/mingw32/bits/ctype_noninline.h: Same. + * config/os/newlib/bits/ctype_noninline.h: Same. + * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. + * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. + * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. + +2002-01-20 Danny Smith <dannysmith@users.sourceforge.net> + + * config/os/mingw32/bits/ctype_noninline.h: Declare _ctype instead + of _pctype. Use to define _S_ctable. Add definition for alternate + ctor. Initialise _M_ctable to _S_ctable in ctors. + (do_toupper, do_tolower): Use inline code appropriate for C-locale + rather than ::toupper, ::tolower. + 2002-01-18 Loren Rittle <ljrittle@acm.org> * testsuite/18_support/numeric_limits.cc (test_extrema<long double>): diff --git a/libstdc++-v3/config/os/aix/bits/ctype_noninline.h b/libstdc++-v3/config/os/aix/bits/ctype_noninline.h index dabcae981bfa1a74fc43f4322635f47a31b6314d..0e081d79381f69837e27fe9e536a6500a99e1378 100644 --- a/libstdc++-v3/config/os/aix/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/aix/bits/ctype_noninline.h @@ -33,18 +33,19 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; - + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) + _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), - _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h b/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h index db58ecb27c486b24ddb0fac08dd7b132937daed3..9b452444daa02975f741c3be8da67820e9bbb4e6 100644 --- a/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h @@ -33,18 +33,19 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) + _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), - _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h b/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h index f27d93dbdc74e879b12b40bfd0adfc2eed25210d..ee9475ee5fcf1ed75171178ccb482a6b5d17b7da 100644 --- a/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h @@ -33,8 +33,9 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) diff --git a/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h b/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h index fd68e814231610872d034b22dd1eee8073276830..e84468c66aeacb5763dd4c72b5e5060aa4aa3b35 100644 --- a/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h @@ -33,8 +33,9 @@ // Information as gleaned from DJGPP <ctype.h> - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } ctype<char>::ctype(__c_locale, const mask* __table = 0, bool __del = false, size_t __refs = 0) diff --git a/libstdc++-v3/config/os/generic/bits/ctype_noninline.h b/libstdc++-v3/config/os/generic/bits/ctype_noninline.h index 36846d74a0820aa45b0fc378a1926ad4afba5561..9fec00b43d2bcddad2ce17626bce5020548eac7a 100644 --- a/libstdc++-v3/config/os/generic/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/generic/bits/ctype_noninline.h @@ -34,20 +34,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; - + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table == 0 ? _S_ctable : __table) + _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), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table == 0 ? _S_ctable : __table) + _M_table(__table == 0 ? classic_table() : __table) { } char diff --git a/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h b/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h index 1f2bdcf9e65eb093927defc33d053f1667335276..86a38fa8f584f4aa6e2d9b9d46c6e2773e6ff17e 100644 --- a/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h @@ -40,9 +40,10 @@ using _C_legacy::__ctype_b; #endif - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable = __ctype_b; - + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return __ctype_b; } + #if _GLIBCPP_C_LOCALE_GNU ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del, size_t __refs) @@ -58,14 +59,14 @@ size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { _M_c_locale_ctype = NULL; } #endif ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { _M_c_locale_ctype = NULL; } char diff --git a/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h b/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h index fae41de2ca006c064a6cc780c9d7cc7ef0bdb36c..7ec3b30ed9c4025e9729a4c736a0688549a9a9b9 100644 --- a/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h @@ -34,9 +34,10 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; - + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), diff --git a/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h index 10fef4e5bcab28530141a9be758ae7cfa5556925..f9df21fb0d0109d1cda1bd66213bff9a72c740d6 100644 --- a/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h @@ -34,8 +34,9 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) diff --git a/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h b/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h index 73676f0c58cbdfa09c3a108fa691235a4ed194ae..009e6110b73c4b4773a36d44cdd5ea530a80ceea 100644 --- a/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h @@ -33,8 +33,9 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) diff --git a/libstdc++-v3/config/os/mingw32/bits/ctype_noninline.h b/libstdc++-v3/config/os/mingw32/bits/ctype_noninline.h index a877cf80fa7c7c352c26b1fc48bb78403661e315..11a78436664e57f58b8102e0e53887fc1f126d90 100644 --- a/libstdc++-v3/config/os/mingw32/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/mingw32/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2000, 2002 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 @@ -33,26 +33,37 @@ // Information as gleaned from /mingw32/include/ctype.h. -// This should be in mingw's ctype.h but isn't in older versions + // This should be in mingw's ctype.h but isn't in older versions + // Static classic C-locale table. _ctype[0] is EOF + extern "C" unsigned short __declspec(dllimport) _ctype[]; - extern "C" unsigned short* __declspec(dllimport) _pctype; + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return _ctype + 1; } + + ctype<char>::ctype(__c_locale, const mask* __table = 0, bool __del = false, + size_t __refs = 0) + : __ctype_abstract_base<char>(__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), - _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL), _M_table(__table == 0 ? (_pctype) : __table) - { } + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } char ctype<char>::do_toupper(char __c) const - { return ::toupper((int) __c); } + { return (this->is(ctype_base::lower, __c) ? (__c - 'a' + 'A') : __c); } const char* ctype<char>::do_toupper(char* __low, const char* __high) const { while (__low < __high) { - *__low = ::toupper((int) *__low); + *__low = this->do_toupper(*__low); ++__low; } return __high; @@ -60,16 +71,19 @@ char ctype<char>::do_tolower(char __c) const - { return ::tolower((int) __c); } + { return (this->is(ctype_base::upper, __c) ? (__c - 'A' + 'a') : __c); } const char* ctype<char>::do_tolower(char* __low, const char* __high) const { while (__low < __high) { - *__low = ::tolower((int) *__low); + *__low = this->do_tolower(*__low); ++__low; } return __high; } + + + diff --git a/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h b/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h index 89a486bcd5a0b9a3adcfb26bfe299a0a642eadd7..546f5c5ac740db3bf4eb873eed7a24c7d9f97eec 100644 --- a/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h @@ -33,20 +33,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table ? __table : _S_ctable) + _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), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h b/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h index a37df89eebb72f34d9d93f5d4b1d38b378a42745..9ab764a6c17becb810f8c49308bbc257dc757b70 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h @@ -33,20 +33,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; - + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table ? __table : _S_ctable) + _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), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h b/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h index 19ad6d97ef1d450eb1c223793c2187fc3645ac45..8e1c2d76f9724d7f41bff224741a4ea9ac01df8e 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h @@ -33,20 +33,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable; + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return 0; } ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_table(__table ? __table : _S_ctable) + _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), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h b/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h index c668ae2a3dd824e69a19203d7e3ba0cceeea54a1..eafc1fc71e2411d2031c43024fad3cd31709b306 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h @@ -34,20 +34,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype<char>::_S_ctable = __ctype_mask; + const ctype_base::mask* + ctype<char>::classic_table() throw() + { return __ctype_mask; } ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_table(__table ? __table : _S_ctable) + _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), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_table(__table == 0 ? __table : _S_ctable) + _M_table(__table == 0 ? __table : classic_table()) { } char diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index 8108bf0c6fc0d023ffaeb7425ee244b5302876d7..9f435be5774f563d7c97ca267bb45db131813030 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -238,7 +238,6 @@ namespace std public: static locale::id id; static const size_t table_size = 1 + static_cast<unsigned char>(-1); - static const mask* _S_ctable; explicit ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0); @@ -265,8 +264,7 @@ namespace std { return _M_table; } static const mask* - classic_table() throw() - { return _S_ctable; } + classic_table() throw(); virtual ~ctype();