Patchwork [v3] Fix libstdc++/48382

login
register
mail settings
Submitter Paolo Carlini
Date March 31, 2011, 5:03 p.m.
Message ID <4D94B3E1.1060404@oracle.com>
Download mbox | patch
Permalink /patch/89101/
State New
Headers show

Comments

Paolo Carlini - March 31, 2011, 5:03 p.m.
Hi,

this fixes the PR by implementing the XXX comment in src/ctype.cc. I 
tested the patch only on x86_64-linux, but (modulo trivial typos) the 
changes for the other targets should be identical and straightforward.

Committed to mainline.

Thanks,
Paolo.

/////////////////////////////
2011-03-31  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/48382
	* src/ctype.cc: Do not include <bits/ctype_noninline.h>.
	* src/Makefile.am: Add ctype_configure_char.cc to host_sources.
	* src/Makefile.in: Regenerate.
	* include/Makefile.am: Remove ctype_noninline.h from host_headers.
	* include/Makefile.in: Regenerate.
	* doc/xml/manual/internals.xml: Update.
	* config/os/newlib/ctype_noninline.h: Fixup and rename to...
	* config/os/newlib/ctype_configure_char.cc: ... this.
	* config/os/aix/ctype_noninline.h: Likewise.
	* config/os/aix/ctype_configure_char.cc: Likewise.
	* config/os/vxworks/ctype_noninline.h: Likewise.
	* config/os/vxworks/ctype_configure_char.cc
	* config/os/hpux/ctype_noninline.h: Likewise.
	* config/os/hpux/ctype_configure_char.cc: Likewise.
	* config/os/gnu-linux/ctype_noninline.h: Likewise.
	* config/os/gnu-linux/ctype_configure_char.cc: Likewise.
	* config/os/mingw32/ctype_noninline.h: Likewise.
	* config/os/mingw32/ctype_configure_char.cc: Likewise.
	* config/os/tpf/ctype_noninline.h: Likewise.
	* config/os/tpf/ctype_configure_char.cc: Likewise.
	* config/os/uclibc/ctype_noninline.h: Likewise.
	* config/os/uclibc/ctype_configure_char.cc: Likewise.
	* config/os/bionic/ctype_noninline.h: Likewise.
	* config/os/bionic/ctype_configure_char.cc: Likewise.
	* config/os/djgpp/ctype_noninline.h: Likewise.
	* config/os/djgpp/ctype_configure_char.cc: Likewise.
	* config/os/qnx/qnx6.1/ctype_noninline.h: Likewise.
	* config/os/qnx/qnx6.1/ctype_configure_char.cc: Likewise.
	* config/os/bsd/netbsd/ctype_noninline.h: Likewise.
	* config/os/bsd/netbsd/ctype_configure_char.cc: Likewise.
	* config/os/bsd/darwin/ctype_noninline.h: Likewise.
	* config/os/bsd/darwin/ctype_configure_char.cc: Likewise.
	* config/os/bsd/freebsd/ctype_noninline.h: Likewise.
	* config/os/bsd/freebsd/ctype_configure_char.cc: Likewise.
	* config/os/irix/irix6.5/ctype_noninline.h: Likewise.
	* config/os/irix/irix6.5/ctype_configure_char.cc: Likewise.
	* config/os/generic/ctype_noninline.h: Likewise.
	* config/os/generic/ctype_configure_char.cc: Likewise.
	* config/os/solaris/solaris2.7/ctype_noninline.h: Likewise.
	* config/os/solaris/solaris2.7/ctype_configure_char.cc: Likewise.

Patch

Index: src/ctype.cc
===================================================================
--- src/ctype.cc	(revision 171787)
+++ src/ctype.cc	(working copy)
@@ -1,5 +1,5 @@ 
 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
-// 2006, 2007, 2008, 2009
+// 2006, 2007, 2008, 2009, 2010, 2011
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -50,11 +50,6 @@ 
   locale::id ctype<wchar_t>::id;
 #endif
 
-  // 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;
 
   ctype<char>::~ctype()
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 171787)
+++ src/Makefile.am	(working copy)
@@ -104,6 +104,7 @@ 
 	atomicity.cc \
 	codecvt_members.cc \
 	collate_members.cc \
+	ctype_configure_char.cc \
 	ctype_members.cc \
 	messages_members.cc \
 	monetary_members.cc \
@@ -116,6 +117,9 @@ 
 collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
 	$(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
 
+ctype_configure_char.cc: ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc
+	$(LN_S) ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc . || true
+
 ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
 	$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
 
Index: doc/xml/manual/internals.xml
===================================================================
--- doc/xml/manual/internals.xml	(revision 171787)
+++ doc/xml/manual/internals.xml	(working copy)
@@ -254,11 +254,8 @@ 
 included before <code>ctype_base.h</code> is included.
    </para>
 
-   <para>The next file to write is <code>ctype_noninline.h</code>, which also does
-not require include guards.  This file defines a few member functions
-that will be included in <code>include/bits/locale_facets.h</code>.  The first
-function that must be written is the <code>ctype&lt;char&gt;::ctype</code>
-constructor.  Here is the IRIX example:
+   <para>The next file to write is <code>ctype_configure_char.cc</code>.
+The first function that must be written is the <code>ctype&lt;char&gt;::ctype</code> constructor.  Here is the IRIX example:
    </para>
 
 <programlisting>
Index: include/Makefile.am
===================================================================
--- include/Makefile.am	(revision 171787)
+++ include/Makefile.am	(working copy)
@@ -827,7 +827,6 @@ 
 host_headers = \
 	${host_srcdir}/ctype_base.h \
 	${host_srcdir}/ctype_inline.h \
-	${host_srcdir}/ctype_noninline.h \
 	${host_srcdir}/os_defines.h \
 	${glibcxx_srcdir}/$(ATOMIC_WORD_SRCDIR)/atomic_word.h \
 	${glibcxx_srcdir}/$(ABI_TWEAKS_SRCDIR)/cxxabi_tweaks.h \
Index: config/os/newlib/ctype_noninline.h
===================================================================
--- config/os/newlib/ctype_noninline.h	(revision 171787)
+++ config/os/newlib/ctype_noninline.h	(working copy)
@@ -1,97 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 2000, 2001, 2002, 2009, 2010 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-
-// Information as gleaned from /usr/include/ctype.h
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return _ctype_ + 1; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
-		     size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(NULL), _M_tolower(NULL),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(NULL), _M_tolower(NULL),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  {
-    int __x = __c;
-    return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x);
-  }
-
-  const char*
-  ctype<char>::do_toupper(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = this->do_toupper(*__low);
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  {
-    int __x = __c;
-    return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x);
-  }
-
-  const char*
-  ctype<char>::do_tolower(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = this->do_tolower(*__low);
-	++__low;
-      }
-    return __high;
-  }
Index: config/os/newlib/ctype_configure_char.cc
===================================================================
--- config/os/newlib/ctype_configure_char.cc	(revision 171779)
+++ config/os/newlib/ctype_configure_char.cc	(working copy)
@@ -1,6 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2000, 2001, 2002, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -22,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
 
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
   const ctype_base::mask*
@@ -95,3 +100,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/aix/ctype_noninline.h
===================================================================
--- config/os/aix/ctype_noninline.h	(revision 171787)
+++ config/os/aix/ctype_noninline.h	(working copy)
@@ -1,91 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 2000, 2001, 2002, 2009, 2010 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-
-// Information as gleaned from /usr/include/ctype.h
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return 0; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
-		     size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(NULL), _M_tolower(NULL),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(NULL), _M_tolower(NULL),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  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;
-  }
-
-  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;
-  }
Index: config/os/aix/ctype_configure_char.cc
===================================================================
--- config/os/aix/ctype_configure_char.cc	(revision 171782)
+++ config/os/aix/ctype_configure_char.cc	(working copy)
@@ -1,6 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2000, 2001, 2002, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -22,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
 
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
   const ctype_base::mask*
@@ -89,3 +94,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/vxworks/ctype_noninline.h
===================================================================
--- config/os/vxworks/ctype_noninline.h	(revision 171787)
+++ config/os/vxworks/ctype_noninline.h	(working copy)
@@ -1,92 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-
-// Information as gleaned from target/h/ctype.h
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return __ctype; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table()) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table())
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  { return __toupper(__c); }
-
-  const char*
-  ctype<char>::do_toupper(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = __toupper(*__low);
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  { return __tolower(__c); }
-
-  const char* 
-  ctype<char>::do_tolower(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = __tolower(*__low);
-	++__low;
-      }
-    return __high;
-  }
Index: config/os/vxworks/ctype_configure_char.cc
===================================================================
--- config/os/vxworks/ctype_configure_char.cc	(revision 171779)
+++ config/os/vxworks/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
 
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from target/h/ctype.h
 
   const ctype_base::mask*
@@ -90,3 +94,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/hpux/ctype_noninline.h
===================================================================
--- config/os/hpux/ctype_noninline.h	(revision 171787)
+++ config/os/hpux/ctype_noninline.h	(working copy)
@@ -1,92 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-  
-// Information as gleaned from /usr/include/ctype.h
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return __SB_masks; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : (const mask *) __SB_masks) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : (const mask *) __SB_masks) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  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;
-  }
-
-  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;
-  }
Index: config/os/hpux/ctype_configure_char.cc
===================================================================
--- config/os/hpux/ctype_configure_char.cc	(revision 171779)
+++ config/os/hpux/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
-  
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
   const ctype_base::mask*
@@ -90,3 +94,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/gnu-linux/ctype_noninline.h
===================================================================
--- config/os/gnu-linux/ctype_noninline.h	(revision 171787)
+++ config/os/gnu-linux/ctype_noninline.h	(working copy)
@@ -1,190 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-
-// Information as gleaned from /usr/include/ctype.h
-
-#if _GLIBCXX_C_LOCALE_GNU
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return _S_get_c_locale()->__ctype_b; }
-#else
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  {
-    const ctype_base::mask* __ret;
-    char* __old = setlocale(LC_CTYPE, NULL);
-    char* __sav = NULL;
-    if (__builtin_strcmp(__old, "C"))
-      {
-	const size_t __len = __builtin_strlen(__old) + 1;
-	__sav = new char[__len];
-	__builtin_memcpy(__sav, __old, __len);
-	setlocale(LC_CTYPE, "C");
-      }
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-    __ret = *__ctype_b_loc();
-#else
-    __ret = __ctype_b;
-#endif
-    if (__sav)
-      {
-	setlocale(LC_CTYPE, __sav);
-	delete [] __sav;
-      }
-    return __ret;
-  }
-#endif
-
-#if _GLIBCXX_C_LOCALE_GNU
-  ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del,
-		     size_t __refs)
-  : facet(__refs), _M_c_locale_ctype(_S_clone_c_locale(__cloc)),
-  _M_del(__table != 0 && __del),
-  _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),
-  _M_widen_ok(0), _M_narrow_ok(0)
-  {
-    __builtin_memset(_M_widen, 0, sizeof(_M_widen));
-    __builtin_memset(_M_narrow, 0, sizeof(_M_narrow));
-  }
-#else
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
-		     size_t __refs)
-  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
-  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
-  {
-    char* __old = setlocale(LC_CTYPE, NULL);
-    char* __sav = NULL;
-    if (__builtin_strcmp(__old, "C"))
-      {
-	const size_t __len = __builtin_strlen(__old) + 1;
-	__sav = new char[__len];
-	__builtin_memcpy(__sav, __old, __len);
-	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
-    if (__sav)
-      {
-	setlocale(LC_CTYPE, __sav);
-	delete [] __sav;
-      }
-    __builtin_memset(_M_widen, 0, sizeof(_M_widen));
-    __builtin_memset(_M_narrow, 0, sizeof(_M_narrow));
-  }
-#endif
-
-#if _GLIBCXX_C_LOCALE_GNU
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
-  _M_del(__table != 0 && __del),
-  _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),
-  _M_widen_ok(0), _M_narrow_ok(0)
-  {
-    __builtin_memset(_M_widen, 0, sizeof(_M_widen));
-    __builtin_memset(_M_narrow, 0, sizeof(_M_narrow));
-  }
-#else
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
-  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
-  {
-    char* __old = setlocale(LC_CTYPE, NULL);
-    char* __sav = NULL;
-    if (__builtin_strcmp(__old, "C"))
-      {
-	const size_t __len = __builtin_strlen(__old) + 1;
-	__sav = new char[__len];
-	__builtin_memcpy(__sav, __old, __len);
-	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
-    if (__sav)
-      {
-	setlocale(LC_CTYPE, __sav);
-	delete [] __sav;
-      }
-    __builtin_memset(_M_widen, 0, sizeof(_M_widen));
-    __builtin_memset(_M_narrow, 0, sizeof(_M_narrow));
-  }
-#endif
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  { return _M_toupper[static_cast<unsigned char>(__c)]; }
-
-  const char*
-  ctype<char>::do_toupper(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_toupper[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  { return _M_tolower[static_cast<unsigned char>(__c)]; }
-
-  const char*
-  ctype<char>::do_tolower(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_tolower[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
Index: config/os/gnu-linux/ctype_configure_char.cc
===================================================================
--- config/os/gnu-linux/ctype_configure_char.cc	(revision 171779)
+++ config/os/gnu-linux/ctype_configure_char.cc	(working copy)
@@ -1,8 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -24,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
 
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
 #if _GLIBCXX_C_LOCALE_GNU
@@ -188,3 +191,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/mingw32/ctype_noninline.h
===================================================================
--- config/os/mingw32/ctype_noninline.h	(revision 171787)
+++ config/os/mingw32/ctype_noninline.h	(working copy)
@@ -1,236 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2007, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-
-// The classic table used in libstdc++ is *not* the C _ctype table
-// used by mscvrt, but is based on the ctype masks defined for libstdc++
-// in ctype_base.h.
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  {
-    static const ctype_base::mask _S_classic_table[256] =
-    {
-      cntrl /* null */,
-      cntrl /* ^A */,
-      cntrl /* ^B */,
-      cntrl /* ^C */,
-      cntrl /* ^D */,
-      cntrl /* ^E */,
-      cntrl /* ^F */,
-      cntrl /* ^G */,
-      cntrl /* ^H */,
-      ctype_base::mask(space | cntrl) /* tab */,
-      ctype_base::mask(space | cntrl) /* LF */,
-      ctype_base::mask(space | cntrl) /* ^K */,
-      ctype_base::mask(space | cntrl) /* FF */,
-      ctype_base::mask(space | cntrl) /* ^M */,
-      cntrl /* ^N */,
-      cntrl /* ^O */,
-      cntrl /* ^P */,
-      cntrl /* ^Q */,
-      cntrl /* ^R */,
-      cntrl /* ^S */,
-      cntrl /* ^T */,
-      cntrl /* ^U */,
-      cntrl /* ^V */,
-      cntrl /* ^W */,
-      cntrl /* ^X */,
-      cntrl /* ^Y */,
-      cntrl /* ^Z */,
-      cntrl /* esc */,
-      cntrl /* ^\ */,
-      cntrl /* ^] */,
-      cntrl /* ^^ */,
-      cntrl /* ^_ */,
-      ctype_base::mask(space | print) /*   */,
-      ctype_base::mask(punct | print) /* ! */,
-      ctype_base::mask(punct | print) /* " */,
-      ctype_base::mask(punct | print) /* # */,
-      ctype_base::mask(punct | print) /* $ */,
-      ctype_base::mask(punct | print) /* % */,
-      ctype_base::mask(punct | print) /* & */,
-      ctype_base::mask(punct | print) /* ' */,
-      ctype_base::mask(punct | print) /* ( */,
-      ctype_base::mask(punct | print) /* ) */,
-      ctype_base::mask(punct | print) /* * */,
-      ctype_base::mask(punct | print) /* + */,
-      ctype_base::mask(punct | print) /* , */,
-      ctype_base::mask(punct | print) /* - */,
-      ctype_base::mask(punct | print) /* . */,
-      ctype_base::mask(punct | print) /* / */,
-      ctype_base::mask(digit | xdigit | print) /* 0 */,
-      ctype_base::mask(digit | xdigit | print) /* 1 */,
-      ctype_base::mask(digit | xdigit | print) /* 2 */,
-      ctype_base::mask(digit | xdigit | print) /* 3 */,
-      ctype_base::mask(digit | xdigit | print) /* 4 */,
-      ctype_base::mask(digit | xdigit | print) /* 5 */,
-      ctype_base::mask(digit | xdigit | print) /* 6 */,
-      ctype_base::mask(digit | xdigit | print) /* 7 */,
-      ctype_base::mask(digit | xdigit | print) /* 8 */,
-      ctype_base::mask(digit | xdigit | print) /* 9 */,
-      ctype_base::mask(punct | print) /* : */,
-      ctype_base::mask(punct | print) /* ; */,
-      ctype_base::mask(punct | print) /* < */,
-      ctype_base::mask(punct | print) /* = */,
-      ctype_base::mask(punct | print) /* > */,
-      ctype_base::mask(punct | print) /* ? */,
-      ctype_base::mask(punct | print) /* ! */,
-      ctype_base::mask(alpha | upper | xdigit | print) /* A */,
-      ctype_base::mask(alpha | upper | xdigit | print) /* B */,
-      ctype_base::mask(alpha | upper | xdigit | print) /* C */,
-      ctype_base::mask(alpha | upper | xdigit | print) /* D */,
-      ctype_base::mask(alpha | upper | xdigit | print) /* E */,
-      ctype_base::mask(alpha | upper | xdigit | print) /* F */,
-      ctype_base::mask(alpha | upper | print) /* G */,
-      ctype_base::mask(alpha | upper | print) /* H */,
-      ctype_base::mask(alpha | upper | print) /* I */,
-      ctype_base::mask(alpha | upper | print) /* J */,
-      ctype_base::mask(alpha | upper | print) /* K */,
-      ctype_base::mask(alpha | upper | print) /* L */,
-      ctype_base::mask(alpha | upper | print) /* M */,
-      ctype_base::mask(alpha | upper | print) /* N */,
-      ctype_base::mask(alpha | upper | print) /* O */,
-      ctype_base::mask(alpha | upper | print) /* P */,
-      ctype_base::mask(alpha | upper | print) /* Q */,
-      ctype_base::mask(alpha | upper | print) /* R */,
-      ctype_base::mask(alpha | upper | print) /* S */,
-      ctype_base::mask(alpha | upper | print) /* T */,
-      ctype_base::mask(alpha | upper | print) /* U */,
-      ctype_base::mask(alpha | upper | print) /* V */,
-      ctype_base::mask(alpha | upper | print) /* W */,
-      ctype_base::mask(alpha | upper | print) /* X */,
-      ctype_base::mask(alpha | upper | print) /* Y */,
-      ctype_base::mask(alpha | upper | print) /* Z */,
-      ctype_base::mask(punct | print) /* [ */,
-      ctype_base::mask(punct | print) /* \ */,
-      ctype_base::mask(punct | print) /* ] */,
-      ctype_base::mask(punct | print) /* ^ */,
-      ctype_base::mask(punct | print) /* _ */,
-      ctype_base::mask(punct | print) /* ` */,
-      ctype_base::mask(alpha | lower | xdigit | print) /* a */,
-      ctype_base::mask(alpha | lower | xdigit | print) /* b */,
-      ctype_base::mask(alpha | lower | xdigit | print) /* c */,
-      ctype_base::mask(alpha | lower | xdigit | print) /* d */,
-      ctype_base::mask(alpha | lower | xdigit | print) /* e */,
-      ctype_base::mask(alpha | lower | xdigit | print) /* f */,
-      ctype_base::mask(alpha | lower | print) /* g */,
-      ctype_base::mask(alpha | lower | print) /* h */,
-      ctype_base::mask(alpha | lower | print) /* i */,
-      ctype_base::mask(alpha | lower | print) /* j */,
-      ctype_base::mask(alpha | lower | print) /* k */,
-      ctype_base::mask(alpha | lower | print) /* l */,
-      ctype_base::mask(alpha | lower | print) /* m */,
-      ctype_base::mask(alpha | lower | print) /* n */,
-      ctype_base::mask(alpha | lower | print) /* o */,
-      ctype_base::mask(alpha | lower | print) /* p */,
-      ctype_base::mask(alpha | lower | print) /* q */,
-      ctype_base::mask(alpha | lower | print) /* r */,
-      ctype_base::mask(alpha | lower | print) /* s */,
-      ctype_base::mask(alpha | lower | print) /* t */,
-      ctype_base::mask(alpha | lower | print) /* u */,
-      ctype_base::mask(alpha | lower | print) /* v */,
-      ctype_base::mask(alpha | lower | print) /* w */,
-      ctype_base::mask(alpha | lower | print) /* x */,
-      ctype_base::mask(alpha | lower | print) /* y */,
-      ctype_base::mask(alpha | lower | print) /* x */,
-      ctype_base::mask(punct | print) /* { */,
-      ctype_base::mask(punct | print) /* | */,
-      ctype_base::mask(punct | print) /* } */,
-      ctype_base::mask(punct | print) /* ~ */,
-      cntrl /* del (0x7f)*/,
-      /* The next 128 entries are all 0.   */
-      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    };
-    return _S_classic_table;
-  }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
-		     size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(NULL), _M_tolower(NULL),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(NULL), _M_tolower(NULL),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  { 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 = this->do_toupper(*__low);
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  { 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 = this->do_tolower(*__low);
-	++__low;
-      }
-    return __high;
-  }
Index: config/os/mingw32/ctype_configure_char.cc
===================================================================
--- config/os/mingw32/ctype_configure_char.cc	(revision 171779)
+++ config/os/mingw32/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2007, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,19 +22,24 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
 
-// The classic table used in libstdc++ is *not* the C _ctype table
-// used by mscvrt, but is based on the ctype masks defined for libstdc++
-// in ctype_base.h.
+#include <locale>
+#include <cstdlib>
+#include <cstring>
 
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  // The classic table used in libstdc++ is *not* the C _ctype table
+  // used by mscvrt, but is based on the ctype masks defined for libstdc++
+  // in ctype_base.h.
+
   const ctype_base::mask*
   ctype<char>::classic_table() throw()
   {
@@ -234,3 +238,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/tpf/ctype_noninline.h
===================================================================
--- config/os/tpf/ctype_noninline.h	(revision 171787)
+++ config/os/tpf/ctype_noninline.h	(working copy)
@@ -1,113 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-  
-// Information as gleaned from /usr/include/ctype.h
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  {
-    const ctype_base::mask* __ret;
-    char* __old = setlocale(LC_CTYPE, NULL);
-    const size_t __len = __builtin_strlen(__old) + 1;
-    char* __sav = new char[__len];
-    __builtin_memcpy(__sav, __old, __len);
-    setlocale(LC_CTYPE, "C");
-    __ret = *__ctype_b_loc();
-    setlocale(LC_CTYPE, __sav);
-    delete [] __sav;
-    return __ret;
-  }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del)
-  {
-    char* __old = setlocale(LC_CTYPE, NULL);
-    const size_t __len = __builtin_strlen(__old) + 1;
-    char* __sav = new char[__len];
-    __builtin_memcpy(__sav, __old, __len);
-    setlocale(LC_CTYPE, "C");
-    _M_toupper = *__ctype_toupper_loc();
-    _M_tolower = *__ctype_tolower_loc();
-    _M_table = __table ? __table : *__ctype_b_loc();
-    setlocale(LC_CTYPE, __sav);
-    delete [] __sav;
-    _M_c_locale_ctype = _S_get_c_locale();
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del)
-  {
-    char* __old = setlocale(LC_CTYPE, NULL);
-    const size_t __len = __builtin_strlen(__old) + 1;
-    char* __sav = new char[__len];
-    __builtin_memcpy(__sav, __old, __len);
-    setlocale(LC_CTYPE, "C");
-    _M_toupper = *__ctype_toupper_loc();
-    _M_tolower = *__ctype_tolower_loc();
-    _M_table = __table ? __table : *__ctype_b_loc();
-    setlocale(LC_CTYPE, __sav);
-    delete [] __sav;
-    _M_c_locale_ctype = _S_get_c_locale();
-  }
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  { return _M_toupper[static_cast<unsigned char>(__c)]; }
-
-  const char*
-  ctype<char>::do_toupper(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_toupper[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  { return _M_tolower[static_cast<unsigned char>(__c)]; }
-
-  const char* 
-  ctype<char>::do_tolower(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_tolower[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
Index: config/os/tpf/ctype_configure_char.cc
===================================================================
--- config/os/tpf/ctype_configure_char.cc	(revision 171779)
+++ config/os/tpf/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
-  
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
   const ctype_base::mask*
@@ -111,3 +115,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/uclibc/ctype_noninline.h
===================================================================
--- config/os/uclibc/ctype_noninline.h	(revision 171787)
+++ config/os/uclibc/ctype_noninline.h	(working copy)
@@ -1,92 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-  
-// Information as gleaned from /usr/include/ctype.h
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return __C_ctype_b; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), 
-  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
-  {
-    _M_toupper = __C_ctype_toupper;
-    _M_tolower = __C_ctype_tolower;
-    _M_table = __table ? __table : __C_ctype_b;
-    memset(_M_widen, 0, sizeof(_M_widen));
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), 
-  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
-  {
-    _M_toupper = __C_ctype_toupper;
-    _M_tolower = __C_ctype_tolower;
-    _M_table = __table ? __table : __C_ctype_b;
-    memset(_M_widen, 0, sizeof(_M_widen));
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-  }
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  { return _M_toupper[static_cast<unsigned char>(__c)]; }
-
-  const char*
-  ctype<char>::do_toupper(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_toupper[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  { return _M_tolower[static_cast<unsigned char>(__c)]; }
-
-  const char* 
-  ctype<char>::do_tolower(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_tolower[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
Index: config/os/uclibc/ctype_configure_char.cc
===================================================================
--- config/os/uclibc/ctype_configure_char.cc	(revision 171779)
+++ config/os/uclibc/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
-  
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
   const ctype_base::mask*
@@ -90,3 +94,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/bionic/ctype_noninline.h
===================================================================
--- config/os/bionic/ctype_noninline.h	(revision 171787)
+++ config/os/bionic/ctype_noninline.h	(working copy)
@@ -1,98 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 2010 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-
-// Information as gleaned from /usr/include/ctype.h
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return _ctype_ + 1; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
-		     size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(NULL), _M_tolower(NULL),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(NULL), _M_tolower(NULL),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  {
-    int __x = __c;
-    return (this->is(ctype_base::lower, __c) ? (__x - 'a' + 'A') : __x);
-  }
-
-  const char*
-  ctype<char>::do_toupper(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = this->do_toupper(*__low);
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  {
-    int __x = __c;
-    return (this->is(ctype_base::upper, __c) ? (__x - 'A' + 'a') : __x);
-  }
-
-  const char*
-  ctype<char>::do_tolower(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = this->do_tolower(*__low);
-	++__low;
-      }
-    return __high;
-  }
-
Index: config/os/bionic/ctype_configure_char.cc
===================================================================
--- config/os/bionic/ctype_configure_char.cc	(revision 171779)
+++ config/os/bionic/ctype_configure_char.cc	(working copy)
@@ -1,6 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2010 Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -22,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
 
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
   const ctype_base::mask*
@@ -96,3 +101,5 @@ 
     return __high;
   }
 
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/djgpp/ctype_noninline.h
===================================================================
--- config/os/djgpp/ctype_noninline.h	(revision 171787)
+++ config/os/djgpp/ctype_noninline.h	(working copy)
@@ -1,92 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-
-// Information as gleaned from DJGPP <ctype.h>
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return __dj_ctype_flags+1; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
-		     size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del),
-  _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower),
-  _M_table(__table ? __table : classic_table())
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  { return _M_toupper[static_cast<unsigned char>(__c)]; }
-
-  const char*
-  ctype<char>::do_toupper(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_toupper[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  { return _M_tolower[static_cast<unsigned char>(__c)]; }
-
-  const char*
-  ctype<char>::do_tolower(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_tolower[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
Index: config/os/djgpp/ctype_configure_char.cc
===================================================================
--- config/os/djgpp/ctype_configure_char.cc	(revision 171779)
+++ config/os/djgpp/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
 
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from DJGPP <ctype.h>
 
   const ctype_base::mask*
@@ -90,3 +94,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/qnx/qnx6.1/ctype_noninline.h
===================================================================
--- config/os/qnx/qnx6.1/ctype_noninline.h	(revision 171787)
+++ config/os/qnx/qnx6.1/ctype_noninline.h	(working copy)
@@ -1,89 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 2002, 2009, 2010 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-  
-// Information as gleaned from /usr/include/ctype.h
-  
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return 0; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _Ctype)
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _Ctype)
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  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;
-  }
-
-  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;
-  }
Index: config/os/qnx/qnx6.1/ctype_configure_char.cc
===================================================================
--- config/os/qnx/qnx6.1/ctype_configure_char.cc	(revision 171779)
+++ config/os/qnx/qnx6.1/ctype_configure_char.cc	(working copy)
@@ -1,6 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2002, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -22,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
-  
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
   
   const ctype_base::mask*
@@ -87,3 +92,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/bsd/netbsd/ctype_noninline.h
===================================================================
--- config/os/bsd/netbsd/ctype_noninline.h	(revision 171787)
+++ config/os/bsd/netbsd/ctype_noninline.h	(working copy)
@@ -1,94 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 2000, 2001, 2002, 2003, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-  
-// Information as gleaned from /usr/include/ctype.h
-
-  extern "C" const u_int8_t _C_ctype_[];
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return _C_ctype_ + 1; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table())
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table())
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  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;
-  }
-
-  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;
-  }
Index: config/os/bsd/netbsd/ctype_configure_char.cc
===================================================================
--- config/os/bsd/netbsd/ctype_configure_char.cc	(revision 171779)
+++ config/os/bsd/netbsd/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2000, 2001, 2002, 2003, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
-  
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
   extern "C" const u_int8_t _C_ctype_[];
@@ -92,3 +96,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/bsd/darwin/ctype_noninline.h
===================================================================
--- config/os/bsd/darwin/ctype_noninline.h	(revision 171787)
+++ config/os/bsd/darwin/ctype_noninline.h	(working copy)
@@ -1,92 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 2000, 2001, 2002, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-  
-// Information as gleaned from /usr/include/ctype.h
-  
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return 0; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table()) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table()) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  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;
-  }
-
-  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;
-  }
Index: config/os/bsd/darwin/ctype_configure_char.cc
===================================================================
--- config/os/bsd/darwin/ctype_configure_char.cc	(revision 171779)
+++ config/os/bsd/darwin/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2000, 2001, 2002, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
-  
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
   
   const ctype_base::mask*
@@ -90,3 +94,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/bsd/freebsd/ctype_noninline.h
===================================================================
--- config/os/bsd/freebsd/ctype_noninline.h	(revision 171787)
+++ config/os/bsd/freebsd/ctype_noninline.h	(working copy)
@@ -1,92 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 2000, 2001, 2002, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-  
-// Information as gleaned from /usr/include/ctype.h
-  
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return 0; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table()) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table()) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  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;
-  }
-
-  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;
-  }
Index: config/os/bsd/freebsd/ctype_configure_char.cc
===================================================================
--- config/os/bsd/freebsd/ctype_configure_char.cc	(revision 171779)
+++ config/os/bsd/freebsd/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2000, 2001, 2002, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
-  
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
   
   const ctype_base::mask*
@@ -90,3 +94,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/irix/irix6.5/ctype_noninline.h
===================================================================
--- config/os/irix/irix6.5/ctype_noninline.h	(revision 171787)
+++ config/os/irix/irix6.5/ctype_noninline.h	(working copy)
@@ -1,94 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-
-// Information as gleaned from /usr/include/ctype.h
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return 0; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
-		     size_t __refs)
-  : 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)
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : 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)
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  { return _toupper(__c); }
-
-  const char*
-  ctype<char>::do_toupper(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = do_toupper(*__low);
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  { return _tolower(__c); }
-
-  const char*
-  ctype<char>::do_tolower(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = do_tolower(*__low);
-	++__low;
-      }
-    return __high;
-  }
Index: config/os/irix/irix6.5/ctype_configure_char.cc
===================================================================
--- config/os/irix/irix6.5/ctype_configure_char.cc	(revision 171779)
+++ config/os/irix/irix6.5/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
 
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
   const ctype_base::mask*
@@ -92,3 +96,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/generic/ctype_noninline.h
===================================================================
--- config/os/generic/ctype_noninline.h	(revision 171787)
+++ config/os/generic/ctype_noninline.h	(working copy)
@@ -1,92 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2009, 2010
-//  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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-  
-// Information as gleaned from /usr/include/ctype.h
-
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  { return 0; }
-
-  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table()) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(NULL), _M_tolower(NULL), 
-  _M_table(__table ? __table : classic_table())
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  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;
-  }
-
-  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;
-  }
Index: config/os/generic/ctype_configure_char.cc
===================================================================
--- config/os/generic/ctype_configure_char.cc	(revision 171779)
+++ config/os/generic/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2009, 2010
-//  Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
-  
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
 
   const ctype_base::mask*
@@ -90,3 +94,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
Index: config/os/solaris/solaris2.7/ctype_noninline.h
===================================================================
--- config/os/solaris/solaris2.7/ctype_noninline.h	(revision 171787)
+++ config/os/solaris/solaris2.7/ctype_noninline.h	(working copy)
@@ -1,92 +0,0 @@ 
-// Locale support -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2009, 2010
-// 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 3, 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
-
-//
-// ISO C++ 14882: 22.1  Locales
-//
-  
-// Information as gleaned from /usr/include/ctype.h
-  
-  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)
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(__trans_upper), _M_tolower(__trans_lower),
-  _M_table(__table ? __table : classic_table()) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
-  : facet(__refs), _M_del(__table != 0 && __del), 
-  _M_toupper(__trans_upper), _M_tolower(__trans_lower),
-  _M_table(__table ? __table : classic_table()) 
-  { 
-    memset(_M_widen, 0, sizeof(_M_widen));
-    _M_widen_ok = 0;
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-    _M_narrow_ok = 0;
-  }
-
-  char
-  ctype<char>::do_toupper(char __c) const
-  { return _M_toupper[static_cast<unsigned char>(__c)]; }
-
-  const char*
-  ctype<char>::do_toupper(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_toupper[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
-
-  char
-  ctype<char>::do_tolower(char __c) const
-  { return _M_tolower[static_cast<unsigned char>(__c)]; }
-
-  const char* 
-  ctype<char>::do_tolower(char* __low, const char* __high) const
-  {
-    while (__low < __high)
-      {
-	*__low = _M_tolower[static_cast<unsigned char>(*__low)];
-	++__low;
-      }
-    return __high;
-  }
Index: config/os/solaris/solaris2.7/ctype_configure_char.cc
===================================================================
--- config/os/solaris/solaris2.7/ctype_configure_char.cc	(revision 171779)
+++ config/os/solaris/solaris2.7/ctype_configure_char.cc	(working copy)
@@ -1,7 +1,6 @@ 
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2011 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
@@ -23,15 +22,20 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
-/** @file bits/ctype_noninline.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{locale}
- */
+/** @file ctype_configure_char.cc */
 
 //
 // ISO C++ 14882: 22.1  Locales
 //
-  
+
+#include <locale>
+#include <cstdlib>
+#include <cstring>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
 // Information as gleaned from /usr/include/ctype.h
   
   const ctype_base::mask* 
@@ -90,3 +94,6 @@ 
       }
     return __high;
   }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace