Add patches for gcc-4.2.1.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/gcc/4.2.1/100-uclibc-conf.patch Sat Aug 04 14:18:42 2007 +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.1/103-uclibc-conf-noupstream.patch Sat Aug 04 14:18:42 2007 +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.1/200-uclibc-locale.patch Sat Aug 04 14:18:42 2007 +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.1/203-uclibc-locale-no__x.patch Sat Aug 04 14:18:42 2007 +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.1/204-uclibc-locale-wchar_fix.patch Sat Aug 04 14:18:42 2007 +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.1/205-uclibc-locale-update.patch Sat Aug 04 14:18:42 2007 +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.1/300-libstdc++-pic.patch Sat Aug 04 14:18:42 2007 +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.1/301-missing-execinfo_h.patch Sat Aug 04 14:18:42 2007 +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.1/302-c99-snprintf.patch Sat Aug 04 14:18:42 2007 +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.1/303-c99-complex-ugly-hack.patch Sat Aug 04 14:18:42 2007 +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.1/304-index_macro.patch Sat Aug 04 14:18:42 2007 +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.1/305-libmudflap-susv3-legacy.patch Sat Aug 04 14:18:42 2007 +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.1/306-libstdc++-namespace.patch Sat Aug 04 14:18:42 2007 +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.1/402-libbackend_dep_gcov-iov.h.patch Sat Aug 04 14:18:42 2007 +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.1/800-arm-bigendian.patch Sat Aug 04 14:18:42 2007 +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.1/801-softfloat-fix.patch Sat Aug 04 14:18:42 2007 +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.1/904-flatten-switch-stmt-00.patch Sat Aug 04 14:18:42 2007 +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,