Robert P. J. DAY says:
apparently, the patchset for gcc 4.2.1 applies properly to the
source for gcc 4.2.2 and gcc 4.2.3. so, if you want, you can simply
add support for those last two just by augmenting menuconfig and
adding a couple symlinks for those two directories. seems like a
cheap way to add a couple new versions.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/gcc/4.2.2/100-uclibc-conf.patch Sun Feb 17 22:08:06 2008 +0000
1.3 @@ -0,0 +1,216 @@
1.4 +diff -durN gcc-4.2.1.orig/boehm-gc/configure gcc-4.2.1/boehm-gc/configure
1.5 +--- gcc-4.2.1.orig/boehm-gc/configure 2007-07-19 16:33:56.000000000 +0200
1.6 ++++ gcc-4.2.1/boehm-gc/configure 2007-08-03 20:29:22.000000000 +0200
1.7 +@@ -4323,7 +4323,7 @@
1.8 + ;;
1.9 +
1.10 + # This must be Linux ELF.
1.11 +-linux-gnu*)
1.12 ++linux*)
1.13 + lt_cv_deplibs_check_method=pass_all
1.14 + ;;
1.15 +
1.16 +diff -durN gcc-4.2.1.orig/contrib/regression/objs-gcc.sh gcc-4.2.1/contrib/regression/objs-gcc.sh
1.17 +--- gcc-4.2.1.orig/contrib/regression/objs-gcc.sh 2005-08-15 02:41:31.000000000 +0200
1.18 ++++ gcc-4.2.1/contrib/regression/objs-gcc.sh 2007-08-03 20:29:22.000000000 +0200
1.19 +@@ -105,6 +105,10 @@
1.20 + then
1.21 + make all-gdb all-dejagnu all-ld || exit 1
1.22 + make install-gdb install-dejagnu install-ld || exit 1
1.23 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
1.24 ++ then
1.25 ++ make all-gdb all-dejagnu all-ld || exit 1
1.26 ++ make install-gdb install-dejagnu install-ld || exit 1
1.27 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
1.28 + make bootstrap || exit 1
1.29 + make install || exit 1
1.30 +diff -durN gcc-4.2.1.orig/gcc/config/cris/linux.h gcc-4.2.1/gcc/config/cris/linux.h
1.31 +--- gcc-4.2.1.orig/gcc/config/cris/linux.h 2006-02-18 12:12:51.000000000 +0100
1.32 ++++ gcc-4.2.1/gcc/config/cris/linux.h 2007-08-03 20:29:22.000000000 +0200
1.33 +@@ -74,7 +74,11 @@
1.34 + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
1.35 +
1.36 + #undef CRIS_SUBTARGET_VERSION
1.37 +-#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
1.38 ++#if UCLIBC_DEFAULT
1.39 ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
1.40 ++#else
1.41 ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
1.42 ++#endif
1.43 +
1.44 + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
1.45 +
1.46 +diff -durN gcc-4.2.1.orig/libffi/configure gcc-4.2.1/libffi/configure
1.47 +--- gcc-4.2.1.orig/libffi/configure 2007-07-19 16:33:56.000000000 +0200
1.48 ++++ gcc-4.2.1/libffi/configure 2007-08-03 20:29:22.000000000 +0200
1.49 +@@ -3460,7 +3460,7 @@
1.50 + ;;
1.51 +
1.52 + # This must be Linux ELF.
1.53 +-linux-gnu*)
1.54 ++linux*)
1.55 + lt_cv_deplibs_check_method=pass_all
1.56 + ;;
1.57 +
1.58 +diff -durN gcc-4.2.1.orig/libgfortran/configure gcc-4.2.1/libgfortran/configure
1.59 +--- gcc-4.2.1.orig/libgfortran/configure 2007-07-19 16:33:56.000000000 +0200
1.60 ++++ gcc-4.2.1/libgfortran/configure 2007-08-03 20:29:22.000000000 +0200
1.61 +@@ -3721,7 +3721,7 @@
1.62 + ;;
1.63 +
1.64 + # This must be Linux ELF.
1.65 +-linux-gnu*)
1.66 ++linux*)
1.67 + lt_cv_deplibs_check_method=pass_all
1.68 + ;;
1.69 +
1.70 +diff -durN gcc-4.2.1.orig/libgomp/configure gcc-4.2.1/libgomp/configure
1.71 +--- gcc-4.2.1.orig/libgomp/configure 2007-07-19 16:33:56.000000000 +0200
1.72 ++++ gcc-4.2.1/libgomp/configure 2007-08-03 20:29:22.000000000 +0200
1.73 +@@ -3893,7 +3893,7 @@
1.74 + ;;
1.75 +
1.76 + # This must be Linux ELF.
1.77 +-linux-gnu*)
1.78 ++linux*)
1.79 + lt_cv_deplibs_check_method=pass_all
1.80 + ;;
1.81 +
1.82 +diff -durN gcc-4.2.1.orig/libjava/classpath/configure gcc-4.2.1/libjava/classpath/configure
1.83 +--- gcc-4.2.1.orig/libjava/classpath/configure 2007-01-17 19:10:26.000000000 +0100
1.84 ++++ gcc-4.2.1/libjava/classpath/configure 2007-08-03 20:29:22.000000000 +0200
1.85 +@@ -5307,7 +5307,7 @@
1.86 + ;;
1.87 +
1.88 + # This must be Linux ELF.
1.89 +-linux-gnu*)
1.90 ++linux*)
1.91 + lt_cv_deplibs_check_method=pass_all
1.92 + ;;
1.93 +
1.94 +diff -durN gcc-4.2.1.orig/libjava/classpath/ltconfig gcc-4.2.1/libjava/classpath/ltconfig
1.95 +--- gcc-4.2.1.orig/libjava/classpath/ltconfig 2006-08-07 22:37:50.000000000 +0200
1.96 ++++ gcc-4.2.1/libjava/classpath/ltconfig 2007-08-03 20:29:22.000000000 +0200
1.97 +@@ -603,7 +603,7 @@
1.98 +
1.99 + # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
1.100 + case $host_os in
1.101 +-linux-gnu*) ;;
1.102 ++linux-gnu*|linux-uclibc*) ;;
1.103 + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
1.104 + esac
1.105 +
1.106 +@@ -1251,7 +1251,7 @@
1.107 + ;;
1.108 +
1.109 + # This must be Linux ELF.
1.110 +-linux-gnu*)
1.111 ++linux*)
1.112 + version_type=linux
1.113 + need_lib_prefix=no
1.114 + need_version=no
1.115 +diff -durN gcc-4.2.1.orig/libjava/configure gcc-4.2.1/libjava/configure
1.116 +--- gcc-4.2.1.orig/libjava/configure 2007-07-19 16:33:56.000000000 +0200
1.117 ++++ gcc-4.2.1/libjava/configure 2007-08-03 20:29:22.000000000 +0200
1.118 +@@ -5424,7 +5424,7 @@
1.119 + ;;
1.120 +
1.121 + # This must be Linux ELF.
1.122 +-linux-gnu*)
1.123 ++linux*)
1.124 + lt_cv_deplibs_check_method=pass_all
1.125 + ;;
1.126 +
1.127 +diff -durN gcc-4.2.1.orig/libmudflap/configure gcc-4.2.1/libmudflap/configure
1.128 +--- gcc-4.2.1.orig/libmudflap/configure 2006-12-04 12:13:07.000000000 +0100
1.129 ++++ gcc-4.2.1/libmudflap/configure 2007-08-03 20:29:22.000000000 +0200
1.130 +@@ -5394,7 +5394,7 @@
1.131 + ;;
1.132 +
1.133 + # This must be Linux ELF.
1.134 +-linux-gnu*)
1.135 ++linux*)
1.136 + lt_cv_deplibs_check_method=pass_all
1.137 + ;;
1.138 +
1.139 +diff -durN gcc-4.2.1.orig/libobjc/configure gcc-4.2.1/libobjc/configure
1.140 +--- gcc-4.2.1.orig/libobjc/configure 2006-10-15 09:42:57.000000000 +0200
1.141 ++++ gcc-4.2.1/libobjc/configure 2007-08-03 20:29:22.000000000 +0200
1.142 +@@ -3314,7 +3314,7 @@
1.143 + ;;
1.144 +
1.145 + # This must be Linux ELF.
1.146 +-linux-gnu*)
1.147 ++linux*)
1.148 + lt_cv_deplibs_check_method=pass_all
1.149 + ;;
1.150 +
1.151 +diff -durN gcc-4.2.1.orig/libssp/configure gcc-4.2.1/libssp/configure
1.152 +--- gcc-4.2.1.orig/libssp/configure 2006-10-15 09:42:57.000000000 +0200
1.153 ++++ gcc-4.2.1/libssp/configure 2007-08-03 20:29:22.000000000 +0200
1.154 +@@ -4480,7 +4480,7 @@
1.155 + ;;
1.156 +
1.157 + # This must be Linux ELF.
1.158 +-linux-gnu*)
1.159 ++linux*)
1.160 + lt_cv_deplibs_check_method=pass_all
1.161 + ;;
1.162 +
1.163 +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
1.164 +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-06-29 01:02:05.000000000 +0200
1.165 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200
1.166 +@@ -4283,7 +4283,7 @@
1.167 + ;;
1.168 +
1.169 + # This must be Linux ELF.
1.170 +-linux-gnu*)
1.171 ++linux*)
1.172 + lt_cv_deplibs_check_method=pass_all
1.173 + ;;
1.174 +
1.175 +diff -durN gcc-4.2.1.orig/libtool.m4 gcc-4.2.1/libtool.m4
1.176 +--- gcc-4.2.1.orig/libtool.m4 2005-07-16 04:30:53.000000000 +0200
1.177 ++++ gcc-4.2.1/libtool.m4 2007-08-03 20:29:22.000000000 +0200
1.178 +@@ -739,7 +739,7 @@
1.179 + ;;
1.180 +
1.181 + # This must be Linux ELF.
1.182 +-linux-gnu*)
1.183 ++linux*)
1.184 + lt_cv_deplibs_check_method=pass_all
1.185 + ;;
1.186 +
1.187 +diff -durN gcc-4.2.1.orig/ltconfig gcc-4.2.1/ltconfig
1.188 +--- gcc-4.2.1.orig/ltconfig 2007-02-14 18:08:35.000000000 +0100
1.189 ++++ gcc-4.2.1/ltconfig 2007-08-03 20:29:22.000000000 +0200
1.190 +@@ -603,7 +603,7 @@
1.191 +
1.192 + # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
1.193 + case $host_os in
1.194 +-linux-gnu*) ;;
1.195 ++linux-gnu*|linux-uclibc*) ;;
1.196 + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
1.197 + esac
1.198 +
1.199 +@@ -1251,7 +1251,7 @@
1.200 + ;;
1.201 +
1.202 + # This must be Linux ELF.
1.203 +-linux-gnu*)
1.204 ++linux*)
1.205 + version_type=linux
1.206 + need_lib_prefix=no
1.207 + need_version=no
1.208 +diff -durN gcc-4.2.1.orig/zlib/configure gcc-4.2.1/zlib/configure
1.209 +--- gcc-4.2.1.orig/zlib/configure 2007-01-17 19:10:26.000000000 +0100
1.210 ++++ gcc-4.2.1/zlib/configure 2007-08-03 20:29:22.000000000 +0200
1.211 +@@ -3429,7 +3429,7 @@
1.212 + ;;
1.213 +
1.214 + # This must be Linux ELF.
1.215 +-linux-gnu*)
1.216 ++linux*)
1.217 + lt_cv_deplibs_check_method=pass_all
1.218 + ;;
1.219 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/patches/gcc/4.2.2/103-uclibc-conf-noupstream.patch Sun Feb 17 22:08:06 2008 +0000
2.3 @@ -0,0 +1,12 @@
2.4 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc
2.5 +--- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100
2.6 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200
2.7 +@@ -1964,7 +1964,7 @@
2.8 + ;;
2.9 + sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
2.10 + sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
2.11 +- sh-*-linux* | sh[346lbe]*-*-linux* | \
2.12 ++ sh*-*-linux* | sh[346lbe]*-*-linux* | \
2.13 + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
2.14 + sh64-*-netbsd* | sh64l*-*-netbsd*)
2.15 + tmake_file="${tmake_file} sh/t-sh sh/t-elf"
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/patches/gcc/4.2.2/200-uclibc-locale.patch Sun Feb 17 22:08:06 2008 +0000
3.3 @@ -0,0 +1,2806 @@
3.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4
3.5 +--- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200
3.6 ++++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200
3.7 +@@ -1334,7 +1334,7 @@
3.8 + AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
3.9 + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
3.10 + [use MODEL for target locale package],
3.11 +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
3.12 ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
3.13 +
3.14 + # Deal with gettext issues. Default to not using it (=no) until we detect
3.15 + # support for it later. Let the user turn it off via --e/d, but let that
3.16 +@@ -1355,6 +1355,9 @@
3.17 + # Default to "generic".
3.18 + if test $enable_clocale_flag = auto; then
3.19 + case ${target_os} in
3.20 ++ *-uclibc*)
3.21 ++ enable_clocale_flag=uclibc
3.22 ++ ;;
3.23 + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
3.24 + enable_clocale_flag=gnu
3.25 + ;;
3.26 +@@ -1526,6 +1529,40 @@
3.27 + CTIME_CC=config/locale/generic/time_members.cc
3.28 + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3.29 + ;;
3.30 ++ uclibc)
3.31 ++ AC_MSG_RESULT(uclibc)
3.32 ++
3.33 ++ # Declare intention to use gettext, and add support for specific
3.34 ++ # languages.
3.35 ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3.36 ++ ALL_LINGUAS="de fr"
3.37 ++
3.38 ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3.39 ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
3.40 ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3.41 ++ USE_NLS=yes
3.42 ++ fi
3.43 ++ # Export the build objects.
3.44 ++ for ling in $ALL_LINGUAS; do \
3.45 ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3.46 ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3.47 ++ done
3.48 ++ AC_SUBST(glibcxx_MOFILES)
3.49 ++ AC_SUBST(glibcxx_POFILES)
3.50 ++
3.51 ++ CLOCALE_H=config/locale/uclibc/c_locale.h
3.52 ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
3.53 ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3.54 ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3.55 ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3.56 ++ CMESSAGES_H=config/locale/uclibc/messages_members.h
3.57 ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3.58 ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
3.59 ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3.60 ++ CTIME_H=config/locale/uclibc/time_members.h
3.61 ++ CTIME_CC=config/locale/uclibc/time_members.cc
3.62 ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3.63 ++ ;;
3.64 + esac
3.65 +
3.66 + # This is where the testsuite looks for locale catalogs, using the
3.67 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
3.68 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100
3.69 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200
3.70 +@@ -0,0 +1,160 @@
3.71 ++// Wrapper for underlying C-language localization -*- C++ -*-
3.72 ++
3.73 ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
3.74 ++//
3.75 ++// This file is part of the GNU ISO C++ Library. This library is free
3.76 ++// software; you can redistribute it and/or modify it under the
3.77 ++// terms of the GNU General Public License as published by the
3.78 ++// Free Software Foundation; either version 2, or (at your option)
3.79 ++// any later version.
3.80 ++
3.81 ++// This library is distributed in the hope that it will be useful,
3.82 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.83 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.84 ++// GNU General Public License for more details.
3.85 ++
3.86 ++// You should have received a copy of the GNU General Public License along
3.87 ++// with this library; see the file COPYING. If not, write to the Free
3.88 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.89 ++// USA.
3.90 ++
3.91 ++// As a special exception, you may use this file as part of a free software
3.92 ++// library without restriction. Specifically, if other files instantiate
3.93 ++// templates or use macros or inline functions from this file, or you compile
3.94 ++// this file and link it with other files to produce an executable, this
3.95 ++// file does not by itself cause the resulting executable to be covered by
3.96 ++// the GNU General Public License. This exception does not however
3.97 ++// invalidate any other reasons why the executable file might be covered by
3.98 ++// the GNU General Public License.
3.99 ++
3.100 ++//
3.101 ++// ISO C++ 14882: 22.8 Standard locale categories.
3.102 ++//
3.103 ++
3.104 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.105 ++
3.106 ++#include <cerrno> // For errno
3.107 ++#include <locale>
3.108 ++#include <stdexcept>
3.109 ++#include <langinfo.h>
3.110 ++#include <bits/c++locale_internal.h>
3.111 ++
3.112 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.113 ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
3.114 ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
3.115 ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
3.116 ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
3.117 ++#define __strtof_l(S, E, L) strtof((S), (E))
3.118 ++#define __strtod_l(S, E, L) strtod((S), (E))
3.119 ++#define __strtold_l(S, E, L) strtold((S), (E))
3.120 ++#warning should dummy __newlocale check for C|POSIX ?
3.121 ++#define __newlocale(a, b, c) NULL
3.122 ++#define __freelocale(a) ((void)0)
3.123 ++#define __duplocale(a) __c_locale()
3.124 ++#endif
3.125 ++
3.126 ++namespace std
3.127 ++{
3.128 ++ template<>
3.129 ++ void
3.130 ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
3.131 ++ const __c_locale& __cloc)
3.132 ++ {
3.133 ++ if (!(__err & ios_base::failbit))
3.134 ++ {
3.135 ++ char* __sanity;
3.136 ++ errno = 0;
3.137 ++ float __f = __strtof_l(__s, &__sanity, __cloc);
3.138 ++ if (__sanity != __s && errno != ERANGE)
3.139 ++ __v = __f;
3.140 ++ else
3.141 ++ __err |= ios_base::failbit;
3.142 ++ }
3.143 ++ }
3.144 ++
3.145 ++ template<>
3.146 ++ void
3.147 ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
3.148 ++ const __c_locale& __cloc)
3.149 ++ {
3.150 ++ if (!(__err & ios_base::failbit))
3.151 ++ {
3.152 ++ char* __sanity;
3.153 ++ errno = 0;
3.154 ++ double __d = __strtod_l(__s, &__sanity, __cloc);
3.155 ++ if (__sanity != __s && errno != ERANGE)
3.156 ++ __v = __d;
3.157 ++ else
3.158 ++ __err |= ios_base::failbit;
3.159 ++ }
3.160 ++ }
3.161 ++
3.162 ++ template<>
3.163 ++ void
3.164 ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
3.165 ++ const __c_locale& __cloc)
3.166 ++ {
3.167 ++ if (!(__err & ios_base::failbit))
3.168 ++ {
3.169 ++ char* __sanity;
3.170 ++ errno = 0;
3.171 ++ long double __ld = __strtold_l(__s, &__sanity, __cloc);
3.172 ++ if (__sanity != __s && errno != ERANGE)
3.173 ++ __v = __ld;
3.174 ++ else
3.175 ++ __err |= ios_base::failbit;
3.176 ++ }
3.177 ++ }
3.178 ++
3.179 ++ void
3.180 ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
3.181 ++ __c_locale __old)
3.182 ++ {
3.183 ++ __cloc = __newlocale(1 << LC_ALL, __s, __old);
3.184 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.185 ++ if (!__cloc)
3.186 ++ {
3.187 ++ // This named locale is not supported by the underlying OS.
3.188 ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
3.189 ++ "name not valid"));
3.190 ++ }
3.191 ++#endif
3.192 ++ }
3.193 ++
3.194 ++ void
3.195 ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
3.196 ++ {
3.197 ++ if (_S_get_c_locale() != __cloc)
3.198 ++ __freelocale(__cloc);
3.199 ++ }
3.200 ++
3.201 ++ __c_locale
3.202 ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
3.203 ++ { return __duplocale(__cloc); }
3.204 ++} // namespace std
3.205 ++
3.206 ++namespace __gnu_cxx
3.207 ++{
3.208 ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
3.209 ++ {
3.210 ++ "LC_CTYPE",
3.211 ++ "LC_NUMERIC",
3.212 ++ "LC_TIME",
3.213 ++ "LC_COLLATE",
3.214 ++ "LC_MONETARY",
3.215 ++ "LC_MESSAGES",
3.216 ++#if _GLIBCXX_NUM_CATEGORIES != 0
3.217 ++ "LC_PAPER",
3.218 ++ "LC_NAME",
3.219 ++ "LC_ADDRESS",
3.220 ++ "LC_TELEPHONE",
3.221 ++ "LC_MEASUREMENT",
3.222 ++ "LC_IDENTIFICATION"
3.223 ++#endif
3.224 ++ };
3.225 ++}
3.226 ++
3.227 ++namespace std
3.228 ++{
3.229 ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
3.230 ++} // namespace std
3.231 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h
3.232 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100
3.233 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200
3.234 +@@ -0,0 +1,117 @@
3.235 ++// Wrapper for underlying C-language localization -*- C++ -*-
3.236 ++
3.237 ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3.238 ++//
3.239 ++// This file is part of the GNU ISO C++ Library. This library is free
3.240 ++// software; you can redistribute it and/or modify it under the
3.241 ++// terms of the GNU General Public License as published by the
3.242 ++// Free Software Foundation; either version 2, or (at your option)
3.243 ++// any later version.
3.244 ++
3.245 ++// This library is distributed in the hope that it will be useful,
3.246 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.247 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.248 ++// GNU General Public License for more details.
3.249 ++
3.250 ++// You should have received a copy of the GNU General Public License along
3.251 ++// with this library; see the file COPYING. If not, write to the Free
3.252 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.253 ++// USA.
3.254 ++
3.255 ++// As a special exception, you may use this file as part of a free software
3.256 ++// library without restriction. Specifically, if other files instantiate
3.257 ++// templates or use macros or inline functions from this file, or you compile
3.258 ++// this file and link it with other files to produce an executable, this
3.259 ++// file does not by itself cause the resulting executable to be covered by
3.260 ++// the GNU General Public License. This exception does not however
3.261 ++// invalidate any other reasons why the executable file might be covered by
3.262 ++// the GNU General Public License.
3.263 ++
3.264 ++//
3.265 ++// ISO C++ 14882: 22.8 Standard locale categories.
3.266 ++//
3.267 ++
3.268 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.269 ++
3.270 ++#ifndef _C_LOCALE_H
3.271 ++#define _C_LOCALE_H 1
3.272 ++
3.273 ++#pragma GCC system_header
3.274 ++
3.275 ++#include <cstring> // get std::strlen
3.276 ++#include <cstdio> // get std::snprintf or std::sprintf
3.277 ++#include <clocale>
3.278 ++#include <langinfo.h> // For codecvt
3.279 ++#ifdef __UCLIBC_MJN3_ONLY__
3.280 ++#warning fix this
3.281 ++#endif
3.282 ++#ifdef __UCLIBC_HAS_LOCALE__
3.283 ++#include <iconv.h> // For codecvt using iconv, iconv_t
3.284 ++#endif
3.285 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
3.286 ++#include <libintl.h> // For messages
3.287 ++#endif
3.288 ++
3.289 ++#ifdef __UCLIBC_MJN3_ONLY__
3.290 ++#warning what is _GLIBCXX_C_LOCALE_GNU for
3.291 ++#endif
3.292 ++#define _GLIBCXX_C_LOCALE_GNU 1
3.293 ++
3.294 ++#ifdef __UCLIBC_MJN3_ONLY__
3.295 ++#warning fix categories
3.296 ++#endif
3.297 ++// #define _GLIBCXX_NUM_CATEGORIES 6
3.298 ++#define _GLIBCXX_NUM_CATEGORIES 0
3.299 ++
3.300 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.301 ++namespace __gnu_cxx
3.302 ++{
3.303 ++ extern "C" __typeof(uselocale) __uselocale;
3.304 ++}
3.305 ++#endif
3.306 ++
3.307 ++namespace std
3.308 ++{
3.309 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.310 ++ typedef __locale_t __c_locale;
3.311 ++#else
3.312 ++ typedef int* __c_locale;
3.313 ++#endif
3.314 ++
3.315 ++ // Convert numeric value of type _Tv to string and return length of
3.316 ++ // string. If snprintf is available use it, otherwise fall back to
3.317 ++ // the unsafe sprintf which, in general, can be dangerous and should
3.318 ++ // be avoided.
3.319 ++ template<typename _Tv>
3.320 ++ int
3.321 ++ __convert_from_v(char* __out,
3.322 ++ const int __size __attribute__ ((__unused__)),
3.323 ++ const char* __fmt,
3.324 ++#ifdef __UCLIBC_HAS_XCLOCALE__
3.325 ++ _Tv __v, const __c_locale& __cloc, int __prec)
3.326 ++ {
3.327 ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
3.328 ++#else
3.329 ++ _Tv __v, const __c_locale&, int __prec)
3.330 ++ {
3.331 ++# ifdef __UCLIBC_HAS_LOCALE__
3.332 ++ char* __old = std::setlocale(LC_ALL, NULL);
3.333 ++ char* __sav = new char[std::strlen(__old) + 1];
3.334 ++ std::strcpy(__sav, __old);
3.335 ++ std::setlocale(LC_ALL, "C");
3.336 ++# endif
3.337 ++#endif
3.338 ++
3.339 ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
3.340 ++
3.341 ++#ifdef __UCLIBC_HAS_XCLOCALE__
3.342 ++ __gnu_cxx::__uselocale(__old);
3.343 ++#elif defined __UCLIBC_HAS_LOCALE__
3.344 ++ std::setlocale(LC_ALL, __sav);
3.345 ++ delete [] __sav;
3.346 ++#endif
3.347 ++ return __ret;
3.348 ++ }
3.349 ++}
3.350 ++
3.351 ++#endif
3.352 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
3.353 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100
3.354 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200
3.355 +@@ -0,0 +1,63 @@
3.356 ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
3.357 ++
3.358 ++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
3.359 ++//
3.360 ++// This file is part of the GNU ISO C++ Library. This library is free
3.361 ++// software; you can redistribute it and/or modify it under the
3.362 ++// terms of the GNU General Public License as published by the
3.363 ++// Free Software Foundation; either version 2, or (at your option)
3.364 ++// any later version.
3.365 ++
3.366 ++// This library is distributed in the hope that it will be useful,
3.367 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.368 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.369 ++// GNU General Public License for more details.
3.370 ++
3.371 ++// You should have received a copy of the GNU General Public License along
3.372 ++// with this library; see the file COPYING. If not, write to the Free
3.373 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.374 ++// USA.
3.375 ++
3.376 ++// As a special exception, you may use this file as part of a free software
3.377 ++// library without restriction. Specifically, if other files instantiate
3.378 ++// templates or use macros or inline functions from this file, or you compile
3.379 ++// this file and link it with other files to produce an executable, this
3.380 ++// file does not by itself cause the resulting executable to be covered by
3.381 ++// the GNU General Public License. This exception does not however
3.382 ++// invalidate any other reasons why the executable file might be covered by
3.383 ++// the GNU General Public License.
3.384 ++
3.385 ++// Written by Jakub Jelinek <jakub@redhat.com>
3.386 ++
3.387 ++#include <bits/c++config.h>
3.388 ++#include <clocale>
3.389 ++
3.390 ++#ifdef __UCLIBC_MJN3_ONLY__
3.391 ++#warning clean this up
3.392 ++#endif
3.393 ++
3.394 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.395 ++
3.396 ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
3.397 ++extern "C" __typeof(strcoll_l) __strcoll_l;
3.398 ++extern "C" __typeof(strftime_l) __strftime_l;
3.399 ++extern "C" __typeof(strtod_l) __strtod_l;
3.400 ++extern "C" __typeof(strtof_l) __strtof_l;
3.401 ++extern "C" __typeof(strtold_l) __strtold_l;
3.402 ++extern "C" __typeof(strxfrm_l) __strxfrm_l;
3.403 ++extern "C" __typeof(newlocale) __newlocale;
3.404 ++extern "C" __typeof(freelocale) __freelocale;
3.405 ++extern "C" __typeof(duplocale) __duplocale;
3.406 ++extern "C" __typeof(uselocale) __uselocale;
3.407 ++
3.408 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.409 ++extern "C" __typeof(iswctype_l) __iswctype_l;
3.410 ++extern "C" __typeof(towlower_l) __towlower_l;
3.411 ++extern "C" __typeof(towupper_l) __towupper_l;
3.412 ++extern "C" __typeof(wcscoll_l) __wcscoll_l;
3.413 ++extern "C" __typeof(wcsftime_l) __wcsftime_l;
3.414 ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
3.415 ++extern "C" __typeof(wctype_l) __wctype_l;
3.416 ++#endif
3.417 ++
3.418 ++#endif // GLIBC 2.3 and later
3.419 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
3.420 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100
3.421 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200
3.422 +@@ -0,0 +1,306 @@
3.423 ++// std::codecvt implementation details, GNU version -*- C++ -*-
3.424 ++
3.425 ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3.426 ++//
3.427 ++// This file is part of the GNU ISO C++ Library. This library is free
3.428 ++// software; you can redistribute it and/or modify it under the
3.429 ++// terms of the GNU General Public License as published by the
3.430 ++// Free Software Foundation; either version 2, or (at your option)
3.431 ++// any later version.
3.432 ++
3.433 ++// This library is distributed in the hope that it will be useful,
3.434 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.435 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.436 ++// GNU General Public License for more details.
3.437 ++
3.438 ++// You should have received a copy of the GNU General Public License along
3.439 ++// with this library; see the file COPYING. If not, write to the Free
3.440 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.441 ++// USA.
3.442 ++
3.443 ++// As a special exception, you may use this file as part of a free software
3.444 ++// library without restriction. Specifically, if other files instantiate
3.445 ++// templates or use macros or inline functions from this file, or you compile
3.446 ++// this file and link it with other files to produce an executable, this
3.447 ++// file does not by itself cause the resulting executable to be covered by
3.448 ++// the GNU General Public License. This exception does not however
3.449 ++// invalidate any other reasons why the executable file might be covered by
3.450 ++// the GNU General Public License.
3.451 ++
3.452 ++//
3.453 ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt
3.454 ++//
3.455 ++
3.456 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.457 ++
3.458 ++#include <locale>
3.459 ++#include <bits/c++locale_internal.h>
3.460 ++
3.461 ++namespace std
3.462 ++{
3.463 ++ // Specializations.
3.464 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.465 ++ codecvt_base::result
3.466 ++ codecvt<wchar_t, char, mbstate_t>::
3.467 ++ do_out(state_type& __state, const intern_type* __from,
3.468 ++ const intern_type* __from_end, const intern_type*& __from_next,
3.469 ++ extern_type* __to, extern_type* __to_end,
3.470 ++ extern_type*& __to_next) const
3.471 ++ {
3.472 ++ result __ret = ok;
3.473 ++ state_type __tmp_state(__state);
3.474 ++
3.475 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.476 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.477 ++#endif
3.478 ++
3.479 ++ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
3.480 ++ // in case we fall back to wcrtomb and then continue, in a loop.
3.481 ++ // NB: wcsnrtombs is a GNU extension
3.482 ++ for (__from_next = __from, __to_next = __to;
3.483 ++ __from_next < __from_end && __to_next < __to_end
3.484 ++ && __ret == ok;)
3.485 ++ {
3.486 ++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
3.487 ++ __from_end - __from_next);
3.488 ++ if (!__from_chunk_end)
3.489 ++ __from_chunk_end = __from_end;
3.490 ++
3.491 ++ __from = __from_next;
3.492 ++ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
3.493 ++ __from_chunk_end - __from_next,
3.494 ++ __to_end - __to_next, &__state);
3.495 ++ if (__conv == static_cast<size_t>(-1))
3.496 ++ {
3.497 ++ // In case of error, in order to stop at the exact place we
3.498 ++ // have to start again from the beginning with a series of
3.499 ++ // wcrtomb.
3.500 ++ for (; __from < __from_next; ++__from)
3.501 ++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
3.502 ++ __state = __tmp_state;
3.503 ++ __ret = error;
3.504 ++ }
3.505 ++ else if (__from_next && __from_next < __from_chunk_end)
3.506 ++ {
3.507 ++ __to_next += __conv;
3.508 ++ __ret = partial;
3.509 ++ }
3.510 ++ else
3.511 ++ {
3.512 ++ __from_next = __from_chunk_end;
3.513 ++ __to_next += __conv;
3.514 ++ }
3.515 ++
3.516 ++ if (__from_next < __from_end && __ret == ok)
3.517 ++ {
3.518 ++ extern_type __buf[MB_LEN_MAX];
3.519 ++ __tmp_state = __state;
3.520 ++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
3.521 ++ if (__conv > static_cast<size_t>(__to_end - __to_next))
3.522 ++ __ret = partial;
3.523 ++ else
3.524 ++ {
3.525 ++ memcpy(__to_next, __buf, __conv);
3.526 ++ __state = __tmp_state;
3.527 ++ __to_next += __conv;
3.528 ++ ++__from_next;
3.529 ++ }
3.530 ++ }
3.531 ++ }
3.532 ++
3.533 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.534 ++ __uselocale(__old);
3.535 ++#endif
3.536 ++
3.537 ++ return __ret;
3.538 ++ }
3.539 ++
3.540 ++ codecvt_base::result
3.541 ++ codecvt<wchar_t, char, mbstate_t>::
3.542 ++ do_in(state_type& __state, const extern_type* __from,
3.543 ++ const extern_type* __from_end, const extern_type*& __from_next,
3.544 ++ intern_type* __to, intern_type* __to_end,
3.545 ++ intern_type*& __to_next) const
3.546 ++ {
3.547 ++ result __ret = ok;
3.548 ++ state_type __tmp_state(__state);
3.549 ++
3.550 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.551 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.552 ++#endif
3.553 ++
3.554 ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
3.555 ++ // in case we store a L'\0' and then continue, in a loop.
3.556 ++ // NB: mbsnrtowcs is a GNU extension
3.557 ++ for (__from_next = __from, __to_next = __to;
3.558 ++ __from_next < __from_end && __to_next < __to_end
3.559 ++ && __ret == ok;)
3.560 ++ {
3.561 ++ const extern_type* __from_chunk_end;
3.562 ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
3.563 ++ __from_end
3.564 ++ - __from_next));
3.565 ++ if (!__from_chunk_end)
3.566 ++ __from_chunk_end = __from_end;
3.567 ++
3.568 ++ __from = __from_next;
3.569 ++ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
3.570 ++ __from_chunk_end - __from_next,
3.571 ++ __to_end - __to_next, &__state);
3.572 ++ if (__conv == static_cast<size_t>(-1))
3.573 ++ {
3.574 ++ // In case of error, in order to stop at the exact place we
3.575 ++ // have to start again from the beginning with a series of
3.576 ++ // mbrtowc.
3.577 ++ for (;; ++__to_next, __from += __conv)
3.578 ++ {
3.579 ++ __conv = mbrtowc(__to_next, __from, __from_end - __from,
3.580 ++ &__tmp_state);
3.581 ++ if (__conv == static_cast<size_t>(-1)
3.582 ++ || __conv == static_cast<size_t>(-2))
3.583 ++ break;
3.584 ++ }
3.585 ++ __from_next = __from;
3.586 ++ __state = __tmp_state;
3.587 ++ __ret = error;
3.588 ++ }
3.589 ++ else if (__from_next && __from_next < __from_chunk_end)
3.590 ++ {
3.591 ++ // It is unclear what to return in this case (see DR 382).
3.592 ++ __to_next += __conv;
3.593 ++ __ret = partial;
3.594 ++ }
3.595 ++ else
3.596 ++ {
3.597 ++ __from_next = __from_chunk_end;
3.598 ++ __to_next += __conv;
3.599 ++ }
3.600 ++
3.601 ++ if (__from_next < __from_end && __ret == ok)
3.602 ++ {
3.603 ++ if (__to_next < __to_end)
3.604 ++ {
3.605 ++ // XXX Probably wrong for stateful encodings
3.606 ++ __tmp_state = __state;
3.607 ++ ++__from_next;
3.608 ++ *__to_next++ = L'\0';
3.609 ++ }
3.610 ++ else
3.611 ++ __ret = partial;
3.612 ++ }
3.613 ++ }
3.614 ++
3.615 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.616 ++ __uselocale(__old);
3.617 ++#endif
3.618 ++
3.619 ++ return __ret;
3.620 ++ }
3.621 ++
3.622 ++ int
3.623 ++ codecvt<wchar_t, char, mbstate_t>::
3.624 ++ do_encoding() const throw()
3.625 ++ {
3.626 ++ // XXX This implementation assumes that the encoding is
3.627 ++ // stateless and is either single-byte or variable-width.
3.628 ++ int __ret = 0;
3.629 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.630 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.631 ++#endif
3.632 ++ if (MB_CUR_MAX == 1)
3.633 ++ __ret = 1;
3.634 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.635 ++ __uselocale(__old);
3.636 ++#endif
3.637 ++ return __ret;
3.638 ++ }
3.639 ++
3.640 ++ int
3.641 ++ codecvt<wchar_t, char, mbstate_t>::
3.642 ++ do_max_length() const throw()
3.643 ++ {
3.644 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.645 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.646 ++#endif
3.647 ++ // XXX Probably wrong for stateful encodings.
3.648 ++ int __ret = MB_CUR_MAX;
3.649 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.650 ++ __uselocale(__old);
3.651 ++#endif
3.652 ++ return __ret;
3.653 ++ }
3.654 ++
3.655 ++ int
3.656 ++ codecvt<wchar_t, char, mbstate_t>::
3.657 ++ do_length(state_type& __state, const extern_type* __from,
3.658 ++ const extern_type* __end, size_t __max) const
3.659 ++ {
3.660 ++ int __ret = 0;
3.661 ++ state_type __tmp_state(__state);
3.662 ++
3.663 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.664 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.665 ++#endif
3.666 ++
3.667 ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
3.668 ++ // in case we advance past it and then continue, in a loop.
3.669 ++ // NB: mbsnrtowcs is a GNU extension
3.670 ++
3.671 ++ // A dummy internal buffer is needed in order for mbsnrtocws to consider
3.672 ++ // its fourth parameter (it wouldn't with NULL as first parameter).
3.673 ++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
3.674 ++ * __max));
3.675 ++ while (__from < __end && __max)
3.676 ++ {
3.677 ++ const extern_type* __from_chunk_end;
3.678 ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
3.679 ++ __end
3.680 ++ - __from));
3.681 ++ if (!__from_chunk_end)
3.682 ++ __from_chunk_end = __end;
3.683 ++
3.684 ++ const extern_type* __tmp_from = __from;
3.685 ++ size_t __conv = mbsnrtowcs(__to, &__from,
3.686 ++ __from_chunk_end - __from,
3.687 ++ __max, &__state);
3.688 ++ if (__conv == static_cast<size_t>(-1))
3.689 ++ {
3.690 ++ // In case of error, in order to stop at the exact place we
3.691 ++ // have to start again from the beginning with a series of
3.692 ++ // mbrtowc.
3.693 ++ for (__from = __tmp_from;; __from += __conv)
3.694 ++ {
3.695 ++ __conv = mbrtowc(NULL, __from, __end - __from,
3.696 ++ &__tmp_state);
3.697 ++ if (__conv == static_cast<size_t>(-1)
3.698 ++ || __conv == static_cast<size_t>(-2))
3.699 ++ break;
3.700 ++ }
3.701 ++ __state = __tmp_state;
3.702 ++ __ret += __from - __tmp_from;
3.703 ++ break;
3.704 ++ }
3.705 ++ if (!__from)
3.706 ++ __from = __from_chunk_end;
3.707 ++
3.708 ++ __ret += __from - __tmp_from;
3.709 ++ __max -= __conv;
3.710 ++
3.711 ++ if (__from < __end && __max)
3.712 ++ {
3.713 ++ // XXX Probably wrong for stateful encodings
3.714 ++ __tmp_state = __state;
3.715 ++ ++__from;
3.716 ++ ++__ret;
3.717 ++ --__max;
3.718 ++ }
3.719 ++ }
3.720 ++
3.721 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.722 ++ __uselocale(__old);
3.723 ++#endif
3.724 ++
3.725 ++ return __ret;
3.726 ++ }
3.727 ++#endif
3.728 ++}
3.729 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc
3.730 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100
3.731 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200
3.732 +@@ -0,0 +1,80 @@
3.733 ++// std::collate implementation details, GNU version -*- C++ -*-
3.734 ++
3.735 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3.736 ++//
3.737 ++// This file is part of the GNU ISO C++ Library. This library is free
3.738 ++// software; you can redistribute it and/or modify it under the
3.739 ++// terms of the GNU General Public License as published by the
3.740 ++// Free Software Foundation; either version 2, or (at your option)
3.741 ++// any later version.
3.742 ++
3.743 ++// This library is distributed in the hope that it will be useful,
3.744 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.745 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.746 ++// GNU General Public License for more details.
3.747 ++
3.748 ++// You should have received a copy of the GNU General Public License along
3.749 ++// with this library; see the file COPYING. If not, write to the Free
3.750 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.751 ++// USA.
3.752 ++
3.753 ++// As a special exception, you may use this file as part of a free software
3.754 ++// library without restriction. Specifically, if other files instantiate
3.755 ++// templates or use macros or inline functions from this file, or you compile
3.756 ++// this file and link it with other files to produce an executable, this
3.757 ++// file does not by itself cause the resulting executable to be covered by
3.758 ++// the GNU General Public License. This exception does not however
3.759 ++// invalidate any other reasons why the executable file might be covered by
3.760 ++// the GNU General Public License.
3.761 ++
3.762 ++//
3.763 ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
3.764 ++//
3.765 ++
3.766 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.767 ++
3.768 ++#include <locale>
3.769 ++#include <bits/c++locale_internal.h>
3.770 ++
3.771 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.772 ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
3.773 ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
3.774 ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
3.775 ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
3.776 ++#endif
3.777 ++
3.778 ++namespace std
3.779 ++{
3.780 ++ // These are basically extensions to char_traits, and perhaps should
3.781 ++ // be put there instead of here.
3.782 ++ template<>
3.783 ++ int
3.784 ++ collate<char>::_M_compare(const char* __one, const char* __two) const
3.785 ++ {
3.786 ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
3.787 ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
3.788 ++ }
3.789 ++
3.790 ++ template<>
3.791 ++ size_t
3.792 ++ collate<char>::_M_transform(char* __to, const char* __from,
3.793 ++ size_t __n) const
3.794 ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
3.795 ++
3.796 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.797 ++ template<>
3.798 ++ int
3.799 ++ collate<wchar_t>::_M_compare(const wchar_t* __one,
3.800 ++ const wchar_t* __two) const
3.801 ++ {
3.802 ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
3.803 ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
3.804 ++ }
3.805 ++
3.806 ++ template<>
3.807 ++ size_t
3.808 ++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
3.809 ++ size_t __n) const
3.810 ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
3.811 ++#endif
3.812 ++}
3.813 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
3.814 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100
3.815 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200
3.816 +@@ -0,0 +1,300 @@
3.817 ++// std::ctype implementation details, GNU version -*- C++ -*-
3.818 ++
3.819 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.820 ++//
3.821 ++// This file is part of the GNU ISO C++ Library. This library is free
3.822 ++// software; you can redistribute it and/or modify it under the
3.823 ++// terms of the GNU General Public License as published by the
3.824 ++// Free Software Foundation; either version 2, or (at your option)
3.825 ++// any later version.
3.826 ++
3.827 ++// This library is distributed in the hope that it will be useful,
3.828 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.829 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.830 ++// GNU General Public License for more details.
3.831 ++
3.832 ++// You should have received a copy of the GNU General Public License along
3.833 ++// with this library; see the file COPYING. If not, write to the Free
3.834 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.835 ++// USA.
3.836 ++
3.837 ++// As a special exception, you may use this file as part of a free software
3.838 ++// library without restriction. Specifically, if other files instantiate
3.839 ++// templates or use macros or inline functions from this file, or you compile
3.840 ++// this file and link it with other files to produce an executable, this
3.841 ++// file does not by itself cause the resulting executable to be covered by
3.842 ++// the GNU General Public License. This exception does not however
3.843 ++// invalidate any other reasons why the executable file might be covered by
3.844 ++// the GNU General Public License.
3.845 ++
3.846 ++//
3.847 ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
3.848 ++//
3.849 ++
3.850 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.851 ++
3.852 ++#define _LIBC
3.853 ++#include <locale>
3.854 ++#undef _LIBC
3.855 ++#include <bits/c++locale_internal.h>
3.856 ++
3.857 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.858 ++#define __wctype_l(S, L) wctype((S))
3.859 ++#define __towupper_l(C, L) towupper((C))
3.860 ++#define __towlower_l(C, L) towlower((C))
3.861 ++#define __iswctype_l(C, M, L) iswctype((C), (M))
3.862 ++#endif
3.863 ++
3.864 ++namespace std
3.865 ++{
3.866 ++ // NB: The other ctype<char> specializations are in src/locale.cc and
3.867 ++ // various /config/os/* files.
3.868 ++ template<>
3.869 ++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
3.870 ++ : ctype<char>(0, false, __refs)
3.871 ++ {
3.872 ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
3.873 ++ {
3.874 ++ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
3.875 ++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
3.876 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.877 ++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
3.878 ++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
3.879 ++ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
3.880 ++#endif
3.881 ++ }
3.882 ++ }
3.883 ++
3.884 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.885 ++ ctype<wchar_t>::__wmask_type
3.886 ++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
3.887 ++ {
3.888 ++ __wmask_type __ret;
3.889 ++ switch (__m)
3.890 ++ {
3.891 ++ case space:
3.892 ++ __ret = __wctype_l("space", _M_c_locale_ctype);
3.893 ++ break;
3.894 ++ case print:
3.895 ++ __ret = __wctype_l("print", _M_c_locale_ctype);
3.896 ++ break;
3.897 ++ case cntrl:
3.898 ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
3.899 ++ break;
3.900 ++ case upper:
3.901 ++ __ret = __wctype_l("upper", _M_c_locale_ctype);
3.902 ++ break;
3.903 ++ case lower:
3.904 ++ __ret = __wctype_l("lower", _M_c_locale_ctype);
3.905 ++ break;
3.906 ++ case alpha:
3.907 ++ __ret = __wctype_l("alpha", _M_c_locale_ctype);
3.908 ++ break;
3.909 ++ case digit:
3.910 ++ __ret = __wctype_l("digit", _M_c_locale_ctype);
3.911 ++ break;
3.912 ++ case punct:
3.913 ++ __ret = __wctype_l("punct", _M_c_locale_ctype);
3.914 ++ break;
3.915 ++ case xdigit:
3.916 ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
3.917 ++ break;
3.918 ++ case alnum:
3.919 ++ __ret = __wctype_l("alnum", _M_c_locale_ctype);
3.920 ++ break;
3.921 ++ case graph:
3.922 ++ __ret = __wctype_l("graph", _M_c_locale_ctype);
3.923 ++ break;
3.924 ++ default:
3.925 ++ __ret = __wmask_type();
3.926 ++ }
3.927 ++ return __ret;
3.928 ++ }
3.929 ++
3.930 ++ wchar_t
3.931 ++ ctype<wchar_t>::do_toupper(wchar_t __c) const
3.932 ++ { return __towupper_l(__c, _M_c_locale_ctype); }
3.933 ++
3.934 ++ const wchar_t*
3.935 ++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
3.936 ++ {
3.937 ++ while (__lo < __hi)
3.938 ++ {
3.939 ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
3.940 ++ ++__lo;
3.941 ++ }
3.942 ++ return __hi;
3.943 ++ }
3.944 ++
3.945 ++ wchar_t
3.946 ++ ctype<wchar_t>::do_tolower(wchar_t __c) const
3.947 ++ { return __towlower_l(__c, _M_c_locale_ctype); }
3.948 ++
3.949 ++ const wchar_t*
3.950 ++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
3.951 ++ {
3.952 ++ while (__lo < __hi)
3.953 ++ {
3.954 ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
3.955 ++ ++__lo;
3.956 ++ }
3.957 ++ return __hi;
3.958 ++ }
3.959 ++
3.960 ++ bool
3.961 ++ ctype<wchar_t>::
3.962 ++ do_is(mask __m, wchar_t __c) const
3.963 ++ {
3.964 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
3.965 ++ // library for blank.
3.966 ++ bool __ret = false;
3.967 ++ const size_t __bitmasksize = 11;
3.968 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
3.969 ++ if (__m & _M_bit[__bitcur]
3.970 ++ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
3.971 ++ {
3.972 ++ __ret = true;
3.973 ++ break;
3.974 ++ }
3.975 ++ return __ret;
3.976 ++ }
3.977 ++
3.978 ++ const wchar_t*
3.979 ++ ctype<wchar_t>::
3.980 ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
3.981 ++ {
3.982 ++ for (; __lo < __hi; ++__vec, ++__lo)
3.983 ++ {
3.984 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
3.985 ++ // library for blank.
3.986 ++ const size_t __bitmasksize = 11;
3.987 ++ mask __m = 0;
3.988 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
3.989 ++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
3.990 ++ __m |= _M_bit[__bitcur];
3.991 ++ *__vec = __m;
3.992 ++ }
3.993 ++ return __hi;
3.994 ++ }
3.995 ++
3.996 ++ const wchar_t*
3.997 ++ ctype<wchar_t>::
3.998 ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
3.999 ++ {
3.1000 ++ while (__lo < __hi && !this->do_is(__m, *__lo))
3.1001 ++ ++__lo;
3.1002 ++ return __lo;
3.1003 ++ }
3.1004 ++
3.1005 ++ const wchar_t*
3.1006 ++ ctype<wchar_t>::
3.1007 ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
3.1008 ++ {
3.1009 ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
3.1010 ++ ++__lo;
3.1011 ++ return __lo;
3.1012 ++ }
3.1013 ++
3.1014 ++ wchar_t
3.1015 ++ ctype<wchar_t>::
3.1016 ++ do_widen(char __c) const
3.1017 ++ { return _M_widen[static_cast<unsigned char>(__c)]; }
3.1018 ++
3.1019 ++ const char*
3.1020 ++ ctype<wchar_t>::
3.1021 ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
3.1022 ++ {
3.1023 ++ while (__lo < __hi)
3.1024 ++ {
3.1025 ++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
3.1026 ++ ++__lo;
3.1027 ++ ++__dest;
3.1028 ++ }
3.1029 ++ return __hi;
3.1030 ++ }
3.1031 ++
3.1032 ++ char
3.1033 ++ ctype<wchar_t>::
3.1034 ++ do_narrow(wchar_t __wc, char __dfault) const
3.1035 ++ {
3.1036 ++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
3.1037 ++ return _M_narrow[__wc];
3.1038 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1039 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
3.1040 ++#endif
3.1041 ++ const int __c = wctob(__wc);
3.1042 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1043 ++ __uselocale(__old);
3.1044 ++#endif
3.1045 ++ return (__c == EOF ? __dfault : static_cast<char>(__c));
3.1046 ++ }
3.1047 ++
3.1048 ++ const wchar_t*
3.1049 ++ ctype<wchar_t>::
3.1050 ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
3.1051 ++ char* __dest) const
3.1052 ++ {
3.1053 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1054 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
3.1055 ++#endif
3.1056 ++ if (_M_narrow_ok)
3.1057 ++ while (__lo < __hi)
3.1058 ++ {
3.1059 ++ if (*__lo >= 0 && *__lo < 128)
3.1060 ++ *__dest = _M_narrow[*__lo];
3.1061 ++ else
3.1062 ++ {
3.1063 ++ const int __c = wctob(*__lo);
3.1064 ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
3.1065 ++ }
3.1066 ++ ++__lo;
3.1067 ++ ++__dest;
3.1068 ++ }
3.1069 ++ else
3.1070 ++ while (__lo < __hi)
3.1071 ++ {
3.1072 ++ const int __c = wctob(*__lo);
3.1073 ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
3.1074 ++ ++__lo;
3.1075 ++ ++__dest;
3.1076 ++ }
3.1077 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1078 ++ __uselocale(__old);
3.1079 ++#endif
3.1080 ++ return __hi;
3.1081 ++ }
3.1082 ++
3.1083 ++ void
3.1084 ++ ctype<wchar_t>::_M_initialize_ctype()
3.1085 ++ {
3.1086 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1087 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
3.1088 ++#endif
3.1089 ++ wint_t __i;
3.1090 ++ for (__i = 0; __i < 128; ++__i)
3.1091 ++ {
3.1092 ++ const int __c = wctob(__i);
3.1093 ++ if (__c == EOF)
3.1094 ++ break;
3.1095 ++ else
3.1096 ++ _M_narrow[__i] = static_cast<char>(__c);
3.1097 ++ }
3.1098 ++ if (__i == 128)
3.1099 ++ _M_narrow_ok = true;
3.1100 ++ else
3.1101 ++ _M_narrow_ok = false;
3.1102 ++ for (size_t __j = 0;
3.1103 ++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
3.1104 ++ _M_widen[__j] = btowc(__j);
3.1105 ++
3.1106 ++ for (size_t __k = 0; __k <= 11; ++__k)
3.1107 ++ {
3.1108 ++ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
3.1109 ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
3.1110 ++ }
3.1111 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1112 ++ __uselocale(__old);
3.1113 ++#endif
3.1114 ++ }
3.1115 ++#endif // _GLIBCXX_USE_WCHAR_T
3.1116 ++}
3.1117 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc
3.1118 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100
3.1119 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200
3.1120 +@@ -0,0 +1,100 @@
3.1121 ++// std::messages implementation details, GNU version -*- C++ -*-
3.1122 ++
3.1123 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3.1124 ++//
3.1125 ++// This file is part of the GNU ISO C++ Library. This library is free
3.1126 ++// software; you can redistribute it and/or modify it under the
3.1127 ++// terms of the GNU General Public License as published by the
3.1128 ++// Free Software Foundation; either version 2, or (at your option)
3.1129 ++// any later version.
3.1130 ++
3.1131 ++// This library is distributed in the hope that it will be useful,
3.1132 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.1133 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.1134 ++// GNU General Public License for more details.
3.1135 ++
3.1136 ++// You should have received a copy of the GNU General Public License along
3.1137 ++// with this library; see the file COPYING. If not, write to the Free
3.1138 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.1139 ++// USA.
3.1140 ++
3.1141 ++// As a special exception, you may use this file as part of a free software
3.1142 ++// library without restriction. Specifically, if other files instantiate
3.1143 ++// templates or use macros or inline functions from this file, or you compile
3.1144 ++// this file and link it with other files to produce an executable, this
3.1145 ++// file does not by itself cause the resulting executable to be covered by
3.1146 ++// the GNU General Public License. This exception does not however
3.1147 ++// invalidate any other reasons why the executable file might be covered by
3.1148 ++// the GNU General Public License.
3.1149 ++
3.1150 ++//
3.1151 ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
3.1152 ++//
3.1153 ++
3.1154 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.1155 ++
3.1156 ++#include <locale>
3.1157 ++#include <bits/c++locale_internal.h>
3.1158 ++
3.1159 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1160 ++#warning fix gettext stuff
3.1161 ++#endif
3.1162 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
3.1163 ++extern "C" char *__dcgettext(const char *domainname,
3.1164 ++ const char *msgid, int category);
3.1165 ++#undef gettext
3.1166 ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
3.1167 ++#else
3.1168 ++#undef gettext
3.1169 ++#define gettext(msgid) (msgid)
3.1170 ++#endif
3.1171 ++
3.1172 ++namespace std
3.1173 ++{
3.1174 ++ // Specializations.
3.1175 ++ template<>
3.1176 ++ string
3.1177 ++ messages<char>::do_get(catalog, int, int, const string& __dfault) const
3.1178 ++ {
3.1179 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1180 ++ __c_locale __old = __uselocale(_M_c_locale_messages);
3.1181 ++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
3.1182 ++ __uselocale(__old);
3.1183 ++ return string(__msg);
3.1184 ++#elif defined __UCLIBC_HAS_LOCALE__
3.1185 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.1186 ++ setlocale(LC_ALL, _M_name_messages);
3.1187 ++ const char* __msg = gettext(__dfault.c_str());
3.1188 ++ setlocale(LC_ALL, __old);
3.1189 ++ free(__old);
3.1190 ++ return string(__msg);
3.1191 ++#else
3.1192 ++ const char* __msg = gettext(__dfault.c_str());
3.1193 ++ return string(__msg);
3.1194 ++#endif
3.1195 ++ }
3.1196 ++
3.1197 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.1198 ++ template<>
3.1199 ++ wstring
3.1200 ++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
3.1201 ++ {
3.1202 ++# ifdef __UCLIBC_HAS_XLOCALE__
3.1203 ++ __c_locale __old = __uselocale(_M_c_locale_messages);
3.1204 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
3.1205 ++ __uselocale(__old);
3.1206 ++ return _M_convert_from_char(__msg);
3.1207 ++# elif defined __UCLIBC_HAS_LOCALE__
3.1208 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.1209 ++ setlocale(LC_ALL, _M_name_messages);
3.1210 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
3.1211 ++ setlocale(LC_ALL, __old);
3.1212 ++ free(__old);
3.1213 ++ return _M_convert_from_char(__msg);
3.1214 ++# else
3.1215 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
3.1216 ++ return _M_convert_from_char(__msg);
3.1217 ++# endif
3.1218 ++ }
3.1219 ++#endif
3.1220 ++}
3.1221 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
3.1222 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100
3.1223 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200
3.1224 +@@ -0,0 +1,118 @@
3.1225 ++// std::messages implementation details, GNU version -*- C++ -*-
3.1226 ++
3.1227 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.1228 ++//
3.1229 ++// This file is part of the GNU ISO C++ Library. This library is free
3.1230 ++// software; you can redistribute it and/or modify it under the
3.1231 ++// terms of the GNU General Public License as published by the
3.1232 ++// Free Software Foundation; either version 2, or (at your option)
3.1233 ++// any later version.
3.1234 ++
3.1235 ++// This library is distributed in the hope that it will be useful,
3.1236 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.1237 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.1238 ++// GNU General Public License for more details.
3.1239 ++
3.1240 ++// You should have received a copy of the GNU General Public License along
3.1241 ++// with this library; see the file COPYING. If not, write to the Free
3.1242 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.1243 ++// USA.
3.1244 ++
3.1245 ++// As a special exception, you may use this file as part of a free software
3.1246 ++// library without restriction. Specifically, if other files instantiate
3.1247 ++// templates or use macros or inline functions from this file, or you compile
3.1248 ++// this file and link it with other files to produce an executable, this
3.1249 ++// file does not by itself cause the resulting executable to be covered by
3.1250 ++// the GNU General Public License. This exception does not however
3.1251 ++// invalidate any other reasons why the executable file might be covered by
3.1252 ++// the GNU General Public License.
3.1253 ++
3.1254 ++//
3.1255 ++// ISO C++ 14882: 22.2.7.1.2 messages functions
3.1256 ++//
3.1257 ++
3.1258 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.1259 ++
3.1260 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1261 ++#warning fix prototypes for *textdomain funcs
3.1262 ++#endif
3.1263 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
3.1264 ++extern "C" char *__textdomain(const char *domainname);
3.1265 ++extern "C" char *__bindtextdomain(const char *domainname,
3.1266 ++ const char *dirname);
3.1267 ++#else
3.1268 ++#undef __textdomain
3.1269 ++#undef __bindtextdomain
3.1270 ++#define __textdomain(D) ((void)0)
3.1271 ++#define __bindtextdomain(D,P) ((void)0)
3.1272 ++#endif
3.1273 ++
3.1274 ++ // Non-virtual member functions.
3.1275 ++ template<typename _CharT>
3.1276 ++ messages<_CharT>::messages(size_t __refs)
3.1277 ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
3.1278 ++ _M_name_messages(_S_get_c_name())
3.1279 ++ { }
3.1280 ++
3.1281 ++ template<typename _CharT>
3.1282 ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
3.1283 ++ size_t __refs)
3.1284 ++ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
3.1285 ++ _M_name_messages(__s)
3.1286 ++ {
3.1287 ++ char* __tmp = new char[std::strlen(__s) + 1];
3.1288 ++ std::strcpy(__tmp, __s);
3.1289 ++ _M_name_messages = __tmp;
3.1290 ++ }
3.1291 ++
3.1292 ++ template<typename _CharT>
3.1293 ++ typename messages<_CharT>::catalog
3.1294 ++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
3.1295 ++ const char* __dir) const
3.1296 ++ {
3.1297 ++ __bindtextdomain(__s.c_str(), __dir);
3.1298 ++ return this->do_open(__s, __loc);
3.1299 ++ }
3.1300 ++
3.1301 ++ // Virtual member functions.
3.1302 ++ template<typename _CharT>
3.1303 ++ messages<_CharT>::~messages()
3.1304 ++ {
3.1305 ++ if (_M_name_messages != _S_get_c_name())
3.1306 ++ delete [] _M_name_messages;
3.1307 ++ _S_destroy_c_locale(_M_c_locale_messages);
3.1308 ++ }
3.1309 ++
3.1310 ++ template<typename _CharT>
3.1311 ++ typename messages<_CharT>::catalog
3.1312 ++ messages<_CharT>::do_open(const basic_string<char>& __s,
3.1313 ++ const locale&) const
3.1314 ++ {
3.1315 ++ // No error checking is done, assume the catalog exists and can
3.1316 ++ // be used.
3.1317 ++ __textdomain(__s.c_str());
3.1318 ++ return 0;
3.1319 ++ }
3.1320 ++
3.1321 ++ template<typename _CharT>
3.1322 ++ void
3.1323 ++ messages<_CharT>::do_close(catalog) const
3.1324 ++ { }
3.1325 ++
3.1326 ++ // messages_byname
3.1327 ++ template<typename _CharT>
3.1328 ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
3.1329 ++ : messages<_CharT>(__refs)
3.1330 ++ {
3.1331 ++ if (this->_M_name_messages != locale::facet::_S_get_c_name())
3.1332 ++ delete [] this->_M_name_messages;
3.1333 ++ char* __tmp = new char[std::strlen(__s) + 1];
3.1334 ++ std::strcpy(__tmp, __s);
3.1335 ++ this->_M_name_messages = __tmp;
3.1336 ++
3.1337 ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
3.1338 ++ {
3.1339 ++ this->_S_destroy_c_locale(this->_M_c_locale_messages);
3.1340 ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
3.1341 ++ }
3.1342 ++ }
3.1343 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
3.1344 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100
3.1345 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200
3.1346 +@@ -0,0 +1,692 @@
3.1347 ++// std::moneypunct implementation details, GNU version -*- C++ -*-
3.1348 ++
3.1349 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.1350 ++//
3.1351 ++// This file is part of the GNU ISO C++ Library. This library is free
3.1352 ++// software; you can redistribute it and/or modify it under the
3.1353 ++// terms of the GNU General Public License as published by the
3.1354 ++// Free Software Foundation; either version 2, or (at your option)
3.1355 ++// any later version.
3.1356 ++
3.1357 ++// This library is distributed in the hope that it will be useful,
3.1358 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.1359 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.1360 ++// GNU General Public License for more details.
3.1361 ++
3.1362 ++// You should have received a copy of the GNU General Public License along
3.1363 ++// with this library; see the file COPYING. If not, write to the Free
3.1364 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.1365 ++// USA.
3.1366 ++
3.1367 ++// As a special exception, you may use this file as part of a free software
3.1368 ++// library without restriction. Specifically, if other files instantiate
3.1369 ++// templates or use macros or inline functions from this file, or you compile
3.1370 ++// this file and link it with other files to produce an executable, this
3.1371 ++// file does not by itself cause the resulting executable to be covered by
3.1372 ++// the GNU General Public License. This exception does not however
3.1373 ++// invalidate any other reasons why the executable file might be covered by
3.1374 ++// the GNU General Public License.
3.1375 ++
3.1376 ++//
3.1377 ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
3.1378 ++//
3.1379 ++
3.1380 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.1381 ++
3.1382 ++#define _LIBC
3.1383 ++#include <locale>
3.1384 ++#undef _LIBC
3.1385 ++#include <bits/c++locale_internal.h>
3.1386 ++
3.1387 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1388 ++#warning optimize this for uclibc
3.1389 ++#warning tailor for stub locale support
3.1390 ++#endif
3.1391 ++
3.1392 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.1393 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
3.1394 ++#endif
3.1395 ++
3.1396 ++namespace std
3.1397 ++{
3.1398 ++ // Construct and return valid pattern consisting of some combination of:
3.1399 ++ // space none symbol sign value
3.1400 ++ money_base::pattern
3.1401 ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
3.1402 ++ {
3.1403 ++ pattern __ret;
3.1404 ++
3.1405 ++ // This insanely complicated routine attempts to construct a valid
3.1406 ++ // pattern for use with monyepunct. A couple of invariants:
3.1407 ++
3.1408 ++ // if (__precedes) symbol -> value
3.1409 ++ // else value -> symbol
3.1410 ++
3.1411 ++ // if (__space) space
3.1412 ++ // else none
3.1413 ++
3.1414 ++ // none == never first
3.1415 ++ // space never first or last
3.1416 ++
3.1417 ++ // Any elegant implementations of this are welcome.
3.1418 ++ switch (__posn)
3.1419 ++ {
3.1420 ++ case 0:
3.1421 ++ case 1:
3.1422 ++ // 1 The sign precedes the value and symbol.
3.1423 ++ __ret.field[0] = sign;
3.1424 ++ if (__space)
3.1425 ++ {
3.1426 ++ // Pattern starts with sign.
3.1427 ++ if (__precedes)
3.1428 ++ {
3.1429 ++ __ret.field[1] = symbol;
3.1430 ++ __ret.field[3] = value;
3.1431 ++ }
3.1432 ++ else
3.1433 ++ {
3.1434 ++ __ret.field[1] = value;
3.1435 ++ __ret.field[3] = symbol;
3.1436 ++ }
3.1437 ++ __ret.field[2] = space;
3.1438 ++ }
3.1439 ++ else
3.1440 ++ {
3.1441 ++ // Pattern starts with sign and ends with none.
3.1442 ++ if (__precedes)
3.1443 ++ {
3.1444 ++ __ret.field[1] = symbol;
3.1445 ++ __ret.field[2] = value;
3.1446 ++ }
3.1447 ++ else
3.1448 ++ {
3.1449 ++ __ret.field[1] = value;
3.1450 ++ __ret.field[2] = symbol;
3.1451 ++ }
3.1452 ++ __ret.field[3] = none;
3.1453 ++ }
3.1454 ++ break;
3.1455 ++ case 2:
3.1456 ++ // 2 The sign follows the value and symbol.
3.1457 ++ if (__space)
3.1458 ++ {
3.1459 ++ // Pattern either ends with sign.
3.1460 ++ if (__precedes)
3.1461 ++ {
3.1462 ++ __ret.field[0] = symbol;
3.1463 ++ __ret.field[2] = value;
3.1464 ++ }
3.1465 ++ else
3.1466 ++ {
3.1467 ++ __ret.field[0] = value;
3.1468 ++ __ret.field[2] = symbol;
3.1469 ++ }
3.1470 ++ __ret.field[1] = space;
3.1471 ++ __ret.field[3] = sign;
3.1472 ++ }
3.1473 ++ else
3.1474 ++ {
3.1475 ++ // Pattern ends with sign then none.
3.1476 ++ if (__precedes)
3.1477 ++ {
3.1478 ++ __ret.field[0] = symbol;
3.1479 ++ __ret.field[1] = value;
3.1480 ++ }
3.1481 ++ else
3.1482 ++ {
3.1483 ++ __ret.field[0] = value;
3.1484 ++ __ret.field[1] = symbol;
3.1485 ++ }
3.1486 ++ __ret.field[2] = sign;
3.1487 ++ __ret.field[3] = none;
3.1488 ++ }
3.1489 ++ break;
3.1490 ++ case 3:
3.1491 ++ // 3 The sign immediately precedes the symbol.
3.1492 ++ if (__precedes)
3.1493 ++ {
3.1494 ++ __ret.field[0] = sign;
3.1495 ++ __ret.field[1] = symbol;
3.1496 ++ if (__space)
3.1497 ++ {
3.1498 ++ __ret.field[2] = space;
3.1499 ++ __ret.field[3] = value;
3.1500 ++ }
3.1501 ++ else
3.1502 ++ {
3.1503 ++ __ret.field[2] = value;
3.1504 ++ __ret.field[3] = none;
3.1505 ++ }
3.1506 ++ }
3.1507 ++ else
3.1508 ++ {
3.1509 ++ __ret.field[0] = value;
3.1510 ++ if (__space)
3.1511 ++ {
3.1512 ++ __ret.field[1] = space;
3.1513 ++ __ret.field[2] = sign;
3.1514 ++ __ret.field[3] = symbol;
3.1515 ++ }
3.1516 ++ else
3.1517 ++ {
3.1518 ++ __ret.field[1] = sign;
3.1519 ++ __ret.field[2] = symbol;
3.1520 ++ __ret.field[3] = none;
3.1521 ++ }
3.1522 ++ }
3.1523 ++ break;
3.1524 ++ case 4:
3.1525 ++ // 4 The sign immediately follows the symbol.
3.1526 ++ if (__precedes)
3.1527 ++ {
3.1528 ++ __ret.field[0] = symbol;
3.1529 ++ __ret.field[1] = sign;
3.1530 ++ if (__space)
3.1531 ++ {
3.1532 ++ __ret.field[2] = space;
3.1533 ++ __ret.field[3] = value;
3.1534 ++ }
3.1535 ++ else
3.1536 ++ {
3.1537 ++ __ret.field[2] = value;
3.1538 ++ __ret.field[3] = none;
3.1539 ++ }
3.1540 ++ }
3.1541 ++ else
3.1542 ++ {
3.1543 ++ __ret.field[0] = value;
3.1544 ++ if (__space)
3.1545 ++ {
3.1546 ++ __ret.field[1] = space;
3.1547 ++ __ret.field[2] = symbol;
3.1548 ++ __ret.field[3] = sign;
3.1549 ++ }
3.1550 ++ else
3.1551 ++ {
3.1552 ++ __ret.field[1] = symbol;
3.1553 ++ __ret.field[2] = sign;
3.1554 ++ __ret.field[3] = none;
3.1555 ++ }
3.1556 ++ }
3.1557 ++ break;
3.1558 ++ default:
3.1559 ++ ;
3.1560 ++ }
3.1561 ++ return __ret;
3.1562 ++ }
3.1563 ++
3.1564 ++ template<>
3.1565 ++ void
3.1566 ++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
3.1567 ++ const char*)
3.1568 ++ {
3.1569 ++ if (!_M_data)
3.1570 ++ _M_data = new __moneypunct_cache<char, true>;
3.1571 ++
3.1572 ++ if (!__cloc)
3.1573 ++ {
3.1574 ++ // "C" locale
3.1575 ++ _M_data->_M_decimal_point = '.';
3.1576 ++ _M_data->_M_thousands_sep = ',';
3.1577 ++ _M_data->_M_grouping = "";
3.1578 ++ _M_data->_M_grouping_size = 0;
3.1579 ++ _M_data->_M_curr_symbol = "";
3.1580 ++ _M_data->_M_curr_symbol_size = 0;
3.1581 ++ _M_data->_M_positive_sign = "";
3.1582 ++ _M_data->_M_positive_sign_size = 0;
3.1583 ++ _M_data->_M_negative_sign = "";
3.1584 ++ _M_data->_M_negative_sign_size = 0;
3.1585 ++ _M_data->_M_frac_digits = 0;
3.1586 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
3.1587 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
3.1588 ++
3.1589 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
3.1590 ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
3.1591 ++ }
3.1592 ++ else
3.1593 ++ {
3.1594 ++ // Named locale.
3.1595 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
3.1596 ++ __cloc));
3.1597 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
3.1598 ++ __cloc));
3.1599 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
3.1600 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.1601 ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
3.1602 ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
3.1603 ++
3.1604 ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
3.1605 ++ if (!__nposn)
3.1606 ++ _M_data->_M_negative_sign = "()";
3.1607 ++ else
3.1608 ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
3.1609 ++ __cloc);
3.1610 ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
3.1611 ++
3.1612 ++ // _Intl == true
3.1613 ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
3.1614 ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
3.1615 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
3.1616 ++ __cloc));
3.1617 ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
3.1618 ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
3.1619 ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
3.1620 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
3.1621 ++ __pposn);
3.1622 ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
3.1623 ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
3.1624 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
3.1625 ++ __nposn);
3.1626 ++ }
3.1627 ++ }
3.1628 ++
3.1629 ++ template<>
3.1630 ++ void
3.1631 ++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
3.1632 ++ const char*)
3.1633 ++ {
3.1634 ++ if (!_M_data)
3.1635 ++ _M_data = new __moneypunct_cache<char, false>;
3.1636 ++
3.1637 ++ if (!__cloc)
3.1638 ++ {
3.1639 ++ // "C" locale
3.1640 ++ _M_data->_M_decimal_point = '.';
3.1641 ++ _M_data->_M_thousands_sep = ',';
3.1642 ++ _M_data->_M_grouping = "";
3.1643 ++ _M_data->_M_grouping_size = 0;
3.1644 ++ _M_data->_M_curr_symbol = "";
3.1645 ++ _M_data->_M_curr_symbol_size = 0;
3.1646 ++ _M_data->_M_positive_sign = "";
3.1647 ++ _M_data->_M_positive_sign_size = 0;
3.1648 ++ _M_data->_M_negative_sign = "";
3.1649 ++ _M_data->_M_negative_sign_size = 0;
3.1650 ++ _M_data->_M_frac_digits = 0;
3.1651 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
3.1652 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
3.1653 ++
3.1654 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
3.1655 ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
3.1656 ++ }
3.1657 ++ else
3.1658 ++ {
3.1659 ++ // Named locale.
3.1660 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
3.1661 ++ __cloc));
3.1662 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
3.1663 ++ __cloc));
3.1664 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
3.1665 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.1666 ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
3.1667 ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
3.1668 ++
3.1669 ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
3.1670 ++ if (!__nposn)
3.1671 ++ _M_data->_M_negative_sign = "()";
3.1672 ++ else
3.1673 ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
3.1674 ++ __cloc);
3.1675 ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
3.1676 ++
3.1677 ++ // _Intl == false
3.1678 ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
3.1679 ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
3.1680 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
3.1681 ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
3.1682 ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
3.1683 ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
3.1684 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
3.1685 ++ __pposn);
3.1686 ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
3.1687 ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
3.1688 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
3.1689 ++ __nposn);
3.1690 ++ }
3.1691 ++ }
3.1692 ++
3.1693 ++ template<>
3.1694 ++ moneypunct<char, true>::~moneypunct()
3.1695 ++ { delete _M_data; }
3.1696 ++
3.1697 ++ template<>
3.1698 ++ moneypunct<char, false>::~moneypunct()
3.1699 ++ { delete _M_data; }
3.1700 ++
3.1701 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.1702 ++ template<>
3.1703 ++ void
3.1704 ++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
3.1705 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1706 ++ const char*)
3.1707 ++#else
3.1708 ++ const char* __name)
3.1709 ++#endif
3.1710 ++ {
3.1711 ++ if (!_M_data)
3.1712 ++ _M_data = new __moneypunct_cache<wchar_t, true>;
3.1713 ++
3.1714 ++ if (!__cloc)
3.1715 ++ {
3.1716 ++ // "C" locale
3.1717 ++ _M_data->_M_decimal_point = L'.';
3.1718 ++ _M_data->_M_thousands_sep = L',';
3.1719 ++ _M_data->_M_grouping = "";
3.1720 ++ _M_data->_M_grouping_size = 0;
3.1721 ++ _M_data->_M_curr_symbol = L"";
3.1722 ++ _M_data->_M_curr_symbol_size = 0;
3.1723 ++ _M_data->_M_positive_sign = L"";
3.1724 ++ _M_data->_M_positive_sign_size = 0;
3.1725 ++ _M_data->_M_negative_sign = L"";
3.1726 ++ _M_data->_M_negative_sign_size = 0;
3.1727 ++ _M_data->_M_frac_digits = 0;
3.1728 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
3.1729 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
3.1730 ++
3.1731 ++ // Use ctype::widen code without the facet...
3.1732 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
3.1733 ++ _M_data->_M_atoms[__i] =
3.1734 ++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
3.1735 ++ }
3.1736 ++ else
3.1737 ++ {
3.1738 ++ // Named locale.
3.1739 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1740 ++ __c_locale __old = __uselocale(__cloc);
3.1741 ++#else
3.1742 ++ // Switch to named locale so that mbsrtowcs will work.
3.1743 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.1744 ++ setlocale(LC_ALL, __name);
3.1745 ++#endif
3.1746 ++
3.1747 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1748 ++#warning fix this... should be monetary
3.1749 ++#endif
3.1750 ++#ifdef __UCLIBC__
3.1751 ++# ifdef __UCLIBC_HAS_XLOCALE__
3.1752 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
3.1753 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
3.1754 ++# else
3.1755 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
3.1756 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
3.1757 ++# endif
3.1758 ++#else
3.1759 ++ union { char *__s; wchar_t __w; } __u;
3.1760 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
3.1761 ++ _M_data->_M_decimal_point = __u.__w;
3.1762 ++
3.1763 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
3.1764 ++ _M_data->_M_thousands_sep = __u.__w;
3.1765 ++#endif
3.1766 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
3.1767 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.1768 ++
3.1769 ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
3.1770 ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
3.1771 ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
3.1772 ++
3.1773 ++ wchar_t* __wcs_ps = 0;
3.1774 ++ wchar_t* __wcs_ns = 0;
3.1775 ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
3.1776 ++ try
3.1777 ++ {
3.1778 ++ mbstate_t __state;
3.1779 ++ size_t __len = strlen(__cpossign);
3.1780 ++ if (__len)
3.1781 ++ {
3.1782 ++ ++__len;
3.1783 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1784 ++ __wcs_ps = new wchar_t[__len];
3.1785 ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
3.1786 ++ _M_data->_M_positive_sign = __wcs_ps;
3.1787 ++ }
3.1788 ++ else
3.1789 ++ _M_data->_M_positive_sign = L"";
3.1790 ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
3.1791 ++
3.1792 ++ __len = strlen(__cnegsign);
3.1793 ++ if (!__nposn)
3.1794 ++ _M_data->_M_negative_sign = L"()";
3.1795 ++ else if (__len)
3.1796 ++ {
3.1797 ++ ++__len;
3.1798 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1799 ++ __wcs_ns = new wchar_t[__len];
3.1800 ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
3.1801 ++ _M_data->_M_negative_sign = __wcs_ns;
3.1802 ++ }
3.1803 ++ else
3.1804 ++ _M_data->_M_negative_sign = L"";
3.1805 ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
3.1806 ++
3.1807 ++ // _Intl == true.
3.1808 ++ __len = strlen(__ccurr);
3.1809 ++ if (__len)
3.1810 ++ {
3.1811 ++ ++__len;
3.1812 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1813 ++ wchar_t* __wcs = new wchar_t[__len];
3.1814 ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
3.1815 ++ _M_data->_M_curr_symbol = __wcs;
3.1816 ++ }
3.1817 ++ else
3.1818 ++ _M_data->_M_curr_symbol = L"";
3.1819 ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
3.1820 ++ }
3.1821 ++ catch (...)
3.1822 ++ {
3.1823 ++ delete _M_data;
3.1824 ++ _M_data = 0;
3.1825 ++ delete __wcs_ps;
3.1826 ++ delete __wcs_ns;
3.1827 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1828 ++ __uselocale(__old);
3.1829 ++#else
3.1830 ++ setlocale(LC_ALL, __old);
3.1831 ++ free(__old);
3.1832 ++#endif
3.1833 ++ __throw_exception_again;
3.1834 ++ }
3.1835 ++
3.1836 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
3.1837 ++ __cloc));
3.1838 ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
3.1839 ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
3.1840 ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
3.1841 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
3.1842 ++ __pposn);
3.1843 ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
3.1844 ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
3.1845 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
3.1846 ++ __nposn);
3.1847 ++
3.1848 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1849 ++ __uselocale(__old);
3.1850 ++#else
3.1851 ++ setlocale(LC_ALL, __old);
3.1852 ++ free(__old);
3.1853 ++#endif
3.1854 ++ }
3.1855 ++ }
3.1856 ++
3.1857 ++ template<>
3.1858 ++ void
3.1859 ++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
3.1860 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1861 ++ const char*)
3.1862 ++#else
3.1863 ++ const char* __name)
3.1864 ++#endif
3.1865 ++ {
3.1866 ++ if (!_M_data)
3.1867 ++ _M_data = new __moneypunct_cache<wchar_t, false>;
3.1868 ++
3.1869 ++ if (!__cloc)
3.1870 ++ {
3.1871 ++ // "C" locale
3.1872 ++ _M_data->_M_decimal_point = L'.';
3.1873 ++ _M_data->_M_thousands_sep = L',';
3.1874 ++ _M_data->_M_grouping = "";
3.1875 ++ _M_data->_M_grouping_size = 0;
3.1876 ++ _M_data->_M_curr_symbol = L"";
3.1877 ++ _M_data->_M_curr_symbol_size = 0;
3.1878 ++ _M_data->_M_positive_sign = L"";
3.1879 ++ _M_data->_M_positive_sign_size = 0;
3.1880 ++ _M_data->_M_negative_sign = L"";
3.1881 ++ _M_data->_M_negative_sign_size = 0;
3.1882 ++ _M_data->_M_frac_digits = 0;
3.1883 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
3.1884 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
3.1885 ++
3.1886 ++ // Use ctype::widen code without the facet...
3.1887 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
3.1888 ++ _M_data->_M_atoms[__i] =
3.1889 ++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
3.1890 ++ }
3.1891 ++ else
3.1892 ++ {
3.1893 ++ // Named locale.
3.1894 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1895 ++ __c_locale __old = __uselocale(__cloc);
3.1896 ++#else
3.1897 ++ // Switch to named locale so that mbsrtowcs will work.
3.1898 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.1899 ++ setlocale(LC_ALL, __name);
3.1900 ++#endif
3.1901 ++
3.1902 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1903 ++#warning fix this... should be monetary
3.1904 ++#endif
3.1905 ++#ifdef __UCLIBC__
3.1906 ++# ifdef __UCLIBC_HAS_XLOCALE__
3.1907 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
3.1908 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
3.1909 ++# else
3.1910 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
3.1911 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
3.1912 ++# endif
3.1913 ++#else
3.1914 ++ union { char *__s; wchar_t __w; } __u;
3.1915 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
3.1916 ++ _M_data->_M_decimal_point = __u.__w;
3.1917 ++
3.1918 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
3.1919 ++ _M_data->_M_thousands_sep = __u.__w;
3.1920 ++#endif
3.1921 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
3.1922 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.1923 ++
3.1924 ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
3.1925 ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
3.1926 ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
3.1927 ++
3.1928 ++ wchar_t* __wcs_ps = 0;
3.1929 ++ wchar_t* __wcs_ns = 0;
3.1930 ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
3.1931 ++ try
3.1932 ++ {
3.1933 ++ mbstate_t __state;
3.1934 ++ size_t __len;
3.1935 ++ __len = strlen(__cpossign);
3.1936 ++ if (__len)
3.1937 ++ {
3.1938 ++ ++__len;
3.1939 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1940 ++ __wcs_ps = new wchar_t[__len];
3.1941 ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
3.1942 ++ _M_data->_M_positive_sign = __wcs_ps;
3.1943 ++ }
3.1944 ++ else
3.1945 ++ _M_data->_M_positive_sign = L"";
3.1946 ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
3.1947 ++
3.1948 ++ __len = strlen(__cnegsign);
3.1949 ++ if (!__nposn)
3.1950 ++ _M_data->_M_negative_sign = L"()";
3.1951 ++ else if (__len)
3.1952 ++ {
3.1953 ++ ++__len;
3.1954 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1955 ++ __wcs_ns = new wchar_t[__len];
3.1956 ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
3.1957 ++ _M_data->_M_negative_sign = __wcs_ns;
3.1958 ++ }
3.1959 ++ else
3.1960 ++ _M_data->_M_negative_sign = L"";
3.1961 ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
3.1962 ++
3.1963 ++ // _Intl == true.
3.1964 ++ __len = strlen(__ccurr);
3.1965 ++ if (__len)
3.1966 ++ {
3.1967 ++ ++__len;
3.1968 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1969 ++ wchar_t* __wcs = new wchar_t[__len];
3.1970 ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
3.1971 ++ _M_data->_M_curr_symbol = __wcs;
3.1972 ++ }
3.1973 ++ else
3.1974 ++ _M_data->_M_curr_symbol = L"";
3.1975 ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
3.1976 ++ }
3.1977 ++ catch (...)
3.1978 ++ {
3.1979 ++ delete _M_data;
3.1980 ++ _M_data = 0;
3.1981 ++ delete __wcs_ps;
3.1982 ++ delete __wcs_ns;
3.1983 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1984 ++ __uselocale(__old);
3.1985 ++#else
3.1986 ++ setlocale(LC_ALL, __old);
3.1987 ++ free(__old);
3.1988 ++#endif
3.1989 ++ __throw_exception_again;
3.1990 ++ }
3.1991 ++
3.1992 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
3.1993 ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
3.1994 ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
3.1995 ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
3.1996 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
3.1997 ++ __pposn);
3.1998 ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
3.1999 ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
3.2000 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
3.2001 ++ __nposn);
3.2002 ++
3.2003 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.2004 ++ __uselocale(__old);
3.2005 ++#else
3.2006 ++ setlocale(LC_ALL, __old);
3.2007 ++ free(__old);
3.2008 ++#endif
3.2009 ++ }
3.2010 ++ }
3.2011 ++
3.2012 ++ template<>
3.2013 ++ moneypunct<wchar_t, true>::~moneypunct()
3.2014 ++ {
3.2015 ++ if (_M_data->_M_positive_sign_size)
3.2016 ++ delete [] _M_data->_M_positive_sign;
3.2017 ++ if (_M_data->_M_negative_sign_size
3.2018 ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
3.2019 ++ delete [] _M_data->_M_negative_sign;
3.2020 ++ if (_M_data->_M_curr_symbol_size)
3.2021 ++ delete [] _M_data->_M_curr_symbol;
3.2022 ++ delete _M_data;
3.2023 ++ }
3.2024 ++
3.2025 ++ template<>
3.2026 ++ moneypunct<wchar_t, false>::~moneypunct()
3.2027 ++ {
3.2028 ++ if (_M_data->_M_positive_sign_size)
3.2029 ++ delete [] _M_data->_M_positive_sign;
3.2030 ++ if (_M_data->_M_negative_sign_size
3.2031 ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
3.2032 ++ delete [] _M_data->_M_negative_sign;
3.2033 ++ if (_M_data->_M_curr_symbol_size)
3.2034 ++ delete [] _M_data->_M_curr_symbol;
3.2035 ++ delete _M_data;
3.2036 ++ }
3.2037 ++#endif
3.2038 ++}
3.2039 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
3.2040 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100
3.2041 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200
3.2042 +@@ -0,0 +1,160 @@
3.2043 ++// std::numpunct implementation details, GNU version -*- C++ -*-
3.2044 ++
3.2045 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.2046 ++//
3.2047 ++// This file is part of the GNU ISO C++ Library. This library is free
3.2048 ++// software; you can redistribute it and/or modify it under the
3.2049 ++// terms of the GNU General Public License as published by the
3.2050 ++// Free Software Foundation; either version 2, or (at your option)
3.2051 ++// any later version.
3.2052 ++
3.2053 ++// This library is distributed in the hope that it will be useful,
3.2054 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.2055 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.2056 ++// GNU General Public License for more details.
3.2057 ++
3.2058 ++// You should have received a copy of the GNU General Public License along
3.2059 ++// with this library; see the file COPYING. If not, write to the Free
3.2060 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.2061 ++// USA.
3.2062 ++
3.2063 ++// As a special exception, you may use this file as part of a free software
3.2064 ++// library without restriction. Specifically, if other files instantiate
3.2065 ++// templates or use macros or inline functions from this file, or you compile
3.2066 ++// this file and link it with other files to produce an executable, this
3.2067 ++// file does not by itself cause the resulting executable to be covered by
3.2068 ++// the GNU General Public License. This exception does not however
3.2069 ++// invalidate any other reasons why the executable file might be covered by
3.2070 ++// the GNU General Public License.
3.2071 ++
3.2072 ++//
3.2073 ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
3.2074 ++//
3.2075 ++
3.2076 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.2077 ++
3.2078 ++#define _LIBC
3.2079 ++#include <locale>
3.2080 ++#undef _LIBC
3.2081 ++#include <bits/c++locale_internal.h>
3.2082 ++
3.2083 ++#ifdef __UCLIBC_MJN3_ONLY__
3.2084 ++#warning tailor for stub locale support
3.2085 ++#endif
3.2086 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.2087 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
3.2088 ++#endif
3.2089 ++
3.2090 ++namespace std
3.2091 ++{
3.2092 ++ template<>
3.2093 ++ void
3.2094 ++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
3.2095 ++ {
3.2096 ++ if (!_M_data)
3.2097 ++ _M_data = new __numpunct_cache<char>;
3.2098 ++
3.2099 ++ if (!__cloc)
3.2100 ++ {
3.2101 ++ // "C" locale
3.2102 ++ _M_data->_M_grouping = "";
3.2103 ++ _M_data->_M_grouping_size = 0;
3.2104 ++ _M_data->_M_use_grouping = false;
3.2105 ++
3.2106 ++ _M_data->_M_decimal_point = '.';
3.2107 ++ _M_data->_M_thousands_sep = ',';
3.2108 ++
3.2109 ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
3.2110 ++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
3.2111 ++
3.2112 ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
3.2113 ++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
3.2114 ++ }
3.2115 ++ else
3.2116 ++ {
3.2117 ++ // Named locale.
3.2118 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
3.2119 ++ __cloc));
3.2120 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
3.2121 ++ __cloc));
3.2122 ++
3.2123 ++ // Check for NULL, which implies no grouping.
3.2124 ++ if (_M_data->_M_thousands_sep == '\0')
3.2125 ++ _M_data->_M_grouping = "";
3.2126 ++ else
3.2127 ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
3.2128 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.2129 ++ }
3.2130 ++
3.2131 ++ // NB: There is no way to extact this info from posix locales.
3.2132 ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
3.2133 ++ _M_data->_M_truename = "true";
3.2134 ++ _M_data->_M_truename_size = 4;
3.2135 ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
3.2136 ++ _M_data->_M_falsename = "false";
3.2137 ++ _M_data->_M_falsename_size = 5;
3.2138 ++ }
3.2139 ++
3.2140 ++ template<>
3.2141 ++ numpunct<char>::~numpunct()
3.2142 ++ { delete _M_data; }
3.2143 ++
3.2144 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.2145 ++ template<>
3.2146 ++ void
3.2147 ++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
3.2148 ++ {
3.2149 ++ if (!_M_data)
3.2150 ++ _M_data = new __numpunct_cache<wchar_t>;
3.2151 ++
3.2152 ++ if (!__cloc)
3.2153 ++ {
3.2154 ++ // "C" locale
3.2155 ++ _M_data->_M_grouping = "";
3.2156 ++ _M_data->_M_grouping_size = 0;
3.2157 ++ _M_data->_M_use_grouping = false;
3.2158 ++
3.2159 ++ _M_data->_M_decimal_point = L'.';
3.2160 ++ _M_data->_M_thousands_sep = L',';
3.2161 ++
3.2162 ++ // Use ctype::widen code without the facet...
3.2163 ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
3.2164 ++ _M_data->_M_atoms_out[__i] =
3.2165 ++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
3.2166 ++
3.2167 ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
3.2168 ++ _M_data->_M_atoms_in[__j] =
3.2169 ++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
3.2170 ++ }
3.2171 ++ else
3.2172 ++ {
3.2173 ++ // Named locale.
3.2174 ++ // NB: In the GNU model wchar_t is always 32 bit wide.
3.2175 ++ union { char *__s; wchar_t __w; } __u;
3.2176 ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
3.2177 ++ _M_data->_M_decimal_point = __u.__w;
3.2178 ++
3.2179 ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
3.2180 ++ _M_data->_M_thousands_sep = __u.__w;
3.2181 ++
3.2182 ++ if (_M_data->_M_thousands_sep == L'\0')
3.2183 ++ _M_data->_M_grouping = "";
3.2184 ++ else
3.2185 ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
3.2186 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.2187 ++ }
3.2188 ++
3.2189 ++ // NB: There is no way to extact this info from posix locales.
3.2190 ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
3.2191 ++ _M_data->_M_truename = L"true";
3.2192 ++ _M_data->_M_truename_size = 4;
3.2193 ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
3.2194 ++ _M_data->_M_falsename = L"false";
3.2195 ++ _M_data->_M_falsename_size = 5;
3.2196 ++ }
3.2197 ++
3.2198 ++ template<>
3.2199 ++ numpunct<wchar_t>::~numpunct()
3.2200 ++ { delete _M_data; }
3.2201 ++ #endif
3.2202 ++}
3.2203 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc
3.2204 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100
3.2205 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200
3.2206 +@@ -0,0 +1,406 @@
3.2207 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
3.2208 ++
3.2209 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.2210 ++//
3.2211 ++// This file is part of the GNU ISO C++ Library. This library is free
3.2212 ++// software; you can redistribute it and/or modify it under the
3.2213 ++// terms of the GNU General Public License as published by the
3.2214 ++// Free Software Foundation; either version 2, or (at your option)
3.2215 ++// any later version.
3.2216 ++
3.2217 ++// This library is distributed in the hope that it will be useful,
3.2218 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.2219 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.2220 ++// GNU General Public License for more details.
3.2221 ++
3.2222 ++// You should have received a copy of the GNU General Public License along
3.2223 ++// with this library; see the file COPYING. If not, write to the Free
3.2224 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.2225 ++// USA.
3.2226 ++
3.2227 ++// As a special exception, you may use this file as part of a free software
3.2228 ++// library without restriction. Specifically, if other files instantiate
3.2229 ++// templates or use macros or inline functions from this file, or you compile
3.2230 ++// this file and link it with other files to produce an executable, this
3.2231 ++// file does not by itself cause the resulting executable to be covered by
3.2232 ++// the GNU General Public License. This exception does not however
3.2233 ++// invalidate any other reasons why the executable file might be covered by
3.2234 ++// the GNU General Public License.
3.2235 ++
3.2236 ++//
3.2237 ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
3.2238 ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
3.2239 ++//
3.2240 ++
3.2241 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.2242 ++
3.2243 ++#include <locale>
3.2244 ++#include <bits/c++locale_internal.h>
3.2245 ++
3.2246 ++#ifdef __UCLIBC_MJN3_ONLY__
3.2247 ++#warning tailor for stub locale support
3.2248 ++#endif
3.2249 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.2250 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
3.2251 ++#endif
3.2252 ++
3.2253 ++namespace std
3.2254 ++{
3.2255 ++ template<>
3.2256 ++ void
3.2257 ++ __timepunct<char>::
3.2258 ++ _M_put(char* __s, size_t __maxlen, const char* __format,
3.2259 ++ const tm* __tm) const
3.2260 ++ {
3.2261 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.2262 ++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
3.2263 ++ _M_c_locale_timepunct);
3.2264 ++#else
3.2265 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.2266 ++ setlocale(LC_ALL, _M_name_timepunct);
3.2267 ++ const size_t __len = strftime(__s, __maxlen, __format, __tm);
3.2268 ++ setlocale(LC_ALL, __old);
3.2269 ++ free(__old);
3.2270 ++#endif
3.2271 ++ // Make sure __s is null terminated.
3.2272 ++ if (__len == 0)
3.2273 ++ __s[0] = '\0';
3.2274 ++ }
3.2275 ++
3.2276 ++ template<>
3.2277 ++ void
3.2278 ++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
3.2279 ++ {
3.2280 ++ if (!_M_data)
3.2281 ++ _M_data = new __timepunct_cache<char>;
3.2282 ++
3.2283 ++ if (!__cloc)
3.2284 ++ {
3.2285 ++ // "C" locale
3.2286 ++ _M_c_locale_timepunct = _S_get_c_locale();
3.2287 ++
3.2288 ++ _M_data->_M_date_format = "%m/%d/%y";
3.2289 ++ _M_data->_M_date_era_format = "%m/%d/%y";
3.2290 ++ _M_data->_M_time_format = "%H:%M:%S";
3.2291 ++ _M_data->_M_time_era_format = "%H:%M:%S";
3.2292 ++ _M_data->_M_date_time_format = "";
3.2293 ++ _M_data->_M_date_time_era_format = "";
3.2294 ++ _M_data->_M_am = "AM";
3.2295 ++ _M_data->_M_pm = "PM";
3.2296 ++ _M_data->_M_am_pm_format = "";
3.2297 ++
3.2298 ++ // Day names, starting with "C"'s Sunday.
3.2299 ++ _M_data->_M_day1 = "Sunday";
3.2300 ++ _M_data->_M_day2 = "Monday";
3.2301 ++ _M_data->_M_day3 = "Tuesday";
3.2302 ++ _M_data->_M_day4 = "Wednesday";
3.2303 ++ _M_data->_M_day5 = "Thursday";
3.2304 ++ _M_data->_M_day6 = "Friday";
3.2305 ++ _M_data->_M_day7 = "Saturday";
3.2306 ++
3.2307 ++ // Abbreviated day names, starting with "C"'s Sun.
3.2308 ++ _M_data->_M_aday1 = "Sun";
3.2309 ++ _M_data->_M_aday2 = "Mon";
3.2310 ++ _M_data->_M_aday3 = "Tue";
3.2311 ++ _M_data->_M_aday4 = "Wed";
3.2312 ++ _M_data->_M_aday5 = "Thu";
3.2313 ++ _M_data->_M_aday6 = "Fri";
3.2314 ++ _M_data->_M_aday7 = "Sat";
3.2315 ++
3.2316 ++ // Month names, starting with "C"'s January.
3.2317 ++ _M_data->_M_month01 = "January";
3.2318 ++ _M_data->_M_month02 = "February";
3.2319 ++ _M_data->_M_month03 = "March";
3.2320 ++ _M_data->_M_month04 = "April";
3.2321 ++ _M_data->_M_month05 = "May";
3.2322 ++ _M_data->_M_month06 = "June";
3.2323 ++ _M_data->_M_month07 = "July";
3.2324 ++ _M_data->_M_month08 = "August";
3.2325 ++ _M_data->_M_month09 = "September";
3.2326 ++ _M_data->_M_month10 = "October";
3.2327 ++ _M_data->_M_month11 = "November";
3.2328 ++ _M_data->_M_month12 = "December";
3.2329 ++
3.2330 ++ // Abbreviated month names, starting with "C"'s Jan.
3.2331 ++ _M_data->_M_amonth01 = "Jan";
3.2332 ++ _M_data->_M_amonth02 = "Feb";
3.2333 ++ _M_data->_M_amonth03 = "Mar";
3.2334 ++ _M_data->_M_amonth04 = "Apr";
3.2335 ++ _M_data->_M_amonth05 = "May";
3.2336 ++ _M_data->_M_amonth06 = "Jun";
3.2337 ++ _M_data->_M_amonth07 = "Jul";
3.2338 ++ _M_data->_M_amonth08 = "Aug";
3.2339 ++ _M_data->_M_amonth09 = "Sep";
3.2340 ++ _M_data->_M_amonth10 = "Oct";
3.2341 ++ _M_data->_M_amonth11 = "Nov";
3.2342 ++ _M_data->_M_amonth12 = "Dec";
3.2343 ++ }
3.2344 ++ else
3.2345 ++ {
3.2346 ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
3.2347 ++
3.2348 ++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
3.2349 ++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
3.2350 ++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
3.2351 ++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
3.2352 ++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
3.2353 ++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
3.2354 ++ __cloc);
3.2355 ++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
3.2356 ++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
3.2357 ++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
3.2358 ++
3.2359 ++ // Day names, starting with "C"'s Sunday.
3.2360 ++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
3.2361 ++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
3.2362 ++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
3.2363 ++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
3.2364 ++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
3.2365 ++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
3.2366 ++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
3.2367 ++
3.2368 ++ // Abbreviated day names, starting with "C"'s Sun.
3.2369 ++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
3.2370 ++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
3.2371 ++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
3.2372 ++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
3.2373 ++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
3.2374 ++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
3.2375 ++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
3.2376 ++
3.2377 ++ // Month names, starting with "C"'s January.
3.2378 ++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
3.2379 ++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
3.2380 ++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
3.2381 ++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
3.2382 ++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
3.2383 ++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
3.2384 ++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
3.2385 ++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
3.2386 ++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
3.2387 ++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
3.2388 ++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
3.2389 ++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
3.2390 ++
3.2391 ++ // Abbreviated month names, starting with "C"'s Jan.
3.2392 ++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
3.2393 ++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
3.2394 ++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
3.2395 ++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
3.2396 ++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
3.2397 ++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
3.2398 ++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
3.2399 ++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
3.2400 ++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
3.2401 ++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
3.2402 ++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
3.2403 ++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
3.2404 ++ }
3.2405 ++ }
3.2406 ++
3.2407 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.2408 ++ template<>
3.2409 ++ void
3.2410 ++ __timepunct<wchar_t>::
3.2411 ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
3.2412 ++ const tm* __tm) const
3.2413 ++ {
3.2414 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.2415 ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
3.2416 ++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
3.2417 ++ _M_c_locale_timepunct);
3.2418 ++#else
3.2419 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.2420 ++ setlocale(LC_ALL, _M_name_timepunct);
3.2421 ++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
3.2422 ++ setlocale(LC_ALL, __old);
3.2423 ++ free(__old);
3.2424 ++#endif
3.2425 ++ // Make sure __s is null terminated.
3.2426 ++ if (__len == 0)
3.2427 ++ __s[0] = L'\0';
3.2428 ++ }
3.2429 ++
3.2430 ++ template<>
3.2431 ++ void
3.2432 ++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
3.2433 ++ {
3.2434 ++ if (!_M_data)
3.2435 ++ _M_data = new __timepunct_cache<wchar_t>;
3.2436 ++
3.2437 ++#warning wide time stuff
3.2438 ++// if (!__cloc)
3.2439 ++ {
3.2440 ++ // "C" locale
3.2441 ++ _M_c_locale_timepunct = _S_get_c_locale();
3.2442 ++
3.2443 ++ _M_data->_M_date_format = L"%m/%d/%y";
3.2444 ++ _M_data->_M_date_era_format = L"%m/%d/%y";
3.2445 ++ _M_data->_M_time_format = L"%H:%M:%S";
3.2446 ++ _M_data->_M_time_era_format = L"%H:%M:%S";
3.2447 ++ _M_data->_M_date_time_format = L"";
3.2448 ++ _M_data->_M_date_time_era_format = L"";
3.2449 ++ _M_data->_M_am = L"AM";
3.2450 ++ _M_data->_M_pm = L"PM";
3.2451 ++ _M_data->_M_am_pm_format = L"";
3.2452 ++
3.2453 ++ // Day names, starting with "C"'s Sunday.
3.2454 ++ _M_data->_M_day1 = L"Sunday";
3.2455 ++ _M_data->_M_day2 = L"Monday";
3.2456 ++ _M_data->_M_day3 = L"Tuesday";
3.2457 ++ _M_data->_M_day4 = L"Wednesday";
3.2458 ++ _M_data->_M_day5 = L"Thursday";
3.2459 ++ _M_data->_M_day6 = L"Friday";
3.2460 ++ _M_data->_M_day7 = L"Saturday";
3.2461 ++
3.2462 ++ // Abbreviated day names, starting with "C"'s Sun.
3.2463 ++ _M_data->_M_aday1 = L"Sun";
3.2464 ++ _M_data->_M_aday2 = L"Mon";
3.2465 ++ _M_data->_M_aday3 = L"Tue";
3.2466 ++ _M_data->_M_aday4 = L"Wed";
3.2467 ++ _M_data->_M_aday5 = L"Thu";
3.2468 ++ _M_data->_M_aday6 = L"Fri";
3.2469 ++ _M_data->_M_aday7 = L"Sat";
3.2470 ++
3.2471 ++ // Month names, starting with "C"'s January.
3.2472 ++ _M_data->_M_month01 = L"January";
3.2473 ++ _M_data->_M_month02 = L"February";
3.2474 ++ _M_data->_M_month03 = L"March";
3.2475 ++ _M_data->_M_month04 = L"April";
3.2476 ++ _M_data->_M_month05 = L"May";
3.2477 ++ _M_data->_M_month06 = L"June";
3.2478 ++ _M_data->_M_month07 = L"July";
3.2479 ++ _M_data->_M_month08 = L"August";
3.2480 ++ _M_data->_M_month09 = L"September";
3.2481 ++ _M_data->_M_month10 = L"October";
3.2482 ++ _M_data->_M_month11 = L"November";
3.2483 ++ _M_data->_M_month12 = L"December";
3.2484 ++
3.2485 ++ // Abbreviated month names, starting with "C"'s Jan.
3.2486 ++ _M_data->_M_amonth01 = L"Jan";
3.2487 ++ _M_data->_M_amonth02 = L"Feb";
3.2488 ++ _M_data->_M_amonth03 = L"Mar";
3.2489 ++ _M_data->_M_amonth04 = L"Apr";
3.2490 ++ _M_data->_M_amonth05 = L"May";
3.2491 ++ _M_data->_M_amonth06 = L"Jun";
3.2492 ++ _M_data->_M_amonth07 = L"Jul";
3.2493 ++ _M_data->_M_amonth08 = L"Aug";
3.2494 ++ _M_data->_M_amonth09 = L"Sep";
3.2495 ++ _M_data->_M_amonth10 = L"Oct";
3.2496 ++ _M_data->_M_amonth11 = L"Nov";
3.2497 ++ _M_data->_M_amonth12 = L"Dec";
3.2498 ++ }
3.2499 ++#if 0
3.2500 ++ else
3.2501 ++ {
3.2502 ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
3.2503 ++
3.2504 ++ union { char *__s; wchar_t *__w; } __u;
3.2505 ++
3.2506 ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
3.2507 ++ _M_data->_M_date_format = __u.__w;
3.2508 ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
3.2509 ++ _M_data->_M_date_era_format = __u.__w;
3.2510 ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
3.2511 ++ _M_data->_M_time_format = __u.__w;
3.2512 ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
3.2513 ++ _M_data->_M_time_era_format = __u.__w;
3.2514 ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
3.2515 ++ _M_data->_M_date_time_format = __u.__w;
3.2516 ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
3.2517 ++ _M_data->_M_date_time_era_format = __u.__w;
3.2518 ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
3.2519 ++ _M_data->_M_am = __u.__w;
3.2520 ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
3.2521 ++ _M_data->_M_pm = __u.__w;
3.2522 ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
3.2523 ++ _M_data->_M_am_pm_format = __u.__w;
3.2524 ++
3.2525 ++ // Day names, starting with "C"'s Sunday.
3.2526 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
3.2527 ++ _M_data->_M_day1 = __u.__w;
3.2528 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
3.2529 ++ _M_data->_M_day2 = __u.__w;
3.2530 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
3.2531 ++ _M_data->_M_day3 = __u.__w;
3.2532 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
3.2533 ++ _M_data->_M_day4 = __u.__w;
3.2534 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
3.2535 ++ _M_data->_M_day5 = __u.__w;
3.2536 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
3.2537 ++ _M_data->_M_day6 = __u.__w;
3.2538 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
3.2539 ++ _M_data->_M_day7 = __u.__w;
3.2540 ++
3.2541 ++ // Abbreviated day names, starting with "C"'s Sun.
3.2542 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
3.2543 ++ _M_data->_M_aday1 = __u.__w;
3.2544 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
3.2545 ++ _M_data->_M_aday2 = __u.__w;
3.2546 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
3.2547 ++ _M_data->_M_aday3 = __u.__w;
3.2548 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
3.2549 ++ _M_data->_M_aday4 = __u.__w;
3.2550 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
3.2551 ++ _M_data->_M_aday5 = __u.__w;
3.2552 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
3.2553 ++ _M_data->_M_aday6 = __u.__w;
3.2554 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
3.2555 ++ _M_data->_M_aday7 = __u.__w;
3.2556 ++
3.2557 ++ // Month names, starting with "C"'s January.
3.2558 ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
3.2559 ++ _M_data->_M_month01 = __u.__w;
3.2560 ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
3.2561 ++ _M_data->_M_month02 = __u.__w;
3.2562 ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
3.2563 ++ _M_data->_M_month03 = __u.__w;
3.2564 ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
3.2565 ++ _M_data->_M_month04 = __u.__w;
3.2566 ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
3.2567 ++ _M_data->_M_month05 = __u.__w;
3.2568 ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
3.2569 ++ _M_data->_M_month06 = __u.__w;
3.2570 ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
3.2571 ++ _M_data->_M_month07 = __u.__w;
3.2572 ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
3.2573 ++ _M_data->_M_month08 = __u.__w;
3.2574 ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
3.2575 ++ _M_data->_M_month09 = __u.__w;
3.2576 ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
3.2577 ++ _M_data->_M_month10 = __u.__w;
3.2578 ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
3.2579 ++ _M_data->_M_month11 = __u.__w;
3.2580 ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
3.2581 ++ _M_data->_M_month12 = __u.__w;
3.2582 ++
3.2583 ++ // Abbreviated month names, starting with "C"'s Jan.
3.2584 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
3.2585 ++ _M_data->_M_amonth01 = __u.__w;
3.2586 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
3.2587 ++ _M_data->_M_amonth02 = __u.__w;
3.2588 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
3.2589 ++ _M_data->_M_amonth03 = __u.__w;
3.2590 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
3.2591 ++ _M_data->_M_amonth04 = __u.__w;
3.2592 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
3.2593 ++ _M_data->_M_amonth05 = __u.__w;
3.2594 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
3.2595 ++ _M_data->_M_amonth06 = __u.__w;
3.2596 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
3.2597 ++ _M_data->_M_amonth07 = __u.__w;
3.2598 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
3.2599 ++ _M_data->_M_amonth08 = __u.__w;
3.2600 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
3.2601 ++ _M_data->_M_amonth09 = __u.__w;
3.2602 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
3.2603 ++ _M_data->_M_amonth10 = __u.__w;
3.2604 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
3.2605 ++ _M_data->_M_amonth11 = __u.__w;
3.2606 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
3.2607 ++ _M_data->_M_amonth12 = __u.__w;
3.2608 ++ }
3.2609 ++#endif // 0
3.2610 ++ }
3.2611 ++#endif
3.2612 ++}
3.2613 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h
3.2614 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100
3.2615 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200
3.2616 +@@ -0,0 +1,68 @@
3.2617 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
3.2618 ++
3.2619 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.2620 ++//
3.2621 ++// This file is part of the GNU ISO C++ Library. This library is free
3.2622 ++// software; you can redistribute it and/or modify it under the
3.2623 ++// terms of the GNU General Public License as published by the
3.2624 ++// Free Software Foundation; either version 2, or (at your option)
3.2625 ++// any later version.
3.2626 ++
3.2627 ++// This library is distributed in the hope that it will be useful,
3.2628 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.2629 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.2630 ++// GNU General Public License for more details.
3.2631 ++
3.2632 ++// You should have received a copy of the GNU General Public License along
3.2633 ++// with this library; see the file COPYING. If not, write to the Free
3.2634 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.2635 ++// USA.
3.2636 ++
3.2637 ++// As a special exception, you may use this file as part of a free software
3.2638 ++// library without restriction. Specifically, if other files instantiate
3.2639 ++// templates or use macros or inline functions from this file, or you compile
3.2640 ++// this file and link it with other files to produce an executable, this
3.2641 ++// file does not by itself cause the resulting executable to be covered by
3.2642 ++// the GNU General Public License. This exception does not however
3.2643 ++// invalidate any other reasons why the executable file might be covered by
3.2644 ++// the GNU General Public License.
3.2645 ++
3.2646 ++//
3.2647 ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions
3.2648 ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions
3.2649 ++//
3.2650 ++
3.2651 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.2652 ++
3.2653 ++ template<typename _CharT>
3.2654 ++ __timepunct<_CharT>::__timepunct(size_t __refs)
3.2655 ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
3.2656 ++ _M_name_timepunct(_S_get_c_name())
3.2657 ++ { _M_initialize_timepunct(); }
3.2658 ++
3.2659 ++ template<typename _CharT>
3.2660 ++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
3.2661 ++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
3.2662 ++ _M_name_timepunct(_S_get_c_name())
3.2663 ++ { _M_initialize_timepunct(); }
3.2664 ++
3.2665 ++ template<typename _CharT>
3.2666 ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
3.2667 ++ size_t __refs)
3.2668 ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
3.2669 ++ _M_name_timepunct(__s)
3.2670 ++ {
3.2671 ++ char* __tmp = new char[std::strlen(__s) + 1];
3.2672 ++ std::strcpy(__tmp, __s);
3.2673 ++ _M_name_timepunct = __tmp;
3.2674 ++ _M_initialize_timepunct(__cloc);
3.2675 ++ }
3.2676 ++
3.2677 ++ template<typename _CharT>
3.2678 ++ __timepunct<_CharT>::~__timepunct()
3.2679 ++ {
3.2680 ++ if (_M_name_timepunct != _S_get_c_name())
3.2681 ++ delete [] _M_name_timepunct;
3.2682 ++ delete _M_data;
3.2683 ++ _S_destroy_c_locale(_M_c_locale_timepunct);
3.2684 ++ }
3.2685 +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
3.2686 +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200
3.2687 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200
3.2688 +@@ -5769,7 +5769,7 @@
3.2689 + enableval="$enable_clocale"
3.2690 +
3.2691 + case "$enableval" in
3.2692 +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
3.2693 ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
3.2694 + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
3.2695 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
3.2696 + { (exit 1); exit 1; }; } ;;
3.2697 +@@ -5802,6 +5802,9 @@
3.2698 + # Default to "generic".
3.2699 + if test $enable_clocale_flag = auto; then
3.2700 + case ${target_os} in
3.2701 ++ linux-uclibc*)
3.2702 ++ enable_clocale_flag=uclibc
3.2703 ++ ;;
3.2704 + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
3.2705 + enable_clocale_flag=gnu
3.2706 + ;;
3.2707 +@@ -6190,6 +6193,76 @@
3.2708 + CTIME_CC=config/locale/generic/time_members.cc
3.2709 + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3.2710 + ;;
3.2711 ++ uclibc)
3.2712 ++ echo "$as_me:$LINENO: result: uclibc" >&5
3.2713 ++echo "${ECHO_T}uclibc" >&6
3.2714 ++
3.2715 ++ # Declare intention to use gettext, and add support for specific
3.2716 ++ # languages.
3.2717 ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3.2718 ++ ALL_LINGUAS="de fr"
3.2719 ++
3.2720 ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3.2721 ++ # Extract the first word of "msgfmt", so it can be a program name with args.
3.2722 ++set dummy msgfmt; ac_word=$2
3.2723 ++echo "$as_me:$LINENO: checking for $ac_word" >&5
3.2724 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
3.2725 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then
3.2726 ++ echo $ECHO_N "(cached) $ECHO_C" >&6
3.2727 ++else
3.2728 ++ if test -n "$check_msgfmt"; then
3.2729 ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
3.2730 ++else
3.2731 ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3.2732 ++for as_dir in $PATH
3.2733 ++do
3.2734 ++ IFS=$as_save_IFS
3.2735 ++ test -z "$as_dir" && as_dir=.
3.2736 ++ for ac_exec_ext in '' $ac_executable_extensions; do
3.2737 ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3.2738 ++ ac_cv_prog_check_msgfmt="yes"
3.2739 ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3.2740 ++ break 2
3.2741 ++ fi
3.2742 ++done
3.2743 ++done
3.2744 ++
3.2745 ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
3.2746 ++fi
3.2747 ++fi
3.2748 ++check_msgfmt=$ac_cv_prog_check_msgfmt
3.2749 ++if test -n "$check_msgfmt"; then
3.2750 ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
3.2751 ++echo "${ECHO_T}$check_msgfmt" >&6
3.2752 ++else
3.2753 ++ echo "$as_me:$LINENO: result: no" >&5
3.2754 ++echo "${ECHO_T}no" >&6
3.2755 ++fi
3.2756 ++
3.2757 ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3.2758 ++ USE_NLS=yes
3.2759 ++ fi
3.2760 ++ # Export the build objects.
3.2761 ++ for ling in $ALL_LINGUAS; do \
3.2762 ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3.2763 ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3.2764 ++ done
3.2765 ++
3.2766 ++
3.2767 ++
3.2768 ++ CLOCALE_H=config/locale/uclibc/c_locale.h
3.2769 ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
3.2770 ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3.2771 ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3.2772 ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3.2773 ++ CMESSAGES_H=config/locale/uclibc/messages_members.h
3.2774 ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3.2775 ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
3.2776 ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3.2777 ++ CTIME_H=config/locale/uclibc/time_members.h
3.2778 ++ CTIME_CC=config/locale/uclibc/time_members.cc
3.2779 ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3.2780 ++ ;;
3.2781 + esac
3.2782 +
3.2783 + # This is where the testsuite looks for locale catalogs, using the
3.2784 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h
3.2785 +--- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200
3.2786 ++++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200
3.2787 +@@ -101,7 +101,9 @@
3.2788 + using std::wmemcpy;
3.2789 + using std::wmemmove;
3.2790 + using std::wmemset;
3.2791 ++#if _GLIBCXX_HAVE_WCSFTIME
3.2792 + using std::wcsftime;
3.2793 ++#endif
3.2794 +
3.2795 + #if _GLIBCXX_USE_C99
3.2796 + using std::wcstold;
3.2797 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h
3.2798 +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100
3.2799 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200
3.2800 +@@ -182,7 +182,9 @@
3.2801 + using ::wcscoll;
3.2802 + using ::wcscpy;
3.2803 + using ::wcscspn;
3.2804 ++#if _GLIBCXX_HAVE_WCSFTIME
3.2805 + using ::wcsftime;
3.2806 ++#endif
3.2807 + using ::wcslen;
3.2808 + using ::wcsncat;
3.2809 + using ::wcsncmp;
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/patches/gcc/4.2.2/203-uclibc-locale-no__x.patch Sun Feb 17 22:08:06 2008 +0000
4.3 @@ -0,0 +1,223 @@
4.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
4.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200
4.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200
4.7 +@@ -39,20 +39,6 @@
4.8 + #include <langinfo.h>
4.9 + #include <bits/c++locale_internal.h>
4.10 +
4.11 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.12 +-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
4.13 +-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
4.14 +-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
4.15 +-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
4.16 +-#define __strtof_l(S, E, L) strtof((S), (E))
4.17 +-#define __strtod_l(S, E, L) strtod((S), (E))
4.18 +-#define __strtold_l(S, E, L) strtold((S), (E))
4.19 +-#warning should dummy __newlocale check for C|POSIX ?
4.20 +-#define __newlocale(a, b, c) NULL
4.21 +-#define __freelocale(a) ((void)0)
4.22 +-#define __duplocale(a) __c_locale()
4.23 +-#endif
4.24 +-
4.25 + namespace std
4.26 + {
4.27 + template<>
4.28 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h
4.29 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200
4.30 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200
4.31 +@@ -68,6 +68,7 @@
4.32 + {
4.33 + extern "C" __typeof(uselocale) __uselocale;
4.34 + }
4.35 ++#define __uselocale uselocale
4.36 + #endif
4.37 +
4.38 + namespace std
4.39 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
4.40 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200
4.41 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200
4.42 +@@ -60,4 +60,49 @@
4.43 + extern "C" __typeof(wctype_l) __wctype_l;
4.44 + #endif
4.45 +
4.46 ++# define __nl_langinfo_l nl_langinfo_l
4.47 ++# define __strcoll_l strcoll_l
4.48 ++# define __strftime_l strftime_l
4.49 ++# define __strtod_l strtod_l
4.50 ++# define __strtof_l strtof_l
4.51 ++# define __strtold_l strtold_l
4.52 ++# define __strxfrm_l strxfrm_l
4.53 ++# define __newlocale newlocale
4.54 ++# define __freelocale freelocale
4.55 ++# define __duplocale duplocale
4.56 ++# define __uselocale uselocale
4.57 ++
4.58 ++# ifdef _GLIBCXX_USE_WCHAR_T
4.59 ++# define __iswctype_l iswctype_l
4.60 ++# define __towlower_l towlower_l
4.61 ++# define __towupper_l towupper_l
4.62 ++# define __wcscoll_l wcscoll_l
4.63 ++# define __wcsftime_l wcsftime_l
4.64 ++# define __wcsxfrm_l wcsxfrm_l
4.65 ++# define __wctype_l wctype_l
4.66 ++# endif
4.67 ++
4.68 ++#else
4.69 ++# define __nl_langinfo_l(N, L) nl_langinfo((N))
4.70 ++# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
4.71 ++# define __strtod_l(S, E, L) strtod((S), (E))
4.72 ++# define __strtof_l(S, E, L) strtof((S), (E))
4.73 ++# define __strtold_l(S, E, L) strtold((S), (E))
4.74 ++# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
4.75 ++# warning should dummy __newlocale check for C|POSIX ?
4.76 ++# define __newlocale(a, b, c) NULL
4.77 ++# define __freelocale(a) ((void)0)
4.78 ++# define __duplocale(a) __c_locale()
4.79 ++//# define __uselocale ?
4.80 ++//
4.81 ++# ifdef _GLIBCXX_USE_WCHAR_T
4.82 ++# define __iswctype_l(C, M, L) iswctype((C), (M))
4.83 ++# define __towlower_l(C, L) towlower((C))
4.84 ++# define __towupper_l(C, L) towupper((C))
4.85 ++# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
4.86 ++//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
4.87 ++# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
4.88 ++# define __wctype_l(S, L) wctype((S))
4.89 ++# endif
4.90 ++
4.91 + #endif // GLIBC 2.3 and later
4.92 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc
4.93 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200
4.94 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200
4.95 +@@ -36,13 +36,6 @@
4.96 + #include <locale>
4.97 + #include <bits/c++locale_internal.h>
4.98 +
4.99 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.100 +-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
4.101 +-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
4.102 +-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
4.103 +-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
4.104 +-#endif
4.105 +-
4.106 + namespace std
4.107 + {
4.108 + // These are basically extensions to char_traits, and perhaps should
4.109 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
4.110 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200
4.111 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200
4.112 +@@ -38,13 +38,6 @@
4.113 + #undef _LIBC
4.114 + #include <bits/c++locale_internal.h>
4.115 +
4.116 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.117 +-#define __wctype_l(S, L) wctype((S))
4.118 +-#define __towupper_l(C, L) towupper((C))
4.119 +-#define __towlower_l(C, L) towlower((C))
4.120 +-#define __iswctype_l(C, M, L) iswctype((C), (M))
4.121 +-#endif
4.122 +-
4.123 + namespace std
4.124 + {
4.125 + // NB: The other ctype<char> specializations are in src/locale.cc and
4.126 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc
4.127 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200
4.128 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200
4.129 +@@ -39,13 +39,10 @@
4.130 + #ifdef __UCLIBC_MJN3_ONLY__
4.131 + #warning fix gettext stuff
4.132 + #endif
4.133 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.134 +-extern "C" char *__dcgettext(const char *domainname,
4.135 +- const char *msgid, int category);
4.136 + #undef gettext
4.137 +-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
4.138 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.139 ++#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
4.140 + #else
4.141 +-#undef gettext
4.142 + #define gettext(msgid) (msgid)
4.143 + #endif
4.144 +
4.145 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
4.146 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200
4.147 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200
4.148 +@@ -36,15 +36,11 @@
4.149 + #ifdef __UCLIBC_MJN3_ONLY__
4.150 + #warning fix prototypes for *textdomain funcs
4.151 + #endif
4.152 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.153 +-extern "C" char *__textdomain(const char *domainname);
4.154 +-extern "C" char *__bindtextdomain(const char *domainname,
4.155 +- const char *dirname);
4.156 +-#else
4.157 +-#undef __textdomain
4.158 +-#undef __bindtextdomain
4.159 +-#define __textdomain(D) ((void)0)
4.160 +-#define __bindtextdomain(D,P) ((void)0)
4.161 ++#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.162 ++#undef textdomain
4.163 ++#undef bindtextdomain
4.164 ++#define textdomain(D) ((void)0)
4.165 ++#define bindtextdomain(D,P) ((void)0)
4.166 + #endif
4.167 +
4.168 + // Non-virtual member functions.
4.169 +@@ -70,7 +66,7 @@
4.170 + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
4.171 + const char* __dir) const
4.172 + {
4.173 +- __bindtextdomain(__s.c_str(), __dir);
4.174 ++ bindtextdomain(__s.c_str(), __dir);
4.175 + return this->do_open(__s, __loc);
4.176 + }
4.177 +
4.178 +@@ -90,7 +86,7 @@
4.179 + {
4.180 + // No error checking is done, assume the catalog exists and can
4.181 + // be used.
4.182 +- __textdomain(__s.c_str());
4.183 ++ textdomain(__s.c_str());
4.184 + return 0;
4.185 + }
4.186 +
4.187 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
4.188 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200
4.189 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200
4.190 +@@ -43,10 +43,6 @@
4.191 + #warning tailor for stub locale support
4.192 + #endif
4.193 +
4.194 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.195 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
4.196 +-#endif
4.197 +-
4.198 + namespace std
4.199 + {
4.200 + // Construct and return valid pattern consisting of some combination of:
4.201 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
4.202 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200
4.203 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200
4.204 +@@ -41,9 +41,6 @@
4.205 + #ifdef __UCLIBC_MJN3_ONLY__
4.206 + #warning tailor for stub locale support
4.207 + #endif
4.208 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.209 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
4.210 +-#endif
4.211 +
4.212 + namespace std
4.213 + {
4.214 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc
4.215 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200
4.216 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200
4.217 +@@ -40,9 +40,6 @@
4.218 + #ifdef __UCLIBC_MJN3_ONLY__
4.219 + #warning tailor for stub locale support
4.220 + #endif
4.221 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.222 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
4.223 +-#endif
4.224 +
4.225 + namespace std
4.226 + {
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/patches/gcc/4.2.2/204-uclibc-locale-wchar_fix.patch Sun Feb 17 22:08:06 2008 +0000
5.3 @@ -0,0 +1,50 @@
5.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
5.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200
5.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200
5.7 +@@ -401,7 +401,7 @@
5.8 + # ifdef __UCLIBC_HAS_XLOCALE__
5.9 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
5.10 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
5.11 +-# else
5.12 ++# elif defined __UCLIBC_HAS_LOCALE__
5.13 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
5.14 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
5.15 + # endif
5.16 +@@ -556,7 +556,7 @@
5.17 + # ifdef __UCLIBC_HAS_XLOCALE__
5.18 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
5.19 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
5.20 +-# else
5.21 ++# elif defined __UCLIBC_HAS_LOCALE__
5.22 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
5.23 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
5.24 + # endif
5.25 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
5.26 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200
5.27 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200
5.28 +@@ -127,12 +127,25 @@
5.29 + {
5.30 + // Named locale.
5.31 + // NB: In the GNU model wchar_t is always 32 bit wide.
5.32 ++#ifdef __UCLIBC_MJN3_ONLY__
5.33 ++#warning fix this... should be numeric
5.34 ++#endif
5.35 ++#ifdef __UCLIBC__
5.36 ++# ifdef __UCLIBC_HAS_XLOCALE__
5.37 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
5.38 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
5.39 ++# elif defined __UCLIBC_HAS_LOCALE__
5.40 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
5.41 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
5.42 ++# endif
5.43 ++#else
5.44 + union { char *__s; wchar_t __w; } __u;
5.45 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
5.46 + _M_data->_M_decimal_point = __u.__w;
5.47 +
5.48 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
5.49 + _M_data->_M_thousands_sep = __u.__w;
5.50 ++#endif
5.51 +
5.52 + if (_M_data->_M_thousands_sep == L'\0')
5.53 + _M_data->_M_grouping = "";
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/patches/gcc/4.2.2/205-uclibc-locale-update.patch Sun Feb 17 22:08:06 2008 +0000
6.3 @@ -0,0 +1,354 @@
6.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
6.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200
6.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200
6.7 +@@ -46,16 +46,13 @@
6.8 + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
6.9 + const __c_locale& __cloc)
6.10 + {
6.11 +- if (!(__err & ios_base::failbit))
6.12 +- {
6.13 +- char* __sanity;
6.14 +- errno = 0;
6.15 +- float __f = __strtof_l(__s, &__sanity, __cloc);
6.16 +- if (__sanity != __s && errno != ERANGE)
6.17 +- __v = __f;
6.18 +- else
6.19 +- __err |= ios_base::failbit;
6.20 +- }
6.21 ++ char* __sanity;
6.22 ++ errno = 0;
6.23 ++ float __f = __strtof_l(__s, &__sanity, __cloc);
6.24 ++ if (__sanity != __s && errno != ERANGE)
6.25 ++ __v = __f;
6.26 ++ else
6.27 ++ __err |= ios_base::failbit;
6.28 + }
6.29 +
6.30 + template<>
6.31 +@@ -63,16 +60,13 @@
6.32 + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
6.33 + const __c_locale& __cloc)
6.34 + {
6.35 +- if (!(__err & ios_base::failbit))
6.36 +- {
6.37 +- char* __sanity;
6.38 +- errno = 0;
6.39 +- double __d = __strtod_l(__s, &__sanity, __cloc);
6.40 +- if (__sanity != __s && errno != ERANGE)
6.41 +- __v = __d;
6.42 +- else
6.43 +- __err |= ios_base::failbit;
6.44 +- }
6.45 ++ char* __sanity;
6.46 ++ errno = 0;
6.47 ++ double __d = __strtod_l(__s, &__sanity, __cloc);
6.48 ++ if (__sanity != __s && errno != ERANGE)
6.49 ++ __v = __d;
6.50 ++ else
6.51 ++ __err |= ios_base::failbit;
6.52 + }
6.53 +
6.54 + template<>
6.55 +@@ -80,16 +74,13 @@
6.56 + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
6.57 + const __c_locale& __cloc)
6.58 + {
6.59 +- if (!(__err & ios_base::failbit))
6.60 +- {
6.61 +- char* __sanity;
6.62 +- errno = 0;
6.63 +- long double __ld = __strtold_l(__s, &__sanity, __cloc);
6.64 +- if (__sanity != __s && errno != ERANGE)
6.65 +- __v = __ld;
6.66 +- else
6.67 +- __err |= ios_base::failbit;
6.68 +- }
6.69 ++ char* __sanity;
6.70 ++ errno = 0;
6.71 ++ long double __ld = __strtold_l(__s, &__sanity, __cloc);
6.72 ++ if (__sanity != __s && errno != ERANGE)
6.73 ++ __v = __ld;
6.74 ++ else
6.75 ++ __err |= ios_base::failbit;
6.76 + }
6.77 +
6.78 + void
6.79 +@@ -110,7 +101,7 @@
6.80 + void
6.81 + locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
6.82 + {
6.83 +- if (_S_get_c_locale() != __cloc)
6.84 ++ if (__cloc && _S_get_c_locale() != __cloc)
6.85 + __freelocale(__cloc);
6.86 + }
6.87 +
6.88 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h
6.89 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200
6.90 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200
6.91 +@@ -39,21 +39,23 @@
6.92 + #pragma GCC system_header
6.93 +
6.94 + #include <cstring> // get std::strlen
6.95 +-#include <cstdio> // get std::snprintf or std::sprintf
6.96 ++#include <cstdio> // get std::vsnprintf or std::vsprintf
6.97 + #include <clocale>
6.98 + #include <langinfo.h> // For codecvt
6.99 + #ifdef __UCLIBC_MJN3_ONLY__
6.100 + #warning fix this
6.101 + #endif
6.102 +-#ifdef __UCLIBC_HAS_LOCALE__
6.103 ++#ifdef _GLIBCXX_USE_ICONV
6.104 + #include <iconv.h> // For codecvt using iconv, iconv_t
6.105 + #endif
6.106 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
6.107 +-#include <libintl.h> // For messages
6.108 ++#ifdef HAVE_LIBINTL_H
6.109 ++#include <libintl.h> // For messages
6.110 + #endif
6.111 ++#include <cstdarg>
6.112 +
6.113 + #ifdef __UCLIBC_MJN3_ONLY__
6.114 + #warning what is _GLIBCXX_C_LOCALE_GNU for
6.115 ++// psm: used in os/gnu-linux/ctype_noninline.h
6.116 + #endif
6.117 + #define _GLIBCXX_C_LOCALE_GNU 1
6.118 +
6.119 +@@ -62,7 +64,7 @@
6.120 + #endif
6.121 + // #define _GLIBCXX_NUM_CATEGORIES 6
6.122 + #define _GLIBCXX_NUM_CATEGORIES 0
6.123 +-
6.124 ++
6.125 + #ifdef __UCLIBC_HAS_XLOCALE__
6.126 + namespace __gnu_cxx
6.127 + {
6.128 +@@ -79,22 +81,24 @@
6.129 + typedef int* __c_locale;
6.130 + #endif
6.131 +
6.132 +- // Convert numeric value of type _Tv to string and return length of
6.133 +- // string. If snprintf is available use it, otherwise fall back to
6.134 +- // the unsafe sprintf which, in general, can be dangerous and should
6.135 ++ // Convert numeric value of type double to string and return length of
6.136 ++ // string. If vsnprintf is available use it, otherwise fall back to
6.137 ++ // the unsafe vsprintf which, in general, can be dangerous and should
6.138 + // be avoided.
6.139 +- template<typename _Tv>
6.140 +- int
6.141 +- __convert_from_v(char* __out,
6.142 +- const int __size __attribute__ ((__unused__)),
6.143 +- const char* __fmt,
6.144 +-#ifdef __UCLIBC_HAS_XCLOCALE__
6.145 +- _Tv __v, const __c_locale& __cloc, int __prec)
6.146 ++ inline int
6.147 ++ __convert_from_v(const __c_locale&
6.148 ++#ifndef __UCLIBC_HAS_XCLOCALE__
6.149 ++ __cloc __attribute__ ((__unused__))
6.150 ++#endif
6.151 ++ ,
6.152 ++ char* __out,
6.153 ++ const int __size,
6.154 ++ const char* __fmt, ...)
6.155 + {
6.156 ++ va_list __args;
6.157 ++#ifdef __UCLIBC_HAS_XCLOCALE__
6.158 + __c_locale __old = __gnu_cxx::__uselocale(__cloc);
6.159 + #else
6.160 +- _Tv __v, const __c_locale&, int __prec)
6.161 +- {
6.162 + # ifdef __UCLIBC_HAS_LOCALE__
6.163 + char* __old = std::setlocale(LC_ALL, NULL);
6.164 + char* __sav = new char[std::strlen(__old) + 1];
6.165 +@@ -103,7 +107,9 @@
6.166 + # endif
6.167 + #endif
6.168 +
6.169 +- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
6.170 ++ va_start(__args, __fmt);
6.171 ++ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
6.172 ++ va_end(__args);
6.173 +
6.174 + #ifdef __UCLIBC_HAS_XCLOCALE__
6.175 + __gnu_cxx::__uselocale(__old);
6.176 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
6.177 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200
6.178 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200
6.179 +@@ -33,9 +33,14 @@
6.180 +
6.181 + // Written by Benjamin Kosnik <bkoz@redhat.com>
6.182 +
6.183 ++#include <features.h>
6.184 ++#ifdef __UCLIBC_HAS_LOCALE__
6.185 + #define _LIBC
6.186 + #include <locale>
6.187 + #undef _LIBC
6.188 ++#else
6.189 ++#include <locale>
6.190 ++#endif
6.191 + #include <bits/c++locale_internal.h>
6.192 +
6.193 + namespace std
6.194 +@@ -138,20 +143,34 @@
6.195 + ctype<wchar_t>::
6.196 + do_is(mask __m, wchar_t __c) const
6.197 + {
6.198 +- // Highest bitmask in ctype_base == 10, but extra in "C"
6.199 +- // library for blank.
6.200 ++ // The case of __m == ctype_base::space is particularly important,
6.201 ++ // due to its use in many istream functions. Therefore we deal with
6.202 ++ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
6.203 ++ // is the mask corresponding to ctype_base::space. NB: an encoding
6.204 ++ // change would not affect correctness!
6.205 + bool __ret = false;
6.206 +- const size_t __bitmasksize = 11;
6.207 +- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
6.208 +- if (__m & _M_bit[__bitcur]
6.209 +- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
6.210 +- {
6.211 +- __ret = true;
6.212 +- break;
6.213 +- }
6.214 ++ if (__m == _M_bit[5])
6.215 ++ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
6.216 ++ else
6.217 ++ {
6.218 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
6.219 ++ // library for blank.
6.220 ++ const size_t __bitmasksize = 11;
6.221 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
6.222 ++ if (__m & _M_bit[__bitcur])
6.223 ++ {
6.224 ++ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
6.225 ++ {
6.226 ++ __ret = true;
6.227 ++ break;
6.228 ++ }
6.229 ++ else if (__m == _M_bit[__bitcur])
6.230 ++ break;
6.231 ++ }
6.232 ++ }
6.233 + return __ret;
6.234 + }
6.235 +-
6.236 ++
6.237 + const wchar_t*
6.238 + ctype<wchar_t>::
6.239 + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
6.240 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
6.241 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200
6.242 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200
6.243 +@@ -47,18 +47,21 @@
6.244 + template<typename _CharT>
6.245 + messages<_CharT>::messages(size_t __refs)
6.246 + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
6.247 +- _M_name_messages(_S_get_c_name())
6.248 ++ _M_name_messages(_S_get_c_name())
6.249 + { }
6.250 +
6.251 + template<typename _CharT>
6.252 + messages<_CharT>::messages(__c_locale __cloc, const char* __s,
6.253 + size_t __refs)
6.254 +- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
6.255 +- _M_name_messages(__s)
6.256 ++ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
6.257 + {
6.258 +- char* __tmp = new char[std::strlen(__s) + 1];
6.259 +- std::strcpy(__tmp, __s);
6.260 ++ const size_t __len = std::strlen(__s) + 1;
6.261 ++ char* __tmp = new char[__len];
6.262 ++ std::memcpy(__tmp, __s, __len);
6.263 + _M_name_messages = __tmp;
6.264 ++
6.265 ++ // Last to avoid leaking memory if new throws.
6.266 ++ _M_c_locale_messages = _S_clone_c_locale(__cloc);
6.267 + }
6.268 +
6.269 + template<typename _CharT>
6.270 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
6.271 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200
6.272 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200
6.273 +@@ -33,9 +33,14 @@
6.274 +
6.275 + // Written by Benjamin Kosnik <bkoz@redhat.com>
6.276 +
6.277 ++#include <features.h>
6.278 ++#ifdef __UCLIBC_HAS_LOCALE__
6.279 + #define _LIBC
6.280 + #include <locale>
6.281 + #undef _LIBC
6.282 ++#else
6.283 ++#include <locale>
6.284 ++#endif
6.285 + #include <bits/c++locale_internal.h>
6.286 +
6.287 + #ifdef __UCLIBC_MJN3_ONLY__
6.288 +@@ -206,7 +211,7 @@
6.289 + }
6.290 + break;
6.291 + default:
6.292 +- ;
6.293 ++ __ret = pattern();
6.294 + }
6.295 + return __ret;
6.296 + }
6.297 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
6.298 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200
6.299 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200
6.300 +@@ -33,9 +33,14 @@
6.301 +
6.302 + // Written by Benjamin Kosnik <bkoz@redhat.com>
6.303 +
6.304 ++#include <features.h>
6.305 ++#ifdef __UCLIBC_HAS_LOCALE__
6.306 + #define _LIBC
6.307 + #include <locale>
6.308 + #undef _LIBC
6.309 ++#else
6.310 ++#include <locale>
6.311 ++#endif
6.312 + #include <bits/c++locale_internal.h>
6.313 +
6.314 + #ifdef __UCLIBC_MJN3_ONLY__
6.315 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h
6.316 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200
6.317 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200
6.318 +@@ -37,25 +37,33 @@
6.319 + template<typename _CharT>
6.320 + __timepunct<_CharT>::__timepunct(size_t __refs)
6.321 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
6.322 +- _M_name_timepunct(_S_get_c_name())
6.323 ++ _M_name_timepunct(_S_get_c_name())
6.324 + { _M_initialize_timepunct(); }
6.325 +
6.326 + template<typename _CharT>
6.327 + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
6.328 + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
6.329 +- _M_name_timepunct(_S_get_c_name())
6.330 ++ _M_name_timepunct(_S_get_c_name())
6.331 + { _M_initialize_timepunct(); }
6.332 +
6.333 + template<typename _CharT>
6.334 + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
6.335 + size_t __refs)
6.336 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
6.337 +- _M_name_timepunct(__s)
6.338 ++ _M_name_timepunct(NULL)
6.339 + {
6.340 +- char* __tmp = new char[std::strlen(__s) + 1];
6.341 +- std::strcpy(__tmp, __s);
6.342 ++ const size_t __len = std::strlen(__s) + 1;
6.343 ++ char* __tmp = new char[__len];
6.344 ++ std::memcpy(__tmp, __s, __len);
6.345 + _M_name_timepunct = __tmp;
6.346 +- _M_initialize_timepunct(__cloc);
6.347 ++
6.348 ++ try
6.349 ++ { _M_initialize_timepunct(__cloc); }
6.350 ++ catch(...)
6.351 ++ {
6.352 ++ delete [] _M_name_timepunct;
6.353 ++ __throw_exception_again;
6.354 ++ }
6.355 + }
6.356 +
6.357 + template<typename _CharT>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/patches/gcc/4.2.2/300-libstdc++-pic.patch Sun Feb 17 22:08:06 2008 +0000
7.3 @@ -0,0 +1,50 @@
7.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am
7.5 +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200
7.6 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200
7.7 +@@ -257,6 +257,12 @@
7.8 + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
7.9 +
7.10 +
7.11 ++install-exec-local:
7.12 ++ifeq ($(enable_shared),yes)
7.13 ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
7.14 ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
7.15 ++endif
7.16 ++
7.17 + # Added bits to build debug library.
7.18 + if GLIBCXX_BUILD_DEBUG
7.19 + all-local: build_debug
7.20 +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in
7.21 +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200
7.22 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200
7.23 +@@ -657,7 +657,7 @@
7.24 +
7.25 + install-data-am: install-data-local
7.26 +
7.27 +-install-exec-am: install-toolexeclibLTLIBRARIES
7.28 ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
7.29 +
7.30 + install-info: install-info-am
7.31 +
7.32 +@@ -690,6 +690,7 @@
7.33 + distclean-libtool distclean-tags distdir dvi dvi-am html \
7.34 + html-am info info-am install install-am install-data \
7.35 + install-data-am install-data-local install-exec \
7.36 ++ install-exec-local \
7.37 + install-exec-am install-info install-info-am install-man \
7.38 + install-strip install-toolexeclibLTLIBRARIES installcheck \
7.39 + installcheck-am installdirs maintainer-clean \
7.40 +@@ -799,6 +800,13 @@
7.41 + install_debug:
7.42 + (cd ${debugdir} && $(MAKE) \
7.43 + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
7.44 ++
7.45 ++install-exec-local:
7.46 ++ifeq ($(enable_shared),yes)
7.47 ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
7.48 ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
7.49 ++endif
7.50 ++
7.51 + # Tell versions [3.59,3.63) of GNU make to not export all variables.
7.52 + # Otherwise a system limit (for SysV at least) may be exceeded.
7.53 + .NOEXPORT:
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/patches/gcc/4.2.2/301-missing-execinfo_h.patch Sun Feb 17 22:08:06 2008 +0000
8.3 @@ -0,0 +1,12 @@
8.4 +diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h
8.5 +--- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200
8.6 ++++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200
8.7 +@@ -502,7 +502,7 @@
8.8 + #if defined(__linux__) || defined(__GLIBC__)
8.9 + # include <features.h>
8.10 + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
8.11 +- && !defined(__ia64__)
8.12 ++ && !defined(__ia64__) && !defined(__UCLIBC__)
8.13 + # ifndef GC_HAVE_BUILTIN_BACKTRACE
8.14 + # define GC_HAVE_BUILTIN_BACKTRACE
8.15 + # endif
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/patches/gcc/4.2.2/302-c99-snprintf.patch Sun Feb 17 22:08:06 2008 +0000
9.3 @@ -0,0 +1,12 @@
9.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h
9.5 +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100
9.6 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200
9.7 +@@ -144,7 +144,7 @@
9.8 +
9.9 + _GLIBCXX_END_NAMESPACE
9.10 +
9.11 +-#if _GLIBCXX_USE_C99
9.12 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
9.13 +
9.14 + #undef snprintf
9.15 + #undef vfscanf
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/patches/gcc/4.2.2/303-c99-complex-ugly-hack.patch Sun Feb 17 22:08:06 2008 +0000
10.3 @@ -0,0 +1,13 @@
10.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
10.5 +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200
10.6 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200
10.7 +@@ -7514,6 +7514,9 @@
10.8 + cat >>conftest.$ac_ext <<_ACEOF
10.9 + /* end confdefs.h. */
10.10 + #include <complex.h>
10.11 ++#ifdef __UCLIBC__
10.12 ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
10.13 ++#endif
10.14 + int
10.15 + main ()
10.16 + {
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/patches/gcc/4.2.2/304-index_macro.patch Sun Feb 17 22:08:06 2008 +0000
11.3 @@ -0,0 +1,26 @@
11.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope
11.5 +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200
11.6 ++++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200
11.7 +@@ -58,6 +58,9 @@
11.8 + #include <bits/allocator.h>
11.9 + #include <ext/hash_fun.h>
11.10 +
11.11 ++/* cope w/ index defined as macro, SuSv3 proposal */
11.12 ++#undef index
11.13 ++
11.14 + # ifdef __GC
11.15 + # define __GC_CONST const
11.16 + # else
11.17 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h
11.18 +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200
11.19 ++++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200
11.20 +@@ -54,6 +54,9 @@
11.21 + #include <ext/memory> // For uninitialized_copy_n
11.22 + #include <ext/numeric> // For power
11.23 +
11.24 ++/* cope w/ index defined as macro, SuSv3 proposal */
11.25 ++#undef index
11.26 ++
11.27 + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
11.28 +
11.29 + using std::size_t;
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/patches/gcc/4.2.2/305-libmudflap-susv3-legacy.patch Sun Feb 17 22:08:06 2008 +0000
12.3 @@ -0,0 +1,48 @@
12.4 +diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c
12.5 +--- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200
12.6 ++++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200
12.7 +@@ -427,7 +427,7 @@
12.8 + {
12.9 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.10 + MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
12.11 +- bzero (s, n);
12.12 ++ memset (s, 0, n);
12.13 + }
12.14 +
12.15 +
12.16 +@@ -437,7 +437,7 @@
12.17 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.18 + MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
12.19 + MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
12.20 +- bcopy (src, dest, n);
12.21 ++ memmove (dest, src, n);
12.22 + }
12.23 +
12.24 +
12.25 +@@ -447,7 +447,7 @@
12.26 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.27 + MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
12.28 + MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
12.29 +- return bcmp (s1, s2, n);
12.30 ++ return n == 0 ? 0 : memcmp (s1, s2, n);
12.31 + }
12.32 +
12.33 +
12.34 +@@ -456,7 +456,7 @@
12.35 + size_t n = strlen (s);
12.36 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.37 + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
12.38 +- return index (s, c);
12.39 ++ return strchr (s, c);
12.40 + }
12.41 +
12.42 +
12.43 +@@ -465,7 +465,7 @@
12.44 + size_t n = strlen (s);
12.45 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.46 + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
12.47 +- return rindex (s, c);
12.48 ++ return strrchr (s, c);
12.49 + }
12.50 +
12.51 + /* XXX: stpcpy, memccpy */
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/patches/gcc/4.2.2/306-libstdc++-namespace.patch Sun Feb 17 22:08:06 2008 +0000
13.3 @@ -0,0 +1,36 @@
13.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
13.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200
13.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200
13.7 +@@ -32,7 +32,8 @@
13.8 + //
13.9 +
13.10 + // Written by Benjamin Kosnik <bkoz@redhat.com>
13.11 +-
13.12 ++namespace std
13.13 ++{
13.14 + #ifdef __UCLIBC_MJN3_ONLY__
13.15 + #warning fix prototypes for *textdomain funcs
13.16 + #endif
13.17 +@@ -115,3 +116,4 @@
13.18 + this->_S_create_c_locale(this->_M_c_locale_messages, __s);
13.19 + }
13.20 + }
13.21 ++}
13.22 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h
13.23 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200
13.24 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200
13.25 +@@ -33,7 +33,8 @@
13.26 + //
13.27 +
13.28 + // Written by Benjamin Kosnik <bkoz@redhat.com>
13.29 +-
13.30 ++namespace std
13.31 ++{
13.32 + template<typename _CharT>
13.33 + __timepunct<_CharT>::__timepunct(size_t __refs)
13.34 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
13.35 +@@ -74,3 +75,4 @@
13.36 + delete _M_data;
13.37 + _S_destroy_c_locale(_M_c_locale_timepunct);
13.38 + }
13.39 ++}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/patches/gcc/4.2.2/402-libbackend_dep_gcov-iov.h.patch Sun Feb 17 22:08:06 2008 +0000
14.3 @@ -0,0 +1,12 @@
14.4 +diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in
14.5 +--- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200
14.6 ++++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200
14.7 +@@ -2660,7 +2660,7 @@
14.8 + # FIXME: writing proper dependencies for this is a *LOT* of work.
14.9 + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \
14.10 + insn-config.h insn-flags.h insn-codes.h insn-constants.h \
14.11 +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
14.12 ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h
14.13 + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
14.14 + -DTARGET_NAME=\"$(target_noncanonical)\" \
14.15 + -DLOCALEDIR=\"$(localedir)\" \
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/patches/gcc/4.2.2/800-arm-bigendian.patch Sun Feb 17 22:08:06 2008 +0000
15.3 @@ -0,0 +1,64 @@
15.4 +diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h
15.5 +--- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100
15.6 ++++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200
15.7 +@@ -28,19 +28,33 @@
15.8 + #undef TARGET_VERSION
15.9 + #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
15.10 +
15.11 ++/*
15.12 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
15.13 ++ * (big endian) configurations.
15.14 ++ */
15.15 ++#if TARGET_BIG_ENDIAN_DEFAULT
15.16 ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
15.17 ++#define TARGET_ENDIAN_OPTION "mbig-endian"
15.18 ++#define TARGET_LINKER_EMULATION "armelfb_linux"
15.19 ++#else
15.20 ++#define TARGET_ENDIAN_DEFAULT 0
15.21 ++#define TARGET_ENDIAN_OPTION "mlittle-endian"
15.22 ++#define TARGET_LINKER_EMULATION "armelf_linux"
15.23 ++#endif
15.24 ++
15.25 + #undef TARGET_DEFAULT_FLOAT_ABI
15.26 + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
15.27 +
15.28 + #undef TARGET_DEFAULT
15.29 +-#define TARGET_DEFAULT (0)
15.30 ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
15.31 +
15.32 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
15.33 +
15.34 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
15.35 ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
15.36 +
15.37 + #undef MULTILIB_DEFAULTS
15.38 + #define MULTILIB_DEFAULTS \
15.39 +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
15.40 ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
15.41 +
15.42 + /* Now we define the strings used to build the spec file. */
15.43 + #undef LIB_SPEC
15.44 +@@ -61,7 +75,7 @@
15.45 + %{rdynamic:-export-dynamic} \
15.46 + %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
15.47 + -X \
15.48 +- %{mbig-endian:-EB}" \
15.49 ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
15.50 + SUBTARGET_EXTRA_LINK_SPEC
15.51 +
15.52 + #undef LINK_SPEC
15.53 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc
15.54 +--- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200
15.55 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200
15.56 +@@ -705,6 +705,11 @@
15.57 + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
15.58 + tmake_file="${tmake_file} t-linux arm/t-arm"
15.59 + case ${target} in
15.60 ++ arm*b-*)
15.61 ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
15.62 ++ ;;
15.63 ++ esac
15.64 ++ case ${target} in
15.65 + arm*-*-linux-*eabi)
15.66 + tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
15.67 + tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/patches/gcc/4.2.2/801-softfloat-fix.patch Sun Feb 17 22:08:06 2008 +0000
16.3 @@ -0,0 +1,58 @@
16.4 +This patch (C) 2007 Yann E. MORIN
16.5 +Licensed under GPL v2.
16.6 +
16.7 +First hunk of this patch solves compiling uClibc:
16.8 +
16.9 +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc'
16.10 + LD libuClibc-0.9.29.so
16.11 +libc/libc_so.a(difftime.os): In function `difftime':
16.12 +difftime.c:(.text+0x8): undefined reference to `__floatsidf'
16.13 +difftime.c:(.text+0x2c): undefined reference to `__subdf3'
16.14 +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr':
16.15 +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2'
16.16 +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2'
16.17 +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3'
16.18 +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2'
16.19 +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3'
16.20 +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2'
16.21 +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3'
16.22 +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric':
16.23 +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2'
16.24 +libc/libc_so.a(strtof.os): In function `strtof':
16.25 +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2'
16.26 +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o):
16.27 +In function `__fixunsdfsi':
16.28 +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi'
16.29 +make[2]: *** [lib/libc.so] Error 1
16.30 +make[1]: *** [lib/libc.so.0] Error 2
16.31 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc'
16.32 +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a]
16.33 +Error 2
16.34 +
16.35 +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have).
16.36 +
16.37 +
16.38 +diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc
16.39 +--- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200
16.40 ++++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200
16.41 +@@ -721,7 +721,7 @@
16.42 + default_use_cxa_atexit=yes
16.43 + ;;
16.44 + *)
16.45 +- tmake_file="$tmake_file arm/t-linux"
16.46 ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf"
16.47 + ;;
16.48 + esac
16.49 + tm_file="$tm_file arm/aout.h arm/arm.h"
16.50 +diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h
16.51 +--- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200
16.52 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200
16.53 +@@ -63,7 +63,7 @@
16.54 + %{shared:-lc} \
16.55 + %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
16.56 +
16.57 +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
16.58 ++#define LIBGCC_SPEC "-lgcc"
16.59 +
16.60 + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
16.61 +
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/patches/gcc/4.2.2/904-flatten-switch-stmt-00.patch Sun Feb 17 22:08:06 2008 +0000
17.3 @@ -0,0 +1,24 @@
17.4 +diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c
17.5 +--- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200
17.6 ++++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200
17.7 +@@ -2512,7 +2512,11 @@
17.8 + use_cost_table
17.9 + = (TREE_CODE (orig_type) != ENUMERAL_TYPE
17.10 + && estimate_case_costs (case_list));
17.11 +- balance_case_nodes (&case_list, NULL);
17.12 ++ /* When optimizing for size, we want a straight list to avoid
17.13 ++ jumps as much as possible. This basically creates an if-else
17.14 ++ chain. */
17.15 ++ if (!optimize_size)
17.16 ++ balance_case_nodes (&case_list, NULL);
17.17 + emit_case_nodes (index, case_list, default_label, index_type);
17.18 + emit_jump (default_label);
17.19 + }
17.20 +@@ -3070,6 +3074,7 @@
17.21 + {
17.22 + if (!node_has_low_bound (node, index_type))
17.23 + {
17.24 ++ if (!optimize_size) /* don't jl to the .default_label. */
17.25 + emit_cmp_and_jump_insns (index,
17.26 + convert_modes
17.27 + (mode, imode,
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/patches/gcc/4.2.3/100-uclibc-conf.patch Sun Feb 17 22:08:06 2008 +0000
18.3 @@ -0,0 +1,216 @@
18.4 +diff -durN gcc-4.2.1.orig/boehm-gc/configure gcc-4.2.1/boehm-gc/configure
18.5 +--- gcc-4.2.1.orig/boehm-gc/configure 2007-07-19 16:33:56.000000000 +0200
18.6 ++++ gcc-4.2.1/boehm-gc/configure 2007-08-03 20:29:22.000000000 +0200
18.7 +@@ -4323,7 +4323,7 @@
18.8 + ;;
18.9 +
18.10 + # This must be Linux ELF.
18.11 +-linux-gnu*)
18.12 ++linux*)
18.13 + lt_cv_deplibs_check_method=pass_all
18.14 + ;;
18.15 +
18.16 +diff -durN gcc-4.2.1.orig/contrib/regression/objs-gcc.sh gcc-4.2.1/contrib/regression/objs-gcc.sh
18.17 +--- gcc-4.2.1.orig/contrib/regression/objs-gcc.sh 2005-08-15 02:41:31.000000000 +0200
18.18 ++++ gcc-4.2.1/contrib/regression/objs-gcc.sh 2007-08-03 20:29:22.000000000 +0200
18.19 +@@ -105,6 +105,10 @@
18.20 + then
18.21 + make all-gdb all-dejagnu all-ld || exit 1
18.22 + make install-gdb install-dejagnu install-ld || exit 1
18.23 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
18.24 ++ then
18.25 ++ make all-gdb all-dejagnu all-ld || exit 1
18.26 ++ make install-gdb install-dejagnu install-ld || exit 1
18.27 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
18.28 + make bootstrap || exit 1
18.29 + make install || exit 1
18.30 +diff -durN gcc-4.2.1.orig/gcc/config/cris/linux.h gcc-4.2.1/gcc/config/cris/linux.h
18.31 +--- gcc-4.2.1.orig/gcc/config/cris/linux.h 2006-02-18 12:12:51.000000000 +0100
18.32 ++++ gcc-4.2.1/gcc/config/cris/linux.h 2007-08-03 20:29:22.000000000 +0200
18.33 +@@ -74,7 +74,11 @@
18.34 + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
18.35 +
18.36 + #undef CRIS_SUBTARGET_VERSION
18.37 +-#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
18.38 ++#if UCLIBC_DEFAULT
18.39 ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
18.40 ++#else
18.41 ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
18.42 ++#endif
18.43 +
18.44 + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
18.45 +
18.46 +diff -durN gcc-4.2.1.orig/libffi/configure gcc-4.2.1/libffi/configure
18.47 +--- gcc-4.2.1.orig/libffi/configure 2007-07-19 16:33:56.000000000 +0200
18.48 ++++ gcc-4.2.1/libffi/configure 2007-08-03 20:29:22.000000000 +0200
18.49 +@@ -3460,7 +3460,7 @@
18.50 + ;;
18.51 +
18.52 + # This must be Linux ELF.
18.53 +-linux-gnu*)
18.54 ++linux*)
18.55 + lt_cv_deplibs_check_method=pass_all
18.56 + ;;
18.57 +
18.58 +diff -durN gcc-4.2.1.orig/libgfortran/configure gcc-4.2.1/libgfortran/configure
18.59 +--- gcc-4.2.1.orig/libgfortran/configure 2007-07-19 16:33:56.000000000 +0200
18.60 ++++ gcc-4.2.1/libgfortran/configure 2007-08-03 20:29:22.000000000 +0200
18.61 +@@ -3721,7 +3721,7 @@
18.62 + ;;
18.63 +
18.64 + # This must be Linux ELF.
18.65 +-linux-gnu*)
18.66 ++linux*)
18.67 + lt_cv_deplibs_check_method=pass_all
18.68 + ;;
18.69 +
18.70 +diff -durN gcc-4.2.1.orig/libgomp/configure gcc-4.2.1/libgomp/configure
18.71 +--- gcc-4.2.1.orig/libgomp/configure 2007-07-19 16:33:56.000000000 +0200
18.72 ++++ gcc-4.2.1/libgomp/configure 2007-08-03 20:29:22.000000000 +0200
18.73 +@@ -3893,7 +3893,7 @@
18.74 + ;;
18.75 +
18.76 + # This must be Linux ELF.
18.77 +-linux-gnu*)
18.78 ++linux*)
18.79 + lt_cv_deplibs_check_method=pass_all
18.80 + ;;
18.81 +
18.82 +diff -durN gcc-4.2.1.orig/libjava/classpath/configure gcc-4.2.1/libjava/classpath/configure
18.83 +--- gcc-4.2.1.orig/libjava/classpath/configure 2007-01-17 19:10:26.000000000 +0100
18.84 ++++ gcc-4.2.1/libjava/classpath/configure 2007-08-03 20:29:22.000000000 +0200
18.85 +@@ -5307,7 +5307,7 @@
18.86 + ;;
18.87 +
18.88 + # This must be Linux ELF.
18.89 +-linux-gnu*)
18.90 ++linux*)
18.91 + lt_cv_deplibs_check_method=pass_all
18.92 + ;;
18.93 +
18.94 +diff -durN gcc-4.2.1.orig/libjava/classpath/ltconfig gcc-4.2.1/libjava/classpath/ltconfig
18.95 +--- gcc-4.2.1.orig/libjava/classpath/ltconfig 2006-08-07 22:37:50.000000000 +0200
18.96 ++++ gcc-4.2.1/libjava/classpath/ltconfig 2007-08-03 20:29:22.000000000 +0200
18.97 +@@ -603,7 +603,7 @@
18.98 +
18.99 + # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
18.100 + case $host_os in
18.101 +-linux-gnu*) ;;
18.102 ++linux-gnu*|linux-uclibc*) ;;
18.103 + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
18.104 + esac
18.105 +
18.106 +@@ -1251,7 +1251,7 @@
18.107 + ;;
18.108 +
18.109 + # This must be Linux ELF.
18.110 +-linux-gnu*)
18.111 ++linux*)
18.112 + version_type=linux
18.113 + need_lib_prefix=no
18.114 + need_version=no
18.115 +diff -durN gcc-4.2.1.orig/libjava/configure gcc-4.2.1/libjava/configure
18.116 +--- gcc-4.2.1.orig/libjava/configure 2007-07-19 16:33:56.000000000 +0200
18.117 ++++ gcc-4.2.1/libjava/configure 2007-08-03 20:29:22.000000000 +0200
18.118 +@@ -5424,7 +5424,7 @@
18.119 + ;;
18.120 +
18.121 + # This must be Linux ELF.
18.122 +-linux-gnu*)
18.123 ++linux*)
18.124 + lt_cv_deplibs_check_method=pass_all
18.125 + ;;
18.126 +
18.127 +diff -durN gcc-4.2.1.orig/libmudflap/configure gcc-4.2.1/libmudflap/configure
18.128 +--- gcc-4.2.1.orig/libmudflap/configure 2006-12-04 12:13:07.000000000 +0100
18.129 ++++ gcc-4.2.1/libmudflap/configure 2007-08-03 20:29:22.000000000 +0200
18.130 +@@ -5394,7 +5394,7 @@
18.131 + ;;
18.132 +
18.133 + # This must be Linux ELF.
18.134 +-linux-gnu*)
18.135 ++linux*)
18.136 + lt_cv_deplibs_check_method=pass_all
18.137 + ;;
18.138 +
18.139 +diff -durN gcc-4.2.1.orig/libobjc/configure gcc-4.2.1/libobjc/configure
18.140 +--- gcc-4.2.1.orig/libobjc/configure 2006-10-15 09:42:57.000000000 +0200
18.141 ++++ gcc-4.2.1/libobjc/configure 2007-08-03 20:29:22.000000000 +0200
18.142 +@@ -3314,7 +3314,7 @@
18.143 + ;;
18.144 +
18.145 + # This must be Linux ELF.
18.146 +-linux-gnu*)
18.147 ++linux*)
18.148 + lt_cv_deplibs_check_method=pass_all
18.149 + ;;
18.150 +
18.151 +diff -durN gcc-4.2.1.orig/libssp/configure gcc-4.2.1/libssp/configure
18.152 +--- gcc-4.2.1.orig/libssp/configure 2006-10-15 09:42:57.000000000 +0200
18.153 ++++ gcc-4.2.1/libssp/configure 2007-08-03 20:29:22.000000000 +0200
18.154 +@@ -4480,7 +4480,7 @@
18.155 + ;;
18.156 +
18.157 + # This must be Linux ELF.
18.158 +-linux-gnu*)
18.159 ++linux*)
18.160 + lt_cv_deplibs_check_method=pass_all
18.161 + ;;
18.162 +
18.163 +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
18.164 +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-06-29 01:02:05.000000000 +0200
18.165 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200
18.166 +@@ -4283,7 +4283,7 @@
18.167 + ;;
18.168 +
18.169 + # This must be Linux ELF.
18.170 +-linux-gnu*)
18.171 ++linux*)
18.172 + lt_cv_deplibs_check_method=pass_all
18.173 + ;;
18.174 +
18.175 +diff -durN gcc-4.2.1.orig/libtool.m4 gcc-4.2.1/libtool.m4
18.176 +--- gcc-4.2.1.orig/libtool.m4 2005-07-16 04:30:53.000000000 +0200
18.177 ++++ gcc-4.2.1/libtool.m4 2007-08-03 20:29:22.000000000 +0200
18.178 +@@ -739,7 +739,7 @@
18.179 + ;;
18.180 +
18.181 + # This must be Linux ELF.
18.182 +-linux-gnu*)
18.183 ++linux*)
18.184 + lt_cv_deplibs_check_method=pass_all
18.185 + ;;
18.186 +
18.187 +diff -durN gcc-4.2.1.orig/ltconfig gcc-4.2.1/ltconfig
18.188 +--- gcc-4.2.1.orig/ltconfig 2007-02-14 18:08:35.000000000 +0100
18.189 ++++ gcc-4.2.1/ltconfig 2007-08-03 20:29:22.000000000 +0200
18.190 +@@ -603,7 +603,7 @@
18.191 +
18.192 + # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
18.193 + case $host_os in
18.194 +-linux-gnu*) ;;
18.195 ++linux-gnu*|linux-uclibc*) ;;
18.196 + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
18.197 + esac
18.198 +
18.199 +@@ -1251,7 +1251,7 @@
18.200 + ;;
18.201 +
18.202 + # This must be Linux ELF.
18.203 +-linux-gnu*)
18.204 ++linux*)
18.205 + version_type=linux
18.206 + need_lib_prefix=no
18.207 + need_version=no
18.208 +diff -durN gcc-4.2.1.orig/zlib/configure gcc-4.2.1/zlib/configure
18.209 +--- gcc-4.2.1.orig/zlib/configure 2007-01-17 19:10:26.000000000 +0100
18.210 ++++ gcc-4.2.1/zlib/configure 2007-08-03 20:29:22.000000000 +0200
18.211 +@@ -3429,7 +3429,7 @@
18.212 + ;;
18.213 +
18.214 + # This must be Linux ELF.
18.215 +-linux-gnu*)
18.216 ++linux*)
18.217 + lt_cv_deplibs_check_method=pass_all
18.218 + ;;
18.219 +
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/patches/gcc/4.2.3/103-uclibc-conf-noupstream.patch Sun Feb 17 22:08:06 2008 +0000
19.3 @@ -0,0 +1,12 @@
19.4 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc
19.5 +--- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100
19.6 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200
19.7 +@@ -1964,7 +1964,7 @@
19.8 + ;;
19.9 + sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
19.10 + sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
19.11 +- sh-*-linux* | sh[346lbe]*-*-linux* | \
19.12 ++ sh*-*-linux* | sh[346lbe]*-*-linux* | \
19.13 + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
19.14 + sh64-*-netbsd* | sh64l*-*-netbsd*)
19.15 + tmake_file="${tmake_file} sh/t-sh sh/t-elf"
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/patches/gcc/4.2.3/200-uclibc-locale.patch Sun Feb 17 22:08:06 2008 +0000
20.3 @@ -0,0 +1,2806 @@
20.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4
20.5 +--- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200
20.6 ++++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200
20.7 +@@ -1334,7 +1334,7 @@
20.8 + AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
20.9 + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
20.10 + [use MODEL for target locale package],
20.11 +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
20.12 ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
20.13 +
20.14 + # Deal with gettext issues. Default to not using it (=no) until we detect
20.15 + # support for it later. Let the user turn it off via --e/d, but let that
20.16 +@@ -1355,6 +1355,9 @@
20.17 + # Default to "generic".
20.18 + if test $enable_clocale_flag = auto; then
20.19 + case ${target_os} in
20.20 ++ *-uclibc*)
20.21 ++ enable_clocale_flag=uclibc
20.22 ++ ;;
20.23 + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
20.24 + enable_clocale_flag=gnu
20.25 + ;;
20.26 +@@ -1526,6 +1529,40 @@
20.27 + CTIME_CC=config/locale/generic/time_members.cc
20.28 + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
20.29 + ;;
20.30 ++ uclibc)
20.31 ++ AC_MSG_RESULT(uclibc)
20.32 ++
20.33 ++ # Declare intention to use gettext, and add support for specific
20.34 ++ # languages.
20.35 ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
20.36 ++ ALL_LINGUAS="de fr"
20.37 ++
20.38 ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
20.39 ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
20.40 ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
20.41 ++ USE_NLS=yes
20.42 ++ fi
20.43 ++ # Export the build objects.
20.44 ++ for ling in $ALL_LINGUAS; do \
20.45 ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
20.46 ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
20.47 ++ done
20.48 ++ AC_SUBST(glibcxx_MOFILES)
20.49 ++ AC_SUBST(glibcxx_POFILES)
20.50 ++
20.51 ++ CLOCALE_H=config/locale/uclibc/c_locale.h
20.52 ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
20.53 ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
20.54 ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
20.55 ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
20.56 ++ CMESSAGES_H=config/locale/uclibc/messages_members.h
20.57 ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
20.58 ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
20.59 ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
20.60 ++ CTIME_H=config/locale/uclibc/time_members.h
20.61 ++ CTIME_CC=config/locale/uclibc/time_members.cc
20.62 ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
20.63 ++ ;;
20.64 + esac
20.65 +
20.66 + # This is where the testsuite looks for locale catalogs, using the
20.67 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
20.68 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100
20.69 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200
20.70 +@@ -0,0 +1,160 @@
20.71 ++// Wrapper for underlying C-language localization -*- C++ -*-
20.72 ++
20.73 ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
20.74 ++//
20.75 ++// This file is part of the GNU ISO C++ Library. This library is free
20.76 ++// software; you can redistribute it and/or modify it under the
20.77 ++// terms of the GNU General Public License as published by the
20.78 ++// Free Software Foundation; either version 2, or (at your option)
20.79 ++// any later version.
20.80 ++
20.81 ++// This library is distributed in the hope that it will be useful,
20.82 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.83 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.84 ++// GNU General Public License for more details.
20.85 ++
20.86 ++// You should have received a copy of the GNU General Public License along
20.87 ++// with this library; see the file COPYING. If not, write to the Free
20.88 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.89 ++// USA.
20.90 ++
20.91 ++// As a special exception, you may use this file as part of a free software
20.92 ++// library without restriction. Specifically, if other files instantiate
20.93 ++// templates or use macros or inline functions from this file, or you compile
20.94 ++// this file and link it with other files to produce an executable, this
20.95 ++// file does not by itself cause the resulting executable to be covered by
20.96 ++// the GNU General Public License. This exception does not however
20.97 ++// invalidate any other reasons why the executable file might be covered by
20.98 ++// the GNU General Public License.
20.99 ++
20.100 ++//
20.101 ++// ISO C++ 14882: 22.8 Standard locale categories.
20.102 ++//
20.103 ++
20.104 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.105 ++
20.106 ++#include <cerrno> // For errno
20.107 ++#include <locale>
20.108 ++#include <stdexcept>
20.109 ++#include <langinfo.h>
20.110 ++#include <bits/c++locale_internal.h>
20.111 ++
20.112 ++#ifndef __UCLIBC_HAS_XLOCALE__
20.113 ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
20.114 ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
20.115 ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
20.116 ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
20.117 ++#define __strtof_l(S, E, L) strtof((S), (E))
20.118 ++#define __strtod_l(S, E, L) strtod((S), (E))
20.119 ++#define __strtold_l(S, E, L) strtold((S), (E))
20.120 ++#warning should dummy __newlocale check for C|POSIX ?
20.121 ++#define __newlocale(a, b, c) NULL
20.122 ++#define __freelocale(a) ((void)0)
20.123 ++#define __duplocale(a) __c_locale()
20.124 ++#endif
20.125 ++
20.126 ++namespace std
20.127 ++{
20.128 ++ template<>
20.129 ++ void
20.130 ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
20.131 ++ const __c_locale& __cloc)
20.132 ++ {
20.133 ++ if (!(__err & ios_base::failbit))
20.134 ++ {
20.135 ++ char* __sanity;
20.136 ++ errno = 0;
20.137 ++ float __f = __strtof_l(__s, &__sanity, __cloc);
20.138 ++ if (__sanity != __s && errno != ERANGE)
20.139 ++ __v = __f;
20.140 ++ else
20.141 ++ __err |= ios_base::failbit;
20.142 ++ }
20.143 ++ }
20.144 ++
20.145 ++ template<>
20.146 ++ void
20.147 ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
20.148 ++ const __c_locale& __cloc)
20.149 ++ {
20.150 ++ if (!(__err & ios_base::failbit))
20.151 ++ {
20.152 ++ char* __sanity;
20.153 ++ errno = 0;
20.154 ++ double __d = __strtod_l(__s, &__sanity, __cloc);
20.155 ++ if (__sanity != __s && errno != ERANGE)
20.156 ++ __v = __d;
20.157 ++ else
20.158 ++ __err |= ios_base::failbit;
20.159 ++ }
20.160 ++ }
20.161 ++
20.162 ++ template<>
20.163 ++ void
20.164 ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
20.165 ++ const __c_locale& __cloc)
20.166 ++ {
20.167 ++ if (!(__err & ios_base::failbit))
20.168 ++ {
20.169 ++ char* __sanity;
20.170 ++ errno = 0;
20.171 ++ long double __ld = __strtold_l(__s, &__sanity, __cloc);
20.172 ++ if (__sanity != __s && errno != ERANGE)
20.173 ++ __v = __ld;
20.174 ++ else
20.175 ++ __err |= ios_base::failbit;
20.176 ++ }
20.177 ++ }
20.178 ++
20.179 ++ void
20.180 ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
20.181 ++ __c_locale __old)
20.182 ++ {
20.183 ++ __cloc = __newlocale(1 << LC_ALL, __s, __old);
20.184 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.185 ++ if (!__cloc)
20.186 ++ {
20.187 ++ // This named locale is not supported by the underlying OS.
20.188 ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
20.189 ++ "name not valid"));
20.190 ++ }
20.191 ++#endif
20.192 ++ }
20.193 ++
20.194 ++ void
20.195 ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
20.196 ++ {
20.197 ++ if (_S_get_c_locale() != __cloc)
20.198 ++ __freelocale(__cloc);
20.199 ++ }
20.200 ++
20.201 ++ __c_locale
20.202 ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
20.203 ++ { return __duplocale(__cloc); }
20.204 ++} // namespace std
20.205 ++
20.206 ++namespace __gnu_cxx
20.207 ++{
20.208 ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
20.209 ++ {
20.210 ++ "LC_CTYPE",
20.211 ++ "LC_NUMERIC",
20.212 ++ "LC_TIME",
20.213 ++ "LC_COLLATE",
20.214 ++ "LC_MONETARY",
20.215 ++ "LC_MESSAGES",
20.216 ++#if _GLIBCXX_NUM_CATEGORIES != 0
20.217 ++ "LC_PAPER",
20.218 ++ "LC_NAME",
20.219 ++ "LC_ADDRESS",
20.220 ++ "LC_TELEPHONE",
20.221 ++ "LC_MEASUREMENT",
20.222 ++ "LC_IDENTIFICATION"
20.223 ++#endif
20.224 ++ };
20.225 ++}
20.226 ++
20.227 ++namespace std
20.228 ++{
20.229 ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
20.230 ++} // namespace std
20.231 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h
20.232 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100
20.233 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200
20.234 +@@ -0,0 +1,117 @@
20.235 ++// Wrapper for underlying C-language localization -*- C++ -*-
20.236 ++
20.237 ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
20.238 ++//
20.239 ++// This file is part of the GNU ISO C++ Library. This library is free
20.240 ++// software; you can redistribute it and/or modify it under the
20.241 ++// terms of the GNU General Public License as published by the
20.242 ++// Free Software Foundation; either version 2, or (at your option)
20.243 ++// any later version.
20.244 ++
20.245 ++// This library is distributed in the hope that it will be useful,
20.246 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.247 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.248 ++// GNU General Public License for more details.
20.249 ++
20.250 ++// You should have received a copy of the GNU General Public License along
20.251 ++// with this library; see the file COPYING. If not, write to the Free
20.252 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.253 ++// USA.
20.254 ++
20.255 ++// As a special exception, you may use this file as part of a free software
20.256 ++// library without restriction. Specifically, if other files instantiate
20.257 ++// templates or use macros or inline functions from this file, or you compile
20.258 ++// this file and link it with other files to produce an executable, this
20.259 ++// file does not by itself cause the resulting executable to be covered by
20.260 ++// the GNU General Public License. This exception does not however
20.261 ++// invalidate any other reasons why the executable file might be covered by
20.262 ++// the GNU General Public License.
20.263 ++
20.264 ++//
20.265 ++// ISO C++ 14882: 22.8 Standard locale categories.
20.266 ++//
20.267 ++
20.268 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.269 ++
20.270 ++#ifndef _C_LOCALE_H
20.271 ++#define _C_LOCALE_H 1
20.272 ++
20.273 ++#pragma GCC system_header
20.274 ++
20.275 ++#include <cstring> // get std::strlen
20.276 ++#include <cstdio> // get std::snprintf or std::sprintf
20.277 ++#include <clocale>
20.278 ++#include <langinfo.h> // For codecvt
20.279 ++#ifdef __UCLIBC_MJN3_ONLY__
20.280 ++#warning fix this
20.281 ++#endif
20.282 ++#ifdef __UCLIBC_HAS_LOCALE__
20.283 ++#include <iconv.h> // For codecvt using iconv, iconv_t
20.284 ++#endif
20.285 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
20.286 ++#include <libintl.h> // For messages
20.287 ++#endif
20.288 ++
20.289 ++#ifdef __UCLIBC_MJN3_ONLY__
20.290 ++#warning what is _GLIBCXX_C_LOCALE_GNU for
20.291 ++#endif
20.292 ++#define _GLIBCXX_C_LOCALE_GNU 1
20.293 ++
20.294 ++#ifdef __UCLIBC_MJN3_ONLY__
20.295 ++#warning fix categories
20.296 ++#endif
20.297 ++// #define _GLIBCXX_NUM_CATEGORIES 6
20.298 ++#define _GLIBCXX_NUM_CATEGORIES 0
20.299 ++
20.300 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.301 ++namespace __gnu_cxx
20.302 ++{
20.303 ++ extern "C" __typeof(uselocale) __uselocale;
20.304 ++}
20.305 ++#endif
20.306 ++
20.307 ++namespace std
20.308 ++{
20.309 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.310 ++ typedef __locale_t __c_locale;
20.311 ++#else
20.312 ++ typedef int* __c_locale;
20.313 ++#endif
20.314 ++
20.315 ++ // Convert numeric value of type _Tv to string and return length of
20.316 ++ // string. If snprintf is available use it, otherwise fall back to
20.317 ++ // the unsafe sprintf which, in general, can be dangerous and should
20.318 ++ // be avoided.
20.319 ++ template<typename _Tv>
20.320 ++ int
20.321 ++ __convert_from_v(char* __out,
20.322 ++ const int __size __attribute__ ((__unused__)),
20.323 ++ const char* __fmt,
20.324 ++#ifdef __UCLIBC_HAS_XCLOCALE__
20.325 ++ _Tv __v, const __c_locale& __cloc, int __prec)
20.326 ++ {
20.327 ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
20.328 ++#else
20.329 ++ _Tv __v, const __c_locale&, int __prec)
20.330 ++ {
20.331 ++# ifdef __UCLIBC_HAS_LOCALE__
20.332 ++ char* __old = std::setlocale(LC_ALL, NULL);
20.333 ++ char* __sav = new char[std::strlen(__old) + 1];
20.334 ++ std::strcpy(__sav, __old);
20.335 ++ std::setlocale(LC_ALL, "C");
20.336 ++# endif
20.337 ++#endif
20.338 ++
20.339 ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
20.340 ++
20.341 ++#ifdef __UCLIBC_HAS_XCLOCALE__
20.342 ++ __gnu_cxx::__uselocale(__old);
20.343 ++#elif defined __UCLIBC_HAS_LOCALE__
20.344 ++ std::setlocale(LC_ALL, __sav);
20.345 ++ delete [] __sav;
20.346 ++#endif
20.347 ++ return __ret;
20.348 ++ }
20.349 ++}
20.350 ++
20.351 ++#endif
20.352 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
20.353 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100
20.354 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200
20.355 +@@ -0,0 +1,63 @@
20.356 ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
20.357 ++
20.358 ++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
20.359 ++//
20.360 ++// This file is part of the GNU ISO C++ Library. This library is free
20.361 ++// software; you can redistribute it and/or modify it under the
20.362 ++// terms of the GNU General Public License as published by the
20.363 ++// Free Software Foundation; either version 2, or (at your option)
20.364 ++// any later version.
20.365 ++
20.366 ++// This library is distributed in the hope that it will be useful,
20.367 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.368 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.369 ++// GNU General Public License for more details.
20.370 ++
20.371 ++// You should have received a copy of the GNU General Public License along
20.372 ++// with this library; see the file COPYING. If not, write to the Free
20.373 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.374 ++// USA.
20.375 ++
20.376 ++// As a special exception, you may use this file as part of a free software
20.377 ++// library without restriction. Specifically, if other files instantiate
20.378 ++// templates or use macros or inline functions from this file, or you compile
20.379 ++// this file and link it with other files to produce an executable, this
20.380 ++// file does not by itself cause the resulting executable to be covered by
20.381 ++// the GNU General Public License. This exception does not however
20.382 ++// invalidate any other reasons why the executable file might be covered by
20.383 ++// the GNU General Public License.
20.384 ++
20.385 ++// Written by Jakub Jelinek <jakub@redhat.com>
20.386 ++
20.387 ++#include <bits/c++config.h>
20.388 ++#include <clocale>
20.389 ++
20.390 ++#ifdef __UCLIBC_MJN3_ONLY__
20.391 ++#warning clean this up
20.392 ++#endif
20.393 ++
20.394 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.395 ++
20.396 ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
20.397 ++extern "C" __typeof(strcoll_l) __strcoll_l;
20.398 ++extern "C" __typeof(strftime_l) __strftime_l;
20.399 ++extern "C" __typeof(strtod_l) __strtod_l;
20.400 ++extern "C" __typeof(strtof_l) __strtof_l;
20.401 ++extern "C" __typeof(strtold_l) __strtold_l;
20.402 ++extern "C" __typeof(strxfrm_l) __strxfrm_l;
20.403 ++extern "C" __typeof(newlocale) __newlocale;
20.404 ++extern "C" __typeof(freelocale) __freelocale;
20.405 ++extern "C" __typeof(duplocale) __duplocale;
20.406 ++extern "C" __typeof(uselocale) __uselocale;
20.407 ++
20.408 ++#ifdef _GLIBCXX_USE_WCHAR_T
20.409 ++extern "C" __typeof(iswctype_l) __iswctype_l;
20.410 ++extern "C" __typeof(towlower_l) __towlower_l;
20.411 ++extern "C" __typeof(towupper_l) __towupper_l;
20.412 ++extern "C" __typeof(wcscoll_l) __wcscoll_l;
20.413 ++extern "C" __typeof(wcsftime_l) __wcsftime_l;
20.414 ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
20.415 ++extern "C" __typeof(wctype_l) __wctype_l;
20.416 ++#endif
20.417 ++
20.418 ++#endif // GLIBC 2.3 and later
20.419 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
20.420 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100
20.421 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200
20.422 +@@ -0,0 +1,306 @@
20.423 ++// std::codecvt implementation details, GNU version -*- C++ -*-
20.424 ++
20.425 ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
20.426 ++//
20.427 ++// This file is part of the GNU ISO C++ Library. This library is free
20.428 ++// software; you can redistribute it and/or modify it under the
20.429 ++// terms of the GNU General Public License as published by the
20.430 ++// Free Software Foundation; either version 2, or (at your option)
20.431 ++// any later version.
20.432 ++
20.433 ++// This library is distributed in the hope that it will be useful,
20.434 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.435 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.436 ++// GNU General Public License for more details.
20.437 ++
20.438 ++// You should have received a copy of the GNU General Public License along
20.439 ++// with this library; see the file COPYING. If not, write to the Free
20.440 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.441 ++// USA.
20.442 ++
20.443 ++// As a special exception, you may use this file as part of a free software
20.444 ++// library without restriction. Specifically, if other files instantiate
20.445 ++// templates or use macros or inline functions from this file, or you compile
20.446 ++// this file and link it with other files to produce an executable, this
20.447 ++// file does not by itself cause the resulting executable to be covered by
20.448 ++// the GNU General Public License. This exception does not however
20.449 ++// invalidate any other reasons why the executable file might be covered by
20.450 ++// the GNU General Public License.
20.451 ++
20.452 ++//
20.453 ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt
20.454 ++//
20.455 ++
20.456 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.457 ++
20.458 ++#include <locale>
20.459 ++#include <bits/c++locale_internal.h>
20.460 ++
20.461 ++namespace std
20.462 ++{
20.463 ++ // Specializations.
20.464 ++#ifdef _GLIBCXX_USE_WCHAR_T
20.465 ++ codecvt_base::result
20.466 ++ codecvt<wchar_t, char, mbstate_t>::
20.467 ++ do_out(state_type& __state, const intern_type* __from,
20.468 ++ const intern_type* __from_end, const intern_type*& __from_next,
20.469 ++ extern_type* __to, extern_type* __to_end,
20.470 ++ extern_type*& __to_next) const
20.471 ++ {
20.472 ++ result __ret = ok;
20.473 ++ state_type __tmp_state(__state);
20.474 ++
20.475 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.476 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
20.477 ++#endif
20.478 ++
20.479 ++ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
20.480 ++ // in case we fall back to wcrtomb and then continue, in a loop.
20.481 ++ // NB: wcsnrtombs is a GNU extension
20.482 ++ for (__from_next = __from, __to_next = __to;
20.483 ++ __from_next < __from_end && __to_next < __to_end
20.484 ++ && __ret == ok;)
20.485 ++ {
20.486 ++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
20.487 ++ __from_end - __from_next);
20.488 ++ if (!__from_chunk_end)
20.489 ++ __from_chunk_end = __from_end;
20.490 ++
20.491 ++ __from = __from_next;
20.492 ++ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
20.493 ++ __from_chunk_end - __from_next,
20.494 ++ __to_end - __to_next, &__state);
20.495 ++ if (__conv == static_cast<size_t>(-1))
20.496 ++ {
20.497 ++ // In case of error, in order to stop at the exact place we
20.498 ++ // have to start again from the beginning with a series of
20.499 ++ // wcrtomb.
20.500 ++ for (; __from < __from_next; ++__from)
20.501 ++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
20.502 ++ __state = __tmp_state;
20.503 ++ __ret = error;
20.504 ++ }
20.505 ++ else if (__from_next && __from_next < __from_chunk_end)
20.506 ++ {
20.507 ++ __to_next += __conv;
20.508 ++ __ret = partial;
20.509 ++ }
20.510 ++ else
20.511 ++ {
20.512 ++ __from_next = __from_chunk_end;
20.513 ++ __to_next += __conv;
20.514 ++ }
20.515 ++
20.516 ++ if (__from_next < __from_end && __ret == ok)
20.517 ++ {
20.518 ++ extern_type __buf[MB_LEN_MAX];
20.519 ++ __tmp_state = __state;
20.520 ++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
20.521 ++ if (__conv > static_cast<size_t>(__to_end - __to_next))
20.522 ++ __ret = partial;
20.523 ++ else
20.524 ++ {
20.525 ++ memcpy(__to_next, __buf, __conv);
20.526 ++ __state = __tmp_state;
20.527 ++ __to_next += __conv;
20.528 ++ ++__from_next;
20.529 ++ }
20.530 ++ }
20.531 ++ }
20.532 ++
20.533 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.534 ++ __uselocale(__old);
20.535 ++#endif
20.536 ++
20.537 ++ return __ret;
20.538 ++ }
20.539 ++
20.540 ++ codecvt_base::result
20.541 ++ codecvt<wchar_t, char, mbstate_t>::
20.542 ++ do_in(state_type& __state, const extern_type* __from,
20.543 ++ const extern_type* __from_end, const extern_type*& __from_next,
20.544 ++ intern_type* __to, intern_type* __to_end,
20.545 ++ intern_type*& __to_next) const
20.546 ++ {
20.547 ++ result __ret = ok;
20.548 ++ state_type __tmp_state(__state);
20.549 ++
20.550 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.551 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
20.552 ++#endif
20.553 ++
20.554 ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
20.555 ++ // in case we store a L'\0' and then continue, in a loop.
20.556 ++ // NB: mbsnrtowcs is a GNU extension
20.557 ++ for (__from_next = __from, __to_next = __to;
20.558 ++ __from_next < __from_end && __to_next < __to_end
20.559 ++ && __ret == ok;)
20.560 ++ {
20.561 ++ const extern_type* __from_chunk_end;
20.562 ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
20.563 ++ __from_end
20.564 ++ - __from_next));
20.565 ++ if (!__from_chunk_end)
20.566 ++ __from_chunk_end = __from_end;
20.567 ++
20.568 ++ __from = __from_next;
20.569 ++ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
20.570 ++ __from_chunk_end - __from_next,
20.571 ++ __to_end - __to_next, &__state);
20.572 ++ if (__conv == static_cast<size_t>(-1))
20.573 ++ {
20.574 ++ // In case of error, in order to stop at the exact place we
20.575 ++ // have to start again from the beginning with a series of
20.576 ++ // mbrtowc.
20.577 ++ for (;; ++__to_next, __from += __conv)
20.578 ++ {
20.579 ++ __conv = mbrtowc(__to_next, __from, __from_end - __from,
20.580 ++ &__tmp_state);
20.581 ++ if (__conv == static_cast<size_t>(-1)
20.582 ++ || __conv == static_cast<size_t>(-2))
20.583 ++ break;
20.584 ++ }
20.585 ++ __from_next = __from;
20.586 ++ __state = __tmp_state;
20.587 ++ __ret = error;
20.588 ++ }
20.589 ++ else if (__from_next && __from_next < __from_chunk_end)
20.590 ++ {
20.591 ++ // It is unclear what to return in this case (see DR 382).
20.592 ++ __to_next += __conv;
20.593 ++ __ret = partial;
20.594 ++ }
20.595 ++ else
20.596 ++ {
20.597 ++ __from_next = __from_chunk_end;
20.598 ++ __to_next += __conv;
20.599 ++ }
20.600 ++
20.601 ++ if (__from_next < __from_end && __ret == ok)
20.602 ++ {
20.603 ++ if (__to_next < __to_end)
20.604 ++ {
20.605 ++ // XXX Probably wrong for stateful encodings
20.606 ++ __tmp_state = __state;
20.607 ++ ++__from_next;
20.608 ++ *__to_next++ = L'\0';
20.609 ++ }
20.610 ++ else
20.611 ++ __ret = partial;
20.612 ++ }
20.613 ++ }
20.614 ++
20.615 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.616 ++ __uselocale(__old);
20.617 ++#endif
20.618 ++
20.619 ++ return __ret;
20.620 ++ }
20.621 ++
20.622 ++ int
20.623 ++ codecvt<wchar_t, char, mbstate_t>::
20.624 ++ do_encoding() const throw()
20.625 ++ {
20.626 ++ // XXX This implementation assumes that the encoding is
20.627 ++ // stateless and is either single-byte or variable-width.
20.628 ++ int __ret = 0;
20.629 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.630 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
20.631 ++#endif
20.632 ++ if (MB_CUR_MAX == 1)
20.633 ++ __ret = 1;
20.634 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.635 ++ __uselocale(__old);
20.636 ++#endif
20.637 ++ return __ret;
20.638 ++ }
20.639 ++
20.640 ++ int
20.641 ++ codecvt<wchar_t, char, mbstate_t>::
20.642 ++ do_max_length() const throw()
20.643 ++ {
20.644 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.645 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
20.646 ++#endif
20.647 ++ // XXX Probably wrong for stateful encodings.
20.648 ++ int __ret = MB_CUR_MAX;
20.649 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.650 ++ __uselocale(__old);
20.651 ++#endif
20.652 ++ return __ret;
20.653 ++ }
20.654 ++
20.655 ++ int
20.656 ++ codecvt<wchar_t, char, mbstate_t>::
20.657 ++ do_length(state_type& __state, const extern_type* __from,
20.658 ++ const extern_type* __end, size_t __max) const
20.659 ++ {
20.660 ++ int __ret = 0;
20.661 ++ state_type __tmp_state(__state);
20.662 ++
20.663 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.664 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
20.665 ++#endif
20.666 ++
20.667 ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
20.668 ++ // in case we advance past it and then continue, in a loop.
20.669 ++ // NB: mbsnrtowcs is a GNU extension
20.670 ++
20.671 ++ // A dummy internal buffer is needed in order for mbsnrtocws to consider
20.672 ++ // its fourth parameter (it wouldn't with NULL as first parameter).
20.673 ++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
20.674 ++ * __max));
20.675 ++ while (__from < __end && __max)
20.676 ++ {
20.677 ++ const extern_type* __from_chunk_end;
20.678 ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
20.679 ++ __end
20.680 ++ - __from));
20.681 ++ if (!__from_chunk_end)
20.682 ++ __from_chunk_end = __end;
20.683 ++
20.684 ++ const extern_type* __tmp_from = __from;
20.685 ++ size_t __conv = mbsnrtowcs(__to, &__from,
20.686 ++ __from_chunk_end - __from,
20.687 ++ __max, &__state);
20.688 ++ if (__conv == static_cast<size_t>(-1))
20.689 ++ {
20.690 ++ // In case of error, in order to stop at the exact place we
20.691 ++ // have to start again from the beginning with a series of
20.692 ++ // mbrtowc.
20.693 ++ for (__from = __tmp_from;; __from += __conv)
20.694 ++ {
20.695 ++ __conv = mbrtowc(NULL, __from, __end - __from,
20.696 ++ &__tmp_state);
20.697 ++ if (__conv == static_cast<size_t>(-1)
20.698 ++ || __conv == static_cast<size_t>(-2))
20.699 ++ break;
20.700 ++ }
20.701 ++ __state = __tmp_state;
20.702 ++ __ret += __from - __tmp_from;
20.703 ++ break;
20.704 ++ }
20.705 ++ if (!__from)
20.706 ++ __from = __from_chunk_end;
20.707 ++
20.708 ++ __ret += __from - __tmp_from;
20.709 ++ __max -= __conv;
20.710 ++
20.711 ++ if (__from < __end && __max)
20.712 ++ {
20.713 ++ // XXX Probably wrong for stateful encodings
20.714 ++ __tmp_state = __state;
20.715 ++ ++__from;
20.716 ++ ++__ret;
20.717 ++ --__max;
20.718 ++ }
20.719 ++ }
20.720 ++
20.721 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.722 ++ __uselocale(__old);
20.723 ++#endif
20.724 ++
20.725 ++ return __ret;
20.726 ++ }
20.727 ++#endif
20.728 ++}
20.729 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc
20.730 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100
20.731 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200
20.732 +@@ -0,0 +1,80 @@
20.733 ++// std::collate implementation details, GNU version -*- C++ -*-
20.734 ++
20.735 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
20.736 ++//
20.737 ++// This file is part of the GNU ISO C++ Library. This library is free
20.738 ++// software; you can redistribute it and/or modify it under the
20.739 ++// terms of the GNU General Public License as published by the
20.740 ++// Free Software Foundation; either version 2, or (at your option)
20.741 ++// any later version.
20.742 ++
20.743 ++// This library is distributed in the hope that it will be useful,
20.744 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.745 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.746 ++// GNU General Public License for more details.
20.747 ++
20.748 ++// You should have received a copy of the GNU General Public License along
20.749 ++// with this library; see the file COPYING. If not, write to the Free
20.750 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.751 ++// USA.
20.752 ++
20.753 ++// As a special exception, you may use this file as part of a free software
20.754 ++// library without restriction. Specifically, if other files instantiate
20.755 ++// templates or use macros or inline functions from this file, or you compile
20.756 ++// this file and link it with other files to produce an executable, this
20.757 ++// file does not by itself cause the resulting executable to be covered by
20.758 ++// the GNU General Public License. This exception does not however
20.759 ++// invalidate any other reasons why the executable file might be covered by
20.760 ++// the GNU General Public License.
20.761 ++
20.762 ++//
20.763 ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
20.764 ++//
20.765 ++
20.766 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.767 ++
20.768 ++#include <locale>
20.769 ++#include <bits/c++locale_internal.h>
20.770 ++
20.771 ++#ifndef __UCLIBC_HAS_XLOCALE__
20.772 ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
20.773 ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
20.774 ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
20.775 ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
20.776 ++#endif
20.777 ++
20.778 ++namespace std
20.779 ++{
20.780 ++ // These are basically extensions to char_traits, and perhaps should
20.781 ++ // be put there instead of here.
20.782 ++ template<>
20.783 ++ int
20.784 ++ collate<char>::_M_compare(const char* __one, const char* __two) const
20.785 ++ {
20.786 ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
20.787 ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
20.788 ++ }
20.789 ++
20.790 ++ template<>
20.791 ++ size_t
20.792 ++ collate<char>::_M_transform(char* __to, const char* __from,
20.793 ++ size_t __n) const
20.794 ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
20.795 ++
20.796 ++#ifdef _GLIBCXX_USE_WCHAR_T
20.797 ++ template<>
20.798 ++ int
20.799 ++ collate<wchar_t>::_M_compare(const wchar_t* __one,
20.800 ++ const wchar_t* __two) const
20.801 ++ {
20.802 ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
20.803 ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
20.804 ++ }
20.805 ++
20.806 ++ template<>
20.807 ++ size_t
20.808 ++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
20.809 ++ size_t __n) const
20.810 ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
20.811 ++#endif
20.812 ++}
20.813 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
20.814 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100
20.815 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200
20.816 +@@ -0,0 +1,300 @@
20.817 ++// std::ctype implementation details, GNU version -*- C++ -*-
20.818 ++
20.819 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
20.820 ++//
20.821 ++// This file is part of the GNU ISO C++ Library. This library is free
20.822 ++// software; you can redistribute it and/or modify it under the
20.823 ++// terms of the GNU General Public License as published by the
20.824 ++// Free Software Foundation; either version 2, or (at your option)
20.825 ++// any later version.
20.826 ++
20.827 ++// This library is distributed in the hope that it will be useful,
20.828 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.829 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.830 ++// GNU General Public License for more details.
20.831 ++
20.832 ++// You should have received a copy of the GNU General Public License along
20.833 ++// with this library; see the file COPYING. If not, write to the Free
20.834 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.835 ++// USA.
20.836 ++
20.837 ++// As a special exception, you may use this file as part of a free software
20.838 ++// library without restriction. Specifically, if other files instantiate
20.839 ++// templates or use macros or inline functions from this file, or you compile
20.840 ++// this file and link it with other files to produce an executable, this
20.841 ++// file does not by itself cause the resulting executable to be covered by
20.842 ++// the GNU General Public License. This exception does not however
20.843 ++// invalidate any other reasons why the executable file might be covered by
20.844 ++// the GNU General Public License.
20.845 ++
20.846 ++//
20.847 ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
20.848 ++//
20.849 ++
20.850 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.851 ++
20.852 ++#define _LIBC
20.853 ++#include <locale>
20.854 ++#undef _LIBC
20.855 ++#include <bits/c++locale_internal.h>
20.856 ++
20.857 ++#ifndef __UCLIBC_HAS_XLOCALE__
20.858 ++#define __wctype_l(S, L) wctype((S))
20.859 ++#define __towupper_l(C, L) towupper((C))
20.860 ++#define __towlower_l(C, L) towlower((C))
20.861 ++#define __iswctype_l(C, M, L) iswctype((C), (M))
20.862 ++#endif
20.863 ++
20.864 ++namespace std
20.865 ++{
20.866 ++ // NB: The other ctype<char> specializations are in src/locale.cc and
20.867 ++ // various /config/os/* files.
20.868 ++ template<>
20.869 ++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
20.870 ++ : ctype<char>(0, false, __refs)
20.871 ++ {
20.872 ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
20.873 ++ {
20.874 ++ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
20.875 ++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
20.876 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.877 ++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
20.878 ++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
20.879 ++ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
20.880 ++#endif
20.881 ++ }
20.882 ++ }
20.883 ++
20.884 ++#ifdef _GLIBCXX_USE_WCHAR_T
20.885 ++ ctype<wchar_t>::__wmask_type
20.886 ++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
20.887 ++ {
20.888 ++ __wmask_type __ret;
20.889 ++ switch (__m)
20.890 ++ {
20.891 ++ case space:
20.892 ++ __ret = __wctype_l("space", _M_c_locale_ctype);
20.893 ++ break;
20.894 ++ case print:
20.895 ++ __ret = __wctype_l("print", _M_c_locale_ctype);
20.896 ++ break;
20.897 ++ case cntrl:
20.898 ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
20.899 ++ break;
20.900 ++ case upper:
20.901 ++ __ret = __wctype_l("upper", _M_c_locale_ctype);
20.902 ++ break;
20.903 ++ case lower:
20.904 ++ __ret = __wctype_l("lower", _M_c_locale_ctype);
20.905 ++ break;
20.906 ++ case alpha:
20.907 ++ __ret = __wctype_l("alpha", _M_c_locale_ctype);
20.908 ++ break;
20.909 ++ case digit:
20.910 ++ __ret = __wctype_l("digit", _M_c_locale_ctype);
20.911 ++ break;
20.912 ++ case punct:
20.913 ++ __ret = __wctype_l("punct", _M_c_locale_ctype);
20.914 ++ break;
20.915 ++ case xdigit:
20.916 ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
20.917 ++ break;
20.918 ++ case alnum:
20.919 ++ __ret = __wctype_l("alnum", _M_c_locale_ctype);
20.920 ++ break;
20.921 ++ case graph:
20.922 ++ __ret = __wctype_l("graph", _M_c_locale_ctype);
20.923 ++ break;
20.924 ++ default:
20.925 ++ __ret = __wmask_type();
20.926 ++ }
20.927 ++ return __ret;
20.928 ++ }
20.929 ++
20.930 ++ wchar_t
20.931 ++ ctype<wchar_t>::do_toupper(wchar_t __c) const
20.932 ++ { return __towupper_l(__c, _M_c_locale_ctype); }
20.933 ++
20.934 ++ const wchar_t*
20.935 ++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
20.936 ++ {
20.937 ++ while (__lo < __hi)
20.938 ++ {
20.939 ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
20.940 ++ ++__lo;
20.941 ++ }
20.942 ++ return __hi;
20.943 ++ }
20.944 ++
20.945 ++ wchar_t
20.946 ++ ctype<wchar_t>::do_tolower(wchar_t __c) const
20.947 ++ { return __towlower_l(__c, _M_c_locale_ctype); }
20.948 ++
20.949 ++ const wchar_t*
20.950 ++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
20.951 ++ {
20.952 ++ while (__lo < __hi)
20.953 ++ {
20.954 ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
20.955 ++ ++__lo;
20.956 ++ }
20.957 ++ return __hi;
20.958 ++ }
20.959 ++
20.960 ++ bool
20.961 ++ ctype<wchar_t>::
20.962 ++ do_is(mask __m, wchar_t __c) const
20.963 ++ {
20.964 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
20.965 ++ // library for blank.
20.966 ++ bool __ret = false;
20.967 ++ const size_t __bitmasksize = 11;
20.968 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
20.969 ++ if (__m & _M_bit[__bitcur]
20.970 ++ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
20.971 ++ {
20.972 ++ __ret = true;
20.973 ++ break;
20.974 ++ }
20.975 ++ return __ret;
20.976 ++ }
20.977 ++
20.978 ++ const wchar_t*
20.979 ++ ctype<wchar_t>::
20.980 ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
20.981 ++ {
20.982 ++ for (; __lo < __hi; ++__vec, ++__lo)
20.983 ++ {
20.984 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
20.985 ++ // library for blank.
20.986 ++ const size_t __bitmasksize = 11;
20.987 ++ mask __m = 0;
20.988 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
20.989 ++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
20.990 ++ __m |= _M_bit[__bitcur];
20.991 ++ *__vec = __m;
20.992 ++ }
20.993 ++ return __hi;
20.994 ++ }
20.995 ++
20.996 ++ const wchar_t*
20.997 ++ ctype<wchar_t>::
20.998 ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
20.999 ++ {
20.1000 ++ while (__lo < __hi && !this->do_is(__m, *__lo))
20.1001 ++ ++__lo;
20.1002 ++ return __lo;
20.1003 ++ }
20.1004 ++
20.1005 ++ const wchar_t*
20.1006 ++ ctype<wchar_t>::
20.1007 ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
20.1008 ++ {
20.1009 ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
20.1010 ++ ++__lo;
20.1011 ++ return __lo;
20.1012 ++ }
20.1013 ++
20.1014 ++ wchar_t
20.1015 ++ ctype<wchar_t>::
20.1016 ++ do_widen(char __c) const
20.1017 ++ { return _M_widen[static_cast<unsigned char>(__c)]; }
20.1018 ++
20.1019 ++ const char*
20.1020 ++ ctype<wchar_t>::
20.1021 ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
20.1022 ++ {
20.1023 ++ while (__lo < __hi)
20.1024 ++ {
20.1025 ++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
20.1026 ++ ++__lo;
20.1027 ++ ++__dest;
20.1028 ++ }
20.1029 ++ return __hi;
20.1030 ++ }
20.1031 ++
20.1032 ++ char
20.1033 ++ ctype<wchar_t>::
20.1034 ++ do_narrow(wchar_t __wc, char __dfault) const
20.1035 ++ {
20.1036 ++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
20.1037 ++ return _M_narrow[__wc];
20.1038 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1039 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
20.1040 ++#endif
20.1041 ++ const int __c = wctob(__wc);
20.1042 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1043 ++ __uselocale(__old);
20.1044 ++#endif
20.1045 ++ return (__c == EOF ? __dfault : static_cast<char>(__c));
20.1046 ++ }
20.1047 ++
20.1048 ++ const wchar_t*
20.1049 ++ ctype<wchar_t>::
20.1050 ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
20.1051 ++ char* __dest) const
20.1052 ++ {
20.1053 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1054 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
20.1055 ++#endif
20.1056 ++ if (_M_narrow_ok)
20.1057 ++ while (__lo < __hi)
20.1058 ++ {
20.1059 ++ if (*__lo >= 0 && *__lo < 128)
20.1060 ++ *__dest = _M_narrow[*__lo];
20.1061 ++ else
20.1062 ++ {
20.1063 ++ const int __c = wctob(*__lo);
20.1064 ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
20.1065 ++ }
20.1066 ++ ++__lo;
20.1067 ++ ++__dest;
20.1068 ++ }
20.1069 ++ else
20.1070 ++ while (__lo < __hi)
20.1071 ++ {
20.1072 ++ const int __c = wctob(*__lo);
20.1073 ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
20.1074 ++ ++__lo;
20.1075 ++ ++__dest;
20.1076 ++ }
20.1077 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1078 ++ __uselocale(__old);
20.1079 ++#endif
20.1080 ++ return __hi;
20.1081 ++ }
20.1082 ++
20.1083 ++ void
20.1084 ++ ctype<wchar_t>::_M_initialize_ctype()
20.1085 ++ {
20.1086 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1087 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
20.1088 ++#endif
20.1089 ++ wint_t __i;
20.1090 ++ for (__i = 0; __i < 128; ++__i)
20.1091 ++ {
20.1092 ++ const int __c = wctob(__i);
20.1093 ++ if (__c == EOF)
20.1094 ++ break;
20.1095 ++ else
20.1096 ++ _M_narrow[__i] = static_cast<char>(__c);
20.1097 ++ }
20.1098 ++ if (__i == 128)
20.1099 ++ _M_narrow_ok = true;
20.1100 ++ else
20.1101 ++ _M_narrow_ok = false;
20.1102 ++ for (size_t __j = 0;
20.1103 ++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
20.1104 ++ _M_widen[__j] = btowc(__j);
20.1105 ++
20.1106 ++ for (size_t __k = 0; __k <= 11; ++__k)
20.1107 ++ {
20.1108 ++ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
20.1109 ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
20.1110 ++ }
20.1111 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1112 ++ __uselocale(__old);
20.1113 ++#endif
20.1114 ++ }
20.1115 ++#endif // _GLIBCXX_USE_WCHAR_T
20.1116 ++}
20.1117 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc
20.1118 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100
20.1119 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200
20.1120 +@@ -0,0 +1,100 @@
20.1121 ++// std::messages implementation details, GNU version -*- C++ -*-
20.1122 ++
20.1123 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
20.1124 ++//
20.1125 ++// This file is part of the GNU ISO C++ Library. This library is free
20.1126 ++// software; you can redistribute it and/or modify it under the
20.1127 ++// terms of the GNU General Public License as published by the
20.1128 ++// Free Software Foundation; either version 2, or (at your option)
20.1129 ++// any later version.
20.1130 ++
20.1131 ++// This library is distributed in the hope that it will be useful,
20.1132 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.1133 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.1134 ++// GNU General Public License for more details.
20.1135 ++
20.1136 ++// You should have received a copy of the GNU General Public License along
20.1137 ++// with this library; see the file COPYING. If not, write to the Free
20.1138 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.1139 ++// USA.
20.1140 ++
20.1141 ++// As a special exception, you may use this file as part of a free software
20.1142 ++// library without restriction. Specifically, if other files instantiate
20.1143 ++// templates or use macros or inline functions from this file, or you compile
20.1144 ++// this file and link it with other files to produce an executable, this
20.1145 ++// file does not by itself cause the resulting executable to be covered by
20.1146 ++// the GNU General Public License. This exception does not however
20.1147 ++// invalidate any other reasons why the executable file might be covered by
20.1148 ++// the GNU General Public License.
20.1149 ++
20.1150 ++//
20.1151 ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
20.1152 ++//
20.1153 ++
20.1154 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.1155 ++
20.1156 ++#include <locale>
20.1157 ++#include <bits/c++locale_internal.h>
20.1158 ++
20.1159 ++#ifdef __UCLIBC_MJN3_ONLY__
20.1160 ++#warning fix gettext stuff
20.1161 ++#endif
20.1162 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
20.1163 ++extern "C" char *__dcgettext(const char *domainname,
20.1164 ++ const char *msgid, int category);
20.1165 ++#undef gettext
20.1166 ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
20.1167 ++#else
20.1168 ++#undef gettext
20.1169 ++#define gettext(msgid) (msgid)
20.1170 ++#endif
20.1171 ++
20.1172 ++namespace std
20.1173 ++{
20.1174 ++ // Specializations.
20.1175 ++ template<>
20.1176 ++ string
20.1177 ++ messages<char>::do_get(catalog, int, int, const string& __dfault) const
20.1178 ++ {
20.1179 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1180 ++ __c_locale __old = __uselocale(_M_c_locale_messages);
20.1181 ++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
20.1182 ++ __uselocale(__old);
20.1183 ++ return string(__msg);
20.1184 ++#elif defined __UCLIBC_HAS_LOCALE__
20.1185 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
20.1186 ++ setlocale(LC_ALL, _M_name_messages);
20.1187 ++ const char* __msg = gettext(__dfault.c_str());
20.1188 ++ setlocale(LC_ALL, __old);
20.1189 ++ free(__old);
20.1190 ++ return string(__msg);
20.1191 ++#else
20.1192 ++ const char* __msg = gettext(__dfault.c_str());
20.1193 ++ return string(__msg);
20.1194 ++#endif
20.1195 ++ }
20.1196 ++
20.1197 ++#ifdef _GLIBCXX_USE_WCHAR_T
20.1198 ++ template<>
20.1199 ++ wstring
20.1200 ++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
20.1201 ++ {
20.1202 ++# ifdef __UCLIBC_HAS_XLOCALE__
20.1203 ++ __c_locale __old = __uselocale(_M_c_locale_messages);
20.1204 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
20.1205 ++ __uselocale(__old);
20.1206 ++ return _M_convert_from_char(__msg);
20.1207 ++# elif defined __UCLIBC_HAS_LOCALE__
20.1208 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
20.1209 ++ setlocale(LC_ALL, _M_name_messages);
20.1210 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
20.1211 ++ setlocale(LC_ALL, __old);
20.1212 ++ free(__old);
20.1213 ++ return _M_convert_from_char(__msg);
20.1214 ++# else
20.1215 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
20.1216 ++ return _M_convert_from_char(__msg);
20.1217 ++# endif
20.1218 ++ }
20.1219 ++#endif
20.1220 ++}
20.1221 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
20.1222 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100
20.1223 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200
20.1224 +@@ -0,0 +1,118 @@
20.1225 ++// std::messages implementation details, GNU version -*- C++ -*-
20.1226 ++
20.1227 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
20.1228 ++//
20.1229 ++// This file is part of the GNU ISO C++ Library. This library is free
20.1230 ++// software; you can redistribute it and/or modify it under the
20.1231 ++// terms of the GNU General Public License as published by the
20.1232 ++// Free Software Foundation; either version 2, or (at your option)
20.1233 ++// any later version.
20.1234 ++
20.1235 ++// This library is distributed in the hope that it will be useful,
20.1236 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.1237 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.1238 ++// GNU General Public License for more details.
20.1239 ++
20.1240 ++// You should have received a copy of the GNU General Public License along
20.1241 ++// with this library; see the file COPYING. If not, write to the Free
20.1242 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.1243 ++// USA.
20.1244 ++
20.1245 ++// As a special exception, you may use this file as part of a free software
20.1246 ++// library without restriction. Specifically, if other files instantiate
20.1247 ++// templates or use macros or inline functions from this file, or you compile
20.1248 ++// this file and link it with other files to produce an executable, this
20.1249 ++// file does not by itself cause the resulting executable to be covered by
20.1250 ++// the GNU General Public License. This exception does not however
20.1251 ++// invalidate any other reasons why the executable file might be covered by
20.1252 ++// the GNU General Public License.
20.1253 ++
20.1254 ++//
20.1255 ++// ISO C++ 14882: 22.2.7.1.2 messages functions
20.1256 ++//
20.1257 ++
20.1258 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.1259 ++
20.1260 ++#ifdef __UCLIBC_MJN3_ONLY__
20.1261 ++#warning fix prototypes for *textdomain funcs
20.1262 ++#endif
20.1263 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
20.1264 ++extern "C" char *__textdomain(const char *domainname);
20.1265 ++extern "C" char *__bindtextdomain(const char *domainname,
20.1266 ++ const char *dirname);
20.1267 ++#else
20.1268 ++#undef __textdomain
20.1269 ++#undef __bindtextdomain
20.1270 ++#define __textdomain(D) ((void)0)
20.1271 ++#define __bindtextdomain(D,P) ((void)0)
20.1272 ++#endif
20.1273 ++
20.1274 ++ // Non-virtual member functions.
20.1275 ++ template<typename _CharT>
20.1276 ++ messages<_CharT>::messages(size_t __refs)
20.1277 ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
20.1278 ++ _M_name_messages(_S_get_c_name())
20.1279 ++ { }
20.1280 ++
20.1281 ++ template<typename _CharT>
20.1282 ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
20.1283 ++ size_t __refs)
20.1284 ++ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
20.1285 ++ _M_name_messages(__s)
20.1286 ++ {
20.1287 ++ char* __tmp = new char[std::strlen(__s) + 1];
20.1288 ++ std::strcpy(__tmp, __s);
20.1289 ++ _M_name_messages = __tmp;
20.1290 ++ }
20.1291 ++
20.1292 ++ template<typename _CharT>
20.1293 ++ typename messages<_CharT>::catalog
20.1294 ++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
20.1295 ++ const char* __dir) const
20.1296 ++ {
20.1297 ++ __bindtextdomain(__s.c_str(), __dir);
20.1298 ++ return this->do_open(__s, __loc);
20.1299 ++ }
20.1300 ++
20.1301 ++ // Virtual member functions.
20.1302 ++ template<typename _CharT>
20.1303 ++ messages<_CharT>::~messages()
20.1304 ++ {
20.1305 ++ if (_M_name_messages != _S_get_c_name())
20.1306 ++ delete [] _M_name_messages;
20.1307 ++ _S_destroy_c_locale(_M_c_locale_messages);
20.1308 ++ }
20.1309 ++
20.1310 ++ template<typename _CharT>
20.1311 ++ typename messages<_CharT>::catalog
20.1312 ++ messages<_CharT>::do_open(const basic_string<char>& __s,
20.1313 ++ const locale&) const
20.1314 ++ {
20.1315 ++ // No error checking is done, assume the catalog exists and can
20.1316 ++ // be used.
20.1317 ++ __textdomain(__s.c_str());
20.1318 ++ return 0;
20.1319 ++ }
20.1320 ++
20.1321 ++ template<typename _CharT>
20.1322 ++ void
20.1323 ++ messages<_CharT>::do_close(catalog) const
20.1324 ++ { }
20.1325 ++
20.1326 ++ // messages_byname
20.1327 ++ template<typename _CharT>
20.1328 ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
20.1329 ++ : messages<_CharT>(__refs)
20.1330 ++ {
20.1331 ++ if (this->_M_name_messages != locale::facet::_S_get_c_name())
20.1332 ++ delete [] this->_M_name_messages;
20.1333 ++ char* __tmp = new char[std::strlen(__s) + 1];
20.1334 ++ std::strcpy(__tmp, __s);
20.1335 ++ this->_M_name_messages = __tmp;
20.1336 ++
20.1337 ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
20.1338 ++ {
20.1339 ++ this->_S_destroy_c_locale(this->_M_c_locale_messages);
20.1340 ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
20.1341 ++ }
20.1342 ++ }
20.1343 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
20.1344 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100
20.1345 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200
20.1346 +@@ -0,0 +1,692 @@
20.1347 ++// std::moneypunct implementation details, GNU version -*- C++ -*-
20.1348 ++
20.1349 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
20.1350 ++//
20.1351 ++// This file is part of the GNU ISO C++ Library. This library is free
20.1352 ++// software; you can redistribute it and/or modify it under the
20.1353 ++// terms of the GNU General Public License as published by the
20.1354 ++// Free Software Foundation; either version 2, or (at your option)
20.1355 ++// any later version.
20.1356 ++
20.1357 ++// This library is distributed in the hope that it will be useful,
20.1358 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.1359 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.1360 ++// GNU General Public License for more details.
20.1361 ++
20.1362 ++// You should have received a copy of the GNU General Public License along
20.1363 ++// with this library; see the file COPYING. If not, write to the Free
20.1364 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.1365 ++// USA.
20.1366 ++
20.1367 ++// As a special exception, you may use this file as part of a free software
20.1368 ++// library without restriction. Specifically, if other files instantiate
20.1369 ++// templates or use macros or inline functions from this file, or you compile
20.1370 ++// this file and link it with other files to produce an executable, this
20.1371 ++// file does not by itself cause the resulting executable to be covered by
20.1372 ++// the GNU General Public License. This exception does not however
20.1373 ++// invalidate any other reasons why the executable file might be covered by
20.1374 ++// the GNU General Public License.
20.1375 ++
20.1376 ++//
20.1377 ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
20.1378 ++//
20.1379 ++
20.1380 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.1381 ++
20.1382 ++#define _LIBC
20.1383 ++#include <locale>
20.1384 ++#undef _LIBC
20.1385 ++#include <bits/c++locale_internal.h>
20.1386 ++
20.1387 ++#ifdef __UCLIBC_MJN3_ONLY__
20.1388 ++#warning optimize this for uclibc
20.1389 ++#warning tailor for stub locale support
20.1390 ++#endif
20.1391 ++
20.1392 ++#ifndef __UCLIBC_HAS_XLOCALE__
20.1393 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
20.1394 ++#endif
20.1395 ++
20.1396 ++namespace std
20.1397 ++{
20.1398 ++ // Construct and return valid pattern consisting of some combination of:
20.1399 ++ // space none symbol sign value
20.1400 ++ money_base::pattern
20.1401 ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
20.1402 ++ {
20.1403 ++ pattern __ret;
20.1404 ++
20.1405 ++ // This insanely complicated routine attempts to construct a valid
20.1406 ++ // pattern for use with monyepunct. A couple of invariants:
20.1407 ++
20.1408 ++ // if (__precedes) symbol -> value
20.1409 ++ // else value -> symbol
20.1410 ++
20.1411 ++ // if (__space) space
20.1412 ++ // else none
20.1413 ++
20.1414 ++ // none == never first
20.1415 ++ // space never first or last
20.1416 ++
20.1417 ++ // Any elegant implementations of this are welcome.
20.1418 ++ switch (__posn)
20.1419 ++ {
20.1420 ++ case 0:
20.1421 ++ case 1:
20.1422 ++ // 1 The sign precedes the value and symbol.
20.1423 ++ __ret.field[0] = sign;
20.1424 ++ if (__space)
20.1425 ++ {
20.1426 ++ // Pattern starts with sign.
20.1427 ++ if (__precedes)
20.1428 ++ {
20.1429 ++ __ret.field[1] = symbol;
20.1430 ++ __ret.field[3] = value;
20.1431 ++ }
20.1432 ++ else
20.1433 ++ {
20.1434 ++ __ret.field[1] = value;
20.1435 ++ __ret.field[3] = symbol;
20.1436 ++ }
20.1437 ++ __ret.field[2] = space;
20.1438 ++ }
20.1439 ++ else
20.1440 ++ {
20.1441 ++ // Pattern starts with sign and ends with none.
20.1442 ++ if (__precedes)
20.1443 ++ {
20.1444 ++ __ret.field[1] = symbol;
20.1445 ++ __ret.field[2] = value;
20.1446 ++ }
20.1447 ++ else
20.1448 ++ {
20.1449 ++ __ret.field[1] = value;
20.1450 ++ __ret.field[2] = symbol;
20.1451 ++ }
20.1452 ++ __ret.field[3] = none;
20.1453 ++ }
20.1454 ++ break;
20.1455 ++ case 2:
20.1456 ++ // 2 The sign follows the value and symbol.
20.1457 ++ if (__space)
20.1458 ++ {
20.1459 ++ // Pattern either ends with sign.
20.1460 ++ if (__precedes)
20.1461 ++ {
20.1462 ++ __ret.field[0] = symbol;
20.1463 ++ __ret.field[2] = value;
20.1464 ++ }
20.1465 ++ else
20.1466 ++ {
20.1467 ++ __ret.field[0] = value;
20.1468 ++ __ret.field[2] = symbol;
20.1469 ++ }
20.1470 ++ __ret.field[1] = space;
20.1471 ++ __ret.field[3] = sign;
20.1472 ++ }
20.1473 ++ else
20.1474 ++ {
20.1475 ++ // Pattern ends with sign then none.
20.1476 ++ if (__precedes)
20.1477 ++ {
20.1478 ++ __ret.field[0] = symbol;
20.1479 ++ __ret.field[1] = value;
20.1480 ++ }
20.1481 ++ else
20.1482 ++ {
20.1483 ++ __ret.field[0] = value;
20.1484 ++ __ret.field[1] = symbol;
20.1485 ++ }
20.1486 ++ __ret.field[2] = sign;
20.1487 ++ __ret.field[3] = none;
20.1488 ++ }
20.1489 ++ break;
20.1490 ++ case 3:
20.1491 ++ // 3 The sign immediately precedes the symbol.
20.1492 ++ if (__precedes)
20.1493 ++ {
20.1494 ++ __ret.field[0] = sign;
20.1495 ++ __ret.field[1] = symbol;
20.1496 ++ if (__space)
20.1497 ++ {
20.1498 ++ __ret.field[2] = space;
20.1499 ++ __ret.field[3] = value;
20.1500 ++ }
20.1501 ++ else
20.1502 ++ {
20.1503 ++ __ret.field[2] = value;
20.1504 ++ __ret.field[3] = none;
20.1505 ++ }
20.1506 ++ }
20.1507 ++ else
20.1508 ++ {
20.1509 ++ __ret.field[0] = value;
20.1510 ++ if (__space)
20.1511 ++ {
20.1512 ++ __ret.field[1] = space;
20.1513 ++ __ret.field[2] = sign;
20.1514 ++ __ret.field[3] = symbol;
20.1515 ++ }
20.1516 ++ else
20.1517 ++ {
20.1518 ++ __ret.field[1] = sign;
20.1519 ++ __ret.field[2] = symbol;
20.1520 ++ __ret.field[3] = none;
20.1521 ++ }
20.1522 ++ }
20.1523 ++ break;
20.1524 ++ case 4:
20.1525 ++ // 4 The sign immediately follows the symbol.
20.1526 ++ if (__precedes)
20.1527 ++ {
20.1528 ++ __ret.field[0] = symbol;
20.1529 ++ __ret.field[1] = sign;
20.1530 ++ if (__space)
20.1531 ++ {
20.1532 ++ __ret.field[2] = space;
20.1533 ++ __ret.field[3] = value;
20.1534 ++ }
20.1535 ++ else
20.1536 ++ {
20.1537 ++ __ret.field[2] = value;
20.1538 ++ __ret.field[3] = none;
20.1539 ++ }
20.1540 ++ }
20.1541 ++ else
20.1542 ++ {
20.1543 ++ __ret.field[0] = value;
20.1544 ++ if (__space)
20.1545 ++ {
20.1546 ++ __ret.field[1] = space;
20.1547 ++ __ret.field[2] = symbol;
20.1548 ++ __ret.field[3] = sign;
20.1549 ++ }
20.1550 ++ else
20.1551 ++ {
20.1552 ++ __ret.field[1] = symbol;
20.1553 ++ __ret.field[2] = sign;
20.1554 ++ __ret.field[3] = none;
20.1555 ++ }
20.1556 ++ }
20.1557 ++ break;
20.1558 ++ default:
20.1559 ++ ;
20.1560 ++ }
20.1561 ++ return __ret;
20.1562 ++ }
20.1563 ++
20.1564 ++ template<>
20.1565 ++ void
20.1566 ++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
20.1567 ++ const char*)
20.1568 ++ {
20.1569 ++ if (!_M_data)
20.1570 ++ _M_data = new __moneypunct_cache<char, true>;
20.1571 ++
20.1572 ++ if (!__cloc)
20.1573 ++ {
20.1574 ++ // "C" locale
20.1575 ++ _M_data->_M_decimal_point = '.';
20.1576 ++ _M_data->_M_thousands_sep = ',';
20.1577 ++ _M_data->_M_grouping = "";
20.1578 ++ _M_data->_M_grouping_size = 0;
20.1579 ++ _M_data->_M_curr_symbol = "";
20.1580 ++ _M_data->_M_curr_symbol_size = 0;
20.1581 ++ _M_data->_M_positive_sign = "";
20.1582 ++ _M_data->_M_positive_sign_size = 0;
20.1583 ++ _M_data->_M_negative_sign = "";
20.1584 ++ _M_data->_M_negative_sign_size = 0;
20.1585 ++ _M_data->_M_frac_digits = 0;
20.1586 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
20.1587 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
20.1588 ++
20.1589 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
20.1590 ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
20.1591 ++ }
20.1592 ++ else
20.1593 ++ {
20.1594 ++ // Named locale.
20.1595 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
20.1596 ++ __cloc));
20.1597 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
20.1598 ++ __cloc));
20.1599 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
20.1600 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
20.1601 ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
20.1602 ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
20.1603 ++
20.1604 ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
20.1605 ++ if (!__nposn)
20.1606 ++ _M_data->_M_negative_sign = "()";
20.1607 ++ else
20.1608 ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
20.1609 ++ __cloc);
20.1610 ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
20.1611 ++
20.1612 ++ // _Intl == true
20.1613 ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
20.1614 ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
20.1615 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
20.1616 ++ __cloc));
20.1617 ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
20.1618 ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
20.1619 ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
20.1620 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
20.1621 ++ __pposn);
20.1622 ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
20.1623 ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
20.1624 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
20.1625 ++ __nposn);
20.1626 ++ }
20.1627 ++ }
20.1628 ++
20.1629 ++ template<>
20.1630 ++ void
20.1631 ++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
20.1632 ++ const char*)
20.1633 ++ {
20.1634 ++ if (!_M_data)
20.1635 ++ _M_data = new __moneypunct_cache<char, false>;
20.1636 ++
20.1637 ++ if (!__cloc)
20.1638 ++ {
20.1639 ++ // "C" locale
20.1640 ++ _M_data->_M_decimal_point = '.';
20.1641 ++ _M_data->_M_thousands_sep = ',';
20.1642 ++ _M_data->_M_grouping = "";
20.1643 ++ _M_data->_M_grouping_size = 0;
20.1644 ++ _M_data->_M_curr_symbol = "";
20.1645 ++ _M_data->_M_curr_symbol_size = 0;
20.1646 ++ _M_data->_M_positive_sign = "";
20.1647 ++ _M_data->_M_positive_sign_size = 0;
20.1648 ++ _M_data->_M_negative_sign = "";
20.1649 ++ _M_data->_M_negative_sign_size = 0;
20.1650 ++ _M_data->_M_frac_digits = 0;
20.1651 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
20.1652 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
20.1653 ++
20.1654 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
20.1655 ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
20.1656 ++ }
20.1657 ++ else
20.1658 ++ {
20.1659 ++ // Named locale.
20.1660 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
20.1661 ++ __cloc));
20.1662 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
20.1663 ++ __cloc));
20.1664 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
20.1665 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
20.1666 ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
20.1667 ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
20.1668 ++
20.1669 ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
20.1670 ++ if (!__nposn)
20.1671 ++ _M_data->_M_negative_sign = "()";
20.1672 ++ else
20.1673 ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
20.1674 ++ __cloc);
20.1675 ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
20.1676 ++
20.1677 ++ // _Intl == false
20.1678 ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
20.1679 ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
20.1680 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
20.1681 ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
20.1682 ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
20.1683 ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
20.1684 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
20.1685 ++ __pposn);
20.1686 ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
20.1687 ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
20.1688 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
20.1689 ++ __nposn);
20.1690 ++ }
20.1691 ++ }
20.1692 ++
20.1693 ++ template<>
20.1694 ++ moneypunct<char, true>::~moneypunct()
20.1695 ++ { delete _M_data; }
20.1696 ++
20.1697 ++ template<>
20.1698 ++ moneypunct<char, false>::~moneypunct()
20.1699 ++ { delete _M_data; }
20.1700 ++
20.1701 ++#ifdef _GLIBCXX_USE_WCHAR_T
20.1702 ++ template<>
20.1703 ++ void
20.1704 ++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
20.1705 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1706 ++ const char*)
20.1707 ++#else
20.1708 ++ const char* __name)
20.1709 ++#endif
20.1710 ++ {
20.1711 ++ if (!_M_data)
20.1712 ++ _M_data = new __moneypunct_cache<wchar_t, true>;
20.1713 ++
20.1714 ++ if (!__cloc)
20.1715 ++ {
20.1716 ++ // "C" locale
20.1717 ++ _M_data->_M_decimal_point = L'.';
20.1718 ++ _M_data->_M_thousands_sep = L',';
20.1719 ++ _M_data->_M_grouping = "";
20.1720 ++ _M_data->_M_grouping_size = 0;
20.1721 ++ _M_data->_M_curr_symbol = L"";
20.1722 ++ _M_data->_M_curr_symbol_size = 0;
20.1723 ++ _M_data->_M_positive_sign = L"";
20.1724 ++ _M_data->_M_positive_sign_size = 0;
20.1725 ++ _M_data->_M_negative_sign = L"";
20.1726 ++ _M_data->_M_negative_sign_size = 0;
20.1727 ++ _M_data->_M_frac_digits = 0;
20.1728 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
20.1729 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
20.1730 ++
20.1731 ++ // Use ctype::widen code without the facet...
20.1732 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
20.1733 ++ _M_data->_M_atoms[__i] =
20.1734 ++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
20.1735 ++ }
20.1736 ++ else
20.1737 ++ {
20.1738 ++ // Named locale.
20.1739 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1740 ++ __c_locale __old = __uselocale(__cloc);
20.1741 ++#else
20.1742 ++ // Switch to named locale so that mbsrtowcs will work.
20.1743 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
20.1744 ++ setlocale(LC_ALL, __name);
20.1745 ++#endif
20.1746 ++
20.1747 ++#ifdef __UCLIBC_MJN3_ONLY__
20.1748 ++#warning fix this... should be monetary
20.1749 ++#endif
20.1750 ++#ifdef __UCLIBC__
20.1751 ++# ifdef __UCLIBC_HAS_XLOCALE__
20.1752 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
20.1753 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
20.1754 ++# else
20.1755 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
20.1756 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
20.1757 ++# endif
20.1758 ++#else
20.1759 ++ union { char *__s; wchar_t __w; } __u;
20.1760 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
20.1761 ++ _M_data->_M_decimal_point = __u.__w;
20.1762 ++
20.1763 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
20.1764 ++ _M_data->_M_thousands_sep = __u.__w;
20.1765 ++#endif
20.1766 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
20.1767 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
20.1768 ++
20.1769 ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
20.1770 ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
20.1771 ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
20.1772 ++
20.1773 ++ wchar_t* __wcs_ps = 0;
20.1774 ++ wchar_t* __wcs_ns = 0;
20.1775 ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
20.1776 ++ try
20.1777 ++ {
20.1778 ++ mbstate_t __state;
20.1779 ++ size_t __len = strlen(__cpossign);
20.1780 ++ if (__len)
20.1781 ++ {
20.1782 ++ ++__len;
20.1783 ++ memset(&__state, 0, sizeof(mbstate_t));
20.1784 ++ __wcs_ps = new wchar_t[__len];
20.1785 ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
20.1786 ++ _M_data->_M_positive_sign = __wcs_ps;
20.1787 ++ }
20.1788 ++ else
20.1789 ++ _M_data->_M_positive_sign = L"";
20.1790 ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
20.1791 ++
20.1792 ++ __len = strlen(__cnegsign);
20.1793 ++ if (!__nposn)
20.1794 ++ _M_data->_M_negative_sign = L"()";
20.1795 ++ else if (__len)
20.1796 ++ {
20.1797 ++ ++__len;
20.1798 ++ memset(&__state, 0, sizeof(mbstate_t));
20.1799 ++ __wcs_ns = new wchar_t[__len];
20.1800 ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
20.1801 ++ _M_data->_M_negative_sign = __wcs_ns;
20.1802 ++ }
20.1803 ++ else
20.1804 ++ _M_data->_M_negative_sign = L"";
20.1805 ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
20.1806 ++
20.1807 ++ // _Intl == true.
20.1808 ++ __len = strlen(__ccurr);
20.1809 ++ if (__len)
20.1810 ++ {
20.1811 ++ ++__len;
20.1812 ++ memset(&__state, 0, sizeof(mbstate_t));
20.1813 ++ wchar_t* __wcs = new wchar_t[__len];
20.1814 ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
20.1815 ++ _M_data->_M_curr_symbol = __wcs;
20.1816 ++ }
20.1817 ++ else
20.1818 ++ _M_data->_M_curr_symbol = L"";
20.1819 ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
20.1820 ++ }
20.1821 ++ catch (...)
20.1822 ++ {
20.1823 ++ delete _M_data;
20.1824 ++ _M_data = 0;
20.1825 ++ delete __wcs_ps;
20.1826 ++ delete __wcs_ns;
20.1827 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1828 ++ __uselocale(__old);
20.1829 ++#else
20.1830 ++ setlocale(LC_ALL, __old);
20.1831 ++ free(__old);
20.1832 ++#endif
20.1833 ++ __throw_exception_again;
20.1834 ++ }
20.1835 ++
20.1836 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
20.1837 ++ __cloc));
20.1838 ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
20.1839 ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
20.1840 ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
20.1841 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
20.1842 ++ __pposn);
20.1843 ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
20.1844 ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
20.1845 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
20.1846 ++ __nposn);
20.1847 ++
20.1848 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1849 ++ __uselocale(__old);
20.1850 ++#else
20.1851 ++ setlocale(LC_ALL, __old);
20.1852 ++ free(__old);
20.1853 ++#endif
20.1854 ++ }
20.1855 ++ }
20.1856 ++
20.1857 ++ template<>
20.1858 ++ void
20.1859 ++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
20.1860 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1861 ++ const char*)
20.1862 ++#else
20.1863 ++ const char* __name)
20.1864 ++#endif
20.1865 ++ {
20.1866 ++ if (!_M_data)
20.1867 ++ _M_data = new __moneypunct_cache<wchar_t, false>;
20.1868 ++
20.1869 ++ if (!__cloc)
20.1870 ++ {
20.1871 ++ // "C" locale
20.1872 ++ _M_data->_M_decimal_point = L'.';
20.1873 ++ _M_data->_M_thousands_sep = L',';
20.1874 ++ _M_data->_M_grouping = "";
20.1875 ++ _M_data->_M_grouping_size = 0;
20.1876 ++ _M_data->_M_curr_symbol = L"";
20.1877 ++ _M_data->_M_curr_symbol_size = 0;
20.1878 ++ _M_data->_M_positive_sign = L"";
20.1879 ++ _M_data->_M_positive_sign_size = 0;
20.1880 ++ _M_data->_M_negative_sign = L"";
20.1881 ++ _M_data->_M_negative_sign_size = 0;
20.1882 ++ _M_data->_M_frac_digits = 0;
20.1883 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
20.1884 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
20.1885 ++
20.1886 ++ // Use ctype::widen code without the facet...
20.1887 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
20.1888 ++ _M_data->_M_atoms[__i] =
20.1889 ++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
20.1890 ++ }
20.1891 ++ else
20.1892 ++ {
20.1893 ++ // Named locale.
20.1894 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1895 ++ __c_locale __old = __uselocale(__cloc);
20.1896 ++#else
20.1897 ++ // Switch to named locale so that mbsrtowcs will work.
20.1898 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
20.1899 ++ setlocale(LC_ALL, __name);
20.1900 ++#endif
20.1901 ++
20.1902 ++#ifdef __UCLIBC_MJN3_ONLY__
20.1903 ++#warning fix this... should be monetary
20.1904 ++#endif
20.1905 ++#ifdef __UCLIBC__
20.1906 ++# ifdef __UCLIBC_HAS_XLOCALE__
20.1907 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
20.1908 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
20.1909 ++# else
20.1910 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
20.1911 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
20.1912 ++# endif
20.1913 ++#else
20.1914 ++ union { char *__s; wchar_t __w; } __u;
20.1915 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
20.1916 ++ _M_data->_M_decimal_point = __u.__w;
20.1917 ++
20.1918 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
20.1919 ++ _M_data->_M_thousands_sep = __u.__w;
20.1920 ++#endif
20.1921 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
20.1922 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
20.1923 ++
20.1924 ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
20.1925 ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
20.1926 ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
20.1927 ++
20.1928 ++ wchar_t* __wcs_ps = 0;
20.1929 ++ wchar_t* __wcs_ns = 0;
20.1930 ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
20.1931 ++ try
20.1932 ++ {
20.1933 ++ mbstate_t __state;
20.1934 ++ size_t __len;
20.1935 ++ __len = strlen(__cpossign);
20.1936 ++ if (__len)
20.1937 ++ {
20.1938 ++ ++__len;
20.1939 ++ memset(&__state, 0, sizeof(mbstate_t));
20.1940 ++ __wcs_ps = new wchar_t[__len];
20.1941 ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
20.1942 ++ _M_data->_M_positive_sign = __wcs_ps;
20.1943 ++ }
20.1944 ++ else
20.1945 ++ _M_data->_M_positive_sign = L"";
20.1946 ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
20.1947 ++
20.1948 ++ __len = strlen(__cnegsign);
20.1949 ++ if (!__nposn)
20.1950 ++ _M_data->_M_negative_sign = L"()";
20.1951 ++ else if (__len)
20.1952 ++ {
20.1953 ++ ++__len;
20.1954 ++ memset(&__state, 0, sizeof(mbstate_t));
20.1955 ++ __wcs_ns = new wchar_t[__len];
20.1956 ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
20.1957 ++ _M_data->_M_negative_sign = __wcs_ns;
20.1958 ++ }
20.1959 ++ else
20.1960 ++ _M_data->_M_negative_sign = L"";
20.1961 ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
20.1962 ++
20.1963 ++ // _Intl == true.
20.1964 ++ __len = strlen(__ccurr);
20.1965 ++ if (__len)
20.1966 ++ {
20.1967 ++ ++__len;
20.1968 ++ memset(&__state, 0, sizeof(mbstate_t));
20.1969 ++ wchar_t* __wcs = new wchar_t[__len];
20.1970 ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
20.1971 ++ _M_data->_M_curr_symbol = __wcs;
20.1972 ++ }
20.1973 ++ else
20.1974 ++ _M_data->_M_curr_symbol = L"";
20.1975 ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
20.1976 ++ }
20.1977 ++ catch (...)
20.1978 ++ {
20.1979 ++ delete _M_data;
20.1980 ++ _M_data = 0;
20.1981 ++ delete __wcs_ps;
20.1982 ++ delete __wcs_ns;
20.1983 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.1984 ++ __uselocale(__old);
20.1985 ++#else
20.1986 ++ setlocale(LC_ALL, __old);
20.1987 ++ free(__old);
20.1988 ++#endif
20.1989 ++ __throw_exception_again;
20.1990 ++ }
20.1991 ++
20.1992 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
20.1993 ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
20.1994 ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
20.1995 ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
20.1996 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
20.1997 ++ __pposn);
20.1998 ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
20.1999 ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
20.2000 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
20.2001 ++ __nposn);
20.2002 ++
20.2003 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.2004 ++ __uselocale(__old);
20.2005 ++#else
20.2006 ++ setlocale(LC_ALL, __old);
20.2007 ++ free(__old);
20.2008 ++#endif
20.2009 ++ }
20.2010 ++ }
20.2011 ++
20.2012 ++ template<>
20.2013 ++ moneypunct<wchar_t, true>::~moneypunct()
20.2014 ++ {
20.2015 ++ if (_M_data->_M_positive_sign_size)
20.2016 ++ delete [] _M_data->_M_positive_sign;
20.2017 ++ if (_M_data->_M_negative_sign_size
20.2018 ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
20.2019 ++ delete [] _M_data->_M_negative_sign;
20.2020 ++ if (_M_data->_M_curr_symbol_size)
20.2021 ++ delete [] _M_data->_M_curr_symbol;
20.2022 ++ delete _M_data;
20.2023 ++ }
20.2024 ++
20.2025 ++ template<>
20.2026 ++ moneypunct<wchar_t, false>::~moneypunct()
20.2027 ++ {
20.2028 ++ if (_M_data->_M_positive_sign_size)
20.2029 ++ delete [] _M_data->_M_positive_sign;
20.2030 ++ if (_M_data->_M_negative_sign_size
20.2031 ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
20.2032 ++ delete [] _M_data->_M_negative_sign;
20.2033 ++ if (_M_data->_M_curr_symbol_size)
20.2034 ++ delete [] _M_data->_M_curr_symbol;
20.2035 ++ delete _M_data;
20.2036 ++ }
20.2037 ++#endif
20.2038 ++}
20.2039 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
20.2040 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100
20.2041 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200
20.2042 +@@ -0,0 +1,160 @@
20.2043 ++// std::numpunct implementation details, GNU version -*- C++ -*-
20.2044 ++
20.2045 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
20.2046 ++//
20.2047 ++// This file is part of the GNU ISO C++ Library. This library is free
20.2048 ++// software; you can redistribute it and/or modify it under the
20.2049 ++// terms of the GNU General Public License as published by the
20.2050 ++// Free Software Foundation; either version 2, or (at your option)
20.2051 ++// any later version.
20.2052 ++
20.2053 ++// This library is distributed in the hope that it will be useful,
20.2054 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.2055 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.2056 ++// GNU General Public License for more details.
20.2057 ++
20.2058 ++// You should have received a copy of the GNU General Public License along
20.2059 ++// with this library; see the file COPYING. If not, write to the Free
20.2060 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.2061 ++// USA.
20.2062 ++
20.2063 ++// As a special exception, you may use this file as part of a free software
20.2064 ++// library without restriction. Specifically, if other files instantiate
20.2065 ++// templates or use macros or inline functions from this file, or you compile
20.2066 ++// this file and link it with other files to produce an executable, this
20.2067 ++// file does not by itself cause the resulting executable to be covered by
20.2068 ++// the GNU General Public License. This exception does not however
20.2069 ++// invalidate any other reasons why the executable file might be covered by
20.2070 ++// the GNU General Public License.
20.2071 ++
20.2072 ++//
20.2073 ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
20.2074 ++//
20.2075 ++
20.2076 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.2077 ++
20.2078 ++#define _LIBC
20.2079 ++#include <locale>
20.2080 ++#undef _LIBC
20.2081 ++#include <bits/c++locale_internal.h>
20.2082 ++
20.2083 ++#ifdef __UCLIBC_MJN3_ONLY__
20.2084 ++#warning tailor for stub locale support
20.2085 ++#endif
20.2086 ++#ifndef __UCLIBC_HAS_XLOCALE__
20.2087 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
20.2088 ++#endif
20.2089 ++
20.2090 ++namespace std
20.2091 ++{
20.2092 ++ template<>
20.2093 ++ void
20.2094 ++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
20.2095 ++ {
20.2096 ++ if (!_M_data)
20.2097 ++ _M_data = new __numpunct_cache<char>;
20.2098 ++
20.2099 ++ if (!__cloc)
20.2100 ++ {
20.2101 ++ // "C" locale
20.2102 ++ _M_data->_M_grouping = "";
20.2103 ++ _M_data->_M_grouping_size = 0;
20.2104 ++ _M_data->_M_use_grouping = false;
20.2105 ++
20.2106 ++ _M_data->_M_decimal_point = '.';
20.2107 ++ _M_data->_M_thousands_sep = ',';
20.2108 ++
20.2109 ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
20.2110 ++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
20.2111 ++
20.2112 ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
20.2113 ++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
20.2114 ++ }
20.2115 ++ else
20.2116 ++ {
20.2117 ++ // Named locale.
20.2118 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
20.2119 ++ __cloc));
20.2120 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
20.2121 ++ __cloc));
20.2122 ++
20.2123 ++ // Check for NULL, which implies no grouping.
20.2124 ++ if (_M_data->_M_thousands_sep == '\0')
20.2125 ++ _M_data->_M_grouping = "";
20.2126 ++ else
20.2127 ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
20.2128 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
20.2129 ++ }
20.2130 ++
20.2131 ++ // NB: There is no way to extact this info from posix locales.
20.2132 ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
20.2133 ++ _M_data->_M_truename = "true";
20.2134 ++ _M_data->_M_truename_size = 4;
20.2135 ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
20.2136 ++ _M_data->_M_falsename = "false";
20.2137 ++ _M_data->_M_falsename_size = 5;
20.2138 ++ }
20.2139 ++
20.2140 ++ template<>
20.2141 ++ numpunct<char>::~numpunct()
20.2142 ++ { delete _M_data; }
20.2143 ++
20.2144 ++#ifdef _GLIBCXX_USE_WCHAR_T
20.2145 ++ template<>
20.2146 ++ void
20.2147 ++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
20.2148 ++ {
20.2149 ++ if (!_M_data)
20.2150 ++ _M_data = new __numpunct_cache<wchar_t>;
20.2151 ++
20.2152 ++ if (!__cloc)
20.2153 ++ {
20.2154 ++ // "C" locale
20.2155 ++ _M_data->_M_grouping = "";
20.2156 ++ _M_data->_M_grouping_size = 0;
20.2157 ++ _M_data->_M_use_grouping = false;
20.2158 ++
20.2159 ++ _M_data->_M_decimal_point = L'.';
20.2160 ++ _M_data->_M_thousands_sep = L',';
20.2161 ++
20.2162 ++ // Use ctype::widen code without the facet...
20.2163 ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
20.2164 ++ _M_data->_M_atoms_out[__i] =
20.2165 ++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
20.2166 ++
20.2167 ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
20.2168 ++ _M_data->_M_atoms_in[__j] =
20.2169 ++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
20.2170 ++ }
20.2171 ++ else
20.2172 ++ {
20.2173 ++ // Named locale.
20.2174 ++ // NB: In the GNU model wchar_t is always 32 bit wide.
20.2175 ++ union { char *__s; wchar_t __w; } __u;
20.2176 ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
20.2177 ++ _M_data->_M_decimal_point = __u.__w;
20.2178 ++
20.2179 ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
20.2180 ++ _M_data->_M_thousands_sep = __u.__w;
20.2181 ++
20.2182 ++ if (_M_data->_M_thousands_sep == L'\0')
20.2183 ++ _M_data->_M_grouping = "";
20.2184 ++ else
20.2185 ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
20.2186 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
20.2187 ++ }
20.2188 ++
20.2189 ++ // NB: There is no way to extact this info from posix locales.
20.2190 ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
20.2191 ++ _M_data->_M_truename = L"true";
20.2192 ++ _M_data->_M_truename_size = 4;
20.2193 ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
20.2194 ++ _M_data->_M_falsename = L"false";
20.2195 ++ _M_data->_M_falsename_size = 5;
20.2196 ++ }
20.2197 ++
20.2198 ++ template<>
20.2199 ++ numpunct<wchar_t>::~numpunct()
20.2200 ++ { delete _M_data; }
20.2201 ++ #endif
20.2202 ++}
20.2203 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc
20.2204 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100
20.2205 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200
20.2206 +@@ -0,0 +1,406 @@
20.2207 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
20.2208 ++
20.2209 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
20.2210 ++//
20.2211 ++// This file is part of the GNU ISO C++ Library. This library is free
20.2212 ++// software; you can redistribute it and/or modify it under the
20.2213 ++// terms of the GNU General Public License as published by the
20.2214 ++// Free Software Foundation; either version 2, or (at your option)
20.2215 ++// any later version.
20.2216 ++
20.2217 ++// This library is distributed in the hope that it will be useful,
20.2218 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.2219 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.2220 ++// GNU General Public License for more details.
20.2221 ++
20.2222 ++// You should have received a copy of the GNU General Public License along
20.2223 ++// with this library; see the file COPYING. If not, write to the Free
20.2224 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.2225 ++// USA.
20.2226 ++
20.2227 ++// As a special exception, you may use this file as part of a free software
20.2228 ++// library without restriction. Specifically, if other files instantiate
20.2229 ++// templates or use macros or inline functions from this file, or you compile
20.2230 ++// this file and link it with other files to produce an executable, this
20.2231 ++// file does not by itself cause the resulting executable to be covered by
20.2232 ++// the GNU General Public License. This exception does not however
20.2233 ++// invalidate any other reasons why the executable file might be covered by
20.2234 ++// the GNU General Public License.
20.2235 ++
20.2236 ++//
20.2237 ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
20.2238 ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
20.2239 ++//
20.2240 ++
20.2241 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.2242 ++
20.2243 ++#include <locale>
20.2244 ++#include <bits/c++locale_internal.h>
20.2245 ++
20.2246 ++#ifdef __UCLIBC_MJN3_ONLY__
20.2247 ++#warning tailor for stub locale support
20.2248 ++#endif
20.2249 ++#ifndef __UCLIBC_HAS_XLOCALE__
20.2250 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
20.2251 ++#endif
20.2252 ++
20.2253 ++namespace std
20.2254 ++{
20.2255 ++ template<>
20.2256 ++ void
20.2257 ++ __timepunct<char>::
20.2258 ++ _M_put(char* __s, size_t __maxlen, const char* __format,
20.2259 ++ const tm* __tm) const
20.2260 ++ {
20.2261 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.2262 ++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
20.2263 ++ _M_c_locale_timepunct);
20.2264 ++#else
20.2265 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
20.2266 ++ setlocale(LC_ALL, _M_name_timepunct);
20.2267 ++ const size_t __len = strftime(__s, __maxlen, __format, __tm);
20.2268 ++ setlocale(LC_ALL, __old);
20.2269 ++ free(__old);
20.2270 ++#endif
20.2271 ++ // Make sure __s is null terminated.
20.2272 ++ if (__len == 0)
20.2273 ++ __s[0] = '\0';
20.2274 ++ }
20.2275 ++
20.2276 ++ template<>
20.2277 ++ void
20.2278 ++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
20.2279 ++ {
20.2280 ++ if (!_M_data)
20.2281 ++ _M_data = new __timepunct_cache<char>;
20.2282 ++
20.2283 ++ if (!__cloc)
20.2284 ++ {
20.2285 ++ // "C" locale
20.2286 ++ _M_c_locale_timepunct = _S_get_c_locale();
20.2287 ++
20.2288 ++ _M_data->_M_date_format = "%m/%d/%y";
20.2289 ++ _M_data->_M_date_era_format = "%m/%d/%y";
20.2290 ++ _M_data->_M_time_format = "%H:%M:%S";
20.2291 ++ _M_data->_M_time_era_format = "%H:%M:%S";
20.2292 ++ _M_data->_M_date_time_format = "";
20.2293 ++ _M_data->_M_date_time_era_format = "";
20.2294 ++ _M_data->_M_am = "AM";
20.2295 ++ _M_data->_M_pm = "PM";
20.2296 ++ _M_data->_M_am_pm_format = "";
20.2297 ++
20.2298 ++ // Day names, starting with "C"'s Sunday.
20.2299 ++ _M_data->_M_day1 = "Sunday";
20.2300 ++ _M_data->_M_day2 = "Monday";
20.2301 ++ _M_data->_M_day3 = "Tuesday";
20.2302 ++ _M_data->_M_day4 = "Wednesday";
20.2303 ++ _M_data->_M_day5 = "Thursday";
20.2304 ++ _M_data->_M_day6 = "Friday";
20.2305 ++ _M_data->_M_day7 = "Saturday";
20.2306 ++
20.2307 ++ // Abbreviated day names, starting with "C"'s Sun.
20.2308 ++ _M_data->_M_aday1 = "Sun";
20.2309 ++ _M_data->_M_aday2 = "Mon";
20.2310 ++ _M_data->_M_aday3 = "Tue";
20.2311 ++ _M_data->_M_aday4 = "Wed";
20.2312 ++ _M_data->_M_aday5 = "Thu";
20.2313 ++ _M_data->_M_aday6 = "Fri";
20.2314 ++ _M_data->_M_aday7 = "Sat";
20.2315 ++
20.2316 ++ // Month names, starting with "C"'s January.
20.2317 ++ _M_data->_M_month01 = "January";
20.2318 ++ _M_data->_M_month02 = "February";
20.2319 ++ _M_data->_M_month03 = "March";
20.2320 ++ _M_data->_M_month04 = "April";
20.2321 ++ _M_data->_M_month05 = "May";
20.2322 ++ _M_data->_M_month06 = "June";
20.2323 ++ _M_data->_M_month07 = "July";
20.2324 ++ _M_data->_M_month08 = "August";
20.2325 ++ _M_data->_M_month09 = "September";
20.2326 ++ _M_data->_M_month10 = "October";
20.2327 ++ _M_data->_M_month11 = "November";
20.2328 ++ _M_data->_M_month12 = "December";
20.2329 ++
20.2330 ++ // Abbreviated month names, starting with "C"'s Jan.
20.2331 ++ _M_data->_M_amonth01 = "Jan";
20.2332 ++ _M_data->_M_amonth02 = "Feb";
20.2333 ++ _M_data->_M_amonth03 = "Mar";
20.2334 ++ _M_data->_M_amonth04 = "Apr";
20.2335 ++ _M_data->_M_amonth05 = "May";
20.2336 ++ _M_data->_M_amonth06 = "Jun";
20.2337 ++ _M_data->_M_amonth07 = "Jul";
20.2338 ++ _M_data->_M_amonth08 = "Aug";
20.2339 ++ _M_data->_M_amonth09 = "Sep";
20.2340 ++ _M_data->_M_amonth10 = "Oct";
20.2341 ++ _M_data->_M_amonth11 = "Nov";
20.2342 ++ _M_data->_M_amonth12 = "Dec";
20.2343 ++ }
20.2344 ++ else
20.2345 ++ {
20.2346 ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
20.2347 ++
20.2348 ++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
20.2349 ++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
20.2350 ++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
20.2351 ++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
20.2352 ++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
20.2353 ++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
20.2354 ++ __cloc);
20.2355 ++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
20.2356 ++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
20.2357 ++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
20.2358 ++
20.2359 ++ // Day names, starting with "C"'s Sunday.
20.2360 ++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
20.2361 ++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
20.2362 ++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
20.2363 ++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
20.2364 ++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
20.2365 ++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
20.2366 ++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
20.2367 ++
20.2368 ++ // Abbreviated day names, starting with "C"'s Sun.
20.2369 ++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
20.2370 ++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
20.2371 ++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
20.2372 ++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
20.2373 ++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
20.2374 ++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
20.2375 ++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
20.2376 ++
20.2377 ++ // Month names, starting with "C"'s January.
20.2378 ++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
20.2379 ++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
20.2380 ++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
20.2381 ++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
20.2382 ++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
20.2383 ++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
20.2384 ++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
20.2385 ++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
20.2386 ++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
20.2387 ++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
20.2388 ++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
20.2389 ++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
20.2390 ++
20.2391 ++ // Abbreviated month names, starting with "C"'s Jan.
20.2392 ++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
20.2393 ++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
20.2394 ++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
20.2395 ++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
20.2396 ++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
20.2397 ++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
20.2398 ++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
20.2399 ++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
20.2400 ++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
20.2401 ++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
20.2402 ++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
20.2403 ++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
20.2404 ++ }
20.2405 ++ }
20.2406 ++
20.2407 ++#ifdef _GLIBCXX_USE_WCHAR_T
20.2408 ++ template<>
20.2409 ++ void
20.2410 ++ __timepunct<wchar_t>::
20.2411 ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
20.2412 ++ const tm* __tm) const
20.2413 ++ {
20.2414 ++#ifdef __UCLIBC_HAS_XLOCALE__
20.2415 ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
20.2416 ++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
20.2417 ++ _M_c_locale_timepunct);
20.2418 ++#else
20.2419 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
20.2420 ++ setlocale(LC_ALL, _M_name_timepunct);
20.2421 ++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
20.2422 ++ setlocale(LC_ALL, __old);
20.2423 ++ free(__old);
20.2424 ++#endif
20.2425 ++ // Make sure __s is null terminated.
20.2426 ++ if (__len == 0)
20.2427 ++ __s[0] = L'\0';
20.2428 ++ }
20.2429 ++
20.2430 ++ template<>
20.2431 ++ void
20.2432 ++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
20.2433 ++ {
20.2434 ++ if (!_M_data)
20.2435 ++ _M_data = new __timepunct_cache<wchar_t>;
20.2436 ++
20.2437 ++#warning wide time stuff
20.2438 ++// if (!__cloc)
20.2439 ++ {
20.2440 ++ // "C" locale
20.2441 ++ _M_c_locale_timepunct = _S_get_c_locale();
20.2442 ++
20.2443 ++ _M_data->_M_date_format = L"%m/%d/%y";
20.2444 ++ _M_data->_M_date_era_format = L"%m/%d/%y";
20.2445 ++ _M_data->_M_time_format = L"%H:%M:%S";
20.2446 ++ _M_data->_M_time_era_format = L"%H:%M:%S";
20.2447 ++ _M_data->_M_date_time_format = L"";
20.2448 ++ _M_data->_M_date_time_era_format = L"";
20.2449 ++ _M_data->_M_am = L"AM";
20.2450 ++ _M_data->_M_pm = L"PM";
20.2451 ++ _M_data->_M_am_pm_format = L"";
20.2452 ++
20.2453 ++ // Day names, starting with "C"'s Sunday.
20.2454 ++ _M_data->_M_day1 = L"Sunday";
20.2455 ++ _M_data->_M_day2 = L"Monday";
20.2456 ++ _M_data->_M_day3 = L"Tuesday";
20.2457 ++ _M_data->_M_day4 = L"Wednesday";
20.2458 ++ _M_data->_M_day5 = L"Thursday";
20.2459 ++ _M_data->_M_day6 = L"Friday";
20.2460 ++ _M_data->_M_day7 = L"Saturday";
20.2461 ++
20.2462 ++ // Abbreviated day names, starting with "C"'s Sun.
20.2463 ++ _M_data->_M_aday1 = L"Sun";
20.2464 ++ _M_data->_M_aday2 = L"Mon";
20.2465 ++ _M_data->_M_aday3 = L"Tue";
20.2466 ++ _M_data->_M_aday4 = L"Wed";
20.2467 ++ _M_data->_M_aday5 = L"Thu";
20.2468 ++ _M_data->_M_aday6 = L"Fri";
20.2469 ++ _M_data->_M_aday7 = L"Sat";
20.2470 ++
20.2471 ++ // Month names, starting with "C"'s January.
20.2472 ++ _M_data->_M_month01 = L"January";
20.2473 ++ _M_data->_M_month02 = L"February";
20.2474 ++ _M_data->_M_month03 = L"March";
20.2475 ++ _M_data->_M_month04 = L"April";
20.2476 ++ _M_data->_M_month05 = L"May";
20.2477 ++ _M_data->_M_month06 = L"June";
20.2478 ++ _M_data->_M_month07 = L"July";
20.2479 ++ _M_data->_M_month08 = L"August";
20.2480 ++ _M_data->_M_month09 = L"September";
20.2481 ++ _M_data->_M_month10 = L"October";
20.2482 ++ _M_data->_M_month11 = L"November";
20.2483 ++ _M_data->_M_month12 = L"December";
20.2484 ++
20.2485 ++ // Abbreviated month names, starting with "C"'s Jan.
20.2486 ++ _M_data->_M_amonth01 = L"Jan";
20.2487 ++ _M_data->_M_amonth02 = L"Feb";
20.2488 ++ _M_data->_M_amonth03 = L"Mar";
20.2489 ++ _M_data->_M_amonth04 = L"Apr";
20.2490 ++ _M_data->_M_amonth05 = L"May";
20.2491 ++ _M_data->_M_amonth06 = L"Jun";
20.2492 ++ _M_data->_M_amonth07 = L"Jul";
20.2493 ++ _M_data->_M_amonth08 = L"Aug";
20.2494 ++ _M_data->_M_amonth09 = L"Sep";
20.2495 ++ _M_data->_M_amonth10 = L"Oct";
20.2496 ++ _M_data->_M_amonth11 = L"Nov";
20.2497 ++ _M_data->_M_amonth12 = L"Dec";
20.2498 ++ }
20.2499 ++#if 0
20.2500 ++ else
20.2501 ++ {
20.2502 ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
20.2503 ++
20.2504 ++ union { char *__s; wchar_t *__w; } __u;
20.2505 ++
20.2506 ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
20.2507 ++ _M_data->_M_date_format = __u.__w;
20.2508 ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
20.2509 ++ _M_data->_M_date_era_format = __u.__w;
20.2510 ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
20.2511 ++ _M_data->_M_time_format = __u.__w;
20.2512 ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
20.2513 ++ _M_data->_M_time_era_format = __u.__w;
20.2514 ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
20.2515 ++ _M_data->_M_date_time_format = __u.__w;
20.2516 ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
20.2517 ++ _M_data->_M_date_time_era_format = __u.__w;
20.2518 ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
20.2519 ++ _M_data->_M_am = __u.__w;
20.2520 ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
20.2521 ++ _M_data->_M_pm = __u.__w;
20.2522 ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
20.2523 ++ _M_data->_M_am_pm_format = __u.__w;
20.2524 ++
20.2525 ++ // Day names, starting with "C"'s Sunday.
20.2526 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
20.2527 ++ _M_data->_M_day1 = __u.__w;
20.2528 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
20.2529 ++ _M_data->_M_day2 = __u.__w;
20.2530 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
20.2531 ++ _M_data->_M_day3 = __u.__w;
20.2532 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
20.2533 ++ _M_data->_M_day4 = __u.__w;
20.2534 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
20.2535 ++ _M_data->_M_day5 = __u.__w;
20.2536 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
20.2537 ++ _M_data->_M_day6 = __u.__w;
20.2538 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
20.2539 ++ _M_data->_M_day7 = __u.__w;
20.2540 ++
20.2541 ++ // Abbreviated day names, starting with "C"'s Sun.
20.2542 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
20.2543 ++ _M_data->_M_aday1 = __u.__w;
20.2544 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
20.2545 ++ _M_data->_M_aday2 = __u.__w;
20.2546 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
20.2547 ++ _M_data->_M_aday3 = __u.__w;
20.2548 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
20.2549 ++ _M_data->_M_aday4 = __u.__w;
20.2550 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
20.2551 ++ _M_data->_M_aday5 = __u.__w;
20.2552 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
20.2553 ++ _M_data->_M_aday6 = __u.__w;
20.2554 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
20.2555 ++ _M_data->_M_aday7 = __u.__w;
20.2556 ++
20.2557 ++ // Month names, starting with "C"'s January.
20.2558 ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
20.2559 ++ _M_data->_M_month01 = __u.__w;
20.2560 ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
20.2561 ++ _M_data->_M_month02 = __u.__w;
20.2562 ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
20.2563 ++ _M_data->_M_month03 = __u.__w;
20.2564 ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
20.2565 ++ _M_data->_M_month04 = __u.__w;
20.2566 ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
20.2567 ++ _M_data->_M_month05 = __u.__w;
20.2568 ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
20.2569 ++ _M_data->_M_month06 = __u.__w;
20.2570 ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
20.2571 ++ _M_data->_M_month07 = __u.__w;
20.2572 ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
20.2573 ++ _M_data->_M_month08 = __u.__w;
20.2574 ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
20.2575 ++ _M_data->_M_month09 = __u.__w;
20.2576 ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
20.2577 ++ _M_data->_M_month10 = __u.__w;
20.2578 ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
20.2579 ++ _M_data->_M_month11 = __u.__w;
20.2580 ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
20.2581 ++ _M_data->_M_month12 = __u.__w;
20.2582 ++
20.2583 ++ // Abbreviated month names, starting with "C"'s Jan.
20.2584 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
20.2585 ++ _M_data->_M_amonth01 = __u.__w;
20.2586 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
20.2587 ++ _M_data->_M_amonth02 = __u.__w;
20.2588 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
20.2589 ++ _M_data->_M_amonth03 = __u.__w;
20.2590 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
20.2591 ++ _M_data->_M_amonth04 = __u.__w;
20.2592 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
20.2593 ++ _M_data->_M_amonth05 = __u.__w;
20.2594 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
20.2595 ++ _M_data->_M_amonth06 = __u.__w;
20.2596 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
20.2597 ++ _M_data->_M_amonth07 = __u.__w;
20.2598 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
20.2599 ++ _M_data->_M_amonth08 = __u.__w;
20.2600 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
20.2601 ++ _M_data->_M_amonth09 = __u.__w;
20.2602 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
20.2603 ++ _M_data->_M_amonth10 = __u.__w;
20.2604 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
20.2605 ++ _M_data->_M_amonth11 = __u.__w;
20.2606 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
20.2607 ++ _M_data->_M_amonth12 = __u.__w;
20.2608 ++ }
20.2609 ++#endif // 0
20.2610 ++ }
20.2611 ++#endif
20.2612 ++}
20.2613 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h
20.2614 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100
20.2615 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200
20.2616 +@@ -0,0 +1,68 @@
20.2617 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
20.2618 ++
20.2619 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
20.2620 ++//
20.2621 ++// This file is part of the GNU ISO C++ Library. This library is free
20.2622 ++// software; you can redistribute it and/or modify it under the
20.2623 ++// terms of the GNU General Public License as published by the
20.2624 ++// Free Software Foundation; either version 2, or (at your option)
20.2625 ++// any later version.
20.2626 ++
20.2627 ++// This library is distributed in the hope that it will be useful,
20.2628 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
20.2629 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.2630 ++// GNU General Public License for more details.
20.2631 ++
20.2632 ++// You should have received a copy of the GNU General Public License along
20.2633 ++// with this library; see the file COPYING. If not, write to the Free
20.2634 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20.2635 ++// USA.
20.2636 ++
20.2637 ++// As a special exception, you may use this file as part of a free software
20.2638 ++// library without restriction. Specifically, if other files instantiate
20.2639 ++// templates or use macros or inline functions from this file, or you compile
20.2640 ++// this file and link it with other files to produce an executable, this
20.2641 ++// file does not by itself cause the resulting executable to be covered by
20.2642 ++// the GNU General Public License. This exception does not however
20.2643 ++// invalidate any other reasons why the executable file might be covered by
20.2644 ++// the GNU General Public License.
20.2645 ++
20.2646 ++//
20.2647 ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions
20.2648 ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions
20.2649 ++//
20.2650 ++
20.2651 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
20.2652 ++
20.2653 ++ template<typename _CharT>
20.2654 ++ __timepunct<_CharT>::__timepunct(size_t __refs)
20.2655 ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
20.2656 ++ _M_name_timepunct(_S_get_c_name())
20.2657 ++ { _M_initialize_timepunct(); }
20.2658 ++
20.2659 ++ template<typename _CharT>
20.2660 ++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
20.2661 ++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
20.2662 ++ _M_name_timepunct(_S_get_c_name())
20.2663 ++ { _M_initialize_timepunct(); }
20.2664 ++
20.2665 ++ template<typename _CharT>
20.2666 ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
20.2667 ++ size_t __refs)
20.2668 ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
20.2669 ++ _M_name_timepunct(__s)
20.2670 ++ {
20.2671 ++ char* __tmp = new char[std::strlen(__s) + 1];
20.2672 ++ std::strcpy(__tmp, __s);
20.2673 ++ _M_name_timepunct = __tmp;
20.2674 ++ _M_initialize_timepunct(__cloc);
20.2675 ++ }
20.2676 ++
20.2677 ++ template<typename _CharT>
20.2678 ++ __timepunct<_CharT>::~__timepunct()
20.2679 ++ {
20.2680 ++ if (_M_name_timepunct != _S_get_c_name())
20.2681 ++ delete [] _M_name_timepunct;
20.2682 ++ delete _M_data;
20.2683 ++ _S_destroy_c_locale(_M_c_locale_timepunct);
20.2684 ++ }
20.2685 +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
20.2686 +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200
20.2687 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200
20.2688 +@@ -5769,7 +5769,7 @@
20.2689 + enableval="$enable_clocale"
20.2690 +
20.2691 + case "$enableval" in
20.2692 +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
20.2693 ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
20.2694 + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
20.2695 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
20.2696 + { (exit 1); exit 1; }; } ;;
20.2697 +@@ -5802,6 +5802,9 @@
20.2698 + # Default to "generic".
20.2699 + if test $enable_clocale_flag = auto; then
20.2700 + case ${target_os} in
20.2701 ++ linux-uclibc*)
20.2702 ++ enable_clocale_flag=uclibc
20.2703 ++ ;;
20.2704 + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
20.2705 + enable_clocale_flag=gnu
20.2706 + ;;
20.2707 +@@ -6190,6 +6193,76 @@
20.2708 + CTIME_CC=config/locale/generic/time_members.cc
20.2709 + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
20.2710 + ;;
20.2711 ++ uclibc)
20.2712 ++ echo "$as_me:$LINENO: result: uclibc" >&5
20.2713 ++echo "${ECHO_T}uclibc" >&6
20.2714 ++
20.2715 ++ # Declare intention to use gettext, and add support for specific
20.2716 ++ # languages.
20.2717 ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
20.2718 ++ ALL_LINGUAS="de fr"
20.2719 ++
20.2720 ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
20.2721 ++ # Extract the first word of "msgfmt", so it can be a program name with args.
20.2722 ++set dummy msgfmt; ac_word=$2
20.2723 ++echo "$as_me:$LINENO: checking for $ac_word" >&5
20.2724 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
20.2725 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then
20.2726 ++ echo $ECHO_N "(cached) $ECHO_C" >&6
20.2727 ++else
20.2728 ++ if test -n "$check_msgfmt"; then
20.2729 ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
20.2730 ++else
20.2731 ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
20.2732 ++for as_dir in $PATH
20.2733 ++do
20.2734 ++ IFS=$as_save_IFS
20.2735 ++ test -z "$as_dir" && as_dir=.
20.2736 ++ for ac_exec_ext in '' $ac_executable_extensions; do
20.2737 ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
20.2738 ++ ac_cv_prog_check_msgfmt="yes"
20.2739 ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
20.2740 ++ break 2
20.2741 ++ fi
20.2742 ++done
20.2743 ++done
20.2744 ++
20.2745 ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
20.2746 ++fi
20.2747 ++fi
20.2748 ++check_msgfmt=$ac_cv_prog_check_msgfmt
20.2749 ++if test -n "$check_msgfmt"; then
20.2750 ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
20.2751 ++echo "${ECHO_T}$check_msgfmt" >&6
20.2752 ++else
20.2753 ++ echo "$as_me:$LINENO: result: no" >&5
20.2754 ++echo "${ECHO_T}no" >&6
20.2755 ++fi
20.2756 ++
20.2757 ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
20.2758 ++ USE_NLS=yes
20.2759 ++ fi
20.2760 ++ # Export the build objects.
20.2761 ++ for ling in $ALL_LINGUAS; do \
20.2762 ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
20.2763 ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
20.2764 ++ done
20.2765 ++
20.2766 ++
20.2767 ++
20.2768 ++ CLOCALE_H=config/locale/uclibc/c_locale.h
20.2769 ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
20.2770 ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
20.2771 ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
20.2772 ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
20.2773 ++ CMESSAGES_H=config/locale/uclibc/messages_members.h
20.2774 ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
20.2775 ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
20.2776 ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
20.2777 ++ CTIME_H=config/locale/uclibc/time_members.h
20.2778 ++ CTIME_CC=config/locale/uclibc/time_members.cc
20.2779 ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
20.2780 ++ ;;
20.2781 + esac
20.2782 +
20.2783 + # This is where the testsuite looks for locale catalogs, using the
20.2784 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h
20.2785 +--- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200
20.2786 ++++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200
20.2787 +@@ -101,7 +101,9 @@
20.2788 + using std::wmemcpy;
20.2789 + using std::wmemmove;
20.2790 + using std::wmemset;
20.2791 ++#if _GLIBCXX_HAVE_WCSFTIME
20.2792 + using std::wcsftime;
20.2793 ++#endif
20.2794 +
20.2795 + #if _GLIBCXX_USE_C99
20.2796 + using std::wcstold;
20.2797 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h
20.2798 +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100
20.2799 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200
20.2800 +@@ -182,7 +182,9 @@
20.2801 + using ::wcscoll;
20.2802 + using ::wcscpy;
20.2803 + using ::wcscspn;
20.2804 ++#if _GLIBCXX_HAVE_WCSFTIME
20.2805 + using ::wcsftime;
20.2806 ++#endif
20.2807 + using ::wcslen;
20.2808 + using ::wcsncat;
20.2809 + using ::wcsncmp;
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/patches/gcc/4.2.3/203-uclibc-locale-no__x.patch Sun Feb 17 22:08:06 2008 +0000
21.3 @@ -0,0 +1,223 @@
21.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
21.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200
21.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200
21.7 +@@ -39,20 +39,6 @@
21.8 + #include <langinfo.h>
21.9 + #include <bits/c++locale_internal.h>
21.10 +
21.11 +-#ifndef __UCLIBC_HAS_XLOCALE__
21.12 +-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
21.13 +-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
21.14 +-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
21.15 +-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
21.16 +-#define __strtof_l(S, E, L) strtof((S), (E))
21.17 +-#define __strtod_l(S, E, L) strtod((S), (E))
21.18 +-#define __strtold_l(S, E, L) strtold((S), (E))
21.19 +-#warning should dummy __newlocale check for C|POSIX ?
21.20 +-#define __newlocale(a, b, c) NULL
21.21 +-#define __freelocale(a) ((void)0)
21.22 +-#define __duplocale(a) __c_locale()
21.23 +-#endif
21.24 +-
21.25 + namespace std
21.26 + {
21.27 + template<>
21.28 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h
21.29 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200
21.30 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200
21.31 +@@ -68,6 +68,7 @@
21.32 + {
21.33 + extern "C" __typeof(uselocale) __uselocale;
21.34 + }
21.35 ++#define __uselocale uselocale
21.36 + #endif
21.37 +
21.38 + namespace std
21.39 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
21.40 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200
21.41 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200
21.42 +@@ -60,4 +60,49 @@
21.43 + extern "C" __typeof(wctype_l) __wctype_l;
21.44 + #endif
21.45 +
21.46 ++# define __nl_langinfo_l nl_langinfo_l
21.47 ++# define __strcoll_l strcoll_l
21.48 ++# define __strftime_l strftime_l
21.49 ++# define __strtod_l strtod_l
21.50 ++# define __strtof_l strtof_l
21.51 ++# define __strtold_l strtold_l
21.52 ++# define __strxfrm_l strxfrm_l
21.53 ++# define __newlocale newlocale
21.54 ++# define __freelocale freelocale
21.55 ++# define __duplocale duplocale
21.56 ++# define __uselocale uselocale
21.57 ++
21.58 ++# ifdef _GLIBCXX_USE_WCHAR_T
21.59 ++# define __iswctype_l iswctype_l
21.60 ++# define __towlower_l towlower_l
21.61 ++# define __towupper_l towupper_l
21.62 ++# define __wcscoll_l wcscoll_l
21.63 ++# define __wcsftime_l wcsftime_l
21.64 ++# define __wcsxfrm_l wcsxfrm_l
21.65 ++# define __wctype_l wctype_l
21.66 ++# endif
21.67 ++
21.68 ++#else
21.69 ++# define __nl_langinfo_l(N, L) nl_langinfo((N))
21.70 ++# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
21.71 ++# define __strtod_l(S, E, L) strtod((S), (E))
21.72 ++# define __strtof_l(S, E, L) strtof((S), (E))
21.73 ++# define __strtold_l(S, E, L) strtold((S), (E))
21.74 ++# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
21.75 ++# warning should dummy __newlocale check for C|POSIX ?
21.76 ++# define __newlocale(a, b, c) NULL
21.77 ++# define __freelocale(a) ((void)0)
21.78 ++# define __duplocale(a) __c_locale()
21.79 ++//# define __uselocale ?
21.80 ++//
21.81 ++# ifdef _GLIBCXX_USE_WCHAR_T
21.82 ++# define __iswctype_l(C, M, L) iswctype((C), (M))
21.83 ++# define __towlower_l(C, L) towlower((C))
21.84 ++# define __towupper_l(C, L) towupper((C))
21.85 ++# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
21.86 ++//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
21.87 ++# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
21.88 ++# define __wctype_l(S, L) wctype((S))
21.89 ++# endif
21.90 ++
21.91 + #endif // GLIBC 2.3 and later
21.92 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc
21.93 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200
21.94 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200
21.95 +@@ -36,13 +36,6 @@
21.96 + #include <locale>
21.97 + #include <bits/c++locale_internal.h>
21.98 +
21.99 +-#ifndef __UCLIBC_HAS_XLOCALE__
21.100 +-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
21.101 +-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
21.102 +-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
21.103 +-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
21.104 +-#endif
21.105 +-
21.106 + namespace std
21.107 + {
21.108 + // These are basically extensions to char_traits, and perhaps should
21.109 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
21.110 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200
21.111 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200
21.112 +@@ -38,13 +38,6 @@
21.113 + #undef _LIBC
21.114 + #include <bits/c++locale_internal.h>
21.115 +
21.116 +-#ifndef __UCLIBC_HAS_XLOCALE__
21.117 +-#define __wctype_l(S, L) wctype((S))
21.118 +-#define __towupper_l(C, L) towupper((C))
21.119 +-#define __towlower_l(C, L) towlower((C))
21.120 +-#define __iswctype_l(C, M, L) iswctype((C), (M))
21.121 +-#endif
21.122 +-
21.123 + namespace std
21.124 + {
21.125 + // NB: The other ctype<char> specializations are in src/locale.cc and
21.126 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc
21.127 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200
21.128 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200
21.129 +@@ -39,13 +39,10 @@
21.130 + #ifdef __UCLIBC_MJN3_ONLY__
21.131 + #warning fix gettext stuff
21.132 + #endif
21.133 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
21.134 +-extern "C" char *__dcgettext(const char *domainname,
21.135 +- const char *msgid, int category);
21.136 + #undef gettext
21.137 +-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
21.138 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
21.139 ++#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
21.140 + #else
21.141 +-#undef gettext
21.142 + #define gettext(msgid) (msgid)
21.143 + #endif
21.144 +
21.145 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
21.146 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200
21.147 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200
21.148 +@@ -36,15 +36,11 @@
21.149 + #ifdef __UCLIBC_MJN3_ONLY__
21.150 + #warning fix prototypes for *textdomain funcs
21.151 + #endif
21.152 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
21.153 +-extern "C" char *__textdomain(const char *domainname);
21.154 +-extern "C" char *__bindtextdomain(const char *domainname,
21.155 +- const char *dirname);
21.156 +-#else
21.157 +-#undef __textdomain
21.158 +-#undef __bindtextdomain
21.159 +-#define __textdomain(D) ((void)0)
21.160 +-#define __bindtextdomain(D,P) ((void)0)
21.161 ++#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
21.162 ++#undef textdomain
21.163 ++#undef bindtextdomain
21.164 ++#define textdomain(D) ((void)0)
21.165 ++#define bindtextdomain(D,P) ((void)0)
21.166 + #endif
21.167 +
21.168 + // Non-virtual member functions.
21.169 +@@ -70,7 +66,7 @@
21.170 + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
21.171 + const char* __dir) const
21.172 + {
21.173 +- __bindtextdomain(__s.c_str(), __dir);
21.174 ++ bindtextdomain(__s.c_str(), __dir);
21.175 + return this->do_open(__s, __loc);
21.176 + }
21.177 +
21.178 +@@ -90,7 +86,7 @@
21.179 + {
21.180 + // No error checking is done, assume the catalog exists and can
21.181 + // be used.
21.182 +- __textdomain(__s.c_str());
21.183 ++ textdomain(__s.c_str());
21.184 + return 0;
21.185 + }
21.186 +
21.187 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
21.188 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200
21.189 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200
21.190 +@@ -43,10 +43,6 @@
21.191 + #warning tailor for stub locale support
21.192 + #endif
21.193 +
21.194 +-#ifndef __UCLIBC_HAS_XLOCALE__
21.195 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
21.196 +-#endif
21.197 +-
21.198 + namespace std
21.199 + {
21.200 + // Construct and return valid pattern consisting of some combination of:
21.201 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
21.202 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200
21.203 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200
21.204 +@@ -41,9 +41,6 @@
21.205 + #ifdef __UCLIBC_MJN3_ONLY__
21.206 + #warning tailor for stub locale support
21.207 + #endif
21.208 +-#ifndef __UCLIBC_HAS_XLOCALE__
21.209 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
21.210 +-#endif
21.211 +
21.212 + namespace std
21.213 + {
21.214 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc
21.215 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200
21.216 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200
21.217 +@@ -40,9 +40,6 @@
21.218 + #ifdef __UCLIBC_MJN3_ONLY__
21.219 + #warning tailor for stub locale support
21.220 + #endif
21.221 +-#ifndef __UCLIBC_HAS_XLOCALE__
21.222 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
21.223 +-#endif
21.224 +
21.225 + namespace std
21.226 + {
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/patches/gcc/4.2.3/204-uclibc-locale-wchar_fix.patch Sun Feb 17 22:08:06 2008 +0000
22.3 @@ -0,0 +1,50 @@
22.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
22.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200
22.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200
22.7 +@@ -401,7 +401,7 @@
22.8 + # ifdef __UCLIBC_HAS_XLOCALE__
22.9 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
22.10 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
22.11 +-# else
22.12 ++# elif defined __UCLIBC_HAS_LOCALE__
22.13 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
22.14 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
22.15 + # endif
22.16 +@@ -556,7 +556,7 @@
22.17 + # ifdef __UCLIBC_HAS_XLOCALE__
22.18 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
22.19 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
22.20 +-# else
22.21 ++# elif defined __UCLIBC_HAS_LOCALE__
22.22 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
22.23 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
22.24 + # endif
22.25 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
22.26 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200
22.27 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200
22.28 +@@ -127,12 +127,25 @@
22.29 + {
22.30 + // Named locale.
22.31 + // NB: In the GNU model wchar_t is always 32 bit wide.
22.32 ++#ifdef __UCLIBC_MJN3_ONLY__
22.33 ++#warning fix this... should be numeric
22.34 ++#endif
22.35 ++#ifdef __UCLIBC__
22.36 ++# ifdef __UCLIBC_HAS_XLOCALE__
22.37 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
22.38 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
22.39 ++# elif defined __UCLIBC_HAS_LOCALE__
22.40 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
22.41 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
22.42 ++# endif
22.43 ++#else
22.44 + union { char *__s; wchar_t __w; } __u;
22.45 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
22.46 + _M_data->_M_decimal_point = __u.__w;
22.47 +
22.48 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
22.49 + _M_data->_M_thousands_sep = __u.__w;
22.50 ++#endif
22.51 +
22.52 + if (_M_data->_M_thousands_sep == L'\0')
22.53 + _M_data->_M_grouping = "";
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/patches/gcc/4.2.3/205-uclibc-locale-update.patch Sun Feb 17 22:08:06 2008 +0000
23.3 @@ -0,0 +1,354 @@
23.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
23.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200
23.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200
23.7 +@@ -46,16 +46,13 @@
23.8 + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
23.9 + const __c_locale& __cloc)
23.10 + {
23.11 +- if (!(__err & ios_base::failbit))
23.12 +- {
23.13 +- char* __sanity;
23.14 +- errno = 0;
23.15 +- float __f = __strtof_l(__s, &__sanity, __cloc);
23.16 +- if (__sanity != __s && errno != ERANGE)
23.17 +- __v = __f;
23.18 +- else
23.19 +- __err |= ios_base::failbit;
23.20 +- }
23.21 ++ char* __sanity;
23.22 ++ errno = 0;
23.23 ++ float __f = __strtof_l(__s, &__sanity, __cloc);
23.24 ++ if (__sanity != __s && errno != ERANGE)
23.25 ++ __v = __f;
23.26 ++ else
23.27 ++ __err |= ios_base::failbit;
23.28 + }
23.29 +
23.30 + template<>
23.31 +@@ -63,16 +60,13 @@
23.32 + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
23.33 + const __c_locale& __cloc)
23.34 + {
23.35 +- if (!(__err & ios_base::failbit))
23.36 +- {
23.37 +- char* __sanity;
23.38 +- errno = 0;
23.39 +- double __d = __strtod_l(__s, &__sanity, __cloc);
23.40 +- if (__sanity != __s && errno != ERANGE)
23.41 +- __v = __d;
23.42 +- else
23.43 +- __err |= ios_base::failbit;
23.44 +- }
23.45 ++ char* __sanity;
23.46 ++ errno = 0;
23.47 ++ double __d = __strtod_l(__s, &__sanity, __cloc);
23.48 ++ if (__sanity != __s && errno != ERANGE)
23.49 ++ __v = __d;
23.50 ++ else
23.51 ++ __err |= ios_base::failbit;
23.52 + }
23.53 +
23.54 + template<>
23.55 +@@ -80,16 +74,13 @@
23.56 + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
23.57 + const __c_locale& __cloc)
23.58 + {
23.59 +- if (!(__err & ios_base::failbit))
23.60 +- {
23.61 +- char* __sanity;
23.62 +- errno = 0;
23.63 +- long double __ld = __strtold_l(__s, &__sanity, __cloc);
23.64 +- if (__sanity != __s && errno != ERANGE)
23.65 +- __v = __ld;
23.66 +- else
23.67 +- __err |= ios_base::failbit;
23.68 +- }
23.69 ++ char* __sanity;
23.70 ++ errno = 0;
23.71 ++ long double __ld = __strtold_l(__s, &__sanity, __cloc);
23.72 ++ if (__sanity != __s && errno != ERANGE)
23.73 ++ __v = __ld;
23.74 ++ else
23.75 ++ __err |= ios_base::failbit;
23.76 + }
23.77 +
23.78 + void
23.79 +@@ -110,7 +101,7 @@
23.80 + void
23.81 + locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
23.82 + {
23.83 +- if (_S_get_c_locale() != __cloc)
23.84 ++ if (__cloc && _S_get_c_locale() != __cloc)
23.85 + __freelocale(__cloc);
23.86 + }
23.87 +
23.88 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h
23.89 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200
23.90 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200
23.91 +@@ -39,21 +39,23 @@
23.92 + #pragma GCC system_header
23.93 +
23.94 + #include <cstring> // get std::strlen
23.95 +-#include <cstdio> // get std::snprintf or std::sprintf
23.96 ++#include <cstdio> // get std::vsnprintf or std::vsprintf
23.97 + #include <clocale>
23.98 + #include <langinfo.h> // For codecvt
23.99 + #ifdef __UCLIBC_MJN3_ONLY__
23.100 + #warning fix this
23.101 + #endif
23.102 +-#ifdef __UCLIBC_HAS_LOCALE__
23.103 ++#ifdef _GLIBCXX_USE_ICONV
23.104 + #include <iconv.h> // For codecvt using iconv, iconv_t
23.105 + #endif
23.106 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
23.107 +-#include <libintl.h> // For messages
23.108 ++#ifdef HAVE_LIBINTL_H
23.109 ++#include <libintl.h> // For messages
23.110 + #endif
23.111 ++#include <cstdarg>
23.112 +
23.113 + #ifdef __UCLIBC_MJN3_ONLY__
23.114 + #warning what is _GLIBCXX_C_LOCALE_GNU for
23.115 ++// psm: used in os/gnu-linux/ctype_noninline.h
23.116 + #endif
23.117 + #define _GLIBCXX_C_LOCALE_GNU 1
23.118 +
23.119 +@@ -62,7 +64,7 @@
23.120 + #endif
23.121 + // #define _GLIBCXX_NUM_CATEGORIES 6
23.122 + #define _GLIBCXX_NUM_CATEGORIES 0
23.123 +-
23.124 ++
23.125 + #ifdef __UCLIBC_HAS_XLOCALE__
23.126 + namespace __gnu_cxx
23.127 + {
23.128 +@@ -79,22 +81,24 @@
23.129 + typedef int* __c_locale;
23.130 + #endif
23.131 +
23.132 +- // Convert numeric value of type _Tv to string and return length of
23.133 +- // string. If snprintf is available use it, otherwise fall back to
23.134 +- // the unsafe sprintf which, in general, can be dangerous and should
23.135 ++ // Convert numeric value of type double to string and return length of
23.136 ++ // string. If vsnprintf is available use it, otherwise fall back to
23.137 ++ // the unsafe vsprintf which, in general, can be dangerous and should
23.138 + // be avoided.
23.139 +- template<typename _Tv>
23.140 +- int
23.141 +- __convert_from_v(char* __out,
23.142 +- const int __size __attribute__ ((__unused__)),
23.143 +- const char* __fmt,
23.144 +-#ifdef __UCLIBC_HAS_XCLOCALE__
23.145 +- _Tv __v, const __c_locale& __cloc, int __prec)
23.146 ++ inline int
23.147 ++ __convert_from_v(const __c_locale&
23.148 ++#ifndef __UCLIBC_HAS_XCLOCALE__
23.149 ++ __cloc __attribute__ ((__unused__))
23.150 ++#endif
23.151 ++ ,
23.152 ++ char* __out,
23.153 ++ const int __size,
23.154 ++ const char* __fmt, ...)
23.155 + {
23.156 ++ va_list __args;
23.157 ++#ifdef __UCLIBC_HAS_XCLOCALE__
23.158 + __c_locale __old = __gnu_cxx::__uselocale(__cloc);
23.159 + #else
23.160 +- _Tv __v, const __c_locale&, int __prec)
23.161 +- {
23.162 + # ifdef __UCLIBC_HAS_LOCALE__
23.163 + char* __old = std::setlocale(LC_ALL, NULL);
23.164 + char* __sav = new char[std::strlen(__old) + 1];
23.165 +@@ -103,7 +107,9 @@
23.166 + # endif
23.167 + #endif
23.168 +
23.169 +- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
23.170 ++ va_start(__args, __fmt);
23.171 ++ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
23.172 ++ va_end(__args);
23.173 +
23.174 + #ifdef __UCLIBC_HAS_XCLOCALE__
23.175 + __gnu_cxx::__uselocale(__old);
23.176 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
23.177 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200
23.178 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200
23.179 +@@ -33,9 +33,14 @@
23.180 +
23.181 + // Written by Benjamin Kosnik <bkoz@redhat.com>
23.182 +
23.183 ++#include <features.h>
23.184 ++#ifdef __UCLIBC_HAS_LOCALE__
23.185 + #define _LIBC
23.186 + #include <locale>
23.187 + #undef _LIBC
23.188 ++#else
23.189 ++#include <locale>
23.190 ++#endif
23.191 + #include <bits/c++locale_internal.h>
23.192 +
23.193 + namespace std
23.194 +@@ -138,20 +143,34 @@
23.195 + ctype<wchar_t>::
23.196 + do_is(mask __m, wchar_t __c) const
23.197 + {
23.198 +- // Highest bitmask in ctype_base == 10, but extra in "C"
23.199 +- // library for blank.
23.200 ++ // The case of __m == ctype_base::space is particularly important,
23.201 ++ // due to its use in many istream functions. Therefore we deal with
23.202 ++ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
23.203 ++ // is the mask corresponding to ctype_base::space. NB: an encoding
23.204 ++ // change would not affect correctness!
23.205 + bool __ret = false;
23.206 +- const size_t __bitmasksize = 11;
23.207 +- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
23.208 +- if (__m & _M_bit[__bitcur]
23.209 +- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
23.210 +- {
23.211 +- __ret = true;
23.212 +- break;
23.213 +- }
23.214 ++ if (__m == _M_bit[5])
23.215 ++ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
23.216 ++ else
23.217 ++ {
23.218 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
23.219 ++ // library for blank.
23.220 ++ const size_t __bitmasksize = 11;
23.221 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
23.222 ++ if (__m & _M_bit[__bitcur])
23.223 ++ {
23.224 ++ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
23.225 ++ {
23.226 ++ __ret = true;
23.227 ++ break;
23.228 ++ }
23.229 ++ else if (__m == _M_bit[__bitcur])
23.230 ++ break;
23.231 ++ }
23.232 ++ }
23.233 + return __ret;
23.234 + }
23.235 +-
23.236 ++
23.237 + const wchar_t*
23.238 + ctype<wchar_t>::
23.239 + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
23.240 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
23.241 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200
23.242 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200
23.243 +@@ -47,18 +47,21 @@
23.244 + template<typename _CharT>
23.245 + messages<_CharT>::messages(size_t __refs)
23.246 + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
23.247 +- _M_name_messages(_S_get_c_name())
23.248 ++ _M_name_messages(_S_get_c_name())
23.249 + { }
23.250 +
23.251 + template<typename _CharT>
23.252 + messages<_CharT>::messages(__c_locale __cloc, const char* __s,
23.253 + size_t __refs)
23.254 +- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
23.255 +- _M_name_messages(__s)
23.256 ++ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
23.257 + {
23.258 +- char* __tmp = new char[std::strlen(__s) + 1];
23.259 +- std::strcpy(__tmp, __s);
23.260 ++ const size_t __len = std::strlen(__s) + 1;
23.261 ++ char* __tmp = new char[__len];
23.262 ++ std::memcpy(__tmp, __s, __len);
23.263 + _M_name_messages = __tmp;
23.264 ++
23.265 ++ // Last to avoid leaking memory if new throws.
23.266 ++ _M_c_locale_messages = _S_clone_c_locale(__cloc);
23.267 + }
23.268 +
23.269 + template<typename _CharT>
23.270 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
23.271 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200
23.272 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200
23.273 +@@ -33,9 +33,14 @@
23.274 +
23.275 + // Written by Benjamin Kosnik <bkoz@redhat.com>
23.276 +
23.277 ++#include <features.h>
23.278 ++#ifdef __UCLIBC_HAS_LOCALE__
23.279 + #define _LIBC
23.280 + #include <locale>
23.281 + #undef _LIBC
23.282 ++#else
23.283 ++#include <locale>
23.284 ++#endif
23.285 + #include <bits/c++locale_internal.h>
23.286 +
23.287 + #ifdef __UCLIBC_MJN3_ONLY__
23.288 +@@ -206,7 +211,7 @@
23.289 + }
23.290 + break;
23.291 + default:
23.292 +- ;
23.293 ++ __ret = pattern();
23.294 + }
23.295 + return __ret;
23.296 + }
23.297 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
23.298 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200
23.299 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200
23.300 +@@ -33,9 +33,14 @@
23.301 +
23.302 + // Written by Benjamin Kosnik <bkoz@redhat.com>
23.303 +
23.304 ++#include <features.h>
23.305 ++#ifdef __UCLIBC_HAS_LOCALE__
23.306 + #define _LIBC
23.307 + #include <locale>
23.308 + #undef _LIBC
23.309 ++#else
23.310 ++#include <locale>
23.311 ++#endif
23.312 + #include <bits/c++locale_internal.h>
23.313 +
23.314 + #ifdef __UCLIBC_MJN3_ONLY__
23.315 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h
23.316 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200
23.317 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200
23.318 +@@ -37,25 +37,33 @@
23.319 + template<typename _CharT>
23.320 + __timepunct<_CharT>::__timepunct(size_t __refs)
23.321 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
23.322 +- _M_name_timepunct(_S_get_c_name())
23.323 ++ _M_name_timepunct(_S_get_c_name())
23.324 + { _M_initialize_timepunct(); }
23.325 +
23.326 + template<typename _CharT>
23.327 + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
23.328 + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
23.329 +- _M_name_timepunct(_S_get_c_name())
23.330 ++ _M_name_timepunct(_S_get_c_name())
23.331 + { _M_initialize_timepunct(); }
23.332 +
23.333 + template<typename _CharT>
23.334 + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
23.335 + size_t __refs)
23.336 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
23.337 +- _M_name_timepunct(__s)
23.338 ++ _M_name_timepunct(NULL)
23.339 + {
23.340 +- char* __tmp = new char[std::strlen(__s) + 1];
23.341 +- std::strcpy(__tmp, __s);
23.342 ++ const size_t __len = std::strlen(__s) + 1;
23.343 ++ char* __tmp = new char[__len];
23.344 ++ std::memcpy(__tmp, __s, __len);
23.345 + _M_name_timepunct = __tmp;
23.346 +- _M_initialize_timepunct(__cloc);
23.347 ++
23.348 ++ try
23.349 ++ { _M_initialize_timepunct(__cloc); }
23.350 ++ catch(...)
23.351 ++ {
23.352 ++ delete [] _M_name_timepunct;
23.353 ++ __throw_exception_again;
23.354 ++ }
23.355 + }
23.356 +
23.357 + template<typename _CharT>
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/patches/gcc/4.2.3/300-libstdc++-pic.patch Sun Feb 17 22:08:06 2008 +0000
24.3 @@ -0,0 +1,50 @@
24.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am
24.5 +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200
24.6 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200
24.7 +@@ -257,6 +257,12 @@
24.8 + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
24.9 +
24.10 +
24.11 ++install-exec-local:
24.12 ++ifeq ($(enable_shared),yes)
24.13 ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
24.14 ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
24.15 ++endif
24.16 ++
24.17 + # Added bits to build debug library.
24.18 + if GLIBCXX_BUILD_DEBUG
24.19 + all-local: build_debug
24.20 +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in
24.21 +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200
24.22 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200
24.23 +@@ -657,7 +657,7 @@
24.24 +
24.25 + install-data-am: install-data-local
24.26 +
24.27 +-install-exec-am: install-toolexeclibLTLIBRARIES
24.28 ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
24.29 +
24.30 + install-info: install-info-am
24.31 +
24.32 +@@ -690,6 +690,7 @@
24.33 + distclean-libtool distclean-tags distdir dvi dvi-am html \
24.34 + html-am info info-am install install-am install-data \
24.35 + install-data-am install-data-local install-exec \
24.36 ++ install-exec-local \
24.37 + install-exec-am install-info install-info-am install-man \
24.38 + install-strip install-toolexeclibLTLIBRARIES installcheck \
24.39 + installcheck-am installdirs maintainer-clean \
24.40 +@@ -799,6 +800,13 @@
24.41 + install_debug:
24.42 + (cd ${debugdir} && $(MAKE) \
24.43 + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
24.44 ++
24.45 ++install-exec-local:
24.46 ++ifeq ($(enable_shared),yes)
24.47 ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
24.48 ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
24.49 ++endif
24.50 ++
24.51 + # Tell versions [3.59,3.63) of GNU make to not export all variables.
24.52 + # Otherwise a system limit (for SysV at least) may be exceeded.
24.53 + .NOEXPORT:
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/patches/gcc/4.2.3/301-missing-execinfo_h.patch Sun Feb 17 22:08:06 2008 +0000
25.3 @@ -0,0 +1,12 @@
25.4 +diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h
25.5 +--- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200
25.6 ++++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200
25.7 +@@ -502,7 +502,7 @@
25.8 + #if defined(__linux__) || defined(__GLIBC__)
25.9 + # include <features.h>
25.10 + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
25.11 +- && !defined(__ia64__)
25.12 ++ && !defined(__ia64__) && !defined(__UCLIBC__)
25.13 + # ifndef GC_HAVE_BUILTIN_BACKTRACE
25.14 + # define GC_HAVE_BUILTIN_BACKTRACE
25.15 + # endif
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/patches/gcc/4.2.3/302-c99-snprintf.patch Sun Feb 17 22:08:06 2008 +0000
26.3 @@ -0,0 +1,12 @@
26.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h
26.5 +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100
26.6 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200
26.7 +@@ -144,7 +144,7 @@
26.8 +
26.9 + _GLIBCXX_END_NAMESPACE
26.10 +
26.11 +-#if _GLIBCXX_USE_C99
26.12 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
26.13 +
26.14 + #undef snprintf
26.15 + #undef vfscanf
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/patches/gcc/4.2.3/303-c99-complex-ugly-hack.patch Sun Feb 17 22:08:06 2008 +0000
27.3 @@ -0,0 +1,13 @@
27.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
27.5 +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200
27.6 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200
27.7 +@@ -7514,6 +7514,9 @@
27.8 + cat >>conftest.$ac_ext <<_ACEOF
27.9 + /* end confdefs.h. */
27.10 + #include <complex.h>
27.11 ++#ifdef __UCLIBC__
27.12 ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
27.13 ++#endif
27.14 + int
27.15 + main ()
27.16 + {
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/patches/gcc/4.2.3/304-index_macro.patch Sun Feb 17 22:08:06 2008 +0000
28.3 @@ -0,0 +1,26 @@
28.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope
28.5 +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200
28.6 ++++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200
28.7 +@@ -58,6 +58,9 @@
28.8 + #include <bits/allocator.h>
28.9 + #include <ext/hash_fun.h>
28.10 +
28.11 ++/* cope w/ index defined as macro, SuSv3 proposal */
28.12 ++#undef index
28.13 ++
28.14 + # ifdef __GC
28.15 + # define __GC_CONST const
28.16 + # else
28.17 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h
28.18 +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200
28.19 ++++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200
28.20 +@@ -54,6 +54,9 @@
28.21 + #include <ext/memory> // For uninitialized_copy_n
28.22 + #include <ext/numeric> // For power
28.23 +
28.24 ++/* cope w/ index defined as macro, SuSv3 proposal */
28.25 ++#undef index
28.26 ++
28.27 + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
28.28 +
28.29 + using std::size_t;
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/patches/gcc/4.2.3/305-libmudflap-susv3-legacy.patch Sun Feb 17 22:08:06 2008 +0000
29.3 @@ -0,0 +1,48 @@
29.4 +diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c
29.5 +--- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200
29.6 ++++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200
29.7 +@@ -427,7 +427,7 @@
29.8 + {
29.9 + TRACE ("%s\n", __PRETTY_FUNCTION__);
29.10 + MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
29.11 +- bzero (s, n);
29.12 ++ memset (s, 0, n);
29.13 + }
29.14 +
29.15 +
29.16 +@@ -437,7 +437,7 @@
29.17 + TRACE ("%s\n", __PRETTY_FUNCTION__);
29.18 + MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
29.19 + MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
29.20 +- bcopy (src, dest, n);
29.21 ++ memmove (dest, src, n);
29.22 + }
29.23 +
29.24 +
29.25 +@@ -447,7 +447,7 @@
29.26 + TRACE ("%s\n", __PRETTY_FUNCTION__);
29.27 + MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
29.28 + MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
29.29 +- return bcmp (s1, s2, n);
29.30 ++ return n == 0 ? 0 : memcmp (s1, s2, n);
29.31 + }
29.32 +
29.33 +
29.34 +@@ -456,7 +456,7 @@
29.35 + size_t n = strlen (s);
29.36 + TRACE ("%s\n", __PRETTY_FUNCTION__);
29.37 + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
29.38 +- return index (s, c);
29.39 ++ return strchr (s, c);
29.40 + }
29.41 +
29.42 +
29.43 +@@ -465,7 +465,7 @@
29.44 + size_t n = strlen (s);
29.45 + TRACE ("%s\n", __PRETTY_FUNCTION__);
29.46 + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
29.47 +- return rindex (s, c);
29.48 ++ return strrchr (s, c);
29.49 + }
29.50 +
29.51 + /* XXX: stpcpy, memccpy */
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/patches/gcc/4.2.3/306-libstdc++-namespace.patch Sun Feb 17 22:08:06 2008 +0000
30.3 @@ -0,0 +1,36 @@
30.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
30.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200
30.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200
30.7 +@@ -32,7 +32,8 @@
30.8 + //
30.9 +
30.10 + // Written by Benjamin Kosnik <bkoz@redhat.com>
30.11 +-
30.12 ++namespace std
30.13 ++{
30.14 + #ifdef __UCLIBC_MJN3_ONLY__
30.15 + #warning fix prototypes for *textdomain funcs
30.16 + #endif
30.17 +@@ -115,3 +116,4 @@
30.18 + this->_S_create_c_locale(this->_M_c_locale_messages, __s);
30.19 + }
30.20 + }
30.21 ++}
30.22 +diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h
30.23 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200
30.24 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200
30.25 +@@ -33,7 +33,8 @@
30.26 + //
30.27 +
30.28 + // Written by Benjamin Kosnik <bkoz@redhat.com>
30.29 +-
30.30 ++namespace std
30.31 ++{
30.32 + template<typename _CharT>
30.33 + __timepunct<_CharT>::__timepunct(size_t __refs)
30.34 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
30.35 +@@ -74,3 +75,4 @@
30.36 + delete _M_data;
30.37 + _S_destroy_c_locale(_M_c_locale_timepunct);
30.38 + }
30.39 ++}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/patches/gcc/4.2.3/402-libbackend_dep_gcov-iov.h.patch Sun Feb 17 22:08:06 2008 +0000
31.3 @@ -0,0 +1,12 @@
31.4 +diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in
31.5 +--- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200
31.6 ++++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200
31.7 +@@ -2660,7 +2660,7 @@
31.8 + # FIXME: writing proper dependencies for this is a *LOT* of work.
31.9 + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \
31.10 + insn-config.h insn-flags.h insn-codes.h insn-constants.h \
31.11 +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
31.12 ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h
31.13 + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
31.14 + -DTARGET_NAME=\"$(target_noncanonical)\" \
31.15 + -DLOCALEDIR=\"$(localedir)\" \
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/patches/gcc/4.2.3/800-arm-bigendian.patch Sun Feb 17 22:08:06 2008 +0000
32.3 @@ -0,0 +1,64 @@
32.4 +diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h
32.5 +--- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100
32.6 ++++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200
32.7 +@@ -28,19 +28,33 @@
32.8 + #undef TARGET_VERSION
32.9 + #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
32.10 +
32.11 ++/*
32.12 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
32.13 ++ * (big endian) configurations.
32.14 ++ */
32.15 ++#if TARGET_BIG_ENDIAN_DEFAULT
32.16 ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
32.17 ++#define TARGET_ENDIAN_OPTION "mbig-endian"
32.18 ++#define TARGET_LINKER_EMULATION "armelfb_linux"
32.19 ++#else
32.20 ++#define TARGET_ENDIAN_DEFAULT 0
32.21 ++#define TARGET_ENDIAN_OPTION "mlittle-endian"
32.22 ++#define TARGET_LINKER_EMULATION "armelf_linux"
32.23 ++#endif
32.24 ++
32.25 + #undef TARGET_DEFAULT_FLOAT_ABI
32.26 + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
32.27 +
32.28 + #undef TARGET_DEFAULT
32.29 +-#define TARGET_DEFAULT (0)
32.30 ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
32.31 +
32.32 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
32.33 +
32.34 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
32.35 ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
32.36 +
32.37 + #undef MULTILIB_DEFAULTS
32.38 + #define MULTILIB_DEFAULTS \
32.39 +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
32.40 ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
32.41 +
32.42 + /* Now we define the strings used to build the spec file. */
32.43 + #undef LIB_SPEC
32.44 +@@ -61,7 +75,7 @@
32.45 + %{rdynamic:-export-dynamic} \
32.46 + %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
32.47 + -X \
32.48 +- %{mbig-endian:-EB}" \
32.49 ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
32.50 + SUBTARGET_EXTRA_LINK_SPEC
32.51 +
32.52 + #undef LINK_SPEC
32.53 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc
32.54 +--- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200
32.55 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200
32.56 +@@ -705,6 +705,11 @@
32.57 + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
32.58 + tmake_file="${tmake_file} t-linux arm/t-arm"
32.59 + case ${target} in
32.60 ++ arm*b-*)
32.61 ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
32.62 ++ ;;
32.63 ++ esac
32.64 ++ case ${target} in
32.65 + arm*-*-linux-*eabi)
32.66 + tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
32.67 + tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/patches/gcc/4.2.3/801-softfloat-fix.patch Sun Feb 17 22:08:06 2008 +0000
33.3 @@ -0,0 +1,58 @@
33.4 +This patch (C) 2007 Yann E. MORIN
33.5 +Licensed under GPL v2.
33.6 +
33.7 +First hunk of this patch solves compiling uClibc:
33.8 +
33.9 +make[1]: Entering directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc'
33.10 + LD libuClibc-0.9.29.so
33.11 +libc/libc_so.a(difftime.os): In function `difftime':
33.12 +difftime.c:(.text+0x8): undefined reference to `__floatsidf'
33.13 +difftime.c:(.text+0x2c): undefined reference to `__subdf3'
33.14 +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr':
33.15 +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2'
33.16 +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2'
33.17 +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3'
33.18 +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2'
33.19 +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3'
33.20 +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2'
33.21 +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3'
33.22 +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric':
33.23 +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2'
33.24 +libc/libc_so.a(strtof.os): In function `strtof':
33.25 +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2'
33.26 +/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/cc_core_prefix/lib/gcc/arm-linux-uclibc/4.1.1/libgcc.a(_fixunsdfsi.o):
33.27 +In function `__fixunsdfsi':
33.28 +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi'
33.29 +make[2]: *** [lib/libc.so] Error 1
33.30 +make[1]: *** [lib/libc.so.0] Error 2
33.31 +make[1]: Leaving directory `/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc'
33.32 +make: *** [/home/ymorin/x-tools/build/armeb-unknown-linux-uclibc/gcc-4.1.1-uClibc-0.9.28.1/build-libc/lib/libc.a]
33.33 +Error 2
33.34 +
33.35 +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have).
33.36 +
33.37 +
33.38 +diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc
33.39 +--- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200
33.40 ++++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200
33.41 +@@ -721,7 +721,7 @@
33.42 + default_use_cxa_atexit=yes
33.43 + ;;
33.44 + *)
33.45 +- tmake_file="$tmake_file arm/t-linux"
33.46 ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf"
33.47 + ;;
33.48 + esac
33.49 + tm_file="$tm_file arm/aout.h arm/arm.h"
33.50 +diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h
33.51 +--- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200
33.52 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200
33.53 +@@ -63,7 +63,7 @@
33.54 + %{shared:-lc} \
33.55 + %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
33.56 +
33.57 +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
33.58 ++#define LIBGCC_SPEC "-lgcc"
33.59 +
33.60 + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
33.61 +
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/patches/gcc/4.2.3/904-flatten-switch-stmt-00.patch Sun Feb 17 22:08:06 2008 +0000
34.3 @@ -0,0 +1,24 @@
34.4 +diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c
34.5 +--- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200
34.6 ++++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200
34.7 +@@ -2512,7 +2512,11 @@
34.8 + use_cost_table
34.9 + = (TREE_CODE (orig_type) != ENUMERAL_TYPE
34.10 + && estimate_case_costs (case_list));
34.11 +- balance_case_nodes (&case_list, NULL);
34.12 ++ /* When optimizing for size, we want a straight list to avoid
34.13 ++ jumps as much as possible. This basically creates an if-else
34.14 ++ chain. */
34.15 ++ if (!optimize_size)
34.16 ++ balance_case_nodes (&case_list, NULL);
34.17 + emit_case_nodes (index, case_list, default_label, index_type);
34.18 + emit_jump (default_label);
34.19 + }
34.20 +@@ -3070,6 +3074,7 @@
34.21 + {
34.22 + if (!node_has_low_bound (node, index_type))
34.23 + {
34.24 ++ if (!optimize_size) /* don't jl to the .default_label. */
34.25 + emit_cmp_and_jump_insns (index,
34.26 + convert_modes
34.27 + (mode, imode,