Add gcc-4.2.4, with patches propagated from 4.2.3.
/trunk/config/cc/gcc.in | 5 5 0 0 +++++
1 file changed, 5 insertions(+)
1.1 --- a/config/cc/gcc.in Sat Jul 19 12:15:17 2008 +0000
1.2 +++ b/config/cc/gcc.in Sat Jul 19 12:17:26 2008 +0000
1.3 @@ -78,6 +78,10 @@
1.4 bool
1.5 prompt "4.2.3"
1.6
1.7 +config CC_V_4_2_4
1.8 + bool
1.9 + prompt "4.2.4"
1.10 +
1.11 config CC_V_4_3_0
1.12 bool
1.13 prompt "4.3.0 (EXPERIMENTAL)"
1.14 @@ -112,6 +116,7 @@
1.15 default "4.2.1" if CC_V_4_2_1
1.16 default "4.2.2" if CC_V_4_2_2
1.17 default "4.2.3" if CC_V_4_2_3
1.18 + default "4.2.4" if CC_V_4_2_4
1.19 default "4.3.0" if CC_V_4_3_0
1.20 default "4.3.1" if CC_V_4_3_1
1.21 # CT_INSERT_VERSION_STRING_ABOVE
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/patches/gcc/4.2.4/100-uclibc-conf.patch Sat Jul 19 12:17:26 2008 +0000
2.3 @@ -0,0 +1,216 @@
2.4 +diff -durN gcc-4.2.1.orig/boehm-gc/configure gcc-4.2.1/boehm-gc/configure
2.5 +--- gcc-4.2.1.orig/boehm-gc/configure 2007-07-19 16:33:56.000000000 +0200
2.6 ++++ gcc-4.2.1/boehm-gc/configure 2007-08-03 20:29:22.000000000 +0200
2.7 +@@ -4323,7 +4323,7 @@
2.8 + ;;
2.9 +
2.10 + # This must be Linux ELF.
2.11 +-linux-gnu*)
2.12 ++linux*)
2.13 + lt_cv_deplibs_check_method=pass_all
2.14 + ;;
2.15 +
2.16 +diff -durN gcc-4.2.1.orig/contrib/regression/objs-gcc.sh gcc-4.2.1/contrib/regression/objs-gcc.sh
2.17 +--- gcc-4.2.1.orig/contrib/regression/objs-gcc.sh 2005-08-15 02:41:31.000000000 +0200
2.18 ++++ gcc-4.2.1/contrib/regression/objs-gcc.sh 2007-08-03 20:29:22.000000000 +0200
2.19 +@@ -105,6 +105,10 @@
2.20 + then
2.21 + make all-gdb all-dejagnu all-ld || exit 1
2.22 + make install-gdb install-dejagnu install-ld || exit 1
2.23 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
2.24 ++ then
2.25 ++ make all-gdb all-dejagnu all-ld || exit 1
2.26 ++ make install-gdb install-dejagnu install-ld || exit 1
2.27 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
2.28 + make bootstrap || exit 1
2.29 + make install || exit 1
2.30 +diff -durN gcc-4.2.1.orig/gcc/config/cris/linux.h gcc-4.2.1/gcc/config/cris/linux.h
2.31 +--- gcc-4.2.1.orig/gcc/config/cris/linux.h 2006-02-18 12:12:51.000000000 +0100
2.32 ++++ gcc-4.2.1/gcc/config/cris/linux.h 2007-08-03 20:29:22.000000000 +0200
2.33 +@@ -74,7 +74,11 @@
2.34 + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
2.35 +
2.36 + #undef CRIS_SUBTARGET_VERSION
2.37 +-#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
2.38 ++#if UCLIBC_DEFAULT
2.39 ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
2.40 ++#else
2.41 ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
2.42 ++#endif
2.43 +
2.44 + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
2.45 +
2.46 +diff -durN gcc-4.2.1.orig/libffi/configure gcc-4.2.1/libffi/configure
2.47 +--- gcc-4.2.1.orig/libffi/configure 2007-07-19 16:33:56.000000000 +0200
2.48 ++++ gcc-4.2.1/libffi/configure 2007-08-03 20:29:22.000000000 +0200
2.49 +@@ -3460,7 +3460,7 @@
2.50 + ;;
2.51 +
2.52 + # This must be Linux ELF.
2.53 +-linux-gnu*)
2.54 ++linux*)
2.55 + lt_cv_deplibs_check_method=pass_all
2.56 + ;;
2.57 +
2.58 +diff -durN gcc-4.2.1.orig/libgfortran/configure gcc-4.2.1/libgfortran/configure
2.59 +--- gcc-4.2.1.orig/libgfortran/configure 2007-07-19 16:33:56.000000000 +0200
2.60 ++++ gcc-4.2.1/libgfortran/configure 2007-08-03 20:29:22.000000000 +0200
2.61 +@@ -3721,7 +3721,7 @@
2.62 + ;;
2.63 +
2.64 + # This must be Linux ELF.
2.65 +-linux-gnu*)
2.66 ++linux*)
2.67 + lt_cv_deplibs_check_method=pass_all
2.68 + ;;
2.69 +
2.70 +diff -durN gcc-4.2.1.orig/libgomp/configure gcc-4.2.1/libgomp/configure
2.71 +--- gcc-4.2.1.orig/libgomp/configure 2007-07-19 16:33:56.000000000 +0200
2.72 ++++ gcc-4.2.1/libgomp/configure 2007-08-03 20:29:22.000000000 +0200
2.73 +@@ -3893,7 +3893,7 @@
2.74 + ;;
2.75 +
2.76 + # This must be Linux ELF.
2.77 +-linux-gnu*)
2.78 ++linux*)
2.79 + lt_cv_deplibs_check_method=pass_all
2.80 + ;;
2.81 +
2.82 +diff -durN gcc-4.2.1.orig/libjava/classpath/configure gcc-4.2.1/libjava/classpath/configure
2.83 +--- gcc-4.2.1.orig/libjava/classpath/configure 2007-01-17 19:10:26.000000000 +0100
2.84 ++++ gcc-4.2.1/libjava/classpath/configure 2007-08-03 20:29:22.000000000 +0200
2.85 +@@ -5307,7 +5307,7 @@
2.86 + ;;
2.87 +
2.88 + # This must be Linux ELF.
2.89 +-linux-gnu*)
2.90 ++linux*)
2.91 + lt_cv_deplibs_check_method=pass_all
2.92 + ;;
2.93 +
2.94 +diff -durN gcc-4.2.1.orig/libjava/classpath/ltconfig gcc-4.2.1/libjava/classpath/ltconfig
2.95 +--- gcc-4.2.1.orig/libjava/classpath/ltconfig 2006-08-07 22:37:50.000000000 +0200
2.96 ++++ gcc-4.2.1/libjava/classpath/ltconfig 2007-08-03 20:29:22.000000000 +0200
2.97 +@@ -603,7 +603,7 @@
2.98 +
2.99 + # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
2.100 + case $host_os in
2.101 +-linux-gnu*) ;;
2.102 ++linux-gnu*|linux-uclibc*) ;;
2.103 + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
2.104 + esac
2.105 +
2.106 +@@ -1251,7 +1251,7 @@
2.107 + ;;
2.108 +
2.109 + # This must be Linux ELF.
2.110 +-linux-gnu*)
2.111 ++linux*)
2.112 + version_type=linux
2.113 + need_lib_prefix=no
2.114 + need_version=no
2.115 +diff -durN gcc-4.2.1.orig/libjava/configure gcc-4.2.1/libjava/configure
2.116 +--- gcc-4.2.1.orig/libjava/configure 2007-07-19 16:33:56.000000000 +0200
2.117 ++++ gcc-4.2.1/libjava/configure 2007-08-03 20:29:22.000000000 +0200
2.118 +@@ -5424,7 +5424,7 @@
2.119 + ;;
2.120 +
2.121 + # This must be Linux ELF.
2.122 +-linux-gnu*)
2.123 ++linux*)
2.124 + lt_cv_deplibs_check_method=pass_all
2.125 + ;;
2.126 +
2.127 +diff -durN gcc-4.2.1.orig/libmudflap/configure gcc-4.2.1/libmudflap/configure
2.128 +--- gcc-4.2.1.orig/libmudflap/configure 2006-12-04 12:13:07.000000000 +0100
2.129 ++++ gcc-4.2.1/libmudflap/configure 2007-08-03 20:29:22.000000000 +0200
2.130 +@@ -5394,7 +5394,7 @@
2.131 + ;;
2.132 +
2.133 + # This must be Linux ELF.
2.134 +-linux-gnu*)
2.135 ++linux*)
2.136 + lt_cv_deplibs_check_method=pass_all
2.137 + ;;
2.138 +
2.139 +diff -durN gcc-4.2.1.orig/libobjc/configure gcc-4.2.1/libobjc/configure
2.140 +--- gcc-4.2.1.orig/libobjc/configure 2006-10-15 09:42:57.000000000 +0200
2.141 ++++ gcc-4.2.1/libobjc/configure 2007-08-03 20:29:22.000000000 +0200
2.142 +@@ -3314,7 +3314,7 @@
2.143 + ;;
2.144 +
2.145 + # This must be Linux ELF.
2.146 +-linux-gnu*)
2.147 ++linux*)
2.148 + lt_cv_deplibs_check_method=pass_all
2.149 + ;;
2.150 +
2.151 +diff -durN gcc-4.2.1.orig/libssp/configure gcc-4.2.1/libssp/configure
2.152 +--- gcc-4.2.1.orig/libssp/configure 2006-10-15 09:42:57.000000000 +0200
2.153 ++++ gcc-4.2.1/libssp/configure 2007-08-03 20:29:22.000000000 +0200
2.154 +@@ -4480,7 +4480,7 @@
2.155 + ;;
2.156 +
2.157 + # This must be Linux ELF.
2.158 +-linux-gnu*)
2.159 ++linux*)
2.160 + lt_cv_deplibs_check_method=pass_all
2.161 + ;;
2.162 +
2.163 +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
2.164 +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-06-29 01:02:05.000000000 +0200
2.165 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200
2.166 +@@ -4283,7 +4283,7 @@
2.167 + ;;
2.168 +
2.169 + # This must be Linux ELF.
2.170 +-linux-gnu*)
2.171 ++linux*)
2.172 + lt_cv_deplibs_check_method=pass_all
2.173 + ;;
2.174 +
2.175 +diff -durN gcc-4.2.1.orig/libtool.m4 gcc-4.2.1/libtool.m4
2.176 +--- gcc-4.2.1.orig/libtool.m4 2005-07-16 04:30:53.000000000 +0200
2.177 ++++ gcc-4.2.1/libtool.m4 2007-08-03 20:29:22.000000000 +0200
2.178 +@@ -739,7 +739,7 @@
2.179 + ;;
2.180 +
2.181 + # This must be Linux ELF.
2.182 +-linux-gnu*)
2.183 ++linux*)
2.184 + lt_cv_deplibs_check_method=pass_all
2.185 + ;;
2.186 +
2.187 +diff -durN gcc-4.2.1.orig/ltconfig gcc-4.2.1/ltconfig
2.188 +--- gcc-4.2.1.orig/ltconfig 2007-02-14 18:08:35.000000000 +0100
2.189 ++++ gcc-4.2.1/ltconfig 2007-08-03 20:29:22.000000000 +0200
2.190 +@@ -603,7 +603,7 @@
2.191 +
2.192 + # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
2.193 + case $host_os in
2.194 +-linux-gnu*) ;;
2.195 ++linux-gnu*|linux-uclibc*) ;;
2.196 + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
2.197 + esac
2.198 +
2.199 +@@ -1251,7 +1251,7 @@
2.200 + ;;
2.201 +
2.202 + # This must be Linux ELF.
2.203 +-linux-gnu*)
2.204 ++linux*)
2.205 + version_type=linux
2.206 + need_lib_prefix=no
2.207 + need_version=no
2.208 +diff -durN gcc-4.2.1.orig/zlib/configure gcc-4.2.1/zlib/configure
2.209 +--- gcc-4.2.1.orig/zlib/configure 2007-01-17 19:10:26.000000000 +0100
2.210 ++++ gcc-4.2.1/zlib/configure 2007-08-03 20:29:22.000000000 +0200
2.211 +@@ -3429,7 +3429,7 @@
2.212 + ;;
2.213 +
2.214 + # This must be Linux ELF.
2.215 +-linux-gnu*)
2.216 ++linux*)
2.217 + lt_cv_deplibs_check_method=pass_all
2.218 + ;;
2.219 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/patches/gcc/4.2.4/103-uclibc-conf-noupstream.patch Sat Jul 19 12:17:26 2008 +0000
3.3 @@ -0,0 +1,12 @@
3.4 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc
3.5 +--- gcc-4.2.1.orig/gcc/config.gcc 2007-02-03 06:25:20.000000000 +0100
3.6 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200
3.7 +@@ -1964,7 +1964,7 @@
3.8 + ;;
3.9 + sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
3.10 + sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
3.11 +- sh-*-linux* | sh[346lbe]*-*-linux* | \
3.12 ++ sh*-*-linux* | sh[346lbe]*-*-linux* | \
3.13 + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
3.14 + sh64-*-netbsd* | sh64l*-*-netbsd*)
3.15 + tmake_file="${tmake_file} sh/t-sh sh/t-elf"
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/patches/gcc/4.2.4/200-uclibc-locale.patch Sat Jul 19 12:17:26 2008 +0000
4.3 @@ -0,0 +1,2806 @@
4.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4
4.5 +--- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200
4.6 ++++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200
4.7 +@@ -1334,7 +1334,7 @@
4.8 + AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
4.9 + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
4.10 + [use MODEL for target locale package],
4.11 +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
4.12 ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
4.13 +
4.14 + # Deal with gettext issues. Default to not using it (=no) until we detect
4.15 + # support for it later. Let the user turn it off via --e/d, but let that
4.16 +@@ -1355,6 +1355,9 @@
4.17 + # Default to "generic".
4.18 + if test $enable_clocale_flag = auto; then
4.19 + case ${target_os} in
4.20 ++ *-uclibc*)
4.21 ++ enable_clocale_flag=uclibc
4.22 ++ ;;
4.23 + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
4.24 + enable_clocale_flag=gnu
4.25 + ;;
4.26 +@@ -1526,6 +1529,40 @@
4.27 + CTIME_CC=config/locale/generic/time_members.cc
4.28 + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
4.29 + ;;
4.30 ++ uclibc)
4.31 ++ AC_MSG_RESULT(uclibc)
4.32 ++
4.33 ++ # Declare intention to use gettext, and add support for specific
4.34 ++ # languages.
4.35 ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
4.36 ++ ALL_LINGUAS="de fr"
4.37 ++
4.38 ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
4.39 ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
4.40 ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
4.41 ++ USE_NLS=yes
4.42 ++ fi
4.43 ++ # Export the build objects.
4.44 ++ for ling in $ALL_LINGUAS; do \
4.45 ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
4.46 ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
4.47 ++ done
4.48 ++ AC_SUBST(glibcxx_MOFILES)
4.49 ++ AC_SUBST(glibcxx_POFILES)
4.50 ++
4.51 ++ CLOCALE_H=config/locale/uclibc/c_locale.h
4.52 ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
4.53 ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
4.54 ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
4.55 ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
4.56 ++ CMESSAGES_H=config/locale/uclibc/messages_members.h
4.57 ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
4.58 ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
4.59 ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
4.60 ++ CTIME_H=config/locale/uclibc/time_members.h
4.61 ++ CTIME_CC=config/locale/uclibc/time_members.cc
4.62 ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
4.63 ++ ;;
4.64 + esac
4.65 +
4.66 + # This is where the testsuite looks for locale catalogs, using the
4.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
4.68 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100
4.69 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200
4.70 +@@ -0,0 +1,160 @@
4.71 ++// Wrapper for underlying C-language localization -*- C++ -*-
4.72 ++
4.73 ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
4.74 ++//
4.75 ++// This file is part of the GNU ISO C++ Library. This library is free
4.76 ++// software; you can redistribute it and/or modify it under the
4.77 ++// terms of the GNU General Public License as published by the
4.78 ++// Free Software Foundation; either version 2, or (at your option)
4.79 ++// any later version.
4.80 ++
4.81 ++// This library is distributed in the hope that it will be useful,
4.82 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.83 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.84 ++// GNU General Public License for more details.
4.85 ++
4.86 ++// You should have received a copy of the GNU General Public License along
4.87 ++// with this library; see the file COPYING. If not, write to the Free
4.88 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.89 ++// USA.
4.90 ++
4.91 ++// As a special exception, you may use this file as part of a free software
4.92 ++// library without restriction. Specifically, if other files instantiate
4.93 ++// templates or use macros or inline functions from this file, or you compile
4.94 ++// this file and link it with other files to produce an executable, this
4.95 ++// file does not by itself cause the resulting executable to be covered by
4.96 ++// the GNU General Public License. This exception does not however
4.97 ++// invalidate any other reasons why the executable file might be covered by
4.98 ++// the GNU General Public License.
4.99 ++
4.100 ++//
4.101 ++// ISO C++ 14882: 22.8 Standard locale categories.
4.102 ++//
4.103 ++
4.104 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.105 ++
4.106 ++#include <cerrno> // For errno
4.107 ++#include <locale>
4.108 ++#include <stdexcept>
4.109 ++#include <langinfo.h>
4.110 ++#include <bits/c++locale_internal.h>
4.111 ++
4.112 ++#ifndef __UCLIBC_HAS_XLOCALE__
4.113 ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
4.114 ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
4.115 ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
4.116 ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
4.117 ++#define __strtof_l(S, E, L) strtof((S), (E))
4.118 ++#define __strtod_l(S, E, L) strtod((S), (E))
4.119 ++#define __strtold_l(S, E, L) strtold((S), (E))
4.120 ++#warning should dummy __newlocale check for C|POSIX ?
4.121 ++#define __newlocale(a, b, c) NULL
4.122 ++#define __freelocale(a) ((void)0)
4.123 ++#define __duplocale(a) __c_locale()
4.124 ++#endif
4.125 ++
4.126 ++namespace std
4.127 ++{
4.128 ++ template<>
4.129 ++ void
4.130 ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
4.131 ++ const __c_locale& __cloc)
4.132 ++ {
4.133 ++ if (!(__err & ios_base::failbit))
4.134 ++ {
4.135 ++ char* __sanity;
4.136 ++ errno = 0;
4.137 ++ float __f = __strtof_l(__s, &__sanity, __cloc);
4.138 ++ if (__sanity != __s && errno != ERANGE)
4.139 ++ __v = __f;
4.140 ++ else
4.141 ++ __err |= ios_base::failbit;
4.142 ++ }
4.143 ++ }
4.144 ++
4.145 ++ template<>
4.146 ++ void
4.147 ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
4.148 ++ const __c_locale& __cloc)
4.149 ++ {
4.150 ++ if (!(__err & ios_base::failbit))
4.151 ++ {
4.152 ++ char* __sanity;
4.153 ++ errno = 0;
4.154 ++ double __d = __strtod_l(__s, &__sanity, __cloc);
4.155 ++ if (__sanity != __s && errno != ERANGE)
4.156 ++ __v = __d;
4.157 ++ else
4.158 ++ __err |= ios_base::failbit;
4.159 ++ }
4.160 ++ }
4.161 ++
4.162 ++ template<>
4.163 ++ void
4.164 ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
4.165 ++ const __c_locale& __cloc)
4.166 ++ {
4.167 ++ if (!(__err & ios_base::failbit))
4.168 ++ {
4.169 ++ char* __sanity;
4.170 ++ errno = 0;
4.171 ++ long double __ld = __strtold_l(__s, &__sanity, __cloc);
4.172 ++ if (__sanity != __s && errno != ERANGE)
4.173 ++ __v = __ld;
4.174 ++ else
4.175 ++ __err |= ios_base::failbit;
4.176 ++ }
4.177 ++ }
4.178 ++
4.179 ++ void
4.180 ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
4.181 ++ __c_locale __old)
4.182 ++ {
4.183 ++ __cloc = __newlocale(1 << LC_ALL, __s, __old);
4.184 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.185 ++ if (!__cloc)
4.186 ++ {
4.187 ++ // This named locale is not supported by the underlying OS.
4.188 ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
4.189 ++ "name not valid"));
4.190 ++ }
4.191 ++#endif
4.192 ++ }
4.193 ++
4.194 ++ void
4.195 ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
4.196 ++ {
4.197 ++ if (_S_get_c_locale() != __cloc)
4.198 ++ __freelocale(__cloc);
4.199 ++ }
4.200 ++
4.201 ++ __c_locale
4.202 ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
4.203 ++ { return __duplocale(__cloc); }
4.204 ++} // namespace std
4.205 ++
4.206 ++namespace __gnu_cxx
4.207 ++{
4.208 ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
4.209 ++ {
4.210 ++ "LC_CTYPE",
4.211 ++ "LC_NUMERIC",
4.212 ++ "LC_TIME",
4.213 ++ "LC_COLLATE",
4.214 ++ "LC_MONETARY",
4.215 ++ "LC_MESSAGES",
4.216 ++#if _GLIBCXX_NUM_CATEGORIES != 0
4.217 ++ "LC_PAPER",
4.218 ++ "LC_NAME",
4.219 ++ "LC_ADDRESS",
4.220 ++ "LC_TELEPHONE",
4.221 ++ "LC_MEASUREMENT",
4.222 ++ "LC_IDENTIFICATION"
4.223 ++#endif
4.224 ++ };
4.225 ++}
4.226 ++
4.227 ++namespace std
4.228 ++{
4.229 ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
4.230 ++} // namespace std
4.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
4.232 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100
4.233 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200
4.234 +@@ -0,0 +1,117 @@
4.235 ++// Wrapper for underlying C-language localization -*- C++ -*-
4.236 ++
4.237 ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4.238 ++//
4.239 ++// This file is part of the GNU ISO C++ Library. This library is free
4.240 ++// software; you can redistribute it and/or modify it under the
4.241 ++// terms of the GNU General Public License as published by the
4.242 ++// Free Software Foundation; either version 2, or (at your option)
4.243 ++// any later version.
4.244 ++
4.245 ++// This library is distributed in the hope that it will be useful,
4.246 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.247 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.248 ++// GNU General Public License for more details.
4.249 ++
4.250 ++// You should have received a copy of the GNU General Public License along
4.251 ++// with this library; see the file COPYING. If not, write to the Free
4.252 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.253 ++// USA.
4.254 ++
4.255 ++// As a special exception, you may use this file as part of a free software
4.256 ++// library without restriction. Specifically, if other files instantiate
4.257 ++// templates or use macros or inline functions from this file, or you compile
4.258 ++// this file and link it with other files to produce an executable, this
4.259 ++// file does not by itself cause the resulting executable to be covered by
4.260 ++// the GNU General Public License. This exception does not however
4.261 ++// invalidate any other reasons why the executable file might be covered by
4.262 ++// the GNU General Public License.
4.263 ++
4.264 ++//
4.265 ++// ISO C++ 14882: 22.8 Standard locale categories.
4.266 ++//
4.267 ++
4.268 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.269 ++
4.270 ++#ifndef _C_LOCALE_H
4.271 ++#define _C_LOCALE_H 1
4.272 ++
4.273 ++#pragma GCC system_header
4.274 ++
4.275 ++#include <cstring> // get std::strlen
4.276 ++#include <cstdio> // get std::snprintf or std::sprintf
4.277 ++#include <clocale>
4.278 ++#include <langinfo.h> // For codecvt
4.279 ++#ifdef __UCLIBC_MJN3_ONLY__
4.280 ++#warning fix this
4.281 ++#endif
4.282 ++#ifdef __UCLIBC_HAS_LOCALE__
4.283 ++#include <iconv.h> // For codecvt using iconv, iconv_t
4.284 ++#endif
4.285 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.286 ++#include <libintl.h> // For messages
4.287 ++#endif
4.288 ++
4.289 ++#ifdef __UCLIBC_MJN3_ONLY__
4.290 ++#warning what is _GLIBCXX_C_LOCALE_GNU for
4.291 ++#endif
4.292 ++#define _GLIBCXX_C_LOCALE_GNU 1
4.293 ++
4.294 ++#ifdef __UCLIBC_MJN3_ONLY__
4.295 ++#warning fix categories
4.296 ++#endif
4.297 ++// #define _GLIBCXX_NUM_CATEGORIES 6
4.298 ++#define _GLIBCXX_NUM_CATEGORIES 0
4.299 ++
4.300 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.301 ++namespace __gnu_cxx
4.302 ++{
4.303 ++ extern "C" __typeof(uselocale) __uselocale;
4.304 ++}
4.305 ++#endif
4.306 ++
4.307 ++namespace std
4.308 ++{
4.309 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.310 ++ typedef __locale_t __c_locale;
4.311 ++#else
4.312 ++ typedef int* __c_locale;
4.313 ++#endif
4.314 ++
4.315 ++ // Convert numeric value of type _Tv to string and return length of
4.316 ++ // string. If snprintf is available use it, otherwise fall back to
4.317 ++ // the unsafe sprintf which, in general, can be dangerous and should
4.318 ++ // be avoided.
4.319 ++ template<typename _Tv>
4.320 ++ int
4.321 ++ __convert_from_v(char* __out,
4.322 ++ const int __size __attribute__ ((__unused__)),
4.323 ++ const char* __fmt,
4.324 ++#ifdef __UCLIBC_HAS_XCLOCALE__
4.325 ++ _Tv __v, const __c_locale& __cloc, int __prec)
4.326 ++ {
4.327 ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
4.328 ++#else
4.329 ++ _Tv __v, const __c_locale&, int __prec)
4.330 ++ {
4.331 ++# ifdef __UCLIBC_HAS_LOCALE__
4.332 ++ char* __old = std::setlocale(LC_ALL, NULL);
4.333 ++ char* __sav = new char[std::strlen(__old) + 1];
4.334 ++ std::strcpy(__sav, __old);
4.335 ++ std::setlocale(LC_ALL, "C");
4.336 ++# endif
4.337 ++#endif
4.338 ++
4.339 ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
4.340 ++
4.341 ++#ifdef __UCLIBC_HAS_XCLOCALE__
4.342 ++ __gnu_cxx::__uselocale(__old);
4.343 ++#elif defined __UCLIBC_HAS_LOCALE__
4.344 ++ std::setlocale(LC_ALL, __sav);
4.345 ++ delete [] __sav;
4.346 ++#endif
4.347 ++ return __ret;
4.348 ++ }
4.349 ++}
4.350 ++
4.351 ++#endif
4.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
4.353 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100
4.354 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200
4.355 +@@ -0,0 +1,63 @@
4.356 ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
4.357 ++
4.358 ++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
4.359 ++//
4.360 ++// This file is part of the GNU ISO C++ Library. This library is free
4.361 ++// software; you can redistribute it and/or modify it under the
4.362 ++// terms of the GNU General Public License as published by the
4.363 ++// Free Software Foundation; either version 2, or (at your option)
4.364 ++// any later version.
4.365 ++
4.366 ++// This library is distributed in the hope that it will be useful,
4.367 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.368 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.369 ++// GNU General Public License for more details.
4.370 ++
4.371 ++// You should have received a copy of the GNU General Public License along
4.372 ++// with this library; see the file COPYING. If not, write to the Free
4.373 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.374 ++// USA.
4.375 ++
4.376 ++// As a special exception, you may use this file as part of a free software
4.377 ++// library without restriction. Specifically, if other files instantiate
4.378 ++// templates or use macros or inline functions from this file, or you compile
4.379 ++// this file and link it with other files to produce an executable, this
4.380 ++// file does not by itself cause the resulting executable to be covered by
4.381 ++// the GNU General Public License. This exception does not however
4.382 ++// invalidate any other reasons why the executable file might be covered by
4.383 ++// the GNU General Public License.
4.384 ++
4.385 ++// Written by Jakub Jelinek <jakub@redhat.com>
4.386 ++
4.387 ++#include <bits/c++config.h>
4.388 ++#include <clocale>
4.389 ++
4.390 ++#ifdef __UCLIBC_MJN3_ONLY__
4.391 ++#warning clean this up
4.392 ++#endif
4.393 ++
4.394 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.395 ++
4.396 ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
4.397 ++extern "C" __typeof(strcoll_l) __strcoll_l;
4.398 ++extern "C" __typeof(strftime_l) __strftime_l;
4.399 ++extern "C" __typeof(strtod_l) __strtod_l;
4.400 ++extern "C" __typeof(strtof_l) __strtof_l;
4.401 ++extern "C" __typeof(strtold_l) __strtold_l;
4.402 ++extern "C" __typeof(strxfrm_l) __strxfrm_l;
4.403 ++extern "C" __typeof(newlocale) __newlocale;
4.404 ++extern "C" __typeof(freelocale) __freelocale;
4.405 ++extern "C" __typeof(duplocale) __duplocale;
4.406 ++extern "C" __typeof(uselocale) __uselocale;
4.407 ++
4.408 ++#ifdef _GLIBCXX_USE_WCHAR_T
4.409 ++extern "C" __typeof(iswctype_l) __iswctype_l;
4.410 ++extern "C" __typeof(towlower_l) __towlower_l;
4.411 ++extern "C" __typeof(towupper_l) __towupper_l;
4.412 ++extern "C" __typeof(wcscoll_l) __wcscoll_l;
4.413 ++extern "C" __typeof(wcsftime_l) __wcsftime_l;
4.414 ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
4.415 ++extern "C" __typeof(wctype_l) __wctype_l;
4.416 ++#endif
4.417 ++
4.418 ++#endif // GLIBC 2.3 and later
4.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
4.420 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100
4.421 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200
4.422 +@@ -0,0 +1,306 @@
4.423 ++// std::codecvt implementation details, GNU version -*- C++ -*-
4.424 ++
4.425 ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4.426 ++//
4.427 ++// This file is part of the GNU ISO C++ Library. This library is free
4.428 ++// software; you can redistribute it and/or modify it under the
4.429 ++// terms of the GNU General Public License as published by the
4.430 ++// Free Software Foundation; either version 2, or (at your option)
4.431 ++// any later version.
4.432 ++
4.433 ++// This library is distributed in the hope that it will be useful,
4.434 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.435 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.436 ++// GNU General Public License for more details.
4.437 ++
4.438 ++// You should have received a copy of the GNU General Public License along
4.439 ++// with this library; see the file COPYING. If not, write to the Free
4.440 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.441 ++// USA.
4.442 ++
4.443 ++// As a special exception, you may use this file as part of a free software
4.444 ++// library without restriction. Specifically, if other files instantiate
4.445 ++// templates or use macros or inline functions from this file, or you compile
4.446 ++// this file and link it with other files to produce an executable, this
4.447 ++// file does not by itself cause the resulting executable to be covered by
4.448 ++// the GNU General Public License. This exception does not however
4.449 ++// invalidate any other reasons why the executable file might be covered by
4.450 ++// the GNU General Public License.
4.451 ++
4.452 ++//
4.453 ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt
4.454 ++//
4.455 ++
4.456 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.457 ++
4.458 ++#include <locale>
4.459 ++#include <bits/c++locale_internal.h>
4.460 ++
4.461 ++namespace std
4.462 ++{
4.463 ++ // Specializations.
4.464 ++#ifdef _GLIBCXX_USE_WCHAR_T
4.465 ++ codecvt_base::result
4.466 ++ codecvt<wchar_t, char, mbstate_t>::
4.467 ++ do_out(state_type& __state, const intern_type* __from,
4.468 ++ const intern_type* __from_end, const intern_type*& __from_next,
4.469 ++ extern_type* __to, extern_type* __to_end,
4.470 ++ extern_type*& __to_next) const
4.471 ++ {
4.472 ++ result __ret = ok;
4.473 ++ state_type __tmp_state(__state);
4.474 ++
4.475 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.476 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
4.477 ++#endif
4.478 ++
4.479 ++ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
4.480 ++ // in case we fall back to wcrtomb and then continue, in a loop.
4.481 ++ // NB: wcsnrtombs is a GNU extension
4.482 ++ for (__from_next = __from, __to_next = __to;
4.483 ++ __from_next < __from_end && __to_next < __to_end
4.484 ++ && __ret == ok;)
4.485 ++ {
4.486 ++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
4.487 ++ __from_end - __from_next);
4.488 ++ if (!__from_chunk_end)
4.489 ++ __from_chunk_end = __from_end;
4.490 ++
4.491 ++ __from = __from_next;
4.492 ++ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
4.493 ++ __from_chunk_end - __from_next,
4.494 ++ __to_end - __to_next, &__state);
4.495 ++ if (__conv == static_cast<size_t>(-1))
4.496 ++ {
4.497 ++ // In case of error, in order to stop at the exact place we
4.498 ++ // have to start again from the beginning with a series of
4.499 ++ // wcrtomb.
4.500 ++ for (; __from < __from_next; ++__from)
4.501 ++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
4.502 ++ __state = __tmp_state;
4.503 ++ __ret = error;
4.504 ++ }
4.505 ++ else if (__from_next && __from_next < __from_chunk_end)
4.506 ++ {
4.507 ++ __to_next += __conv;
4.508 ++ __ret = partial;
4.509 ++ }
4.510 ++ else
4.511 ++ {
4.512 ++ __from_next = __from_chunk_end;
4.513 ++ __to_next += __conv;
4.514 ++ }
4.515 ++
4.516 ++ if (__from_next < __from_end && __ret == ok)
4.517 ++ {
4.518 ++ extern_type __buf[MB_LEN_MAX];
4.519 ++ __tmp_state = __state;
4.520 ++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
4.521 ++ if (__conv > static_cast<size_t>(__to_end - __to_next))
4.522 ++ __ret = partial;
4.523 ++ else
4.524 ++ {
4.525 ++ memcpy(__to_next, __buf, __conv);
4.526 ++ __state = __tmp_state;
4.527 ++ __to_next += __conv;
4.528 ++ ++__from_next;
4.529 ++ }
4.530 ++ }
4.531 ++ }
4.532 ++
4.533 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.534 ++ __uselocale(__old);
4.535 ++#endif
4.536 ++
4.537 ++ return __ret;
4.538 ++ }
4.539 ++
4.540 ++ codecvt_base::result
4.541 ++ codecvt<wchar_t, char, mbstate_t>::
4.542 ++ do_in(state_type& __state, const extern_type* __from,
4.543 ++ const extern_type* __from_end, const extern_type*& __from_next,
4.544 ++ intern_type* __to, intern_type* __to_end,
4.545 ++ intern_type*& __to_next) const
4.546 ++ {
4.547 ++ result __ret = ok;
4.548 ++ state_type __tmp_state(__state);
4.549 ++
4.550 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.551 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
4.552 ++#endif
4.553 ++
4.554 ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
4.555 ++ // in case we store a L'\0' and then continue, in a loop.
4.556 ++ // NB: mbsnrtowcs is a GNU extension
4.557 ++ for (__from_next = __from, __to_next = __to;
4.558 ++ __from_next < __from_end && __to_next < __to_end
4.559 ++ && __ret == ok;)
4.560 ++ {
4.561 ++ const extern_type* __from_chunk_end;
4.562 ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
4.563 ++ __from_end
4.564 ++ - __from_next));
4.565 ++ if (!__from_chunk_end)
4.566 ++ __from_chunk_end = __from_end;
4.567 ++
4.568 ++ __from = __from_next;
4.569 ++ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
4.570 ++ __from_chunk_end - __from_next,
4.571 ++ __to_end - __to_next, &__state);
4.572 ++ if (__conv == static_cast<size_t>(-1))
4.573 ++ {
4.574 ++ // In case of error, in order to stop at the exact place we
4.575 ++ // have to start again from the beginning with a series of
4.576 ++ // mbrtowc.
4.577 ++ for (;; ++__to_next, __from += __conv)
4.578 ++ {
4.579 ++ __conv = mbrtowc(__to_next, __from, __from_end - __from,
4.580 ++ &__tmp_state);
4.581 ++ if (__conv == static_cast<size_t>(-1)
4.582 ++ || __conv == static_cast<size_t>(-2))
4.583 ++ break;
4.584 ++ }
4.585 ++ __from_next = __from;
4.586 ++ __state = __tmp_state;
4.587 ++ __ret = error;
4.588 ++ }
4.589 ++ else if (__from_next && __from_next < __from_chunk_end)
4.590 ++ {
4.591 ++ // It is unclear what to return in this case (see DR 382).
4.592 ++ __to_next += __conv;
4.593 ++ __ret = partial;
4.594 ++ }
4.595 ++ else
4.596 ++ {
4.597 ++ __from_next = __from_chunk_end;
4.598 ++ __to_next += __conv;
4.599 ++ }
4.600 ++
4.601 ++ if (__from_next < __from_end && __ret == ok)
4.602 ++ {
4.603 ++ if (__to_next < __to_end)
4.604 ++ {
4.605 ++ // XXX Probably wrong for stateful encodings
4.606 ++ __tmp_state = __state;
4.607 ++ ++__from_next;
4.608 ++ *__to_next++ = L'\0';
4.609 ++ }
4.610 ++ else
4.611 ++ __ret = partial;
4.612 ++ }
4.613 ++ }
4.614 ++
4.615 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.616 ++ __uselocale(__old);
4.617 ++#endif
4.618 ++
4.619 ++ return __ret;
4.620 ++ }
4.621 ++
4.622 ++ int
4.623 ++ codecvt<wchar_t, char, mbstate_t>::
4.624 ++ do_encoding() const throw()
4.625 ++ {
4.626 ++ // XXX This implementation assumes that the encoding is
4.627 ++ // stateless and is either single-byte or variable-width.
4.628 ++ int __ret = 0;
4.629 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.630 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
4.631 ++#endif
4.632 ++ if (MB_CUR_MAX == 1)
4.633 ++ __ret = 1;
4.634 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.635 ++ __uselocale(__old);
4.636 ++#endif
4.637 ++ return __ret;
4.638 ++ }
4.639 ++
4.640 ++ int
4.641 ++ codecvt<wchar_t, char, mbstate_t>::
4.642 ++ do_max_length() const throw()
4.643 ++ {
4.644 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.645 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
4.646 ++#endif
4.647 ++ // XXX Probably wrong for stateful encodings.
4.648 ++ int __ret = MB_CUR_MAX;
4.649 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.650 ++ __uselocale(__old);
4.651 ++#endif
4.652 ++ return __ret;
4.653 ++ }
4.654 ++
4.655 ++ int
4.656 ++ codecvt<wchar_t, char, mbstate_t>::
4.657 ++ do_length(state_type& __state, const extern_type* __from,
4.658 ++ const extern_type* __end, size_t __max) const
4.659 ++ {
4.660 ++ int __ret = 0;
4.661 ++ state_type __tmp_state(__state);
4.662 ++
4.663 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.664 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
4.665 ++#endif
4.666 ++
4.667 ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
4.668 ++ // in case we advance past it and then continue, in a loop.
4.669 ++ // NB: mbsnrtowcs is a GNU extension
4.670 ++
4.671 ++ // A dummy internal buffer is needed in order for mbsnrtocws to consider
4.672 ++ // its fourth parameter (it wouldn't with NULL as first parameter).
4.673 ++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
4.674 ++ * __max));
4.675 ++ while (__from < __end && __max)
4.676 ++ {
4.677 ++ const extern_type* __from_chunk_end;
4.678 ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
4.679 ++ __end
4.680 ++ - __from));
4.681 ++ if (!__from_chunk_end)
4.682 ++ __from_chunk_end = __end;
4.683 ++
4.684 ++ const extern_type* __tmp_from = __from;
4.685 ++ size_t __conv = mbsnrtowcs(__to, &__from,
4.686 ++ __from_chunk_end - __from,
4.687 ++ __max, &__state);
4.688 ++ if (__conv == static_cast<size_t>(-1))
4.689 ++ {
4.690 ++ // In case of error, in order to stop at the exact place we
4.691 ++ // have to start again from the beginning with a series of
4.692 ++ // mbrtowc.
4.693 ++ for (__from = __tmp_from;; __from += __conv)
4.694 ++ {
4.695 ++ __conv = mbrtowc(NULL, __from, __end - __from,
4.696 ++ &__tmp_state);
4.697 ++ if (__conv == static_cast<size_t>(-1)
4.698 ++ || __conv == static_cast<size_t>(-2))
4.699 ++ break;
4.700 ++ }
4.701 ++ __state = __tmp_state;
4.702 ++ __ret += __from - __tmp_from;
4.703 ++ break;
4.704 ++ }
4.705 ++ if (!__from)
4.706 ++ __from = __from_chunk_end;
4.707 ++
4.708 ++ __ret += __from - __tmp_from;
4.709 ++ __max -= __conv;
4.710 ++
4.711 ++ if (__from < __end && __max)
4.712 ++ {
4.713 ++ // XXX Probably wrong for stateful encodings
4.714 ++ __tmp_state = __state;
4.715 ++ ++__from;
4.716 ++ ++__ret;
4.717 ++ --__max;
4.718 ++ }
4.719 ++ }
4.720 ++
4.721 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.722 ++ __uselocale(__old);
4.723 ++#endif
4.724 ++
4.725 ++ return __ret;
4.726 ++ }
4.727 ++#endif
4.728 ++}
4.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
4.730 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100
4.731 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200
4.732 +@@ -0,0 +1,80 @@
4.733 ++// std::collate implementation details, GNU version -*- C++ -*-
4.734 ++
4.735 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
4.736 ++//
4.737 ++// This file is part of the GNU ISO C++ Library. This library is free
4.738 ++// software; you can redistribute it and/or modify it under the
4.739 ++// terms of the GNU General Public License as published by the
4.740 ++// Free Software Foundation; either version 2, or (at your option)
4.741 ++// any later version.
4.742 ++
4.743 ++// This library is distributed in the hope that it will be useful,
4.744 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.745 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.746 ++// GNU General Public License for more details.
4.747 ++
4.748 ++// You should have received a copy of the GNU General Public License along
4.749 ++// with this library; see the file COPYING. If not, write to the Free
4.750 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.751 ++// USA.
4.752 ++
4.753 ++// As a special exception, you may use this file as part of a free software
4.754 ++// library without restriction. Specifically, if other files instantiate
4.755 ++// templates or use macros or inline functions from this file, or you compile
4.756 ++// this file and link it with other files to produce an executable, this
4.757 ++// file does not by itself cause the resulting executable to be covered by
4.758 ++// the GNU General Public License. This exception does not however
4.759 ++// invalidate any other reasons why the executable file might be covered by
4.760 ++// the GNU General Public License.
4.761 ++
4.762 ++//
4.763 ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
4.764 ++//
4.765 ++
4.766 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.767 ++
4.768 ++#include <locale>
4.769 ++#include <bits/c++locale_internal.h>
4.770 ++
4.771 ++#ifndef __UCLIBC_HAS_XLOCALE__
4.772 ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
4.773 ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
4.774 ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
4.775 ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
4.776 ++#endif
4.777 ++
4.778 ++namespace std
4.779 ++{
4.780 ++ // These are basically extensions to char_traits, and perhaps should
4.781 ++ // be put there instead of here.
4.782 ++ template<>
4.783 ++ int
4.784 ++ collate<char>::_M_compare(const char* __one, const char* __two) const
4.785 ++ {
4.786 ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
4.787 ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
4.788 ++ }
4.789 ++
4.790 ++ template<>
4.791 ++ size_t
4.792 ++ collate<char>::_M_transform(char* __to, const char* __from,
4.793 ++ size_t __n) const
4.794 ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
4.795 ++
4.796 ++#ifdef _GLIBCXX_USE_WCHAR_T
4.797 ++ template<>
4.798 ++ int
4.799 ++ collate<wchar_t>::_M_compare(const wchar_t* __one,
4.800 ++ const wchar_t* __two) const
4.801 ++ {
4.802 ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
4.803 ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
4.804 ++ }
4.805 ++
4.806 ++ template<>
4.807 ++ size_t
4.808 ++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
4.809 ++ size_t __n) const
4.810 ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
4.811 ++#endif
4.812 ++}
4.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
4.814 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100
4.815 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200
4.816 +@@ -0,0 +1,300 @@
4.817 ++// std::ctype implementation details, GNU version -*- C++ -*-
4.818 ++
4.819 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4.820 ++//
4.821 ++// This file is part of the GNU ISO C++ Library. This library is free
4.822 ++// software; you can redistribute it and/or modify it under the
4.823 ++// terms of the GNU General Public License as published by the
4.824 ++// Free Software Foundation; either version 2, or (at your option)
4.825 ++// any later version.
4.826 ++
4.827 ++// This library is distributed in the hope that it will be useful,
4.828 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.829 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.830 ++// GNU General Public License for more details.
4.831 ++
4.832 ++// You should have received a copy of the GNU General Public License along
4.833 ++// with this library; see the file COPYING. If not, write to the Free
4.834 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.835 ++// USA.
4.836 ++
4.837 ++// As a special exception, you may use this file as part of a free software
4.838 ++// library without restriction. Specifically, if other files instantiate
4.839 ++// templates or use macros or inline functions from this file, or you compile
4.840 ++// this file and link it with other files to produce an executable, this
4.841 ++// file does not by itself cause the resulting executable to be covered by
4.842 ++// the GNU General Public License. This exception does not however
4.843 ++// invalidate any other reasons why the executable file might be covered by
4.844 ++// the GNU General Public License.
4.845 ++
4.846 ++//
4.847 ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
4.848 ++//
4.849 ++
4.850 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.851 ++
4.852 ++#define _LIBC
4.853 ++#include <locale>
4.854 ++#undef _LIBC
4.855 ++#include <bits/c++locale_internal.h>
4.856 ++
4.857 ++#ifndef __UCLIBC_HAS_XLOCALE__
4.858 ++#define __wctype_l(S, L) wctype((S))
4.859 ++#define __towupper_l(C, L) towupper((C))
4.860 ++#define __towlower_l(C, L) towlower((C))
4.861 ++#define __iswctype_l(C, M, L) iswctype((C), (M))
4.862 ++#endif
4.863 ++
4.864 ++namespace std
4.865 ++{
4.866 ++ // NB: The other ctype<char> specializations are in src/locale.cc and
4.867 ++ // various /config/os/* files.
4.868 ++ template<>
4.869 ++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
4.870 ++ : ctype<char>(0, false, __refs)
4.871 ++ {
4.872 ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
4.873 ++ {
4.874 ++ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
4.875 ++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
4.876 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.877 ++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
4.878 ++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
4.879 ++ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
4.880 ++#endif
4.881 ++ }
4.882 ++ }
4.883 ++
4.884 ++#ifdef _GLIBCXX_USE_WCHAR_T
4.885 ++ ctype<wchar_t>::__wmask_type
4.886 ++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
4.887 ++ {
4.888 ++ __wmask_type __ret;
4.889 ++ switch (__m)
4.890 ++ {
4.891 ++ case space:
4.892 ++ __ret = __wctype_l("space", _M_c_locale_ctype);
4.893 ++ break;
4.894 ++ case print:
4.895 ++ __ret = __wctype_l("print", _M_c_locale_ctype);
4.896 ++ break;
4.897 ++ case cntrl:
4.898 ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
4.899 ++ break;
4.900 ++ case upper:
4.901 ++ __ret = __wctype_l("upper", _M_c_locale_ctype);
4.902 ++ break;
4.903 ++ case lower:
4.904 ++ __ret = __wctype_l("lower", _M_c_locale_ctype);
4.905 ++ break;
4.906 ++ case alpha:
4.907 ++ __ret = __wctype_l("alpha", _M_c_locale_ctype);
4.908 ++ break;
4.909 ++ case digit:
4.910 ++ __ret = __wctype_l("digit", _M_c_locale_ctype);
4.911 ++ break;
4.912 ++ case punct:
4.913 ++ __ret = __wctype_l("punct", _M_c_locale_ctype);
4.914 ++ break;
4.915 ++ case xdigit:
4.916 ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
4.917 ++ break;
4.918 ++ case alnum:
4.919 ++ __ret = __wctype_l("alnum", _M_c_locale_ctype);
4.920 ++ break;
4.921 ++ case graph:
4.922 ++ __ret = __wctype_l("graph", _M_c_locale_ctype);
4.923 ++ break;
4.924 ++ default:
4.925 ++ __ret = __wmask_type();
4.926 ++ }
4.927 ++ return __ret;
4.928 ++ }
4.929 ++
4.930 ++ wchar_t
4.931 ++ ctype<wchar_t>::do_toupper(wchar_t __c) const
4.932 ++ { return __towupper_l(__c, _M_c_locale_ctype); }
4.933 ++
4.934 ++ const wchar_t*
4.935 ++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
4.936 ++ {
4.937 ++ while (__lo < __hi)
4.938 ++ {
4.939 ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
4.940 ++ ++__lo;
4.941 ++ }
4.942 ++ return __hi;
4.943 ++ }
4.944 ++
4.945 ++ wchar_t
4.946 ++ ctype<wchar_t>::do_tolower(wchar_t __c) const
4.947 ++ { return __towlower_l(__c, _M_c_locale_ctype); }
4.948 ++
4.949 ++ const wchar_t*
4.950 ++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
4.951 ++ {
4.952 ++ while (__lo < __hi)
4.953 ++ {
4.954 ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
4.955 ++ ++__lo;
4.956 ++ }
4.957 ++ return __hi;
4.958 ++ }
4.959 ++
4.960 ++ bool
4.961 ++ ctype<wchar_t>::
4.962 ++ do_is(mask __m, wchar_t __c) const
4.963 ++ {
4.964 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
4.965 ++ // library for blank.
4.966 ++ bool __ret = false;
4.967 ++ const size_t __bitmasksize = 11;
4.968 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
4.969 ++ if (__m & _M_bit[__bitcur]
4.970 ++ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
4.971 ++ {
4.972 ++ __ret = true;
4.973 ++ break;
4.974 ++ }
4.975 ++ return __ret;
4.976 ++ }
4.977 ++
4.978 ++ const wchar_t*
4.979 ++ ctype<wchar_t>::
4.980 ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
4.981 ++ {
4.982 ++ for (; __lo < __hi; ++__vec, ++__lo)
4.983 ++ {
4.984 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
4.985 ++ // library for blank.
4.986 ++ const size_t __bitmasksize = 11;
4.987 ++ mask __m = 0;
4.988 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
4.989 ++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
4.990 ++ __m |= _M_bit[__bitcur];
4.991 ++ *__vec = __m;
4.992 ++ }
4.993 ++ return __hi;
4.994 ++ }
4.995 ++
4.996 ++ const wchar_t*
4.997 ++ ctype<wchar_t>::
4.998 ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
4.999 ++ {
4.1000 ++ while (__lo < __hi && !this->do_is(__m, *__lo))
4.1001 ++ ++__lo;
4.1002 ++ return __lo;
4.1003 ++ }
4.1004 ++
4.1005 ++ const wchar_t*
4.1006 ++ ctype<wchar_t>::
4.1007 ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
4.1008 ++ {
4.1009 ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
4.1010 ++ ++__lo;
4.1011 ++ return __lo;
4.1012 ++ }
4.1013 ++
4.1014 ++ wchar_t
4.1015 ++ ctype<wchar_t>::
4.1016 ++ do_widen(char __c) const
4.1017 ++ { return _M_widen[static_cast<unsigned char>(__c)]; }
4.1018 ++
4.1019 ++ const char*
4.1020 ++ ctype<wchar_t>::
4.1021 ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
4.1022 ++ {
4.1023 ++ while (__lo < __hi)
4.1024 ++ {
4.1025 ++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
4.1026 ++ ++__lo;
4.1027 ++ ++__dest;
4.1028 ++ }
4.1029 ++ return __hi;
4.1030 ++ }
4.1031 ++
4.1032 ++ char
4.1033 ++ ctype<wchar_t>::
4.1034 ++ do_narrow(wchar_t __wc, char __dfault) const
4.1035 ++ {
4.1036 ++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
4.1037 ++ return _M_narrow[__wc];
4.1038 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1039 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
4.1040 ++#endif
4.1041 ++ const int __c = wctob(__wc);
4.1042 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1043 ++ __uselocale(__old);
4.1044 ++#endif
4.1045 ++ return (__c == EOF ? __dfault : static_cast<char>(__c));
4.1046 ++ }
4.1047 ++
4.1048 ++ const wchar_t*
4.1049 ++ ctype<wchar_t>::
4.1050 ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
4.1051 ++ char* __dest) const
4.1052 ++ {
4.1053 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1054 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
4.1055 ++#endif
4.1056 ++ if (_M_narrow_ok)
4.1057 ++ while (__lo < __hi)
4.1058 ++ {
4.1059 ++ if (*__lo >= 0 && *__lo < 128)
4.1060 ++ *__dest = _M_narrow[*__lo];
4.1061 ++ else
4.1062 ++ {
4.1063 ++ const int __c = wctob(*__lo);
4.1064 ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
4.1065 ++ }
4.1066 ++ ++__lo;
4.1067 ++ ++__dest;
4.1068 ++ }
4.1069 ++ else
4.1070 ++ while (__lo < __hi)
4.1071 ++ {
4.1072 ++ const int __c = wctob(*__lo);
4.1073 ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
4.1074 ++ ++__lo;
4.1075 ++ ++__dest;
4.1076 ++ }
4.1077 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1078 ++ __uselocale(__old);
4.1079 ++#endif
4.1080 ++ return __hi;
4.1081 ++ }
4.1082 ++
4.1083 ++ void
4.1084 ++ ctype<wchar_t>::_M_initialize_ctype()
4.1085 ++ {
4.1086 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1087 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
4.1088 ++#endif
4.1089 ++ wint_t __i;
4.1090 ++ for (__i = 0; __i < 128; ++__i)
4.1091 ++ {
4.1092 ++ const int __c = wctob(__i);
4.1093 ++ if (__c == EOF)
4.1094 ++ break;
4.1095 ++ else
4.1096 ++ _M_narrow[__i] = static_cast<char>(__c);
4.1097 ++ }
4.1098 ++ if (__i == 128)
4.1099 ++ _M_narrow_ok = true;
4.1100 ++ else
4.1101 ++ _M_narrow_ok = false;
4.1102 ++ for (size_t __j = 0;
4.1103 ++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
4.1104 ++ _M_widen[__j] = btowc(__j);
4.1105 ++
4.1106 ++ for (size_t __k = 0; __k <= 11; ++__k)
4.1107 ++ {
4.1108 ++ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
4.1109 ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
4.1110 ++ }
4.1111 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1112 ++ __uselocale(__old);
4.1113 ++#endif
4.1114 ++ }
4.1115 ++#endif // _GLIBCXX_USE_WCHAR_T
4.1116 ++}
4.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
4.1118 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100
4.1119 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200
4.1120 +@@ -0,0 +1,100 @@
4.1121 ++// std::messages implementation details, GNU version -*- C++ -*-
4.1122 ++
4.1123 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
4.1124 ++//
4.1125 ++// This file is part of the GNU ISO C++ Library. This library is free
4.1126 ++// software; you can redistribute it and/or modify it under the
4.1127 ++// terms of the GNU General Public License as published by the
4.1128 ++// Free Software Foundation; either version 2, or (at your option)
4.1129 ++// any later version.
4.1130 ++
4.1131 ++// This library is distributed in the hope that it will be useful,
4.1132 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.1133 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.1134 ++// GNU General Public License for more details.
4.1135 ++
4.1136 ++// You should have received a copy of the GNU General Public License along
4.1137 ++// with this library; see the file COPYING. If not, write to the Free
4.1138 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.1139 ++// USA.
4.1140 ++
4.1141 ++// As a special exception, you may use this file as part of a free software
4.1142 ++// library without restriction. Specifically, if other files instantiate
4.1143 ++// templates or use macros or inline functions from this file, or you compile
4.1144 ++// this file and link it with other files to produce an executable, this
4.1145 ++// file does not by itself cause the resulting executable to be covered by
4.1146 ++// the GNU General Public License. This exception does not however
4.1147 ++// invalidate any other reasons why the executable file might be covered by
4.1148 ++// the GNU General Public License.
4.1149 ++
4.1150 ++//
4.1151 ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
4.1152 ++//
4.1153 ++
4.1154 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.1155 ++
4.1156 ++#include <locale>
4.1157 ++#include <bits/c++locale_internal.h>
4.1158 ++
4.1159 ++#ifdef __UCLIBC_MJN3_ONLY__
4.1160 ++#warning fix gettext stuff
4.1161 ++#endif
4.1162 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.1163 ++extern "C" char *__dcgettext(const char *domainname,
4.1164 ++ const char *msgid, int category);
4.1165 ++#undef gettext
4.1166 ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
4.1167 ++#else
4.1168 ++#undef gettext
4.1169 ++#define gettext(msgid) (msgid)
4.1170 ++#endif
4.1171 ++
4.1172 ++namespace std
4.1173 ++{
4.1174 ++ // Specializations.
4.1175 ++ template<>
4.1176 ++ string
4.1177 ++ messages<char>::do_get(catalog, int, int, const string& __dfault) const
4.1178 ++ {
4.1179 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1180 ++ __c_locale __old = __uselocale(_M_c_locale_messages);
4.1181 ++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
4.1182 ++ __uselocale(__old);
4.1183 ++ return string(__msg);
4.1184 ++#elif defined __UCLIBC_HAS_LOCALE__
4.1185 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
4.1186 ++ setlocale(LC_ALL, _M_name_messages);
4.1187 ++ const char* __msg = gettext(__dfault.c_str());
4.1188 ++ setlocale(LC_ALL, __old);
4.1189 ++ free(__old);
4.1190 ++ return string(__msg);
4.1191 ++#else
4.1192 ++ const char* __msg = gettext(__dfault.c_str());
4.1193 ++ return string(__msg);
4.1194 ++#endif
4.1195 ++ }
4.1196 ++
4.1197 ++#ifdef _GLIBCXX_USE_WCHAR_T
4.1198 ++ template<>
4.1199 ++ wstring
4.1200 ++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
4.1201 ++ {
4.1202 ++# ifdef __UCLIBC_HAS_XLOCALE__
4.1203 ++ __c_locale __old = __uselocale(_M_c_locale_messages);
4.1204 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
4.1205 ++ __uselocale(__old);
4.1206 ++ return _M_convert_from_char(__msg);
4.1207 ++# elif defined __UCLIBC_HAS_LOCALE__
4.1208 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
4.1209 ++ setlocale(LC_ALL, _M_name_messages);
4.1210 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
4.1211 ++ setlocale(LC_ALL, __old);
4.1212 ++ free(__old);
4.1213 ++ return _M_convert_from_char(__msg);
4.1214 ++# else
4.1215 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
4.1216 ++ return _M_convert_from_char(__msg);
4.1217 ++# endif
4.1218 ++ }
4.1219 ++#endif
4.1220 ++}
4.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
4.1222 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100
4.1223 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200
4.1224 +@@ -0,0 +1,118 @@
4.1225 ++// std::messages implementation details, GNU version -*- C++ -*-
4.1226 ++
4.1227 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4.1228 ++//
4.1229 ++// This file is part of the GNU ISO C++ Library. This library is free
4.1230 ++// software; you can redistribute it and/or modify it under the
4.1231 ++// terms of the GNU General Public License as published by the
4.1232 ++// Free Software Foundation; either version 2, or (at your option)
4.1233 ++// any later version.
4.1234 ++
4.1235 ++// This library is distributed in the hope that it will be useful,
4.1236 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.1237 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.1238 ++// GNU General Public License for more details.
4.1239 ++
4.1240 ++// You should have received a copy of the GNU General Public License along
4.1241 ++// with this library; see the file COPYING. If not, write to the Free
4.1242 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.1243 ++// USA.
4.1244 ++
4.1245 ++// As a special exception, you may use this file as part of a free software
4.1246 ++// library without restriction. Specifically, if other files instantiate
4.1247 ++// templates or use macros or inline functions from this file, or you compile
4.1248 ++// this file and link it with other files to produce an executable, this
4.1249 ++// file does not by itself cause the resulting executable to be covered by
4.1250 ++// the GNU General Public License. This exception does not however
4.1251 ++// invalidate any other reasons why the executable file might be covered by
4.1252 ++// the GNU General Public License.
4.1253 ++
4.1254 ++//
4.1255 ++// ISO C++ 14882: 22.2.7.1.2 messages functions
4.1256 ++//
4.1257 ++
4.1258 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.1259 ++
4.1260 ++#ifdef __UCLIBC_MJN3_ONLY__
4.1261 ++#warning fix prototypes for *textdomain funcs
4.1262 ++#endif
4.1263 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.1264 ++extern "C" char *__textdomain(const char *domainname);
4.1265 ++extern "C" char *__bindtextdomain(const char *domainname,
4.1266 ++ const char *dirname);
4.1267 ++#else
4.1268 ++#undef __textdomain
4.1269 ++#undef __bindtextdomain
4.1270 ++#define __textdomain(D) ((void)0)
4.1271 ++#define __bindtextdomain(D,P) ((void)0)
4.1272 ++#endif
4.1273 ++
4.1274 ++ // Non-virtual member functions.
4.1275 ++ template<typename _CharT>
4.1276 ++ messages<_CharT>::messages(size_t __refs)
4.1277 ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
4.1278 ++ _M_name_messages(_S_get_c_name())
4.1279 ++ { }
4.1280 ++
4.1281 ++ template<typename _CharT>
4.1282 ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
4.1283 ++ size_t __refs)
4.1284 ++ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
4.1285 ++ _M_name_messages(__s)
4.1286 ++ {
4.1287 ++ char* __tmp = new char[std::strlen(__s) + 1];
4.1288 ++ std::strcpy(__tmp, __s);
4.1289 ++ _M_name_messages = __tmp;
4.1290 ++ }
4.1291 ++
4.1292 ++ template<typename _CharT>
4.1293 ++ typename messages<_CharT>::catalog
4.1294 ++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
4.1295 ++ const char* __dir) const
4.1296 ++ {
4.1297 ++ __bindtextdomain(__s.c_str(), __dir);
4.1298 ++ return this->do_open(__s, __loc);
4.1299 ++ }
4.1300 ++
4.1301 ++ // Virtual member functions.
4.1302 ++ template<typename _CharT>
4.1303 ++ messages<_CharT>::~messages()
4.1304 ++ {
4.1305 ++ if (_M_name_messages != _S_get_c_name())
4.1306 ++ delete [] _M_name_messages;
4.1307 ++ _S_destroy_c_locale(_M_c_locale_messages);
4.1308 ++ }
4.1309 ++
4.1310 ++ template<typename _CharT>
4.1311 ++ typename messages<_CharT>::catalog
4.1312 ++ messages<_CharT>::do_open(const basic_string<char>& __s,
4.1313 ++ const locale&) const
4.1314 ++ {
4.1315 ++ // No error checking is done, assume the catalog exists and can
4.1316 ++ // be used.
4.1317 ++ __textdomain(__s.c_str());
4.1318 ++ return 0;
4.1319 ++ }
4.1320 ++
4.1321 ++ template<typename _CharT>
4.1322 ++ void
4.1323 ++ messages<_CharT>::do_close(catalog) const
4.1324 ++ { }
4.1325 ++
4.1326 ++ // messages_byname
4.1327 ++ template<typename _CharT>
4.1328 ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
4.1329 ++ : messages<_CharT>(__refs)
4.1330 ++ {
4.1331 ++ if (this->_M_name_messages != locale::facet::_S_get_c_name())
4.1332 ++ delete [] this->_M_name_messages;
4.1333 ++ char* __tmp = new char[std::strlen(__s) + 1];
4.1334 ++ std::strcpy(__tmp, __s);
4.1335 ++ this->_M_name_messages = __tmp;
4.1336 ++
4.1337 ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
4.1338 ++ {
4.1339 ++ this->_S_destroy_c_locale(this->_M_c_locale_messages);
4.1340 ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
4.1341 ++ }
4.1342 ++ }
4.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
4.1344 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100
4.1345 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200
4.1346 +@@ -0,0 +1,692 @@
4.1347 ++// std::moneypunct implementation details, GNU version -*- C++ -*-
4.1348 ++
4.1349 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4.1350 ++//
4.1351 ++// This file is part of the GNU ISO C++ Library. This library is free
4.1352 ++// software; you can redistribute it and/or modify it under the
4.1353 ++// terms of the GNU General Public License as published by the
4.1354 ++// Free Software Foundation; either version 2, or (at your option)
4.1355 ++// any later version.
4.1356 ++
4.1357 ++// This library is distributed in the hope that it will be useful,
4.1358 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.1359 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.1360 ++// GNU General Public License for more details.
4.1361 ++
4.1362 ++// You should have received a copy of the GNU General Public License along
4.1363 ++// with this library; see the file COPYING. If not, write to the Free
4.1364 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.1365 ++// USA.
4.1366 ++
4.1367 ++// As a special exception, you may use this file as part of a free software
4.1368 ++// library without restriction. Specifically, if other files instantiate
4.1369 ++// templates or use macros or inline functions from this file, or you compile
4.1370 ++// this file and link it with other files to produce an executable, this
4.1371 ++// file does not by itself cause the resulting executable to be covered by
4.1372 ++// the GNU General Public License. This exception does not however
4.1373 ++// invalidate any other reasons why the executable file might be covered by
4.1374 ++// the GNU General Public License.
4.1375 ++
4.1376 ++//
4.1377 ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
4.1378 ++//
4.1379 ++
4.1380 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.1381 ++
4.1382 ++#define _LIBC
4.1383 ++#include <locale>
4.1384 ++#undef _LIBC
4.1385 ++#include <bits/c++locale_internal.h>
4.1386 ++
4.1387 ++#ifdef __UCLIBC_MJN3_ONLY__
4.1388 ++#warning optimize this for uclibc
4.1389 ++#warning tailor for stub locale support
4.1390 ++#endif
4.1391 ++
4.1392 ++#ifndef __UCLIBC_HAS_XLOCALE__
4.1393 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
4.1394 ++#endif
4.1395 ++
4.1396 ++namespace std
4.1397 ++{
4.1398 ++ // Construct and return valid pattern consisting of some combination of:
4.1399 ++ // space none symbol sign value
4.1400 ++ money_base::pattern
4.1401 ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
4.1402 ++ {
4.1403 ++ pattern __ret;
4.1404 ++
4.1405 ++ // This insanely complicated routine attempts to construct a valid
4.1406 ++ // pattern for use with monyepunct. A couple of invariants:
4.1407 ++
4.1408 ++ // if (__precedes) symbol -> value
4.1409 ++ // else value -> symbol
4.1410 ++
4.1411 ++ // if (__space) space
4.1412 ++ // else none
4.1413 ++
4.1414 ++ // none == never first
4.1415 ++ // space never first or last
4.1416 ++
4.1417 ++ // Any elegant implementations of this are welcome.
4.1418 ++ switch (__posn)
4.1419 ++ {
4.1420 ++ case 0:
4.1421 ++ case 1:
4.1422 ++ // 1 The sign precedes the value and symbol.
4.1423 ++ __ret.field[0] = sign;
4.1424 ++ if (__space)
4.1425 ++ {
4.1426 ++ // Pattern starts with sign.
4.1427 ++ if (__precedes)
4.1428 ++ {
4.1429 ++ __ret.field[1] = symbol;
4.1430 ++ __ret.field[3] = value;
4.1431 ++ }
4.1432 ++ else
4.1433 ++ {
4.1434 ++ __ret.field[1] = value;
4.1435 ++ __ret.field[3] = symbol;
4.1436 ++ }
4.1437 ++ __ret.field[2] = space;
4.1438 ++ }
4.1439 ++ else
4.1440 ++ {
4.1441 ++ // Pattern starts with sign and ends with none.
4.1442 ++ if (__precedes)
4.1443 ++ {
4.1444 ++ __ret.field[1] = symbol;
4.1445 ++ __ret.field[2] = value;
4.1446 ++ }
4.1447 ++ else
4.1448 ++ {
4.1449 ++ __ret.field[1] = value;
4.1450 ++ __ret.field[2] = symbol;
4.1451 ++ }
4.1452 ++ __ret.field[3] = none;
4.1453 ++ }
4.1454 ++ break;
4.1455 ++ case 2:
4.1456 ++ // 2 The sign follows the value and symbol.
4.1457 ++ if (__space)
4.1458 ++ {
4.1459 ++ // Pattern either ends with sign.
4.1460 ++ if (__precedes)
4.1461 ++ {
4.1462 ++ __ret.field[0] = symbol;
4.1463 ++ __ret.field[2] = value;
4.1464 ++ }
4.1465 ++ else
4.1466 ++ {
4.1467 ++ __ret.field[0] = value;
4.1468 ++ __ret.field[2] = symbol;
4.1469 ++ }
4.1470 ++ __ret.field[1] = space;
4.1471 ++ __ret.field[3] = sign;
4.1472 ++ }
4.1473 ++ else
4.1474 ++ {
4.1475 ++ // Pattern ends with sign then none.
4.1476 ++ if (__precedes)
4.1477 ++ {
4.1478 ++ __ret.field[0] = symbol;
4.1479 ++ __ret.field[1] = value;
4.1480 ++ }
4.1481 ++ else
4.1482 ++ {
4.1483 ++ __ret.field[0] = value;
4.1484 ++ __ret.field[1] = symbol;
4.1485 ++ }
4.1486 ++ __ret.field[2] = sign;
4.1487 ++ __ret.field[3] = none;
4.1488 ++ }
4.1489 ++ break;
4.1490 ++ case 3:
4.1491 ++ // 3 The sign immediately precedes the symbol.
4.1492 ++ if (__precedes)
4.1493 ++ {
4.1494 ++ __ret.field[0] = sign;
4.1495 ++ __ret.field[1] = symbol;
4.1496 ++ if (__space)
4.1497 ++ {
4.1498 ++ __ret.field[2] = space;
4.1499 ++ __ret.field[3] = value;
4.1500 ++ }
4.1501 ++ else
4.1502 ++ {
4.1503 ++ __ret.field[2] = value;
4.1504 ++ __ret.field[3] = none;
4.1505 ++ }
4.1506 ++ }
4.1507 ++ else
4.1508 ++ {
4.1509 ++ __ret.field[0] = value;
4.1510 ++ if (__space)
4.1511 ++ {
4.1512 ++ __ret.field[1] = space;
4.1513 ++ __ret.field[2] = sign;
4.1514 ++ __ret.field[3] = symbol;
4.1515 ++ }
4.1516 ++ else
4.1517 ++ {
4.1518 ++ __ret.field[1] = sign;
4.1519 ++ __ret.field[2] = symbol;
4.1520 ++ __ret.field[3] = none;
4.1521 ++ }
4.1522 ++ }
4.1523 ++ break;
4.1524 ++ case 4:
4.1525 ++ // 4 The sign immediately follows the symbol.
4.1526 ++ if (__precedes)
4.1527 ++ {
4.1528 ++ __ret.field[0] = symbol;
4.1529 ++ __ret.field[1] = sign;
4.1530 ++ if (__space)
4.1531 ++ {
4.1532 ++ __ret.field[2] = space;
4.1533 ++ __ret.field[3] = value;
4.1534 ++ }
4.1535 ++ else
4.1536 ++ {
4.1537 ++ __ret.field[2] = value;
4.1538 ++ __ret.field[3] = none;
4.1539 ++ }
4.1540 ++ }
4.1541 ++ else
4.1542 ++ {
4.1543 ++ __ret.field[0] = value;
4.1544 ++ if (__space)
4.1545 ++ {
4.1546 ++ __ret.field[1] = space;
4.1547 ++ __ret.field[2] = symbol;
4.1548 ++ __ret.field[3] = sign;
4.1549 ++ }
4.1550 ++ else
4.1551 ++ {
4.1552 ++ __ret.field[1] = symbol;
4.1553 ++ __ret.field[2] = sign;
4.1554 ++ __ret.field[3] = none;
4.1555 ++ }
4.1556 ++ }
4.1557 ++ break;
4.1558 ++ default:
4.1559 ++ ;
4.1560 ++ }
4.1561 ++ return __ret;
4.1562 ++ }
4.1563 ++
4.1564 ++ template<>
4.1565 ++ void
4.1566 ++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
4.1567 ++ const char*)
4.1568 ++ {
4.1569 ++ if (!_M_data)
4.1570 ++ _M_data = new __moneypunct_cache<char, true>;
4.1571 ++
4.1572 ++ if (!__cloc)
4.1573 ++ {
4.1574 ++ // "C" locale
4.1575 ++ _M_data->_M_decimal_point = '.';
4.1576 ++ _M_data->_M_thousands_sep = ',';
4.1577 ++ _M_data->_M_grouping = "";
4.1578 ++ _M_data->_M_grouping_size = 0;
4.1579 ++ _M_data->_M_curr_symbol = "";
4.1580 ++ _M_data->_M_curr_symbol_size = 0;
4.1581 ++ _M_data->_M_positive_sign = "";
4.1582 ++ _M_data->_M_positive_sign_size = 0;
4.1583 ++ _M_data->_M_negative_sign = "";
4.1584 ++ _M_data->_M_negative_sign_size = 0;
4.1585 ++ _M_data->_M_frac_digits = 0;
4.1586 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
4.1587 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
4.1588 ++
4.1589 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
4.1590 ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
4.1591 ++ }
4.1592 ++ else
4.1593 ++ {
4.1594 ++ // Named locale.
4.1595 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
4.1596 ++ __cloc));
4.1597 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
4.1598 ++ __cloc));
4.1599 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
4.1600 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
4.1601 ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
4.1602 ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
4.1603 ++
4.1604 ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
4.1605 ++ if (!__nposn)
4.1606 ++ _M_data->_M_negative_sign = "()";
4.1607 ++ else
4.1608 ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
4.1609 ++ __cloc);
4.1610 ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
4.1611 ++
4.1612 ++ // _Intl == true
4.1613 ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
4.1614 ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
4.1615 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
4.1616 ++ __cloc));
4.1617 ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
4.1618 ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
4.1619 ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
4.1620 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
4.1621 ++ __pposn);
4.1622 ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
4.1623 ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
4.1624 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
4.1625 ++ __nposn);
4.1626 ++ }
4.1627 ++ }
4.1628 ++
4.1629 ++ template<>
4.1630 ++ void
4.1631 ++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
4.1632 ++ const char*)
4.1633 ++ {
4.1634 ++ if (!_M_data)
4.1635 ++ _M_data = new __moneypunct_cache<char, false>;
4.1636 ++
4.1637 ++ if (!__cloc)
4.1638 ++ {
4.1639 ++ // "C" locale
4.1640 ++ _M_data->_M_decimal_point = '.';
4.1641 ++ _M_data->_M_thousands_sep = ',';
4.1642 ++ _M_data->_M_grouping = "";
4.1643 ++ _M_data->_M_grouping_size = 0;
4.1644 ++ _M_data->_M_curr_symbol = "";
4.1645 ++ _M_data->_M_curr_symbol_size = 0;
4.1646 ++ _M_data->_M_positive_sign = "";
4.1647 ++ _M_data->_M_positive_sign_size = 0;
4.1648 ++ _M_data->_M_negative_sign = "";
4.1649 ++ _M_data->_M_negative_sign_size = 0;
4.1650 ++ _M_data->_M_frac_digits = 0;
4.1651 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
4.1652 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
4.1653 ++
4.1654 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
4.1655 ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
4.1656 ++ }
4.1657 ++ else
4.1658 ++ {
4.1659 ++ // Named locale.
4.1660 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
4.1661 ++ __cloc));
4.1662 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
4.1663 ++ __cloc));
4.1664 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
4.1665 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
4.1666 ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
4.1667 ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
4.1668 ++
4.1669 ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
4.1670 ++ if (!__nposn)
4.1671 ++ _M_data->_M_negative_sign = "()";
4.1672 ++ else
4.1673 ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
4.1674 ++ __cloc);
4.1675 ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
4.1676 ++
4.1677 ++ // _Intl == false
4.1678 ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
4.1679 ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
4.1680 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
4.1681 ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
4.1682 ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
4.1683 ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
4.1684 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
4.1685 ++ __pposn);
4.1686 ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
4.1687 ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
4.1688 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
4.1689 ++ __nposn);
4.1690 ++ }
4.1691 ++ }
4.1692 ++
4.1693 ++ template<>
4.1694 ++ moneypunct<char, true>::~moneypunct()
4.1695 ++ { delete _M_data; }
4.1696 ++
4.1697 ++ template<>
4.1698 ++ moneypunct<char, false>::~moneypunct()
4.1699 ++ { delete _M_data; }
4.1700 ++
4.1701 ++#ifdef _GLIBCXX_USE_WCHAR_T
4.1702 ++ template<>
4.1703 ++ void
4.1704 ++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
4.1705 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1706 ++ const char*)
4.1707 ++#else
4.1708 ++ const char* __name)
4.1709 ++#endif
4.1710 ++ {
4.1711 ++ if (!_M_data)
4.1712 ++ _M_data = new __moneypunct_cache<wchar_t, true>;
4.1713 ++
4.1714 ++ if (!__cloc)
4.1715 ++ {
4.1716 ++ // "C" locale
4.1717 ++ _M_data->_M_decimal_point = L'.';
4.1718 ++ _M_data->_M_thousands_sep = L',';
4.1719 ++ _M_data->_M_grouping = "";
4.1720 ++ _M_data->_M_grouping_size = 0;
4.1721 ++ _M_data->_M_curr_symbol = L"";
4.1722 ++ _M_data->_M_curr_symbol_size = 0;
4.1723 ++ _M_data->_M_positive_sign = L"";
4.1724 ++ _M_data->_M_positive_sign_size = 0;
4.1725 ++ _M_data->_M_negative_sign = L"";
4.1726 ++ _M_data->_M_negative_sign_size = 0;
4.1727 ++ _M_data->_M_frac_digits = 0;
4.1728 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
4.1729 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
4.1730 ++
4.1731 ++ // Use ctype::widen code without the facet...
4.1732 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
4.1733 ++ _M_data->_M_atoms[__i] =
4.1734 ++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
4.1735 ++ }
4.1736 ++ else
4.1737 ++ {
4.1738 ++ // Named locale.
4.1739 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1740 ++ __c_locale __old = __uselocale(__cloc);
4.1741 ++#else
4.1742 ++ // Switch to named locale so that mbsrtowcs will work.
4.1743 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
4.1744 ++ setlocale(LC_ALL, __name);
4.1745 ++#endif
4.1746 ++
4.1747 ++#ifdef __UCLIBC_MJN3_ONLY__
4.1748 ++#warning fix this... should be monetary
4.1749 ++#endif
4.1750 ++#ifdef __UCLIBC__
4.1751 ++# ifdef __UCLIBC_HAS_XLOCALE__
4.1752 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
4.1753 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
4.1754 ++# else
4.1755 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
4.1756 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
4.1757 ++# endif
4.1758 ++#else
4.1759 ++ union { char *__s; wchar_t __w; } __u;
4.1760 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
4.1761 ++ _M_data->_M_decimal_point = __u.__w;
4.1762 ++
4.1763 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
4.1764 ++ _M_data->_M_thousands_sep = __u.__w;
4.1765 ++#endif
4.1766 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
4.1767 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
4.1768 ++
4.1769 ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
4.1770 ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
4.1771 ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
4.1772 ++
4.1773 ++ wchar_t* __wcs_ps = 0;
4.1774 ++ wchar_t* __wcs_ns = 0;
4.1775 ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
4.1776 ++ try
4.1777 ++ {
4.1778 ++ mbstate_t __state;
4.1779 ++ size_t __len = strlen(__cpossign);
4.1780 ++ if (__len)
4.1781 ++ {
4.1782 ++ ++__len;
4.1783 ++ memset(&__state, 0, sizeof(mbstate_t));
4.1784 ++ __wcs_ps = new wchar_t[__len];
4.1785 ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
4.1786 ++ _M_data->_M_positive_sign = __wcs_ps;
4.1787 ++ }
4.1788 ++ else
4.1789 ++ _M_data->_M_positive_sign = L"";
4.1790 ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
4.1791 ++
4.1792 ++ __len = strlen(__cnegsign);
4.1793 ++ if (!__nposn)
4.1794 ++ _M_data->_M_negative_sign = L"()";
4.1795 ++ else if (__len)
4.1796 ++ {
4.1797 ++ ++__len;
4.1798 ++ memset(&__state, 0, sizeof(mbstate_t));
4.1799 ++ __wcs_ns = new wchar_t[__len];
4.1800 ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
4.1801 ++ _M_data->_M_negative_sign = __wcs_ns;
4.1802 ++ }
4.1803 ++ else
4.1804 ++ _M_data->_M_negative_sign = L"";
4.1805 ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
4.1806 ++
4.1807 ++ // _Intl == true.
4.1808 ++ __len = strlen(__ccurr);
4.1809 ++ if (__len)
4.1810 ++ {
4.1811 ++ ++__len;
4.1812 ++ memset(&__state, 0, sizeof(mbstate_t));
4.1813 ++ wchar_t* __wcs = new wchar_t[__len];
4.1814 ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
4.1815 ++ _M_data->_M_curr_symbol = __wcs;
4.1816 ++ }
4.1817 ++ else
4.1818 ++ _M_data->_M_curr_symbol = L"";
4.1819 ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
4.1820 ++ }
4.1821 ++ catch (...)
4.1822 ++ {
4.1823 ++ delete _M_data;
4.1824 ++ _M_data = 0;
4.1825 ++ delete __wcs_ps;
4.1826 ++ delete __wcs_ns;
4.1827 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1828 ++ __uselocale(__old);
4.1829 ++#else
4.1830 ++ setlocale(LC_ALL, __old);
4.1831 ++ free(__old);
4.1832 ++#endif
4.1833 ++ __throw_exception_again;
4.1834 ++ }
4.1835 ++
4.1836 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
4.1837 ++ __cloc));
4.1838 ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
4.1839 ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
4.1840 ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
4.1841 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
4.1842 ++ __pposn);
4.1843 ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
4.1844 ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
4.1845 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
4.1846 ++ __nposn);
4.1847 ++
4.1848 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1849 ++ __uselocale(__old);
4.1850 ++#else
4.1851 ++ setlocale(LC_ALL, __old);
4.1852 ++ free(__old);
4.1853 ++#endif
4.1854 ++ }
4.1855 ++ }
4.1856 ++
4.1857 ++ template<>
4.1858 ++ void
4.1859 ++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
4.1860 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1861 ++ const char*)
4.1862 ++#else
4.1863 ++ const char* __name)
4.1864 ++#endif
4.1865 ++ {
4.1866 ++ if (!_M_data)
4.1867 ++ _M_data = new __moneypunct_cache<wchar_t, false>;
4.1868 ++
4.1869 ++ if (!__cloc)
4.1870 ++ {
4.1871 ++ // "C" locale
4.1872 ++ _M_data->_M_decimal_point = L'.';
4.1873 ++ _M_data->_M_thousands_sep = L',';
4.1874 ++ _M_data->_M_grouping = "";
4.1875 ++ _M_data->_M_grouping_size = 0;
4.1876 ++ _M_data->_M_curr_symbol = L"";
4.1877 ++ _M_data->_M_curr_symbol_size = 0;
4.1878 ++ _M_data->_M_positive_sign = L"";
4.1879 ++ _M_data->_M_positive_sign_size = 0;
4.1880 ++ _M_data->_M_negative_sign = L"";
4.1881 ++ _M_data->_M_negative_sign_size = 0;
4.1882 ++ _M_data->_M_frac_digits = 0;
4.1883 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
4.1884 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
4.1885 ++
4.1886 ++ // Use ctype::widen code without the facet...
4.1887 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
4.1888 ++ _M_data->_M_atoms[__i] =
4.1889 ++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
4.1890 ++ }
4.1891 ++ else
4.1892 ++ {
4.1893 ++ // Named locale.
4.1894 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1895 ++ __c_locale __old = __uselocale(__cloc);
4.1896 ++#else
4.1897 ++ // Switch to named locale so that mbsrtowcs will work.
4.1898 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
4.1899 ++ setlocale(LC_ALL, __name);
4.1900 ++#endif
4.1901 ++
4.1902 ++#ifdef __UCLIBC_MJN3_ONLY__
4.1903 ++#warning fix this... should be monetary
4.1904 ++#endif
4.1905 ++#ifdef __UCLIBC__
4.1906 ++# ifdef __UCLIBC_HAS_XLOCALE__
4.1907 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
4.1908 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
4.1909 ++# else
4.1910 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
4.1911 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
4.1912 ++# endif
4.1913 ++#else
4.1914 ++ union { char *__s; wchar_t __w; } __u;
4.1915 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
4.1916 ++ _M_data->_M_decimal_point = __u.__w;
4.1917 ++
4.1918 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
4.1919 ++ _M_data->_M_thousands_sep = __u.__w;
4.1920 ++#endif
4.1921 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
4.1922 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
4.1923 ++
4.1924 ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
4.1925 ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
4.1926 ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
4.1927 ++
4.1928 ++ wchar_t* __wcs_ps = 0;
4.1929 ++ wchar_t* __wcs_ns = 0;
4.1930 ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
4.1931 ++ try
4.1932 ++ {
4.1933 ++ mbstate_t __state;
4.1934 ++ size_t __len;
4.1935 ++ __len = strlen(__cpossign);
4.1936 ++ if (__len)
4.1937 ++ {
4.1938 ++ ++__len;
4.1939 ++ memset(&__state, 0, sizeof(mbstate_t));
4.1940 ++ __wcs_ps = new wchar_t[__len];
4.1941 ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
4.1942 ++ _M_data->_M_positive_sign = __wcs_ps;
4.1943 ++ }
4.1944 ++ else
4.1945 ++ _M_data->_M_positive_sign = L"";
4.1946 ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
4.1947 ++
4.1948 ++ __len = strlen(__cnegsign);
4.1949 ++ if (!__nposn)
4.1950 ++ _M_data->_M_negative_sign = L"()";
4.1951 ++ else if (__len)
4.1952 ++ {
4.1953 ++ ++__len;
4.1954 ++ memset(&__state, 0, sizeof(mbstate_t));
4.1955 ++ __wcs_ns = new wchar_t[__len];
4.1956 ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
4.1957 ++ _M_data->_M_negative_sign = __wcs_ns;
4.1958 ++ }
4.1959 ++ else
4.1960 ++ _M_data->_M_negative_sign = L"";
4.1961 ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
4.1962 ++
4.1963 ++ // _Intl == true.
4.1964 ++ __len = strlen(__ccurr);
4.1965 ++ if (__len)
4.1966 ++ {
4.1967 ++ ++__len;
4.1968 ++ memset(&__state, 0, sizeof(mbstate_t));
4.1969 ++ wchar_t* __wcs = new wchar_t[__len];
4.1970 ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
4.1971 ++ _M_data->_M_curr_symbol = __wcs;
4.1972 ++ }
4.1973 ++ else
4.1974 ++ _M_data->_M_curr_symbol = L"";
4.1975 ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
4.1976 ++ }
4.1977 ++ catch (...)
4.1978 ++ {
4.1979 ++ delete _M_data;
4.1980 ++ _M_data = 0;
4.1981 ++ delete __wcs_ps;
4.1982 ++ delete __wcs_ns;
4.1983 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.1984 ++ __uselocale(__old);
4.1985 ++#else
4.1986 ++ setlocale(LC_ALL, __old);
4.1987 ++ free(__old);
4.1988 ++#endif
4.1989 ++ __throw_exception_again;
4.1990 ++ }
4.1991 ++
4.1992 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
4.1993 ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
4.1994 ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
4.1995 ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
4.1996 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
4.1997 ++ __pposn);
4.1998 ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
4.1999 ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
4.2000 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
4.2001 ++ __nposn);
4.2002 ++
4.2003 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.2004 ++ __uselocale(__old);
4.2005 ++#else
4.2006 ++ setlocale(LC_ALL, __old);
4.2007 ++ free(__old);
4.2008 ++#endif
4.2009 ++ }
4.2010 ++ }
4.2011 ++
4.2012 ++ template<>
4.2013 ++ moneypunct<wchar_t, true>::~moneypunct()
4.2014 ++ {
4.2015 ++ if (_M_data->_M_positive_sign_size)
4.2016 ++ delete [] _M_data->_M_positive_sign;
4.2017 ++ if (_M_data->_M_negative_sign_size
4.2018 ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
4.2019 ++ delete [] _M_data->_M_negative_sign;
4.2020 ++ if (_M_data->_M_curr_symbol_size)
4.2021 ++ delete [] _M_data->_M_curr_symbol;
4.2022 ++ delete _M_data;
4.2023 ++ }
4.2024 ++
4.2025 ++ template<>
4.2026 ++ moneypunct<wchar_t, false>::~moneypunct()
4.2027 ++ {
4.2028 ++ if (_M_data->_M_positive_sign_size)
4.2029 ++ delete [] _M_data->_M_positive_sign;
4.2030 ++ if (_M_data->_M_negative_sign_size
4.2031 ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
4.2032 ++ delete [] _M_data->_M_negative_sign;
4.2033 ++ if (_M_data->_M_curr_symbol_size)
4.2034 ++ delete [] _M_data->_M_curr_symbol;
4.2035 ++ delete _M_data;
4.2036 ++ }
4.2037 ++#endif
4.2038 ++}
4.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
4.2040 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100
4.2041 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200
4.2042 +@@ -0,0 +1,160 @@
4.2043 ++// std::numpunct implementation details, GNU version -*- C++ -*-
4.2044 ++
4.2045 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4.2046 ++//
4.2047 ++// This file is part of the GNU ISO C++ Library. This library is free
4.2048 ++// software; you can redistribute it and/or modify it under the
4.2049 ++// terms of the GNU General Public License as published by the
4.2050 ++// Free Software Foundation; either version 2, or (at your option)
4.2051 ++// any later version.
4.2052 ++
4.2053 ++// This library is distributed in the hope that it will be useful,
4.2054 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.2055 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.2056 ++// GNU General Public License for more details.
4.2057 ++
4.2058 ++// You should have received a copy of the GNU General Public License along
4.2059 ++// with this library; see the file COPYING. If not, write to the Free
4.2060 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.2061 ++// USA.
4.2062 ++
4.2063 ++// As a special exception, you may use this file as part of a free software
4.2064 ++// library without restriction. Specifically, if other files instantiate
4.2065 ++// templates or use macros or inline functions from this file, or you compile
4.2066 ++// this file and link it with other files to produce an executable, this
4.2067 ++// file does not by itself cause the resulting executable to be covered by
4.2068 ++// the GNU General Public License. This exception does not however
4.2069 ++// invalidate any other reasons why the executable file might be covered by
4.2070 ++// the GNU General Public License.
4.2071 ++
4.2072 ++//
4.2073 ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
4.2074 ++//
4.2075 ++
4.2076 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.2077 ++
4.2078 ++#define _LIBC
4.2079 ++#include <locale>
4.2080 ++#undef _LIBC
4.2081 ++#include <bits/c++locale_internal.h>
4.2082 ++
4.2083 ++#ifdef __UCLIBC_MJN3_ONLY__
4.2084 ++#warning tailor for stub locale support
4.2085 ++#endif
4.2086 ++#ifndef __UCLIBC_HAS_XLOCALE__
4.2087 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
4.2088 ++#endif
4.2089 ++
4.2090 ++namespace std
4.2091 ++{
4.2092 ++ template<>
4.2093 ++ void
4.2094 ++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
4.2095 ++ {
4.2096 ++ if (!_M_data)
4.2097 ++ _M_data = new __numpunct_cache<char>;
4.2098 ++
4.2099 ++ if (!__cloc)
4.2100 ++ {
4.2101 ++ // "C" locale
4.2102 ++ _M_data->_M_grouping = "";
4.2103 ++ _M_data->_M_grouping_size = 0;
4.2104 ++ _M_data->_M_use_grouping = false;
4.2105 ++
4.2106 ++ _M_data->_M_decimal_point = '.';
4.2107 ++ _M_data->_M_thousands_sep = ',';
4.2108 ++
4.2109 ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
4.2110 ++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
4.2111 ++
4.2112 ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
4.2113 ++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
4.2114 ++ }
4.2115 ++ else
4.2116 ++ {
4.2117 ++ // Named locale.
4.2118 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
4.2119 ++ __cloc));
4.2120 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
4.2121 ++ __cloc));
4.2122 ++
4.2123 ++ // Check for NULL, which implies no grouping.
4.2124 ++ if (_M_data->_M_thousands_sep == '\0')
4.2125 ++ _M_data->_M_grouping = "";
4.2126 ++ else
4.2127 ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
4.2128 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
4.2129 ++ }
4.2130 ++
4.2131 ++ // NB: There is no way to extact this info from posix locales.
4.2132 ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
4.2133 ++ _M_data->_M_truename = "true";
4.2134 ++ _M_data->_M_truename_size = 4;
4.2135 ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
4.2136 ++ _M_data->_M_falsename = "false";
4.2137 ++ _M_data->_M_falsename_size = 5;
4.2138 ++ }
4.2139 ++
4.2140 ++ template<>
4.2141 ++ numpunct<char>::~numpunct()
4.2142 ++ { delete _M_data; }
4.2143 ++
4.2144 ++#ifdef _GLIBCXX_USE_WCHAR_T
4.2145 ++ template<>
4.2146 ++ void
4.2147 ++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
4.2148 ++ {
4.2149 ++ if (!_M_data)
4.2150 ++ _M_data = new __numpunct_cache<wchar_t>;
4.2151 ++
4.2152 ++ if (!__cloc)
4.2153 ++ {
4.2154 ++ // "C" locale
4.2155 ++ _M_data->_M_grouping = "";
4.2156 ++ _M_data->_M_grouping_size = 0;
4.2157 ++ _M_data->_M_use_grouping = false;
4.2158 ++
4.2159 ++ _M_data->_M_decimal_point = L'.';
4.2160 ++ _M_data->_M_thousands_sep = L',';
4.2161 ++
4.2162 ++ // Use ctype::widen code without the facet...
4.2163 ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
4.2164 ++ _M_data->_M_atoms_out[__i] =
4.2165 ++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
4.2166 ++
4.2167 ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
4.2168 ++ _M_data->_M_atoms_in[__j] =
4.2169 ++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
4.2170 ++ }
4.2171 ++ else
4.2172 ++ {
4.2173 ++ // Named locale.
4.2174 ++ // NB: In the GNU model wchar_t is always 32 bit wide.
4.2175 ++ union { char *__s; wchar_t __w; } __u;
4.2176 ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
4.2177 ++ _M_data->_M_decimal_point = __u.__w;
4.2178 ++
4.2179 ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
4.2180 ++ _M_data->_M_thousands_sep = __u.__w;
4.2181 ++
4.2182 ++ if (_M_data->_M_thousands_sep == L'\0')
4.2183 ++ _M_data->_M_grouping = "";
4.2184 ++ else
4.2185 ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
4.2186 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
4.2187 ++ }
4.2188 ++
4.2189 ++ // NB: There is no way to extact this info from posix locales.
4.2190 ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
4.2191 ++ _M_data->_M_truename = L"true";
4.2192 ++ _M_data->_M_truename_size = 4;
4.2193 ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
4.2194 ++ _M_data->_M_falsename = L"false";
4.2195 ++ _M_data->_M_falsename_size = 5;
4.2196 ++ }
4.2197 ++
4.2198 ++ template<>
4.2199 ++ numpunct<wchar_t>::~numpunct()
4.2200 ++ { delete _M_data; }
4.2201 ++ #endif
4.2202 ++}
4.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
4.2204 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100
4.2205 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200
4.2206 +@@ -0,0 +1,406 @@
4.2207 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
4.2208 ++
4.2209 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4.2210 ++//
4.2211 ++// This file is part of the GNU ISO C++ Library. This library is free
4.2212 ++// software; you can redistribute it and/or modify it under the
4.2213 ++// terms of the GNU General Public License as published by the
4.2214 ++// Free Software Foundation; either version 2, or (at your option)
4.2215 ++// any later version.
4.2216 ++
4.2217 ++// This library is distributed in the hope that it will be useful,
4.2218 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.2219 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.2220 ++// GNU General Public License for more details.
4.2221 ++
4.2222 ++// You should have received a copy of the GNU General Public License along
4.2223 ++// with this library; see the file COPYING. If not, write to the Free
4.2224 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.2225 ++// USA.
4.2226 ++
4.2227 ++// As a special exception, you may use this file as part of a free software
4.2228 ++// library without restriction. Specifically, if other files instantiate
4.2229 ++// templates or use macros or inline functions from this file, or you compile
4.2230 ++// this file and link it with other files to produce an executable, this
4.2231 ++// file does not by itself cause the resulting executable to be covered by
4.2232 ++// the GNU General Public License. This exception does not however
4.2233 ++// invalidate any other reasons why the executable file might be covered by
4.2234 ++// the GNU General Public License.
4.2235 ++
4.2236 ++//
4.2237 ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
4.2238 ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
4.2239 ++//
4.2240 ++
4.2241 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.2242 ++
4.2243 ++#include <locale>
4.2244 ++#include <bits/c++locale_internal.h>
4.2245 ++
4.2246 ++#ifdef __UCLIBC_MJN3_ONLY__
4.2247 ++#warning tailor for stub locale support
4.2248 ++#endif
4.2249 ++#ifndef __UCLIBC_HAS_XLOCALE__
4.2250 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
4.2251 ++#endif
4.2252 ++
4.2253 ++namespace std
4.2254 ++{
4.2255 ++ template<>
4.2256 ++ void
4.2257 ++ __timepunct<char>::
4.2258 ++ _M_put(char* __s, size_t __maxlen, const char* __format,
4.2259 ++ const tm* __tm) const
4.2260 ++ {
4.2261 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.2262 ++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
4.2263 ++ _M_c_locale_timepunct);
4.2264 ++#else
4.2265 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
4.2266 ++ setlocale(LC_ALL, _M_name_timepunct);
4.2267 ++ const size_t __len = strftime(__s, __maxlen, __format, __tm);
4.2268 ++ setlocale(LC_ALL, __old);
4.2269 ++ free(__old);
4.2270 ++#endif
4.2271 ++ // Make sure __s is null terminated.
4.2272 ++ if (__len == 0)
4.2273 ++ __s[0] = '\0';
4.2274 ++ }
4.2275 ++
4.2276 ++ template<>
4.2277 ++ void
4.2278 ++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
4.2279 ++ {
4.2280 ++ if (!_M_data)
4.2281 ++ _M_data = new __timepunct_cache<char>;
4.2282 ++
4.2283 ++ if (!__cloc)
4.2284 ++ {
4.2285 ++ // "C" locale
4.2286 ++ _M_c_locale_timepunct = _S_get_c_locale();
4.2287 ++
4.2288 ++ _M_data->_M_date_format = "%m/%d/%y";
4.2289 ++ _M_data->_M_date_era_format = "%m/%d/%y";
4.2290 ++ _M_data->_M_time_format = "%H:%M:%S";
4.2291 ++ _M_data->_M_time_era_format = "%H:%M:%S";
4.2292 ++ _M_data->_M_date_time_format = "";
4.2293 ++ _M_data->_M_date_time_era_format = "";
4.2294 ++ _M_data->_M_am = "AM";
4.2295 ++ _M_data->_M_pm = "PM";
4.2296 ++ _M_data->_M_am_pm_format = "";
4.2297 ++
4.2298 ++ // Day names, starting with "C"'s Sunday.
4.2299 ++ _M_data->_M_day1 = "Sunday";
4.2300 ++ _M_data->_M_day2 = "Monday";
4.2301 ++ _M_data->_M_day3 = "Tuesday";
4.2302 ++ _M_data->_M_day4 = "Wednesday";
4.2303 ++ _M_data->_M_day5 = "Thursday";
4.2304 ++ _M_data->_M_day6 = "Friday";
4.2305 ++ _M_data->_M_day7 = "Saturday";
4.2306 ++
4.2307 ++ // Abbreviated day names, starting with "C"'s Sun.
4.2308 ++ _M_data->_M_aday1 = "Sun";
4.2309 ++ _M_data->_M_aday2 = "Mon";
4.2310 ++ _M_data->_M_aday3 = "Tue";
4.2311 ++ _M_data->_M_aday4 = "Wed";
4.2312 ++ _M_data->_M_aday5 = "Thu";
4.2313 ++ _M_data->_M_aday6 = "Fri";
4.2314 ++ _M_data->_M_aday7 = "Sat";
4.2315 ++
4.2316 ++ // Month names, starting with "C"'s January.
4.2317 ++ _M_data->_M_month01 = "January";
4.2318 ++ _M_data->_M_month02 = "February";
4.2319 ++ _M_data->_M_month03 = "March";
4.2320 ++ _M_data->_M_month04 = "April";
4.2321 ++ _M_data->_M_month05 = "May";
4.2322 ++ _M_data->_M_month06 = "June";
4.2323 ++ _M_data->_M_month07 = "July";
4.2324 ++ _M_data->_M_month08 = "August";
4.2325 ++ _M_data->_M_month09 = "September";
4.2326 ++ _M_data->_M_month10 = "October";
4.2327 ++ _M_data->_M_month11 = "November";
4.2328 ++ _M_data->_M_month12 = "December";
4.2329 ++
4.2330 ++ // Abbreviated month names, starting with "C"'s Jan.
4.2331 ++ _M_data->_M_amonth01 = "Jan";
4.2332 ++ _M_data->_M_amonth02 = "Feb";
4.2333 ++ _M_data->_M_amonth03 = "Mar";
4.2334 ++ _M_data->_M_amonth04 = "Apr";
4.2335 ++ _M_data->_M_amonth05 = "May";
4.2336 ++ _M_data->_M_amonth06 = "Jun";
4.2337 ++ _M_data->_M_amonth07 = "Jul";
4.2338 ++ _M_data->_M_amonth08 = "Aug";
4.2339 ++ _M_data->_M_amonth09 = "Sep";
4.2340 ++ _M_data->_M_amonth10 = "Oct";
4.2341 ++ _M_data->_M_amonth11 = "Nov";
4.2342 ++ _M_data->_M_amonth12 = "Dec";
4.2343 ++ }
4.2344 ++ else
4.2345 ++ {
4.2346 ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
4.2347 ++
4.2348 ++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
4.2349 ++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
4.2350 ++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
4.2351 ++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
4.2352 ++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
4.2353 ++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
4.2354 ++ __cloc);
4.2355 ++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
4.2356 ++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
4.2357 ++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
4.2358 ++
4.2359 ++ // Day names, starting with "C"'s Sunday.
4.2360 ++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
4.2361 ++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
4.2362 ++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
4.2363 ++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
4.2364 ++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
4.2365 ++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
4.2366 ++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
4.2367 ++
4.2368 ++ // Abbreviated day names, starting with "C"'s Sun.
4.2369 ++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
4.2370 ++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
4.2371 ++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
4.2372 ++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
4.2373 ++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
4.2374 ++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
4.2375 ++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
4.2376 ++
4.2377 ++ // Month names, starting with "C"'s January.
4.2378 ++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
4.2379 ++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
4.2380 ++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
4.2381 ++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
4.2382 ++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
4.2383 ++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
4.2384 ++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
4.2385 ++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
4.2386 ++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
4.2387 ++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
4.2388 ++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
4.2389 ++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
4.2390 ++
4.2391 ++ // Abbreviated month names, starting with "C"'s Jan.
4.2392 ++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
4.2393 ++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
4.2394 ++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
4.2395 ++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
4.2396 ++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
4.2397 ++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
4.2398 ++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
4.2399 ++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
4.2400 ++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
4.2401 ++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
4.2402 ++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
4.2403 ++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
4.2404 ++ }
4.2405 ++ }
4.2406 ++
4.2407 ++#ifdef _GLIBCXX_USE_WCHAR_T
4.2408 ++ template<>
4.2409 ++ void
4.2410 ++ __timepunct<wchar_t>::
4.2411 ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
4.2412 ++ const tm* __tm) const
4.2413 ++ {
4.2414 ++#ifdef __UCLIBC_HAS_XLOCALE__
4.2415 ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
4.2416 ++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
4.2417 ++ _M_c_locale_timepunct);
4.2418 ++#else
4.2419 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
4.2420 ++ setlocale(LC_ALL, _M_name_timepunct);
4.2421 ++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
4.2422 ++ setlocale(LC_ALL, __old);
4.2423 ++ free(__old);
4.2424 ++#endif
4.2425 ++ // Make sure __s is null terminated.
4.2426 ++ if (__len == 0)
4.2427 ++ __s[0] = L'\0';
4.2428 ++ }
4.2429 ++
4.2430 ++ template<>
4.2431 ++ void
4.2432 ++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
4.2433 ++ {
4.2434 ++ if (!_M_data)
4.2435 ++ _M_data = new __timepunct_cache<wchar_t>;
4.2436 ++
4.2437 ++#warning wide time stuff
4.2438 ++// if (!__cloc)
4.2439 ++ {
4.2440 ++ // "C" locale
4.2441 ++ _M_c_locale_timepunct = _S_get_c_locale();
4.2442 ++
4.2443 ++ _M_data->_M_date_format = L"%m/%d/%y";
4.2444 ++ _M_data->_M_date_era_format = L"%m/%d/%y";
4.2445 ++ _M_data->_M_time_format = L"%H:%M:%S";
4.2446 ++ _M_data->_M_time_era_format = L"%H:%M:%S";
4.2447 ++ _M_data->_M_date_time_format = L"";
4.2448 ++ _M_data->_M_date_time_era_format = L"";
4.2449 ++ _M_data->_M_am = L"AM";
4.2450 ++ _M_data->_M_pm = L"PM";
4.2451 ++ _M_data->_M_am_pm_format = L"";
4.2452 ++
4.2453 ++ // Day names, starting with "C"'s Sunday.
4.2454 ++ _M_data->_M_day1 = L"Sunday";
4.2455 ++ _M_data->_M_day2 = L"Monday";
4.2456 ++ _M_data->_M_day3 = L"Tuesday";
4.2457 ++ _M_data->_M_day4 = L"Wednesday";
4.2458 ++ _M_data->_M_day5 = L"Thursday";
4.2459 ++ _M_data->_M_day6 = L"Friday";
4.2460 ++ _M_data->_M_day7 = L"Saturday";
4.2461 ++
4.2462 ++ // Abbreviated day names, starting with "C"'s Sun.
4.2463 ++ _M_data->_M_aday1 = L"Sun";
4.2464 ++ _M_data->_M_aday2 = L"Mon";
4.2465 ++ _M_data->_M_aday3 = L"Tue";
4.2466 ++ _M_data->_M_aday4 = L"Wed";
4.2467 ++ _M_data->_M_aday5 = L"Thu";
4.2468 ++ _M_data->_M_aday6 = L"Fri";
4.2469 ++ _M_data->_M_aday7 = L"Sat";
4.2470 ++
4.2471 ++ // Month names, starting with "C"'s January.
4.2472 ++ _M_data->_M_month01 = L"January";
4.2473 ++ _M_data->_M_month02 = L"February";
4.2474 ++ _M_data->_M_month03 = L"March";
4.2475 ++ _M_data->_M_month04 = L"April";
4.2476 ++ _M_data->_M_month05 = L"May";
4.2477 ++ _M_data->_M_month06 = L"June";
4.2478 ++ _M_data->_M_month07 = L"July";
4.2479 ++ _M_data->_M_month08 = L"August";
4.2480 ++ _M_data->_M_month09 = L"September";
4.2481 ++ _M_data->_M_month10 = L"October";
4.2482 ++ _M_data->_M_month11 = L"November";
4.2483 ++ _M_data->_M_month12 = L"December";
4.2484 ++
4.2485 ++ // Abbreviated month names, starting with "C"'s Jan.
4.2486 ++ _M_data->_M_amonth01 = L"Jan";
4.2487 ++ _M_data->_M_amonth02 = L"Feb";
4.2488 ++ _M_data->_M_amonth03 = L"Mar";
4.2489 ++ _M_data->_M_amonth04 = L"Apr";
4.2490 ++ _M_data->_M_amonth05 = L"May";
4.2491 ++ _M_data->_M_amonth06 = L"Jun";
4.2492 ++ _M_data->_M_amonth07 = L"Jul";
4.2493 ++ _M_data->_M_amonth08 = L"Aug";
4.2494 ++ _M_data->_M_amonth09 = L"Sep";
4.2495 ++ _M_data->_M_amonth10 = L"Oct";
4.2496 ++ _M_data->_M_amonth11 = L"Nov";
4.2497 ++ _M_data->_M_amonth12 = L"Dec";
4.2498 ++ }
4.2499 ++#if 0
4.2500 ++ else
4.2501 ++ {
4.2502 ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
4.2503 ++
4.2504 ++ union { char *__s; wchar_t *__w; } __u;
4.2505 ++
4.2506 ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
4.2507 ++ _M_data->_M_date_format = __u.__w;
4.2508 ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
4.2509 ++ _M_data->_M_date_era_format = __u.__w;
4.2510 ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
4.2511 ++ _M_data->_M_time_format = __u.__w;
4.2512 ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
4.2513 ++ _M_data->_M_time_era_format = __u.__w;
4.2514 ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
4.2515 ++ _M_data->_M_date_time_format = __u.__w;
4.2516 ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
4.2517 ++ _M_data->_M_date_time_era_format = __u.__w;
4.2518 ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
4.2519 ++ _M_data->_M_am = __u.__w;
4.2520 ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
4.2521 ++ _M_data->_M_pm = __u.__w;
4.2522 ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
4.2523 ++ _M_data->_M_am_pm_format = __u.__w;
4.2524 ++
4.2525 ++ // Day names, starting with "C"'s Sunday.
4.2526 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
4.2527 ++ _M_data->_M_day1 = __u.__w;
4.2528 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
4.2529 ++ _M_data->_M_day2 = __u.__w;
4.2530 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
4.2531 ++ _M_data->_M_day3 = __u.__w;
4.2532 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
4.2533 ++ _M_data->_M_day4 = __u.__w;
4.2534 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
4.2535 ++ _M_data->_M_day5 = __u.__w;
4.2536 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
4.2537 ++ _M_data->_M_day6 = __u.__w;
4.2538 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
4.2539 ++ _M_data->_M_day7 = __u.__w;
4.2540 ++
4.2541 ++ // Abbreviated day names, starting with "C"'s Sun.
4.2542 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
4.2543 ++ _M_data->_M_aday1 = __u.__w;
4.2544 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
4.2545 ++ _M_data->_M_aday2 = __u.__w;
4.2546 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
4.2547 ++ _M_data->_M_aday3 = __u.__w;
4.2548 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
4.2549 ++ _M_data->_M_aday4 = __u.__w;
4.2550 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
4.2551 ++ _M_data->_M_aday5 = __u.__w;
4.2552 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
4.2553 ++ _M_data->_M_aday6 = __u.__w;
4.2554 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
4.2555 ++ _M_data->_M_aday7 = __u.__w;
4.2556 ++
4.2557 ++ // Month names, starting with "C"'s January.
4.2558 ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
4.2559 ++ _M_data->_M_month01 = __u.__w;
4.2560 ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
4.2561 ++ _M_data->_M_month02 = __u.__w;
4.2562 ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
4.2563 ++ _M_data->_M_month03 = __u.__w;
4.2564 ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
4.2565 ++ _M_data->_M_month04 = __u.__w;
4.2566 ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
4.2567 ++ _M_data->_M_month05 = __u.__w;
4.2568 ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
4.2569 ++ _M_data->_M_month06 = __u.__w;
4.2570 ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
4.2571 ++ _M_data->_M_month07 = __u.__w;
4.2572 ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
4.2573 ++ _M_data->_M_month08 = __u.__w;
4.2574 ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
4.2575 ++ _M_data->_M_month09 = __u.__w;
4.2576 ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
4.2577 ++ _M_data->_M_month10 = __u.__w;
4.2578 ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
4.2579 ++ _M_data->_M_month11 = __u.__w;
4.2580 ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
4.2581 ++ _M_data->_M_month12 = __u.__w;
4.2582 ++
4.2583 ++ // Abbreviated month names, starting with "C"'s Jan.
4.2584 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
4.2585 ++ _M_data->_M_amonth01 = __u.__w;
4.2586 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
4.2587 ++ _M_data->_M_amonth02 = __u.__w;
4.2588 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
4.2589 ++ _M_data->_M_amonth03 = __u.__w;
4.2590 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
4.2591 ++ _M_data->_M_amonth04 = __u.__w;
4.2592 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
4.2593 ++ _M_data->_M_amonth05 = __u.__w;
4.2594 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
4.2595 ++ _M_data->_M_amonth06 = __u.__w;
4.2596 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
4.2597 ++ _M_data->_M_amonth07 = __u.__w;
4.2598 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
4.2599 ++ _M_data->_M_amonth08 = __u.__w;
4.2600 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
4.2601 ++ _M_data->_M_amonth09 = __u.__w;
4.2602 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
4.2603 ++ _M_data->_M_amonth10 = __u.__w;
4.2604 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
4.2605 ++ _M_data->_M_amonth11 = __u.__w;
4.2606 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
4.2607 ++ _M_data->_M_amonth12 = __u.__w;
4.2608 ++ }
4.2609 ++#endif // 0
4.2610 ++ }
4.2611 ++#endif
4.2612 ++}
4.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
4.2614 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100
4.2615 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200
4.2616 +@@ -0,0 +1,68 @@
4.2617 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
4.2618 ++
4.2619 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4.2620 ++//
4.2621 ++// This file is part of the GNU ISO C++ Library. This library is free
4.2622 ++// software; you can redistribute it and/or modify it under the
4.2623 ++// terms of the GNU General Public License as published by the
4.2624 ++// Free Software Foundation; either version 2, or (at your option)
4.2625 ++// any later version.
4.2626 ++
4.2627 ++// This library is distributed in the hope that it will be useful,
4.2628 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
4.2629 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.2630 ++// GNU General Public License for more details.
4.2631 ++
4.2632 ++// You should have received a copy of the GNU General Public License along
4.2633 ++// with this library; see the file COPYING. If not, write to the Free
4.2634 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
4.2635 ++// USA.
4.2636 ++
4.2637 ++// As a special exception, you may use this file as part of a free software
4.2638 ++// library without restriction. Specifically, if other files instantiate
4.2639 ++// templates or use macros or inline functions from this file, or you compile
4.2640 ++// this file and link it with other files to produce an executable, this
4.2641 ++// file does not by itself cause the resulting executable to be covered by
4.2642 ++// the GNU General Public License. This exception does not however
4.2643 ++// invalidate any other reasons why the executable file might be covered by
4.2644 ++// the GNU General Public License.
4.2645 ++
4.2646 ++//
4.2647 ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions
4.2648 ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions
4.2649 ++//
4.2650 ++
4.2651 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
4.2652 ++
4.2653 ++ template<typename _CharT>
4.2654 ++ __timepunct<_CharT>::__timepunct(size_t __refs)
4.2655 ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
4.2656 ++ _M_name_timepunct(_S_get_c_name())
4.2657 ++ { _M_initialize_timepunct(); }
4.2658 ++
4.2659 ++ template<typename _CharT>
4.2660 ++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
4.2661 ++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
4.2662 ++ _M_name_timepunct(_S_get_c_name())
4.2663 ++ { _M_initialize_timepunct(); }
4.2664 ++
4.2665 ++ template<typename _CharT>
4.2666 ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
4.2667 ++ size_t __refs)
4.2668 ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
4.2669 ++ _M_name_timepunct(__s)
4.2670 ++ {
4.2671 ++ char* __tmp = new char[std::strlen(__s) + 1];
4.2672 ++ std::strcpy(__tmp, __s);
4.2673 ++ _M_name_timepunct = __tmp;
4.2674 ++ _M_initialize_timepunct(__cloc);
4.2675 ++ }
4.2676 ++
4.2677 ++ template<typename _CharT>
4.2678 ++ __timepunct<_CharT>::~__timepunct()
4.2679 ++ {
4.2680 ++ if (_M_name_timepunct != _S_get_c_name())
4.2681 ++ delete [] _M_name_timepunct;
4.2682 ++ delete _M_data;
4.2683 ++ _S_destroy_c_locale(_M_c_locale_timepunct);
4.2684 ++ }
4.2685 +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
4.2686 +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200
4.2687 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200
4.2688 +@@ -5769,7 +5769,7 @@
4.2689 + enableval="$enable_clocale"
4.2690 +
4.2691 + case "$enableval" in
4.2692 +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
4.2693 ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
4.2694 + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
4.2695 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
4.2696 + { (exit 1); exit 1; }; } ;;
4.2697 +@@ -5802,6 +5802,9 @@
4.2698 + # Default to "generic".
4.2699 + if test $enable_clocale_flag = auto; then
4.2700 + case ${target_os} in
4.2701 ++ linux-uclibc*)
4.2702 ++ enable_clocale_flag=uclibc
4.2703 ++ ;;
4.2704 + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
4.2705 + enable_clocale_flag=gnu
4.2706 + ;;
4.2707 +@@ -6190,6 +6193,76 @@
4.2708 + CTIME_CC=config/locale/generic/time_members.cc
4.2709 + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
4.2710 + ;;
4.2711 ++ uclibc)
4.2712 ++ echo "$as_me:$LINENO: result: uclibc" >&5
4.2713 ++echo "${ECHO_T}uclibc" >&6
4.2714 ++
4.2715 ++ # Declare intention to use gettext, and add support for specific
4.2716 ++ # languages.
4.2717 ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
4.2718 ++ ALL_LINGUAS="de fr"
4.2719 ++
4.2720 ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
4.2721 ++ # Extract the first word of "msgfmt", so it can be a program name with args.
4.2722 ++set dummy msgfmt; ac_word=$2
4.2723 ++echo "$as_me:$LINENO: checking for $ac_word" >&5
4.2724 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
4.2725 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then
4.2726 ++ echo $ECHO_N "(cached) $ECHO_C" >&6
4.2727 ++else
4.2728 ++ if test -n "$check_msgfmt"; then
4.2729 ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
4.2730 ++else
4.2731 ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4.2732 ++for as_dir in $PATH
4.2733 ++do
4.2734 ++ IFS=$as_save_IFS
4.2735 ++ test -z "$as_dir" && as_dir=.
4.2736 ++ for ac_exec_ext in '' $ac_executable_extensions; do
4.2737 ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
4.2738 ++ ac_cv_prog_check_msgfmt="yes"
4.2739 ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
4.2740 ++ break 2
4.2741 ++ fi
4.2742 ++done
4.2743 ++done
4.2744 ++
4.2745 ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
4.2746 ++fi
4.2747 ++fi
4.2748 ++check_msgfmt=$ac_cv_prog_check_msgfmt
4.2749 ++if test -n "$check_msgfmt"; then
4.2750 ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
4.2751 ++echo "${ECHO_T}$check_msgfmt" >&6
4.2752 ++else
4.2753 ++ echo "$as_me:$LINENO: result: no" >&5
4.2754 ++echo "${ECHO_T}no" >&6
4.2755 ++fi
4.2756 ++
4.2757 ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
4.2758 ++ USE_NLS=yes
4.2759 ++ fi
4.2760 ++ # Export the build objects.
4.2761 ++ for ling in $ALL_LINGUAS; do \
4.2762 ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
4.2763 ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
4.2764 ++ done
4.2765 ++
4.2766 ++
4.2767 ++
4.2768 ++ CLOCALE_H=config/locale/uclibc/c_locale.h
4.2769 ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
4.2770 ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
4.2771 ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
4.2772 ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
4.2773 ++ CMESSAGES_H=config/locale/uclibc/messages_members.h
4.2774 ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
4.2775 ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
4.2776 ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
4.2777 ++ CTIME_H=config/locale/uclibc/time_members.h
4.2778 ++ CTIME_CC=config/locale/uclibc/time_members.cc
4.2779 ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
4.2780 ++ ;;
4.2781 + esac
4.2782 +
4.2783 + # This is where the testsuite looks for locale catalogs, using the
4.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
4.2785 +--- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200
4.2786 ++++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200
4.2787 +@@ -101,7 +101,9 @@
4.2788 + using std::wmemcpy;
4.2789 + using std::wmemmove;
4.2790 + using std::wmemset;
4.2791 ++#if _GLIBCXX_HAVE_WCSFTIME
4.2792 + using std::wcsftime;
4.2793 ++#endif
4.2794 +
4.2795 + #if _GLIBCXX_USE_C99
4.2796 + using std::wcstold;
4.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
4.2798 +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100
4.2799 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200
4.2800 +@@ -182,7 +182,9 @@
4.2801 + using ::wcscoll;
4.2802 + using ::wcscpy;
4.2803 + using ::wcscspn;
4.2804 ++#if _GLIBCXX_HAVE_WCSFTIME
4.2805 + using ::wcsftime;
4.2806 ++#endif
4.2807 + using ::wcslen;
4.2808 + using ::wcsncat;
4.2809 + using ::wcsncmp;
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/patches/gcc/4.2.4/203-uclibc-locale-no__x.patch Sat Jul 19 12:17:26 2008 +0000
5.3 @@ -0,0 +1,223 @@
5.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
5.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200
5.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200
5.7 +@@ -39,20 +39,6 @@
5.8 + #include <langinfo.h>
5.9 + #include <bits/c++locale_internal.h>
5.10 +
5.11 +-#ifndef __UCLIBC_HAS_XLOCALE__
5.12 +-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
5.13 +-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
5.14 +-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
5.15 +-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
5.16 +-#define __strtof_l(S, E, L) strtof((S), (E))
5.17 +-#define __strtod_l(S, E, L) strtod((S), (E))
5.18 +-#define __strtold_l(S, E, L) strtold((S), (E))
5.19 +-#warning should dummy __newlocale check for C|POSIX ?
5.20 +-#define __newlocale(a, b, c) NULL
5.21 +-#define __freelocale(a) ((void)0)
5.22 +-#define __duplocale(a) __c_locale()
5.23 +-#endif
5.24 +-
5.25 + namespace std
5.26 + {
5.27 + template<>
5.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
5.29 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200
5.30 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200
5.31 +@@ -68,6 +68,7 @@
5.32 + {
5.33 + extern "C" __typeof(uselocale) __uselocale;
5.34 + }
5.35 ++#define __uselocale uselocale
5.36 + #endif
5.37 +
5.38 + namespace std
5.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
5.40 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200
5.41 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:53.000000000 +0200
5.42 +@@ -60,4 +60,49 @@
5.43 + extern "C" __typeof(wctype_l) __wctype_l;
5.44 + #endif
5.45 +
5.46 ++# define __nl_langinfo_l nl_langinfo_l
5.47 ++# define __strcoll_l strcoll_l
5.48 ++# define __strftime_l strftime_l
5.49 ++# define __strtod_l strtod_l
5.50 ++# define __strtof_l strtof_l
5.51 ++# define __strtold_l strtold_l
5.52 ++# define __strxfrm_l strxfrm_l
5.53 ++# define __newlocale newlocale
5.54 ++# define __freelocale freelocale
5.55 ++# define __duplocale duplocale
5.56 ++# define __uselocale uselocale
5.57 ++
5.58 ++# ifdef _GLIBCXX_USE_WCHAR_T
5.59 ++# define __iswctype_l iswctype_l
5.60 ++# define __towlower_l towlower_l
5.61 ++# define __towupper_l towupper_l
5.62 ++# define __wcscoll_l wcscoll_l
5.63 ++# define __wcsftime_l wcsftime_l
5.64 ++# define __wcsxfrm_l wcsxfrm_l
5.65 ++# define __wctype_l wctype_l
5.66 ++# endif
5.67 ++
5.68 ++#else
5.69 ++# define __nl_langinfo_l(N, L) nl_langinfo((N))
5.70 ++# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
5.71 ++# define __strtod_l(S, E, L) strtod((S), (E))
5.72 ++# define __strtof_l(S, E, L) strtof((S), (E))
5.73 ++# define __strtold_l(S, E, L) strtold((S), (E))
5.74 ++# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
5.75 ++# warning should dummy __newlocale check for C|POSIX ?
5.76 ++# define __newlocale(a, b, c) NULL
5.77 ++# define __freelocale(a) ((void)0)
5.78 ++# define __duplocale(a) __c_locale()
5.79 ++//# define __uselocale ?
5.80 ++//
5.81 ++# ifdef _GLIBCXX_USE_WCHAR_T
5.82 ++# define __iswctype_l(C, M, L) iswctype((C), (M))
5.83 ++# define __towlower_l(C, L) towlower((C))
5.84 ++# define __towupper_l(C, L) towupper((C))
5.85 ++# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
5.86 ++//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
5.87 ++# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
5.88 ++# define __wctype_l(S, L) wctype((S))
5.89 ++# endif
5.90 ++
5.91 + #endif // GLIBC 2.3 and later
5.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
5.93 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200
5.94 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:53.000000000 +0200
5.95 +@@ -36,13 +36,6 @@
5.96 + #include <locale>
5.97 + #include <bits/c++locale_internal.h>
5.98 +
5.99 +-#ifndef __UCLIBC_HAS_XLOCALE__
5.100 +-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
5.101 +-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
5.102 +-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
5.103 +-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
5.104 +-#endif
5.105 +-
5.106 + namespace std
5.107 + {
5.108 + // These are basically extensions to char_traits, and perhaps should
5.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
5.110 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200
5.111 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200
5.112 +@@ -38,13 +38,6 @@
5.113 + #undef _LIBC
5.114 + #include <bits/c++locale_internal.h>
5.115 +
5.116 +-#ifndef __UCLIBC_HAS_XLOCALE__
5.117 +-#define __wctype_l(S, L) wctype((S))
5.118 +-#define __towupper_l(C, L) towupper((C))
5.119 +-#define __towlower_l(C, L) towlower((C))
5.120 +-#define __iswctype_l(C, M, L) iswctype((C), (M))
5.121 +-#endif
5.122 +-
5.123 + namespace std
5.124 + {
5.125 + // NB: The other ctype<char> specializations are in src/locale.cc and
5.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
5.127 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200
5.128 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:53.000000000 +0200
5.129 +@@ -39,13 +39,10 @@
5.130 + #ifdef __UCLIBC_MJN3_ONLY__
5.131 + #warning fix gettext stuff
5.132 + #endif
5.133 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
5.134 +-extern "C" char *__dcgettext(const char *domainname,
5.135 +- const char *msgid, int category);
5.136 + #undef gettext
5.137 +-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
5.138 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
5.139 ++#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
5.140 + #else
5.141 +-#undef gettext
5.142 + #define gettext(msgid) (msgid)
5.143 + #endif
5.144 +
5.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
5.146 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200
5.147 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200
5.148 +@@ -36,15 +36,11 @@
5.149 + #ifdef __UCLIBC_MJN3_ONLY__
5.150 + #warning fix prototypes for *textdomain funcs
5.151 + #endif
5.152 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
5.153 +-extern "C" char *__textdomain(const char *domainname);
5.154 +-extern "C" char *__bindtextdomain(const char *domainname,
5.155 +- const char *dirname);
5.156 +-#else
5.157 +-#undef __textdomain
5.158 +-#undef __bindtextdomain
5.159 +-#define __textdomain(D) ((void)0)
5.160 +-#define __bindtextdomain(D,P) ((void)0)
5.161 ++#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
5.162 ++#undef textdomain
5.163 ++#undef bindtextdomain
5.164 ++#define textdomain(D) ((void)0)
5.165 ++#define bindtextdomain(D,P) ((void)0)
5.166 + #endif
5.167 +
5.168 + // Non-virtual member functions.
5.169 +@@ -70,7 +66,7 @@
5.170 + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
5.171 + const char* __dir) const
5.172 + {
5.173 +- __bindtextdomain(__s.c_str(), __dir);
5.174 ++ bindtextdomain(__s.c_str(), __dir);
5.175 + return this->do_open(__s, __loc);
5.176 + }
5.177 +
5.178 +@@ -90,7 +86,7 @@
5.179 + {
5.180 + // No error checking is done, assume the catalog exists and can
5.181 + // be used.
5.182 +- __textdomain(__s.c_str());
5.183 ++ textdomain(__s.c_str());
5.184 + return 0;
5.185 + }
5.186 +
5.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
5.188 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200
5.189 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200
5.190 +@@ -43,10 +43,6 @@
5.191 + #warning tailor for stub locale support
5.192 + #endif
5.193 +
5.194 +-#ifndef __UCLIBC_HAS_XLOCALE__
5.195 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
5.196 +-#endif
5.197 +-
5.198 + namespace std
5.199 + {
5.200 + // Construct and return valid pattern consisting of some combination of:
5.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
5.202 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200
5.203 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200
5.204 +@@ -41,9 +41,6 @@
5.205 + #ifdef __UCLIBC_MJN3_ONLY__
5.206 + #warning tailor for stub locale support
5.207 + #endif
5.208 +-#ifndef __UCLIBC_HAS_XLOCALE__
5.209 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
5.210 +-#endif
5.211 +
5.212 + namespace std
5.213 + {
5.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
5.215 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200
5.216 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:53.000000000 +0200
5.217 +@@ -40,9 +40,6 @@
5.218 + #ifdef __UCLIBC_MJN3_ONLY__
5.219 + #warning tailor for stub locale support
5.220 + #endif
5.221 +-#ifndef __UCLIBC_HAS_XLOCALE__
5.222 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
5.223 +-#endif
5.224 +
5.225 + namespace std
5.226 + {
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/patches/gcc/4.2.4/204-uclibc-locale-wchar_fix.patch Sat Jul 19 12:17:26 2008 +0000
6.3 @@ -0,0 +1,50 @@
6.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
6.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:53.000000000 +0200
6.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200
6.7 +@@ -401,7 +401,7 @@
6.8 + # ifdef __UCLIBC_HAS_XLOCALE__
6.9 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
6.10 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
6.11 +-# else
6.12 ++# elif defined __UCLIBC_HAS_LOCALE__
6.13 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
6.14 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
6.15 + # endif
6.16 +@@ -556,7 +556,7 @@
6.17 + # ifdef __UCLIBC_HAS_XLOCALE__
6.18 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
6.19 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
6.20 +-# else
6.21 ++# elif defined __UCLIBC_HAS_LOCALE__
6.22 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
6.23 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
6.24 + # endif
6.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
6.26 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:53.000000000 +0200
6.27 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200
6.28 +@@ -127,12 +127,25 @@
6.29 + {
6.30 + // Named locale.
6.31 + // NB: In the GNU model wchar_t is always 32 bit wide.
6.32 ++#ifdef __UCLIBC_MJN3_ONLY__
6.33 ++#warning fix this... should be numeric
6.34 ++#endif
6.35 ++#ifdef __UCLIBC__
6.36 ++# ifdef __UCLIBC_HAS_XLOCALE__
6.37 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
6.38 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
6.39 ++# elif defined __UCLIBC_HAS_LOCALE__
6.40 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
6.41 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
6.42 ++# endif
6.43 ++#else
6.44 + union { char *__s; wchar_t __w; } __u;
6.45 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
6.46 + _M_data->_M_decimal_point = __u.__w;
6.47 +
6.48 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
6.49 + _M_data->_M_thousands_sep = __u.__w;
6.50 ++#endif
6.51 +
6.52 + if (_M_data->_M_thousands_sep == L'\0')
6.53 + _M_data->_M_grouping = "";
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/patches/gcc/4.2.4/205-uclibc-locale-update.patch Sat Jul 19 12:17:26 2008 +0000
7.3 @@ -0,0 +1,354 @@
7.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
7.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:53.000000000 +0200
7.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:31:54.000000000 +0200
7.7 +@@ -46,16 +46,13 @@
7.8 + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
7.9 + const __c_locale& __cloc)
7.10 + {
7.11 +- if (!(__err & ios_base::failbit))
7.12 +- {
7.13 +- char* __sanity;
7.14 +- errno = 0;
7.15 +- float __f = __strtof_l(__s, &__sanity, __cloc);
7.16 +- if (__sanity != __s && errno != ERANGE)
7.17 +- __v = __f;
7.18 +- else
7.19 +- __err |= ios_base::failbit;
7.20 +- }
7.21 ++ char* __sanity;
7.22 ++ errno = 0;
7.23 ++ float __f = __strtof_l(__s, &__sanity, __cloc);
7.24 ++ if (__sanity != __s && errno != ERANGE)
7.25 ++ __v = __f;
7.26 ++ else
7.27 ++ __err |= ios_base::failbit;
7.28 + }
7.29 +
7.30 + template<>
7.31 +@@ -63,16 +60,13 @@
7.32 + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
7.33 + const __c_locale& __cloc)
7.34 + {
7.35 +- if (!(__err & ios_base::failbit))
7.36 +- {
7.37 +- char* __sanity;
7.38 +- errno = 0;
7.39 +- double __d = __strtod_l(__s, &__sanity, __cloc);
7.40 +- if (__sanity != __s && errno != ERANGE)
7.41 +- __v = __d;
7.42 +- else
7.43 +- __err |= ios_base::failbit;
7.44 +- }
7.45 ++ char* __sanity;
7.46 ++ errno = 0;
7.47 ++ double __d = __strtod_l(__s, &__sanity, __cloc);
7.48 ++ if (__sanity != __s && errno != ERANGE)
7.49 ++ __v = __d;
7.50 ++ else
7.51 ++ __err |= ios_base::failbit;
7.52 + }
7.53 +
7.54 + template<>
7.55 +@@ -80,16 +74,13 @@
7.56 + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
7.57 + const __c_locale& __cloc)
7.58 + {
7.59 +- if (!(__err & ios_base::failbit))
7.60 +- {
7.61 +- char* __sanity;
7.62 +- errno = 0;
7.63 +- long double __ld = __strtold_l(__s, &__sanity, __cloc);
7.64 +- if (__sanity != __s && errno != ERANGE)
7.65 +- __v = __ld;
7.66 +- else
7.67 +- __err |= ios_base::failbit;
7.68 +- }
7.69 ++ char* __sanity;
7.70 ++ errno = 0;
7.71 ++ long double __ld = __strtold_l(__s, &__sanity, __cloc);
7.72 ++ if (__sanity != __s && errno != ERANGE)
7.73 ++ __v = __ld;
7.74 ++ else
7.75 ++ __err |= ios_base::failbit;
7.76 + }
7.77 +
7.78 + void
7.79 +@@ -110,7 +101,7 @@
7.80 + void
7.81 + locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
7.82 + {
7.83 +- if (_S_get_c_locale() != __cloc)
7.84 ++ if (__cloc && _S_get_c_locale() != __cloc)
7.85 + __freelocale(__cloc);
7.86 + }
7.87 +
7.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
7.89 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:53.000000000 +0200
7.90 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:31:54.000000000 +0200
7.91 +@@ -39,21 +39,23 @@
7.92 + #pragma GCC system_header
7.93 +
7.94 + #include <cstring> // get std::strlen
7.95 +-#include <cstdio> // get std::snprintf or std::sprintf
7.96 ++#include <cstdio> // get std::vsnprintf or std::vsprintf
7.97 + #include <clocale>
7.98 + #include <langinfo.h> // For codecvt
7.99 + #ifdef __UCLIBC_MJN3_ONLY__
7.100 + #warning fix this
7.101 + #endif
7.102 +-#ifdef __UCLIBC_HAS_LOCALE__
7.103 ++#ifdef _GLIBCXX_USE_ICONV
7.104 + #include <iconv.h> // For codecvt using iconv, iconv_t
7.105 + #endif
7.106 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
7.107 +-#include <libintl.h> // For messages
7.108 ++#ifdef HAVE_LIBINTL_H
7.109 ++#include <libintl.h> // For messages
7.110 + #endif
7.111 ++#include <cstdarg>
7.112 +
7.113 + #ifdef __UCLIBC_MJN3_ONLY__
7.114 + #warning what is _GLIBCXX_C_LOCALE_GNU for
7.115 ++// psm: used in os/gnu-linux/ctype_noninline.h
7.116 + #endif
7.117 + #define _GLIBCXX_C_LOCALE_GNU 1
7.118 +
7.119 +@@ -62,7 +64,7 @@
7.120 + #endif
7.121 + // #define _GLIBCXX_NUM_CATEGORIES 6
7.122 + #define _GLIBCXX_NUM_CATEGORIES 0
7.123 +-
7.124 ++
7.125 + #ifdef __UCLIBC_HAS_XLOCALE__
7.126 + namespace __gnu_cxx
7.127 + {
7.128 +@@ -79,22 +81,24 @@
7.129 + typedef int* __c_locale;
7.130 + #endif
7.131 +
7.132 +- // Convert numeric value of type _Tv to string and return length of
7.133 +- // string. If snprintf is available use it, otherwise fall back to
7.134 +- // the unsafe sprintf which, in general, can be dangerous and should
7.135 ++ // Convert numeric value of type double to string and return length of
7.136 ++ // string. If vsnprintf is available use it, otherwise fall back to
7.137 ++ // the unsafe vsprintf which, in general, can be dangerous and should
7.138 + // be avoided.
7.139 +- template<typename _Tv>
7.140 +- int
7.141 +- __convert_from_v(char* __out,
7.142 +- const int __size __attribute__ ((__unused__)),
7.143 +- const char* __fmt,
7.144 +-#ifdef __UCLIBC_HAS_XCLOCALE__
7.145 +- _Tv __v, const __c_locale& __cloc, int __prec)
7.146 ++ inline int
7.147 ++ __convert_from_v(const __c_locale&
7.148 ++#ifndef __UCLIBC_HAS_XCLOCALE__
7.149 ++ __cloc __attribute__ ((__unused__))
7.150 ++#endif
7.151 ++ ,
7.152 ++ char* __out,
7.153 ++ const int __size,
7.154 ++ const char* __fmt, ...)
7.155 + {
7.156 ++ va_list __args;
7.157 ++#ifdef __UCLIBC_HAS_XCLOCALE__
7.158 + __c_locale __old = __gnu_cxx::__uselocale(__cloc);
7.159 + #else
7.160 +- _Tv __v, const __c_locale&, int __prec)
7.161 +- {
7.162 + # ifdef __UCLIBC_HAS_LOCALE__
7.163 + char* __old = std::setlocale(LC_ALL, NULL);
7.164 + char* __sav = new char[std::strlen(__old) + 1];
7.165 +@@ -103,7 +107,9 @@
7.166 + # endif
7.167 + #endif
7.168 +
7.169 +- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
7.170 ++ va_start(__args, __fmt);
7.171 ++ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
7.172 ++ va_end(__args);
7.173 +
7.174 + #ifdef __UCLIBC_HAS_XCLOCALE__
7.175 + __gnu_cxx::__uselocale(__old);
7.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
7.177 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:53.000000000 +0200
7.178 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:31:54.000000000 +0200
7.179 +@@ -33,9 +33,14 @@
7.180 +
7.181 + // Written by Benjamin Kosnik <bkoz@redhat.com>
7.182 +
7.183 ++#include <features.h>
7.184 ++#ifdef __UCLIBC_HAS_LOCALE__
7.185 + #define _LIBC
7.186 + #include <locale>
7.187 + #undef _LIBC
7.188 ++#else
7.189 ++#include <locale>
7.190 ++#endif
7.191 + #include <bits/c++locale_internal.h>
7.192 +
7.193 + namespace std
7.194 +@@ -138,20 +143,34 @@
7.195 + ctype<wchar_t>::
7.196 + do_is(mask __m, wchar_t __c) const
7.197 + {
7.198 +- // Highest bitmask in ctype_base == 10, but extra in "C"
7.199 +- // library for blank.
7.200 ++ // The case of __m == ctype_base::space is particularly important,
7.201 ++ // due to its use in many istream functions. Therefore we deal with
7.202 ++ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
7.203 ++ // is the mask corresponding to ctype_base::space. NB: an encoding
7.204 ++ // change would not affect correctness!
7.205 + bool __ret = false;
7.206 +- const size_t __bitmasksize = 11;
7.207 +- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
7.208 +- if (__m & _M_bit[__bitcur]
7.209 +- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
7.210 +- {
7.211 +- __ret = true;
7.212 +- break;
7.213 +- }
7.214 ++ if (__m == _M_bit[5])
7.215 ++ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
7.216 ++ else
7.217 ++ {
7.218 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
7.219 ++ // library for blank.
7.220 ++ const size_t __bitmasksize = 11;
7.221 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
7.222 ++ if (__m & _M_bit[__bitcur])
7.223 ++ {
7.224 ++ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
7.225 ++ {
7.226 ++ __ret = true;
7.227 ++ break;
7.228 ++ }
7.229 ++ else if (__m == _M_bit[__bitcur])
7.230 ++ break;
7.231 ++ }
7.232 ++ }
7.233 + return __ret;
7.234 + }
7.235 +-
7.236 ++
7.237 + const wchar_t*
7.238 + ctype<wchar_t>::
7.239 + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
7.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
7.241 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:53.000000000 +0200
7.242 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200
7.243 +@@ -47,18 +47,21 @@
7.244 + template<typename _CharT>
7.245 + messages<_CharT>::messages(size_t __refs)
7.246 + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
7.247 +- _M_name_messages(_S_get_c_name())
7.248 ++ _M_name_messages(_S_get_c_name())
7.249 + { }
7.250 +
7.251 + template<typename _CharT>
7.252 + messages<_CharT>::messages(__c_locale __cloc, const char* __s,
7.253 + size_t __refs)
7.254 +- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
7.255 +- _M_name_messages(__s)
7.256 ++ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
7.257 + {
7.258 +- char* __tmp = new char[std::strlen(__s) + 1];
7.259 +- std::strcpy(__tmp, __s);
7.260 ++ const size_t __len = std::strlen(__s) + 1;
7.261 ++ char* __tmp = new char[__len];
7.262 ++ std::memcpy(__tmp, __s, __len);
7.263 + _M_name_messages = __tmp;
7.264 ++
7.265 ++ // Last to avoid leaking memory if new throws.
7.266 ++ _M_c_locale_messages = _S_clone_c_locale(__cloc);
7.267 + }
7.268 +
7.269 + template<typename _CharT>
7.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
7.271 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:24.000000000 +0200
7.272 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:31:54.000000000 +0200
7.273 +@@ -33,9 +33,14 @@
7.274 +
7.275 + // Written by Benjamin Kosnik <bkoz@redhat.com>
7.276 +
7.277 ++#include <features.h>
7.278 ++#ifdef __UCLIBC_HAS_LOCALE__
7.279 + #define _LIBC
7.280 + #include <locale>
7.281 + #undef _LIBC
7.282 ++#else
7.283 ++#include <locale>
7.284 ++#endif
7.285 + #include <bits/c++locale_internal.h>
7.286 +
7.287 + #ifdef __UCLIBC_MJN3_ONLY__
7.288 +@@ -206,7 +211,7 @@
7.289 + }
7.290 + break;
7.291 + default:
7.292 +- ;
7.293 ++ __ret = pattern();
7.294 + }
7.295 + return __ret;
7.296 + }
7.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
7.298 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:24.000000000 +0200
7.299 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:31:54.000000000 +0200
7.300 +@@ -33,9 +33,14 @@
7.301 +
7.302 + // Written by Benjamin Kosnik <bkoz@redhat.com>
7.303 +
7.304 ++#include <features.h>
7.305 ++#ifdef __UCLIBC_HAS_LOCALE__
7.306 + #define _LIBC
7.307 + #include <locale>
7.308 + #undef _LIBC
7.309 ++#else
7.310 ++#include <locale>
7.311 ++#endif
7.312 + #include <bits/c++locale_internal.h>
7.313 +
7.314 + #ifdef __UCLIBC_MJN3_ONLY__
7.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
7.316 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200
7.317 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200
7.318 +@@ -37,25 +37,33 @@
7.319 + template<typename _CharT>
7.320 + __timepunct<_CharT>::__timepunct(size_t __refs)
7.321 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
7.322 +- _M_name_timepunct(_S_get_c_name())
7.323 ++ _M_name_timepunct(_S_get_c_name())
7.324 + { _M_initialize_timepunct(); }
7.325 +
7.326 + template<typename _CharT>
7.327 + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
7.328 + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
7.329 +- _M_name_timepunct(_S_get_c_name())
7.330 ++ _M_name_timepunct(_S_get_c_name())
7.331 + { _M_initialize_timepunct(); }
7.332 +
7.333 + template<typename _CharT>
7.334 + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
7.335 + size_t __refs)
7.336 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
7.337 +- _M_name_timepunct(__s)
7.338 ++ _M_name_timepunct(NULL)
7.339 + {
7.340 +- char* __tmp = new char[std::strlen(__s) + 1];
7.341 +- std::strcpy(__tmp, __s);
7.342 ++ const size_t __len = std::strlen(__s) + 1;
7.343 ++ char* __tmp = new char[__len];
7.344 ++ std::memcpy(__tmp, __s, __len);
7.345 + _M_name_timepunct = __tmp;
7.346 +- _M_initialize_timepunct(__cloc);
7.347 ++
7.348 ++ try
7.349 ++ { _M_initialize_timepunct(__cloc); }
7.350 ++ catch(...)
7.351 ++ {
7.352 ++ delete [] _M_name_timepunct;
7.353 ++ __throw_exception_again;
7.354 ++ }
7.355 + }
7.356 +
7.357 + template<typename _CharT>
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/patches/gcc/4.2.4/300-libstdc++-pic.patch Sat Jul 19 12:17:26 2008 +0000
8.3 @@ -0,0 +1,50 @@
8.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am gcc-4.2.1/libstdc++-v3/src/Makefile.am
8.5 +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.am 2006-07-28 06:57:34.000000000 +0200
8.6 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.am 2007-08-03 20:32:27.000000000 +0200
8.7 +@@ -257,6 +257,12 @@
8.8 + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
8.9 +
8.10 +
8.11 ++install-exec-local:
8.12 ++ifeq ($(enable_shared),yes)
8.13 ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
8.14 ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
8.15 ++endif
8.16 ++
8.17 + # Added bits to build debug library.
8.18 + if GLIBCXX_BUILD_DEBUG
8.19 + all-local: build_debug
8.20 +diff -durN gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in gcc-4.2.1/libstdc++-v3/src/Makefile.in
8.21 +--- gcc-4.2.1.orig/libstdc++-v3/src/Makefile.in 2006-10-16 21:08:22.000000000 +0200
8.22 ++++ gcc-4.2.1/libstdc++-v3/src/Makefile.in 2007-08-03 20:32:27.000000000 +0200
8.23 +@@ -657,7 +657,7 @@
8.24 +
8.25 + install-data-am: install-data-local
8.26 +
8.27 +-install-exec-am: install-toolexeclibLTLIBRARIES
8.28 ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
8.29 +
8.30 + install-info: install-info-am
8.31 +
8.32 +@@ -690,6 +690,7 @@
8.33 + distclean-libtool distclean-tags distdir dvi dvi-am html \
8.34 + html-am info info-am install install-am install-data \
8.35 + install-data-am install-data-local install-exec \
8.36 ++ install-exec-local \
8.37 + install-exec-am install-info install-info-am install-man \
8.38 + install-strip install-toolexeclibLTLIBRARIES installcheck \
8.39 + installcheck-am installdirs maintainer-clean \
8.40 +@@ -799,6 +800,13 @@
8.41 + install_debug:
8.42 + (cd ${debugdir} && $(MAKE) \
8.43 + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
8.44 ++
8.45 ++install-exec-local:
8.46 ++ifeq ($(enable_shared),yes)
8.47 ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
8.48 ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
8.49 ++endif
8.50 ++
8.51 + # Tell versions [3.59,3.63) of GNU make to not export all variables.
8.52 + # Otherwise a system limit (for SysV at least) may be exceeded.
8.53 + .NOEXPORT:
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/patches/gcc/4.2.4/301-missing-execinfo_h.patch Sat Jul 19 12:17:26 2008 +0000
9.3 @@ -0,0 +1,12 @@
9.4 +diff -durN gcc-4.2.1.orig/boehm-gc/include/gc.h gcc-4.2.1/boehm-gc/include/gc.h
9.5 +--- gcc-4.2.1.orig/boehm-gc/include/gc.h 2006-09-18 20:45:08.000000000 +0200
9.6 ++++ gcc-4.2.1/boehm-gc/include/gc.h 2007-08-03 20:33:00.000000000 +0200
9.7 +@@ -502,7 +502,7 @@
9.8 + #if defined(__linux__) || defined(__GLIBC__)
9.9 + # include <features.h>
9.10 + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
9.11 +- && !defined(__ia64__)
9.12 ++ && !defined(__ia64__) && !defined(__UCLIBC__)
9.13 + # ifndef GC_HAVE_BUILTIN_BACKTRACE
9.14 + # define GC_HAVE_BUILTIN_BACKTRACE
9.15 + # endif
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/patches/gcc/4.2.4/302-c99-snprintf.patch Sat Jul 19 12:17:26 2008 +0000
10.3 @@ -0,0 +1,12 @@
10.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
10.5 +--- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100
10.6 ++++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cstdio.h 2007-08-03 20:33:24.000000000 +0200
10.7 +@@ -144,7 +144,7 @@
10.8 +
10.9 + _GLIBCXX_END_NAMESPACE
10.10 +
10.11 +-#if _GLIBCXX_USE_C99
10.12 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
10.13 +
10.14 + #undef snprintf
10.15 + #undef vfscanf
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/patches/gcc/4.2.4/303-c99-complex-ugly-hack.patch Sat Jul 19 12:17:26 2008 +0000
11.3 @@ -0,0 +1,13 @@
11.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
11.5 +--- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200
11.6 ++++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:33:56.000000000 +0200
11.7 +@@ -7514,6 +7514,9 @@
11.8 + cat >>conftest.$ac_ext <<_ACEOF
11.9 + /* end confdefs.h. */
11.10 + #include <complex.h>
11.11 ++#ifdef __UCLIBC__
11.12 ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
11.13 ++#endif
11.14 + int
11.15 + main ()
11.16 + {
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/patches/gcc/4.2.4/304-index_macro.patch Sat Jul 19 12:17:26 2008 +0000
12.3 @@ -0,0 +1,26 @@
12.4 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/rope gcc-4.2.1/libstdc++-v3/include/ext/rope
12.5 +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/rope 2006-10-17 13:56:21.000000000 +0200
12.6 ++++ gcc-4.2.1/libstdc++-v3/include/ext/rope 2007-08-03 20:34:23.000000000 +0200
12.7 +@@ -58,6 +58,9 @@
12.8 + #include <bits/allocator.h>
12.9 + #include <ext/hash_fun.h>
12.10 +
12.11 ++/* cope w/ index defined as macro, SuSv3 proposal */
12.12 ++#undef index
12.13 ++
12.14 + # ifdef __GC
12.15 + # define __GC_CONST const
12.16 + # else
12.17 +diff -durN gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h
12.18 +--- gcc-4.2.1.orig/libstdc++-v3/include/ext/ropeimpl.h 2006-10-17 13:56:21.000000000 +0200
12.19 ++++ gcc-4.2.1/libstdc++-v3/include/ext/ropeimpl.h 2007-08-03 20:34:23.000000000 +0200
12.20 +@@ -54,6 +54,9 @@
12.21 + #include <ext/memory> // For uninitialized_copy_n
12.22 + #include <ext/numeric> // For power
12.23 +
12.24 ++/* cope w/ index defined as macro, SuSv3 proposal */
12.25 ++#undef index
12.26 ++
12.27 + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
12.28 +
12.29 + using std::size_t;
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/patches/gcc/4.2.4/305-libmudflap-susv3-legacy.patch Sat Jul 19 12:17:26 2008 +0000
13.3 @@ -0,0 +1,48 @@
13.4 +diff -durN gcc-4.2.1.orig/libmudflap/mf-hooks2.c gcc-4.2.1/libmudflap/mf-hooks2.c
13.5 +--- gcc-4.2.1.orig/libmudflap/mf-hooks2.c 2005-09-23 23:58:39.000000000 +0200
13.6 ++++ gcc-4.2.1/libmudflap/mf-hooks2.c 2007-08-03 20:35:09.000000000 +0200
13.7 +@@ -427,7 +427,7 @@
13.8 + {
13.9 + TRACE ("%s\n", __PRETTY_FUNCTION__);
13.10 + MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
13.11 +- bzero (s, n);
13.12 ++ memset (s, 0, n);
13.13 + }
13.14 +
13.15 +
13.16 +@@ -437,7 +437,7 @@
13.17 + TRACE ("%s\n", __PRETTY_FUNCTION__);
13.18 + MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
13.19 + MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
13.20 +- bcopy (src, dest, n);
13.21 ++ memmove (dest, src, n);
13.22 + }
13.23 +
13.24 +
13.25 +@@ -447,7 +447,7 @@
13.26 + TRACE ("%s\n", __PRETTY_FUNCTION__);
13.27 + MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
13.28 + MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
13.29 +- return bcmp (s1, s2, n);
13.30 ++ return n == 0 ? 0 : memcmp (s1, s2, n);
13.31 + }
13.32 +
13.33 +
13.34 +@@ -456,7 +456,7 @@
13.35 + size_t n = strlen (s);
13.36 + TRACE ("%s\n", __PRETTY_FUNCTION__);
13.37 + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
13.38 +- return index (s, c);
13.39 ++ return strchr (s, c);
13.40 + }
13.41 +
13.42 +
13.43 +@@ -465,7 +465,7 @@
13.44 + size_t n = strlen (s);
13.45 + TRACE ("%s\n", __PRETTY_FUNCTION__);
13.46 + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
13.47 +- return rindex (s, c);
13.48 ++ return strrchr (s, c);
13.49 + }
13.50 +
13.51 + /* XXX: stpcpy, memccpy */
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/patches/gcc/4.2.4/306-libstdc++-namespace.patch Sat Jul 19 12:17:26 2008 +0000
14.3 @@ -0,0 +1,36 @@
14.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
14.5 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:31:54.000000000 +0200
14.6 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:35:40.000000000 +0200
14.7 +@@ -32,7 +32,8 @@
14.8 + //
14.9 +
14.10 + // Written by Benjamin Kosnik <bkoz@redhat.com>
14.11 +-
14.12 ++namespace std
14.13 ++{
14.14 + #ifdef __UCLIBC_MJN3_ONLY__
14.15 + #warning fix prototypes for *textdomain funcs
14.16 + #endif
14.17 +@@ -115,3 +116,4 @@
14.18 + this->_S_create_c_locale(this->_M_c_locale_messages, __s);
14.19 + }
14.20 + }
14.21 ++}
14.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
14.23 +--- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:31:54.000000000 +0200
14.24 ++++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:35:40.000000000 +0200
14.25 +@@ -33,7 +33,8 @@
14.26 + //
14.27 +
14.28 + // Written by Benjamin Kosnik <bkoz@redhat.com>
14.29 +-
14.30 ++namespace std
14.31 ++{
14.32 + template<typename _CharT>
14.33 + __timepunct<_CharT>::__timepunct(size_t __refs)
14.34 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
14.35 +@@ -74,3 +75,4 @@
14.36 + delete _M_data;
14.37 + _S_destroy_c_locale(_M_c_locale_timepunct);
14.38 + }
14.39 ++}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/patches/gcc/4.2.4/402-libbackend_dep_gcov-iov.h.patch Sat Jul 19 12:17:26 2008 +0000
15.3 @@ -0,0 +1,12 @@
15.4 +diff -durN gcc-4.2.1.orig/gcc/Makefile.in gcc-4.2.1/gcc/Makefile.in
15.5 +--- gcc-4.2.1.orig/gcc/Makefile.in 2007-05-31 17:37:38.000000000 +0200
15.6 ++++ gcc-4.2.1/gcc/Makefile.in 2007-08-03 20:36:14.000000000 +0200
15.7 +@@ -2660,7 +2660,7 @@
15.8 + # FIXME: writing proper dependencies for this is a *LOT* of work.
15.9 + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \
15.10 + insn-config.h insn-flags.h insn-codes.h insn-constants.h \
15.11 +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
15.12 ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h
15.13 + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
15.14 + -DTARGET_NAME=\"$(target_noncanonical)\" \
15.15 + -DLOCALEDIR=\"$(localedir)\" \
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/patches/gcc/4.2.4/800-arm-bigendian.patch Sat Jul 19 12:17:26 2008 +0000
16.3 @@ -0,0 +1,64 @@
16.4 +diff -durN gcc-4.2.1.orig/gcc/config/arm/linux-elf.h gcc-4.2.1/gcc/config/arm/linux-elf.h
16.5 +--- gcc-4.2.1.orig/gcc/config/arm/linux-elf.h 2006-02-17 00:29:10.000000000 +0100
16.6 ++++ gcc-4.2.1/gcc/config/arm/linux-elf.h 2007-08-03 20:36:43.000000000 +0200
16.7 +@@ -28,19 +28,33 @@
16.8 + #undef TARGET_VERSION
16.9 + #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
16.10 +
16.11 ++/*
16.12 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
16.13 ++ * (big endian) configurations.
16.14 ++ */
16.15 ++#if TARGET_BIG_ENDIAN_DEFAULT
16.16 ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
16.17 ++#define TARGET_ENDIAN_OPTION "mbig-endian"
16.18 ++#define TARGET_LINKER_EMULATION "armelfb_linux"
16.19 ++#else
16.20 ++#define TARGET_ENDIAN_DEFAULT 0
16.21 ++#define TARGET_ENDIAN_OPTION "mlittle-endian"
16.22 ++#define TARGET_LINKER_EMULATION "armelf_linux"
16.23 ++#endif
16.24 ++
16.25 + #undef TARGET_DEFAULT_FLOAT_ABI
16.26 + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
16.27 +
16.28 + #undef TARGET_DEFAULT
16.29 +-#define TARGET_DEFAULT (0)
16.30 ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
16.31 +
16.32 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
16.33 +
16.34 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
16.35 ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
16.36 +
16.37 + #undef MULTILIB_DEFAULTS
16.38 + #define MULTILIB_DEFAULTS \
16.39 +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
16.40 ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
16.41 +
16.42 + /* Now we define the strings used to build the spec file. */
16.43 + #undef LIB_SPEC
16.44 +@@ -61,7 +75,7 @@
16.45 + %{rdynamic:-export-dynamic} \
16.46 + %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
16.47 + -X \
16.48 +- %{mbig-endian:-EB}" \
16.49 ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
16.50 + SUBTARGET_EXTRA_LINK_SPEC
16.51 +
16.52 + #undef LINK_SPEC
16.53 +diff -durN gcc-4.2.1.orig/gcc/config.gcc gcc-4.2.1/gcc/config.gcc
16.54 +--- gcc-4.2.1.orig/gcc/config.gcc 2007-08-03 20:29:52.000000000 +0200
16.55 ++++ gcc-4.2.1/gcc/config.gcc 2007-08-03 20:36:43.000000000 +0200
16.56 +@@ -705,6 +705,11 @@
16.57 + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
16.58 + tmake_file="${tmake_file} t-linux arm/t-arm"
16.59 + case ${target} in
16.60 ++ arm*b-*)
16.61 ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
16.62 ++ ;;
16.63 ++ esac
16.64 ++ case ${target} in
16.65 + arm*-*-linux-*eabi)
16.66 + tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
16.67 + tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/patches/gcc/4.2.4/801-softfloat-fix.patch Sat Jul 19 12:17:26 2008 +0000
17.3 @@ -0,0 +1,58 @@
17.4 +This patch (C) 2007 Yann E. MORIN
17.5 +Licensed under GPL v2.
17.6 +
17.7 +First hunk of this patch solves compiling uClibc:
17.8 +
17.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'
17.10 + LD libuClibc-0.9.29.so
17.11 +libc/libc_so.a(difftime.os): In function `difftime':
17.12 +difftime.c:(.text+0x8): undefined reference to `__floatsidf'
17.13 +difftime.c:(.text+0x2c): undefined reference to `__subdf3'
17.14 +libc/libc_so.a(_fpmaxtostr.os): In function `_fpmaxtostr':
17.15 +_fpmaxtostr.c:(.text+0xd4): undefined reference to `__nedf2'
17.16 +_fpmaxtostr.c:(.text+0xf8): undefined reference to `__eqdf2'
17.17 +_fpmaxtostr.c:(.text+0x114): undefined reference to `__divdf3'
17.18 +_fpmaxtostr.c:(.text+0x120): undefined reference to `__ltdf2'
17.19 +_fpmaxtostr.c:(.text+0x1c4): undefined reference to `__muldf3'
17.20 +_fpmaxtostr.c:(.text+0x388): undefined reference to `__gedf2'
17.21 +_fpmaxtostr.c:(.text+0x430): undefined reference to `__adddf3'
17.22 +libc/libc_so.a(__psfs_do_numeric.os): In function `__psfs_do_numeric':
17.23 +__psfs_do_numeric.c:(.text+0x520): undefined reference to `__truncdfsf2'
17.24 +libc/libc_so.a(strtof.os): In function `strtof':
17.25 +strtof.c:(.text+0x1c): undefined reference to `__extendsfdf2'
17.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):
17.27 +In function `__fixunsdfsi':
17.28 +libgcc2.c:(.text+0x34): undefined reference to `__fixdfsi'
17.29 +make[2]: *** [lib/libc.so] Error 1
17.30 +make[1]: *** [lib/libc.so.0] Error 2
17.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'
17.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]
17.33 +Error 2
17.34 +
17.35 +The second hunk fixes building final gcc because soft-float implies using -lfloat (which we don't have).
17.36 +
17.37 +
17.38 +diff -dur gcc-4.2.0.orig/gcc/config.gcc gcc-4.2.0/gcc/config.gcc
17.39 +--- gcc-4.2.0.orig/gcc/config.gcc 2007-07-15 11:24:18.000000000 +0200
17.40 ++++ gcc-4.2.0/gcc/config.gcc 2007-07-15 11:26:02.000000000 +0200
17.41 +@@ -721,7 +721,7 @@
17.42 + default_use_cxa_atexit=yes
17.43 + ;;
17.44 + *)
17.45 +- tmake_file="$tmake_file arm/t-linux"
17.46 ++ tmake_file="$tmake_file arm/t-linux arm/t-arm-elf"
17.47 + ;;
17.48 + esac
17.49 + tm_file="$tm_file arm/aout.h arm/arm.h"
17.50 +diff -dur gcc-4.2.0.orig/gcc/config/arm/linux-elf.h gcc-4.2.0/gcc/config/arm/linux-elf.h
17.51 +--- gcc-4.2.0.orig/gcc/config/arm/linux-elf.h 2007-07-15 11:24:18.000000000 +0200
17.52 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h 2007-07-15 11:26:02.000000000 +0200
17.53 +@@ -63,7 +63,7 @@
17.54 + %{shared:-lc} \
17.55 + %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
17.56 +
17.57 +-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
17.58 ++#define LIBGCC_SPEC "-lgcc"
17.59 +
17.60 + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
17.61 +
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/patches/gcc/4.2.4/904-flatten-switch-stmt-00.patch Sat Jul 19 12:17:26 2008 +0000
18.3 @@ -0,0 +1,24 @@
18.4 +diff -durN gcc-4.2.1.orig/gcc/stmt.c gcc-4.2.1/gcc/stmt.c
18.5 +--- gcc-4.2.1.orig/gcc/stmt.c 2007-07-19 05:25:32.000000000 +0200
18.6 ++++ gcc-4.2.1/gcc/stmt.c 2007-08-03 20:37:19.000000000 +0200
18.7 +@@ -2512,7 +2512,11 @@
18.8 + use_cost_table
18.9 + = (TREE_CODE (orig_type) != ENUMERAL_TYPE
18.10 + && estimate_case_costs (case_list));
18.11 +- balance_case_nodes (&case_list, NULL);
18.12 ++ /* When optimizing for size, we want a straight list to avoid
18.13 ++ jumps as much as possible. This basically creates an if-else
18.14 ++ chain. */
18.15 ++ if (!optimize_size)
18.16 ++ balance_case_nodes (&case_list, NULL);
18.17 + emit_case_nodes (index, case_list, default_label, index_type);
18.18 + emit_jump (default_label);
18.19 + }
18.20 +@@ -3070,6 +3074,7 @@
18.21 + {
18.22 + if (!node_has_low_bound (node, index_type))
18.23 + {
18.24 ++ if (!optimize_size) /* don't jl to the .default_label. */
18.25 + emit_cmp_and_jump_insns (index,
18.26 + convert_modes
18.27 + (mode, imode,
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/patches/gcc/4.2.4/920-soft-float.patch Sat Jul 19 12:17:26 2008 +0000
19.3 @@ -0,0 +1,21 @@
19.4 +diff -uNpr gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c
19.5 +--- gcc-4.2.1_orig/gcc/config/rs6000/darwin-ldouble.c 2007-03-05 11:54:00.000000000 -0500
19.6 ++++ gcc-4.2.1/gcc/config/rs6000/darwin-ldouble.c 2008-01-31 17:51:24.000000000 -0500
19.7 +@@ -70,6 +70,8 @@ Software Foundation, 51 Franklin Street,
19.8 + but GCC currently generates poor code when a union is used to turn
19.9 + a long double into a pair of doubles. */
19.10 +
19.11 ++#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__)
19.12 ++
19.13 + long double __gcc_qadd (double, double, double, double);
19.14 + long double __gcc_qsub (double, double, double, double);
19.15 + long double __gcc_qmul (double, double, double, double);
19.16 +@@ -219,8 +221,6 @@ __gcc_qdiv (double a, double b, double c
19.17 + return z.ldval;
19.18 + }
19.19 +
19.20 +-#if defined (_SOFT_FLOAT) && defined (__LONG_DOUBLE_128__)
19.21 +-
19.22 + long double __gcc_qneg (double, double);
19.23 + int __gcc_qeq (double, double, double, double);
19.24 + int __gcc_qne (double, double, double, double);
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/patches/gcc/4.2.4/930-eabi_fixes.patch Sat Jul 19 12:17:26 2008 +0000
20.3 @@ -0,0 +1,13 @@
20.4 +diff -durN gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h gcc-4.2.3/gcc/config/arm/linux-eabi.h
20.5 +--- gcc-4.2.3.orig/gcc/config/arm/linux-eabi.h 2007-09-01 17:28:30.000000000 +0200
20.6 ++++ gcc-4.2.3/gcc/config/arm/linux-eabi.h 2008-05-25 23:47:36.000000000 +0200
20.7 +@@ -47,7 +47,8 @@
20.8 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
20.9 +
20.10 + #undef SUBTARGET_EXTRA_LINK_SPEC
20.11 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi"
20.12 ++#define SUBTARGET_EXTRA_LINK_SPEC \
20.13 ++ " %{mlittle-endian:-m armelf_linux_eabi} %{mbig-endian:-m armelfb_linux_eabi}"
20.14 +
20.15 + /* Use ld-linux.so.3 so that it will be possible to run "classic"
20.16 + GNU/Linux binaries on an EABI system. */
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/patches/gcc/4.2.4/940-gcc-alpha-signal_h.patch Sat Jul 19 12:17:26 2008 +0000
21.3 @@ -0,0 +1,17 @@
21.4 +--- gcc-4.2.1-stock/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500
21.5 ++++ gcc-4.2.1/gcc/config/alpha/linux-unwind.h 2007-09-01 20:21:34.000000000 -0500
21.6 +@@ -29,6 +29,9 @@ Boston, MA 02110-1301, USA. */
21.7 + /* Do code reading to identify a signal frame, and set the frame
21.8 + state data appropriately. See unwind-dw2.c for the structs. */
21.9 +
21.10 ++/* Don't use this if inhibit_libc is set
21.11 ++ The build for this target will fail trying to include missing headers */
21.12 ++#ifndef inhibit_libc
21.13 + #include <signal.h>
21.14 + #include <sys/ucontext.h>
21.15 +
21.16 +@@ -80,3 +83,4 @@ alpha_fallback_frame_state (struct _Unwi
21.17 + fs->retaddr_column = 64;
21.18 + return _URC_NO_REASON;
21.19 + }
21.20 ++#endif /* inhibit_libc */
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/patches/gcc/4.2.4/950-fortran-signed-TImode.patch Sat Jul 19 12:17:26 2008 +0000
22.3 @@ -0,0 +1,43 @@
22.4 +Fix building gfortran for ARM.
22.5 +http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01010.html
22.6 +----
22.7 +
22.8 +The patch below fixes a crash building libgfortran on arm-linux-gnueabi.
22.9 +
22.10 +This target doesn't really have a 128-bit integer type, however it does use
22.11 +TImode to represent the return value of certain special ABI defined library
22.12 +functions. This results in type_for_size(TImode) being called.
22.13 +
22.14 +Because TImode deosn't correspond to any gfortran integer kind
22.15 +gfc_type_for_size returns NULL and we segfault shortly after.
22.16 +
22.17 +The patch below fixes this by making gfc_type_for_size handle TImode in the
22.18 +same way as the C frontend.
22.19 +
22.20 +Tested on x86_64-linux and arm-linux-gnueabi.
22.21 +Applied to trunk.
22.22 +
22.23 +Paul
22.24 +
22.25 +2007-05-15 Paul Brook <paul@codesourcery.com>
22.26 +
22.27 + gcc/fortran/
22.28 + * trans-types.c (gfc_type_for_size): Handle signed TImode.
22.29 +
22.30 +diff -durN gcc-4.2.3.old/gcc/fortran/trans-types.c gcc-4.2.3/gcc/fortran/trans-types.c
22.31 +--- gcc-4.2.3.old/gcc/fortran/trans-types.c 2007-08-31 10:27:50.000000000 +0200
22.32 ++++ gcc-4.2.3/gcc/fortran/trans-types.c 2008-07-17 09:54:20.000000000 +0200
22.33 +@@ -1799,6 +1799,13 @@
22.34 + if (type && bits == TYPE_PRECISION (type))
22.35 + return type;
22.36 + }
22.37 ++
22.38 ++ /* Handle TImode as a special case because it is used by some backends
22.39 ++ (eg. ARM) even though it is not available for normal use. */
22.40 ++#if HOST_BITS_PER_WIDE_INT >= 64
22.41 ++ if (bits == TYPE_PRECISION (intTI_type_node))
22.42 ++ return intTI_type_node;
22.43 ++#endif
22.44 + }
22.45 + else
22.46 + {