From 78fa66448c770aa99b6f69113061eb5d77581627 Mon Sep 17 00:00:00 2001 From: kan Date: Mon, 10 Feb 2003 05:47:54 +0000 Subject: Gcc 3.2.2-release C++ support bits. --- contrib/libstdc++/src/Makefile.in | 1 + contrib/libstdc++/src/codecvt.cc | 18 ++++++++++-------- contrib/libstdc++/src/ios.cc | 9 ++++++++- contrib/libstdc++/src/locale.cc | 8 ++++---- contrib/libstdc++/src/localename.cc | 34 ++++++++++++++++------------------ contrib/libstdc++/src/stl-inst.cc | 4 ---- 6 files changed, 39 insertions(+), 35 deletions(-) (limited to 'contrib/libstdc++/src') diff --git a/contrib/libstdc++/src/Makefile.in b/contrib/libstdc++/src/Makefile.in index 0e55017..9e3ff9b 100644 --- a/contrib/libstdc++/src/Makefile.in +++ b/contrib/libstdc++/src/Makefile.in @@ -75,6 +75,7 @@ CMESSAGES_H = @CMESSAGES_H@ CPP = @CPP@ CPU_LIMITS_INC_SRCDIR = @CPU_LIMITS_INC_SRCDIR@ CSTDIO_H = @CSTDIO_H@ +CTIME_H = @CTIME_H@ CXXCPP = @CXXCPP@ C_INCLUDE_DIR = @C_INCLUDE_DIR@ DEBUG_FLAGS = @DEBUG_FLAGS@ diff --git a/contrib/libstdc++/src/codecvt.cc b/contrib/libstdc++/src/codecvt.cc index 1fe6b97..c536979 100644 --- a/contrib/libstdc++/src/codecvt.cc +++ b/contrib/libstdc++/src/codecvt.cc @@ -55,12 +55,13 @@ namespace std codecvt_base::result codecvt:: do_out(state_type&, const intern_type* __from, - const intern_type* __from_end, const intern_type*& __from_next, - extern_type* __to, extern_type* __to_end, + const intern_type*, const intern_type*& __from_next, + extern_type* __to, extern_type*, extern_type*& __to_next) const { - size_t __len = min(__from_end - __from, __to_end - __to); - memcpy(__to, __from, __len); + // _GLIBCPP_RESOLVE_LIB_DEFECTS + // According to the resolution of DR19, "If returns noconv [...] + // there are no changes to the values in [to, to_limit)." __from_next = __from; __to_next = __to; return noconv; @@ -78,12 +79,13 @@ namespace std codecvt_base::result codecvt:: do_in(state_type&, const extern_type* __from, - const extern_type* __from_end, const extern_type*& __from_next, - intern_type* __to, intern_type* __to_end, + const extern_type*, const extern_type*& __from_next, + intern_type* __to, intern_type*, intern_type*& __to_next) const { - size_t __len = min(__from_end - __from, __to_end - __to); - memcpy(__to, __from, __len); + // _GLIBCPP_RESOLVE_LIB_DEFECTS + // According to the resolution of DR19, "If returns noconv [...] + // there are no changes to the values in [to, to_limit)." __from_next = __from; __to_next = __to; return noconv; diff --git a/contrib/libstdc++/src/ios.cc b/contrib/libstdc++/src/ios.cc index 7bfdc5b..9f4c718 100644 --- a/contrib/libstdc++/src/ios.cc +++ b/contrib/libstdc++/src/ios.cc @@ -38,6 +38,9 @@ #include #include #include +#ifdef _GLIBCPP_HAVE_UNISTD_H +#include +#endif namespace __gnu_cxx { @@ -157,7 +160,11 @@ namespace std ios_base::Init::_S_ios_create(bool __sync) { int __out_size = __sync ? 0 : static_cast(BUFSIZ); - int __in_size = __sync ? 1 : static_cast(BUFSIZ); +#ifdef _GLIBCPP_HAVE_ISATTY + int __in_size = (__sync || isatty (0)) ? 1 : static_cast(BUFSIZ); +#else + int __in_size = 1; +#endif // NB: The file globals.cc creates the four standard files // with NULL buffers. At this point, we swap out the dummy NULL diff --git a/contrib/libstdc++/src/locale.cc b/contrib/libstdc++/src/locale.cc index 127197d..f16ca0d 100644 --- a/contrib/libstdc++/src/locale.cc +++ b/contrib/libstdc++/src/locale.cc @@ -1,4 +1,4 @@ -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -367,9 +367,7 @@ namespace std const locale& locale::classic() { - static _STL_mutex_lock __lock __STL_MUTEX_INITIALIZER; - _STL_auto_lock __auto(__lock); - + // Locking protocol: singleton-called-before-threading-starts if (!_S_classic) { try @@ -453,6 +451,8 @@ namespace std __c_locale locale::facet::_S_c_locale; + char locale::facet::_S_c_name[2]; + locale::facet:: ~facet() { } diff --git a/contrib/libstdc++/src/localename.cc b/contrib/libstdc++/src/localename.cc index 61aa952..e9debef 100644 --- a/contrib/libstdc++/src/localename.cc +++ b/contrib/libstdc++/src/localename.cc @@ -141,36 +141,31 @@ namespace std } // Name all the categories. + size_t __len = strlen(__s); if (!strchr(__s, ';')) { - size_t __len = strlen(__s) + 1; for (size_t __i = 0; __i < _S_categories_size + _S_extra_categories_size; ++__i) { - _M_names[__i] = new char[__len]; + _M_names[__i] = new char[__len + 1]; strcpy(_M_names[__i], __s); } } else { - char* __tmp = strdup(__s); - __tmp[strlen(__tmp)] = ';'; - strtok(__tmp, "=;"); + const char* __beg = __s; for (size_t __i = 0; - __i < _S_categories_size + _S_extra_categories_size - 1; ++__i) + __i < _S_categories_size + _S_extra_categories_size; ++__i) { - char* __src = strtok(NULL, "=;"); - char* __new = new char[strlen(__src) + 1]; - strcpy(__new, __src); + __beg = strchr(__beg, '=') + 1; + const char* __end = strchr(__beg, ';'); + if (!__end) + __end = __s + __len; + char* __new = new char[__end - __beg + 1]; + memcpy(__new, __beg, __end - __beg); + __new[__end - __beg] = '\0'; _M_names[__i] = __new; - strtok(NULL, "=;"); } - char* __src = strtok(NULL, "=;"); - char* __new = new char[strlen(__src) + 1]; - strcpy(__new, __src); - _M_names[_S_categories_size + _S_extra_categories_size - 1] = __new; - - free(__tmp); } // Construct all standard facets and add them to _M_facets. @@ -214,7 +209,10 @@ namespace std : _M_references(__refs), _M_facets_size(_GLIBCPP_NUM_FACETS) { // Initialize the underlying locale model. - locale::facet::_S_create_c_locale(locale::facet::_S_c_locale, "C"); + locale::facet::_S_c_name[0] = 'C'; + locale::facet::_S_c_name[1] = '\0'; + locale::facet::_S_create_c_locale(locale::facet::_S_c_locale, + locale::facet::_S_c_name); _M_facets = new(&facet_vec) facet*[_M_facets_size]; for (size_t __i = 0; __i < _M_facets_size; ++__i) @@ -225,7 +223,7 @@ namespace std __i < _S_categories_size + _S_extra_categories_size; ++__i) { _M_names[__i] = new (&facet_name[__i]) char[2]; - strcpy(_M_names[__i], "C"); + strcpy(_M_names[__i], locale::facet::_S_c_name); } // This is needed as presently the C++ version of "C" locales diff --git a/contrib/libstdc++/src/stl-inst.cc b/contrib/libstdc++/src/stl-inst.cc index d8879a7..d80a718 100644 --- a/contrib/libstdc++/src/stl-inst.cc +++ b/contrib/libstdc++/src/stl-inst.cc @@ -39,9 +39,5 @@ namespace std template class allocator; template class allocator; -#ifdef __USE_MALLOC - template class __malloc_alloc_template<0>; -#else template class __default_alloc_template; -#endif } // namespace std -- cgit v1.1