]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Fri, 13 Sep 2002 01:21:42 +0000 (01:21 +0000)
committerNo Author <no-author@gcc.gnu.org>
Fri, 13 Sep 2002 01:21:42 +0000 (01:21 +0000)
'gcc-3_2-branch'.

From-SVN: r57084

gcc/testsuite/gcc.dg/cpp/_Pragma4.c [new file with mode: 0644]
libstdc++-v3/config/locale/generic/codecvt_members.cc [new file with mode: 0644]
libstdc++-v3/config/locale/gnu/codecvt_members.cc [new file with mode: 0644]
libstdc++-v3/docs/html/abi.txt [new file with mode: 0644]
libstdc++-v3/src/ctype.cc [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/cpp/_Pragma4.c b/gcc/testsuite/gcc.dg/cpp/_Pragma4.c
new file mode 100644 (file)
index 0000000..a7ac42d
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do preprocess } */
+
+/* Based on Debian GNATS PR 157416.  3 Sep 2002.  */
+
+#define b foo _Pragma ("bar") baz
+a b c 
+
+/*
+   { dg-final { if ![file exists _Pragma4.i] { return }                   } }
+   { dg-final { if { [grep _Pragma4.i "#pragma bar "] != "" } { return }  } }
+   { dg-final { fail "_Pragma4.c: #pragma appearing on its own line"      } }
+*/
diff --git a/libstdc++-v3/config/locale/generic/codecvt_members.cc b/libstdc++-v3/config/locale/generic/codecvt_members.cc
new file mode 100644 (file)
index 0000000..814b8a2
--- /dev/null
@@ -0,0 +1,101 @@
+// std::codecvt implementation details, generic version -*- C++ -*-
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+#include "c++locale_internal.h"
+
+namespace std
+{
+  // Specializations.
+#ifdef _GLIBCPP_USE_WCHAR_T
+  codecvt_base::result
+  codecvt<wchar_t, char, mbstate_t>::
+  do_out(state_type& __state, const intern_type* __from, 
+        const intern_type* __from_end, const intern_type*& __from_next,
+        extern_type* __to, extern_type* __to_end,
+        extern_type*& __to_next) const
+  {
+    result __ret = error;
+    size_t __len = min(__from_end - __from, __to_end - __to);
+    size_t __conv = wcsrtombs(__to, &__from, __len, &__state);
+
+    if (__conv == __len)
+      {
+       __from_next = __from;
+       __to_next = __to + __conv;
+       __ret = ok;
+      }
+    else if (__conv > 0 && __conv < __len)
+      {
+       __from_next = __from;
+       __to_next = __to + __conv;
+       __ret = partial;
+      }
+    else
+      __ret = error;
+       
+    return __ret; 
+  }
+  
+  codecvt_base::result
+  codecvt<wchar_t, char, mbstate_t>::
+  do_in(state_type& __state, const extern_type* __from, 
+       const extern_type* __from_end, const extern_type*& __from_next,
+       intern_type* __to, intern_type* __to_end,
+       intern_type*& __to_next) const
+  {
+    result __ret = error;
+    size_t __len = min(__from_end - __from, __to_end - __to);
+    size_t __conv = mbsrtowcs(__to, &__from, __len, &__state);
+
+    if (__conv == __len)
+      {
+       __from_next = __from;
+       __to_next = __to + __conv;
+       __ret = ok;
+      }
+    else if (__conv > 0 && __conv < __len)
+      {
+       __from_next = __from;
+       __to_next = __to + __conv;
+       __ret = partial;
+      }
+    else
+      __ret = error;
+       
+    return __ret; 
+  }
+#endif
+}
diff --git a/libstdc++-v3/config/locale/gnu/codecvt_members.cc b/libstdc++-v3/config/locale/gnu/codecvt_members.cc
new file mode 100644 (file)
index 0000000..aa855a6
--- /dev/null
@@ -0,0 +1,113 @@
+// std::codecvt implementation details, GNU version -*- C++ -*-
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
+//
+
+// Written by Benjamin Kosnik <bkoz@redhat.com>
+
+#include <locale>
+#include "c++locale_internal.h"
+
+namespace std
+{
+  // Specializations.
+#ifdef _GLIBCPP_USE_WCHAR_T
+  codecvt_base::result
+  codecvt<wchar_t, char, mbstate_t>::
+  do_out(state_type& __state, const intern_type* __from, 
+        const intern_type* __from_end, const intern_type*& __from_next,
+        extern_type* __to, extern_type* __to_end,
+        extern_type*& __to_next) const
+  {
+    result __ret = error;
+    size_t __len = min(__from_end - __from, __to_end - __to);
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+    __c_locale __old = __uselocale(_M_c_locale_codecvt);
+#endif
+    size_t __conv = wcsrtombs(__to, &__from, __len, &__state);
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+    __uselocale(__old);
+#endif
+
+    if (__conv == __len)
+      {
+       __from_next = __from;
+       __to_next = __to + __conv;
+       __ret = ok;
+      }
+    else if (__conv > 0 && __conv < __len)
+      {
+       __from_next = __from;
+       __to_next = __to + __conv;
+       __ret = partial;
+      }
+    else
+      __ret = error;
+       
+    return __ret; 
+  }
+  
+  codecvt_base::result
+  codecvt<wchar_t, char, mbstate_t>::
+  do_in(state_type& __state, const extern_type* __from, 
+       const extern_type* __from_end, const extern_type*& __from_next,
+       intern_type* __to, intern_type* __to_end,
+       intern_type*& __to_next) const
+  {
+    result __ret = error;
+    size_t __len = min(__from_end - __from, __to_end - __to);
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+    __c_locale __old = __uselocale(_M_c_locale_codecvt);
+#endif
+    size_t __conv = mbsrtowcs(__to, &__from, __len, &__state);
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+    __uselocale(__old);
+#endif
+
+    if (__conv == __len)
+      {
+       __from_next = __from;
+       __to_next = __to + __conv;
+       __ret = ok;
+      }
+    else if (__conv > 0 && __conv < __len)
+      {
+       __from_next = __from;
+       __to_next = __to + __conv;
+       __ret = partial;
+      }
+    else
+      __ret = error;
+       
+    return __ret; 
+  }
+#endif
+}
diff --git a/libstdc++-v3/docs/html/abi.txt b/libstdc++-v3/docs/html/abi.txt
new file mode 100644 (file)
index 0000000..770c3cf
--- /dev/null
@@ -0,0 +1,386 @@
+
+===========================
+
+See http://gcc.gnu.org/ml/libstdc++/2002-07/msg00054.html for why this
+document exists, why it's incomplete, and what needs to be done still.
+
+===========================
+
+2002-09-06 Benjamin Kosnik
+
+Description of the libstdc++ ABI.
+
+I. What is an ABI? What's covered? What's not?
+
+- scope of document, of use to system integrators.
+
+- What's the deal with C++? Why can't different compiler's object
+  files link with each other? Bug? Feature?
+
+- compilation includes and linked library binary must match up..
+
+- shared library only, static is immutable.
+
+- What's an ABI?
+
+- library ABI, compiler ABI different issues, (but related)
+
+- GNU C++ does not have a compiler command line option to switch
+  between various different C++ ABIs. For instance, there is no way to
+  switch between the gcc-3.0.x ABI, gcc-3.1.x ABI, and the gcc-3.2.x
+  ABI during compilation. Other C++ compilers do allow this, and some
+  g++ command line options may change the ABI (-fno-exceptions, see
+  the complete list), but there is no version switch. Sorry. 
+
+  To use a specific C++ABI, one must use the corresponding GNU C++
+  toolchain. 
+
+- How can this complexity be managed? What does C++ versioning mean?
+  Because library and compiler changes often make binaries compiled
+  with one version of the GNU tools incompatible with binaries
+  compiled with other (either newer or older) versions of the same GNU
+  tools, specific techniques are used to make managing this complexity
+  easier.
+
+  The following techniques are used:
+
+  - Release versioning on the libgcc_s.so binary.
+
+    It is versioned as follows:
+    gcc-3.0.0: libgcc_s.so.1
+    gcc-3.0.1: libgcc_s.so.1
+    gcc-3.0.2: libgcc_s.so.1
+    gcc-3.0.3: libgcc_s.so.1
+    gcc-3.0.4: libgcc_s.so.1
+    gcc-3.1.0: libgcc_s.so.1
+    gcc-3.1.1: libgcc_s.so.1
+    gcc-3.2.0: libgcc_s.so.1
+
+
+  - Release versioning on the libstdc++.so binary.
+
+    It is versioned as follows:
+    gcc-3.0.0: libstdc++.so.3.0.0
+    gcc-3.0.1: libstdc++.so.3.0.1
+    gcc-3.0.2: libstdc++.so.3.0.2
+    gcc-3.0.3: libstdc++.so.3.0.2 (Error, should be libstdc++.so.3.0.3)
+    gcc-3.0.4: libstdc++.so.3.0.4
+    gcc-3.1.0: libstdc++.so.4.0.0
+    gcc-3.1.1: libstdc++.so.4.0.1
+    gcc-3.2.0: libstdc++.so.5.0.0
+
+
+  - Symbol versioning on the libgcc_s.so binary.
+  
+    file: gcc/libgcc-std.ver
+
+    It is versioned as follows:
+    gcc-3.0.0: GCC_3.0
+    gcc-3.0.1: GCC_3.0
+    gcc-3.0.2: GCC_3.0
+    gcc-3.0.3: GCC_3.0
+    gcc-3.0.4: GCC_3.0
+    gcc-3.1.0: GCC_3.0
+    gcc-3.1.1: GCC_3.0
+    gcc-3.2.0: GCC_3.0
+
+
+  - Symbol versioning on the libstdc++.so binary.
+  
+    It is versioned as follows:
+    gcc-3.0.0: (Error, unversioned)
+    gcc-3.0.1: (Error, unversioned)
+    gcc-3.0.2: (Error, unversioned)
+    gcc-3.0.3: (Error, unversioned)
+    gcc-3.0.4: (Error, unversioned)
+    gcc-3.1.0: GLIBCPP_3.1, CXXABI_1
+    gcc-3.1.1: GLIBCPP_3.1, CXXABI_1
+    gcc-3.2.0: GLIBCPP_3.2, CXXABI_1.2
+    
+    file: libstdc++-v3/config/linker-map.gnu
+  
+
+  - Incremental bumping of a compiler pre-defined macro,
+    __GXX_ABI_VERSION. This macro is defined as the version of the
+    compiler v3 ABI, with g++ 3.0.x being version 100. This macro will
+    be automatically defined whenever g++ is used (the curious can
+    test this by invoking g++ with the '-v' flag.)
+    
+    This macro is defined in the file "lang-specs.h" in the gcc/cp directory.
+    Later versions define it in "c-common.c" in the gcc directory.
+
+    It is versioned as follows:
+    gcc-3.0.x: 100
+    gcc-3.1.x: 100 (Error, should be 101)
+    gcc-3.2.x: 102
+
+
+  - Incremental bumping of a library pre-defined macro,
+    __GLIBCPP__. This macro is defined as the date the library was
+    released, in compressed ISO date format, as an unsigned long.
+
+    This macro is defined in the file "c++config" in the
+    "libstdc++-v3/include/bits" directory and is changed every night
+    by an automated script.
+
+    It is versioned as follows:
+    gcc-3.0.0: 20010615
+    gcc-3.0.1: 20010819
+    gcc-3.0.2: 20011023
+    gcc-3.0.3: 20011220
+    gcc-3.0.4: 20020220
+    gcc-3.1.0: 20020514
+    gcc-3.1.1: 20020725
+    gcc-3.2.0: 20020814
+
+
+  - Incremental bumping of a library pre-defined macro,
+    _GLIBCPP_VERSION. This macro is defined as the released version of
+    the library, as a string literal. This is only implemented in
+    gcc-3.1.0 releases and higher.
+
+    This macro is defined in the file "c++config" in the
+    "libstdc++-v3/include/bits" directory and is generated
+    automatically by autoconf as part of the configure-time generation
+    of config.h.
+
+    It is versioned as follows:
+    gcc-3.0.0: "3.0.0"
+    gcc-3.0.1: "3.0.0" (Error, should be "3.0.1")
+    gcc-3.0.2: "3.0.0" (Error, should be "3.0.2")
+    gcc-3.0.3: "3.0.0" (Error, should be "3.0.3")
+    gcc-3.0.4: "3.0.0" (Error, should be "3.0.4")
+    gcc-3.1.0: "3.1.0"
+    gcc-3.1.1: "3.1.1"
+    gcc-3.2.0: "3.2"
+
+
+  - Matching each specific C++ compiler release to a specific set of
+    C++ include files. This is only implemented in gcc-3.1.1 releases
+    and higher.
+
+    All C++ includes are installed in include/c++, then nest in a
+    directory hierarchy corresponding to the C++ compiler's released
+    version. This version corresponds to the variable "gcc_version" in
+    "libstdc++-v3/acinclude.m4," and more details can be found in that
+    file's macro GLIBCPP_CONFIGURE.
+
+    C++ includes are versioned as follows:
+    gcc-3.0.0: include/g++-v3
+    gcc-3.0.1: include/g++-v3
+    gcc-3.0.2: include/g++-v3
+    gcc-3.0.3: include/g++-v3
+    gcc-3.0.4: include/g++-v3
+    gcc-3.1.0: include/g++-v3
+    gcc-3.1.1: include/c++/3.1.1
+    gcc-3.2.0: include/c++/3.2
+
+  Taken together, these techniques can accurately specify interface
+  and implementation changes in the GNU C++ tools themselves. Used
+  properly, they allow both the GNU C++ tools implementation, and
+  programs using them, an evolving yet controlled development that
+  maintains backward compatibility.
+
+- Minimum environment that supports a versioned ABI: what's needed?  A
+  supported dynamic linker, a GNU linker of sufficient vintage to
+  understand demangled C++ name globbing (ld), a shared executable
+  compiled with g++, and shared libraries (libgcc_s, libstdc++-v3)
+  compiled by a compiler (g++) with a compatible ABI. Phew.
+
+  On top of all that, an additional constraint: libstdc++ did not
+  attempt to version symbols (or age gracefully, really) until version
+  3.1.0. 
+
+  Most modern Linux and BSD versions, particularly ones using
+  gcc-3.1.x tools, will meet the requirements above.
+
+- What configure options impact symbol versioning?
+
+  It turns out that most of the configure options that change default
+  behavior will impact the mangled names of exported symbols, and thus
+  impact versioning and compatibility.
+
+  For more information on configure options, including ABI impacts, see:
+  http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html
+
+  There is one flag that explicitly deals with symbol versioning:
+  --enable-symvers. 
+
+  In particular, libstdc++-v3/acinclude.m4 has a macro called
+  GLIBCPP_ENABLE_SYMVERS that defaults to yes (or the argument passed
+  in via --enable-symvers=foo). At that point, the macro attempts to
+  make sure that all the requirement for symbol versioning are in
+  place. For more information, please consult acinclude.m4. 
+
+- How can I tell if symbol versioning is, indeed, active? 
+
+  When the GNU C++ library is being built with symbol versioning on,
+  you should see the following at configure time for libstdc++-v3:
+
+  checking versioning on shared library symbols... gnu
+
+  If you don't see this line in the configure output, or if this line
+  appears but the last word is 'no', then you are out of luck.
+
+  If the compiler is pre-installed, a quick way to test is to compile
+  the following (or any) simple C++ file:
+
+#include <iostream>
+
+int main()
+{ std::cout << "hello" << std::endl; return 0; }
+
+%g++ hello.cc -o hello.out
+%nm hello.out
+
+If you see symbols in the resulting output with "GLIBCPP_3.x" as part
+of the name, then the executable is versioned. Here's an example:
+
+         U _ZNSt8ios_base4InitC1Ev@@GLIBCPP_3.1
+
+
+II. Library ABI changes
+
+The following will cause the library major version number to
+increase, say from "libstdc++.so.3.0.4" to "libstdc++.so.4.0.0".
+
+- any g++ compiler ABI changes
+
+- (anything) changing size of an exported symbol
+
+- (anything) changing alignment of an exported symbol
+
+- (anything) changing the layout of an exported symbol
+
+- (anything) changing mangling on an exported symbol
+
+- (anything) deleting an exported symbol
+
+Note: adding an exported symbol, if it's in a new linker map name, is ok.
+
+The following will cause the library revision version number to
+increase, say from "libstdc++.so.5.0.0" to "libstdc++.so.5.0.1".
+
+- any release of the gcc toolchain.
+
+
+III. Versioning
+
+- include files
+
+  - versioning headers with version, why necessary
+    (need to control member/non-member functions, add delete files)
+
+- shared library binaries
+
+  - release versions
+
+  - libtool versions
+
+  - when does so version get a bump? what are the options?
+
+  - how is the link map used?  
+
+  - in an non-abi breaking minor release, how are symbols added?
+    removed?
+
+  - in an abi-breaking major release, what happens? symbol fall back
+
+
+IV. Testing ABI changes
+
+Testing for GNU C++ ABI changes is composed of two distinct areas:
+testing the C++ compiler (g++) for compiler changes, and testing the
+C++ library (libstdc++) for library changes.
+
+Testing the C++ compiler ABI can be done various ways.
+
+One. 
+Intel ABI checker. More information can be obtained
+<a href="http://developer.intel.com/software/products/opensource/">here.</a>
+
+Two.
+The second is yet unreleased, but has been announced on the gcc
+mailing list. It is yet unspecified if these tools will be freely
+available, and able to be included in a GNU project. Please contact
+Mark Mitchell (mark@codesourcery.com) for more details, and current
+status.
+
+Three.
+Involves using the vlad.consistency test framework. This has also been
+discussed on the gcc mailing lists.
+
+Testing the C++ library ABI can also be done various ways.
+
+One. 
+(Brendan Kehoe, Jeff Law suggestion to run 'make check-c++' two ways, 
+one with a new compiler and an old library, and the other with an old
+compiler and a new library, and look for testsuite regressions)
+
+Details on how to set this kind of test up can be found here:
+http://gcc.gnu.org/ml/gcc/2002-08/msg00142.html
+
+Two.  
+Use the 'make check-abi' rule in the libstdc++-v3 Makefile. 
+
+This is a proactive check the library ABI. Currently, exported symbol
+names that are either weak or defined are checked against a last known
+good baseline. Currently, this baseline is keyed off of 3.2.0
+binaries, as this was the last time the .so number was incremented. In
+addition, all exported names are demangled, and the exported objects
+are checked to make sure they are the same size as the same object in
+the baseline.
+
+In the future, more tests should be added. In particular, vtable
+information, offsets of data members in class objects, and other
+layout information should be checked.
+
+It should be possible to use sizeof, alignof, and offset to compute
+offsets for each structure and type in the standard library, saving to
+another datafile. Then, compute this for new binaries, and look for
+differences.
+
+Another approach might be to use the -fdump-class-hierarchy flag to
+get information.
+(See g++/7470 on how this was used to find bugs.)
+
+Perhaps there are other C++ ABI checkers. If so, please notify
+us. We'd like to know about them!
+
+
+V. Issues not directly addressed, and possible suggestions
+
+- what to do about multi-ABI systems (nathan scenario)?
+
+  - compatibility libs
+
+  --enable-version-specific-runtime-libs
+
+  - Alexandre Oliva proposal to have extended name attributes, modify ld
+  - directory-level versioning
+
+- wrapping C++ API's in "C" to use the C ABI.
+
+
+V. References
+
+ABIcheck, a vague idea of checking ABI compatibility
+http://abicheck.sourceforge.net/
+
+C++ ABI reference
+http://www.codesourcery.com/cxx-abi/
+
+Intel ABI documentation
+"IntelĀ® Compilers for Linux* -Compatibility with the GNU Compilers"
+(included in icc 6.0)
+
+Sun Solaris 2.9 docs
+Linker and Libraries Guide (document 816-1386)
+C++ Migration Guide (document 816-2459)
+http://docs.sun.com/db/prod/solaris.9
+http://docs.sun.com/?p=/doc/816-1386&a=load
+
+Ulrich Drepper, "ELF Symbol Versioning"
+http://people.redhat.com/drepper/symbol-versioning
+
diff --git a/libstdc++-v3/src/ctype.cc b/libstdc++-v3/src/ctype.cc
new file mode 100644 (file)
index 0000000..7ca934e
--- /dev/null
@@ -0,0 +1,153 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <locale>
+
+namespace std 
+{
+  // XXX At some point, just rename this file to ctype_members_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>
+
+  // Definitions for locale::id of standard facets that are specialized.
+  locale::id ctype<char>::id;
+
+#ifdef _GLIBCPP_USE_WCHAR_T  
+  locale::id ctype<wchar_t>::id;
+#endif
+
+  template<>
+    const ctype<char>&
+    use_facet<ctype<char> >(const locale& __loc)
+    {
+      size_t __i = ctype<char>::id._M_id();
+      const locale::_Impl* __tmp = __loc._M_impl;
+      return static_cast<const ctype<char>&>(*(__tmp->_M_facets[__i]));
+    }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+  template<>
+    const ctype<wchar_t>&
+    use_facet<ctype<wchar_t> >(const locale& __loc)
+    {
+      size_t __i = ctype<wchar_t>::id._M_id();
+      const locale::_Impl* __tmp = __loc._M_impl;
+      return static_cast<const ctype<wchar_t>&>(*(__tmp->_M_facets[__i]));
+    }
+#endif
+
+  // Definitions for static const data members of ctype_base.
+  const ctype_base::mask ctype_base::space;
+  const ctype_base::mask ctype_base::print;
+  const ctype_base::mask ctype_base::cntrl;
+  const ctype_base::mask ctype_base::upper;
+  const ctype_base::mask ctype_base::lower;
+  const ctype_base::mask ctype_base::alpha;
+  const ctype_base::mask ctype_base::digit;
+  const ctype_base::mask ctype_base::punct;
+  const ctype_base::mask ctype_base::xdigit;
+  const ctype_base::mask ctype_base::alnum;
+  const ctype_base::mask ctype_base::graph;
+
+  const size_t ctype<char>::table_size;
+
+  ctype<char>::~ctype()
+  { 
+    if (_M_c_locale_ctype != _S_c_locale)
+      _S_destroy_c_locale(_M_c_locale_ctype);
+    if (_M_del) 
+      delete[] this->table(); 
+  }
+
+  // These are dummy placeholders as these virtual functions are never called.
+  bool 
+  ctype<char>::do_is(mask, char_type) const 
+  { return false; }
+  
+  const char*
+  ctype<char>::do_is(const char_type* __c, const char_type*, mask*) const 
+  { return __c; }
+  
+  const char*
+  ctype<char>::do_scan_is(mask, const char_type* __c, const char_type*) const 
+  { return __c; }
+
+  const char* 
+  ctype<char>::do_scan_not(mask, const char_type* __c, const char_type*) const
+  { return __c; }
+
+  char
+  ctype<char>::do_widen(char __c) const
+  { return __c; }
+  
+  const char* 
+  ctype<char>::do_widen(const char* __lo, const char* __hi, char* __dest) const
+  {
+    memcpy(__dest, __lo, __hi - __lo);
+    return __hi;
+  }
+  
+  char
+  ctype<char>::do_narrow(char __c, char /*__dfault*/) const
+  { return __c; }
+  
+  const char* 
+  ctype<char>::do_narrow(const char* __lo, const char* __hi, 
+                        char /*__dfault*/, char* __dest) const
+  {
+    memcpy(__dest, __lo, __hi - __lo);
+    return __hi;
+  }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+  ctype<wchar_t>::ctype(size_t __refs) 
+  : __ctype_abstract_base<wchar_t>(__refs)
+  { _M_c_locale_ctype = _S_c_locale; }
+
+  ctype<wchar_t>::ctype(__c_locale __cloc, size_t __refs) 
+  : __ctype_abstract_base<wchar_t>(__refs) 
+  { _M_c_locale_ctype = _S_clone_c_locale(__cloc); }
+
+  ctype<wchar_t>::~ctype() 
+  { 
+    if (_M_c_locale_ctype != _S_c_locale)
+      _S_destroy_c_locale(_M_c_locale_ctype); 
+  }
+
+  template<>
+    ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
+    : ctype<wchar_t>(__refs) 
+    {  
+      if (_M_c_locale_ctype != _S_c_locale)
+       _S_destroy_c_locale(_M_c_locale_ctype);
+      _S_create_c_locale(_M_c_locale_ctype, __s); 
+    }
+#endif
+} // namespace std
+