More minor issues found while building libstdc++-v3 in gcc mainline for FreeBSD (with patch) 2/3
Loren James Rittle
rittle@latour.rsch.comm.mot.com
Mon Apr 24 22:19:00 GMT 2000
FreeBSD now configures to use config/generic/ctype.cc (under v2,
neither that file nor any version of ctype.cc was used by this
configuration) yet _S_toupper and _S_tolower which are both referenced
in that file are not defined anywhere. I have studied the situation
and concluded that since bits/std_cctype.h is included before ctype.cc
we could just use the inline toupper and tolower functions defined
there. Sure this *may* be slower that the table-driven approach used
but we are talking about the generic config here. Anyone that wants
to tune libstdc++ for their architecture would have configured it to
use a special ctype.cc, no? This patch has been tested and
bootstrapped on FreeBSD (note that I have only modified the path
outside the _GLIBCPP_USE_WCHAR_T guard since I have no way to test
those changes). It should allow more platforms that depend on
config/generic to build without special hacks.
2000-04-24 Loren J. Rittle <ljrittle@acm.org>
* config/generic/ctype.cc (do_toupper): Remove dependence on
non-portable/non-existent lookup table.
(do_tolower): Same.
Index: libstdc++-v3/config/generic/ctype.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/config/generic/ctype.cc,v
retrieving revision 1.1
diff -p -r1.1 ctype.cc
*** ctype.cc 2000/04/21 20:33:29 1.1
--- ctype.cc 2000/04/25 04:01:42
***************
*** 42,55 ****
char
ctype<char>::do_toupper(char __c) const
! { return _S_toupper[(int) __c]; }
const char*
ctype<char>::do_toupper(char* __low, const char* __high) const
{
while (__low < __high)
{
! *__low = _S_toupper[(int) *__low];
++__low;
}
return __high;
--- 42,55 ----
char
ctype<char>::do_toupper(char __c) const
! { return toupper((int) __c); }
const char*
ctype<char>::do_toupper(char* __low, const char* __high) const
{
while (__low < __high)
{
! *__low = toupper((int) *__low);
++__low;
}
return __high;
***************
*** 57,70 ****
char
ctype<char>::do_tolower(char __c) const
! { return _S_tolower[(int) __c]; }
const char*
ctype<char>::do_tolower(char* __low, const char* __high) const
{
while (__low < __high)
{
! *__low = _S_tolower[(int) *__low];
++__low;
}
return __high;
--- 57,70 ----
char
ctype<char>::do_tolower(char __c) const
! { return tolower((int) __c); }
const char*
ctype<char>::do_tolower(char* __low, const char* __high) const
{
while (__low < __high)
{
! *__low = tolower((int) *__low);
++__low;
}
return __high;
More information about the Libstdc++
mailing list