glibc-2.3 is out

Lasse Kliemann lassekliemann at gmx.net
Sun Oct 6 04:15:15 PDT 2002


* Lee Hancock writes:
> ignore last post, you've used the wronge patch... grab this one from 
> here instead...
> http://gcc.gnu.org/ml/gcc/2002-10/msg00337.html

That's just the good old
<http://www.haible.de/bruno/gcc-3.2-glibc-2.3-compat.diff>, which
is not sufficient. Maybe you were referring to
<http://gcc.gnu.org/ml/gcc/2002-10/msg00332.html>, which I haven't
tried yet. What I'm testing in the moment is exchanging the
ctype_noninline.h from a gcc-3.2 against the one from yesterday's
cvs version of gcc. I've attached a corresponding patch. Maybe
someone can point out to me if this is a sane step. For me, it
seems to run fine.

I'd like to use a complete cvs gcc, but the last time I tried (that
was yesterday) the build stopped in an early stage with bison
complaining about unresolved references.

I'll try the above mentioned patch and your suggestion from your
previous post later, though I guess the latter is equivalent to
using cvs gcc.

Lasse
-------------- next part --------------
--- gcc-3.2/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h	2002-04-19 09:59:07.000000000 +0200
+++ /home/snyder/tmp/gcc-cvs/gcc-3.2-cvs/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h	2002-09-06 19:58:27.000000000 +0200
@@ -34,16 +34,32 @@
   
 // Information as gleaned from /usr/include/ctype.h
 
-#if _GLIBCPP_USE_SHADOW_HEADERS
-  using _C_legacy::__ctype_toupper;
-  using _C_legacy::__ctype_tolower;
-  using _C_legacy::__ctype_b;
-#endif
-
+#if _GLIBCPP_C_LOCALE_GNU
   const ctype_base::mask*
   ctype<char>::classic_table() throw()
-  { return __ctype_b; }  
-  
+  {
+    if (!_S_c_locale)
+      _S_create_c_locale(_S_c_locale, "C");
+    return _S_c_locale->__ctype_b;
+  }
+#else
+  const ctype_base::mask*
+  ctype<char>::classic_table() throw()
+  {
+    const ctype_base::mask* __ret;
+    char* __old = strdup(setlocale(LC_CTYPE, NULL));
+    setlocale(LC_CTYPE, "C");
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+    __ret = *__ctype_b_loc();
+#else
+    __ret = __ctype_b;
+#endif
+    setlocale(LC_CTYPE, __old);
+    free(__old);
+    return __ret;
+  }
+#endif
+
 #if _GLIBCPP_C_LOCALE_GNU
   ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del, 
 		     size_t __refs) 
@@ -57,17 +73,54 @@
 #else
   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(__ctype_toupper), _M_tolower(__ctype_tolower),
-  _M_table(__table ? __table : classic_table())
-  { _M_c_locale_ctype = _S_c_locale; }
+  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
+  {
+    char* __old=strdup(setlocale(LC_CTYPE, NULL));
+    setlocale(LC_CTYPE, "C");
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+    _M_toupper = *__ctype_toupper_loc();
+    _M_tolower = *__ctype_tolower_loc();
+    _M_table = __table ? __table : *__ctype_b_loc();
+#else
+    _M_toupper = __ctype_toupper;
+    _M_tolower = __ctype_tolower;
+    _M_table = __table ? __table : __ctype_b;
+#endif
+    setlocale(LC_CTYPE, __old);
+    free(__old);
+    _M_c_locale_ctype = _S_c_locale;
+  }
 #endif
 
+#if _GLIBCPP_C_LOCALE_GNU
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : 
+  __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
+  {
+    _M_c_locale_ctype = _S_c_locale;
+    _M_toupper = _M_c_locale_ctype->__ctype_toupper;
+    _M_tolower = _M_c_locale_ctype->__ctype_tolower;
+    _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), 
-  _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
-  _M_table(__table ? __table : classic_table())
-  { _M_c_locale_ctype = _S_c_locale; }
+  __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
+  {
+    char* __old=strdup(setlocale(LC_CTYPE, NULL));
+    setlocale(LC_CTYPE, "C");
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+    _M_toupper = *__ctype_toupper_loc();
+    _M_tolower = *__ctype_tolower_loc();
+    _M_table = __table ? __table : *__ctype_b_loc();
+#else
+    _M_toupper = __ctype_toupper;
+    _M_tolower = __ctype_tolower;
+    _M_table = __table ? __table : __ctype_b;
+#endif
+    setlocale(LC_CTYPE, __old);
+    free(__old);
+    _M_c_locale_ctype = _S_c_locale;
+  }
+#endif
 
   char
   ctype<char>::do_toupper(char __c) const


More information about the lfs-dev mailing list