]> git.ipfire.org Git - ipfire-2.x.git/blob - src/uClibc/sources/gcc-810-libstd++-locale.patch
git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@16 ea5c0bd1-69bd-2848...
[ipfire-2.x.git] / src / uClibc / sources / gcc-810-libstd++-locale.patch
1 diff -urN gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/c_locale.cc gcc-3.3.1/libstdc++-v3/config/locale/gnu/c_locale.cc
2 --- gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/c_locale.cc 2003-02-28 00:09:52.000000000 -0600
3 +++ gcc-3.3.1/libstdc++-v3/config/locale/gnu/c_locale.cc 2003-08-31 10:55:17.000000000 -0500
4 @@ -195,12 +195,15 @@
5 "LC_TIME",
6 "LC_COLLATE",
7 "LC_MONETARY",
8 - "LC_MESSAGES",
9 + "LC_MESSAGES"
10 +#if _GLIBCPP_NUM_CATEGORIES != 0
11 + ,
12 "LC_PAPER",
13 "LC_NAME",
14 "LC_ADDRESS",
15 "LC_TELEPHONE",
16 "LC_MEASUREMENT",
17 "LC_IDENTIFICATION"
18 +#endif
19 };
20 } // namespace std
21 diff -urN gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/c_locale.h gcc-3.3.1/libstdc++-v3/config/locale/gnu/c_locale.h
22 --- gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/c_locale.h 2003-01-23 12:56:16.000000000 -0600
23 +++ gcc-3.3.1/libstdc++-v3/config/locale/gnu/c_locale.h 2003-08-31 10:55:17.000000000 -0500
24 @@ -46,6 +46,10 @@
25 #define _GLIBCPP_C_LOCALE_GNU 1
26
27 #define _GLIBCPP_NUM_CATEGORIES 6
28 +#ifdef __UCLIBC__
29 +#undef _GLIBCPP_NUM_CATEGORIES
30 +#define _GLIBCPP_NUM_CATEGORIES 0
31 +#endif
32
33 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
34 namespace __gnu_cxx
35 diff -urN gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/c++locale_internal.h gcc-3.3.1/libstdc++-v3/config/locale/gnu/c++locale_internal.h
36 --- gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/c++locale_internal.h 2002-09-05 02:46:16.000000000 -0500
37 +++ gcc-3.3.1/libstdc++-v3/config/locale/gnu/c++locale_internal.h 2003-08-31 10:55:17.000000000 -0500
38 @@ -48,7 +48,9 @@
39 extern "C" __typeof(towlower_l) __towlower_l;
40 extern "C" __typeof(towupper_l) __towupper_l;
41 extern "C" __typeof(wcscoll_l) __wcscoll_l;
42 +#ifdef HAVE_WCSFTIME
43 extern "C" __typeof(wcsftime_l) __wcsftime_l;
44 +#endif
45 extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
46 extern "C" __typeof(wctype_l) __wctype_l;
47 extern "C" __typeof(newlocale) __newlocale;
48 diff -urN gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/messages_members.cc gcc-3.3.1/libstdc++-v3/config/locale/gnu/messages_members.cc
49 --- gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/messages_members.cc 2003-02-28 00:09:52.000000000 -0600
50 +++ gcc-3.3.1/libstdc++-v3/config/locale/gnu/messages_members.cc 2003-08-31 10:55:17.000000000 -0500
51 @@ -36,6 +36,13 @@
52 #include <locale>
53 #include <bits/c++locale_internal.h>
54
55 +#ifdef __UCLIBC__
56 +extern "C" char *__dcgettext(const char *domainname,
57 + const char *msgid, int category);
58 +#undef gettext
59 +#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
60 +#endif
61 +
62 namespace std
63 {
64 // Specializations.
65 diff -urN gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/messages_members.h gcc-3.3.1/libstdc++-v3/config/locale/gnu/messages_members.h
66 --- gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/messages_members.h 2003-01-06 16:20:03.000000000 -0600
67 +++ gcc-3.3.1/libstdc++-v3/config/locale/gnu/messages_members.h 2003-08-31 10:55:17.000000000 -0500
68 @@ -33,6 +33,12 @@
69
70 // Written by Benjamin Kosnik <bkoz@redhat.com>
71
72 +#ifdef __UCLIBC__
73 +extern "C" char *__textdomain(const char *domainname);
74 +extern "C" char *__bindtextdomain(const char *domainname,
75 + const char *dirname);
76 +#endif
77 +
78 // Non-virtual member functions.
79 template<typename _CharT>
80 messages<_CharT>::messages(size_t __refs)
81 @@ -61,7 +67,11 @@
82 messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
83 const char* __dir) const
84 {
85 +#ifdef __UCLIBC__
86 + __bindtextdomain(__s.c_str(), __dir);
87 +#else
88 bindtextdomain(__s.c_str(), __dir);
89 +#endif
90 return this->do_open(__s, __loc);
91 }
92
93 @@ -83,7 +93,11 @@
94 {
95 // No error checking is done, assume the catalog exists and can
96 // be used.
97 +#ifdef __UCLIBC__
98 + __textdomain(__s.c_str());
99 +#else
100 textdomain(__s.c_str());
101 +#endif
102 return 0;
103 }
104
105 diff -urN gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/numeric_members.cc gcc-3.3.1/libstdc++-v3/config/locale/gnu/numeric_members.cc
106 --- gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/numeric_members.cc 2003-02-28 00:09:52.000000000 -0600
107 +++ gcc-3.3.1/libstdc++-v3/config/locale/gnu/numeric_members.cc 2003-08-31 10:55:18.000000000 -0500
108 @@ -86,8 +86,13 @@
109 else
110 {
111 // Named locale.
112 +#ifdef __UCLIBC__
113 + _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __cloc->decimal_point_wc }).__w);
114 + _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __cloc->thousands_sep_wc }).__w);
115 +#else
116 _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
117 _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
118 +#endif
119 if (_M_thousands_sep == L'\0')
120 _M_grouping = "";
121 else
122 diff -urN gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/time_members.cc gcc-3.3.1/libstdc++-v3/config/locale/gnu/time_members.cc
123 --- gcc-3.3.1-old/libstdc++-v3/config/locale/gnu/time_members.cc 2003-02-28 00:09:52.000000000 -0600
124 +++ gcc-3.3.1/libstdc++-v3/config/locale/gnu/time_members.cc 2003-08-31 10:55:18.000000000 -0500
125 @@ -183,6 +183,7 @@
126 }
127 }
128
129 +#ifndef __UCLIBC__
130 #ifdef _GLIBCPP_USE_WCHAR_T
131 template<>
132 void
133 @@ -328,4 +329,5 @@
134 }
135 }
136 #endif
137 +#endif
138 }
139 diff -urN gcc-3.3.1-old/libstdc++-v3/config/os/gnu-linux/ctype_base.h gcc-3.3.1/libstdc++-v3/config/os/gnu-linux/ctype_base.h
140 --- gcc-3.3.1-old/libstdc++-v3/config/os/gnu-linux/ctype_base.h 2002-09-09 15:26:41.000000000 -0500
141 +++ gcc-3.3.1/libstdc++-v3/config/os/gnu-linux/ctype_base.h 2003-08-31 10:55:18.000000000 -0500
142 @@ -36,11 +36,18 @@
143 struct ctype_base
144 {
145 // Non-standard typedefs.
146 +#ifdef __UCLIBC__
147 + typedef const __ctype_touplow_t* __to_type;
148 + // NB: Offsets into ctype<char>::_M_table force a particular size
149 + // on the mask type. Because of this, we don't use an enum.
150 + typedef __ctype_mask_t mask;
151 +#else
152 typedef const int* __to_type;
153 -
154 // NB: Offsets into ctype<char>::_M_table force a particular size
155 // on the mask type. Because of this, we don't use an enum.
156 typedef unsigned short mask;
157 +#endif
158 +
159 static const mask upper = _ISupper;
160 static const mask lower = _ISlower;
161 static const mask alpha = _ISalpha;
162 diff -urN gcc-3.3.1-old/libstdc++-v3/include/c_std/std_cstdlib.h gcc-3.3.1/libstdc++-v3/include/c_std/std_cstdlib.h
163 --- gcc-3.3.1-old/libstdc++-v3/include/c_std/std_cstdlib.h 2003-04-18 05:08:05.000000000 -0500
164 +++ gcc-3.3.1/libstdc++-v3/include/c_std/std_cstdlib.h 2003-08-31 10:55:18.000000000 -0500
165 @@ -101,9 +101,11 @@
166 using ::labs;
167 using ::ldiv;
168 using ::malloc;
169 +#if _GLIBCPP_USE_WCHAR_T
170 using ::mblen;
171 using ::mbstowcs;
172 using ::mbtowc;
173 +#endif
174 using ::qsort;
175 using ::rand;
176 using ::realloc;
177 @@ -112,8 +114,10 @@
178 using ::strtol;
179 using ::strtoul;
180 using ::system;
181 +#if _GLIBCPP_USE_WCHAR_T
182 using ::wcstombs;
183 using ::wctomb;
184 +#endif
185
186 inline long
187 abs(long __i) { return labs(__i); }
188 diff -urN gcc-3.3.1-old/libstdc++-v3/include/c_std/std_cwchar.h gcc-3.3.1/libstdc++-v3/include/c_std/std_cwchar.h
189 --- gcc-3.3.1-old/libstdc++-v3/include/c_std/std_cwchar.h 2003-04-18 05:08:05.000000000 -0500
190 +++ gcc-3.3.1/libstdc++-v3/include/c_std/std_cwchar.h 2003-08-31 10:55:18.000000000 -0500
191 @@ -165,7 +165,9 @@
192 using ::wcscoll;
193 using ::wcscpy;
194 using ::wcscspn;
195 +#ifdef HAVE_WCSFTIME
196 using ::wcsftime;
197 +#endif
198 using ::wcslen;
199 using ::wcsncat;
200 using ::wcsncmp;
201 diff -urN gcc-3.3.2-old/libstdc++-v3/config/locale/gnu/ctype_members.cc gcc-3.3.2/libstdc++-v3/config/locale/gnu/ctype_members.cc
202 --- gcc-3.3.2-old/libstdc++-v3/config/locale/gnu/ctype_members.cc 2003-10-07 03:40:58.000000000 -0500
203 +++ gcc-3.3.2/libstdc++-v3/config/locale/gnu/ctype_members.cc 2003-11-10 14:21:45.000000000 -0600
204 @@ -36,6 +36,14 @@
205 #include <locale>
206 #include <bits/c++locale_internal.h>
207
208 +#ifdef __UCLIBC_HAS_XLOCALE__
209 +struct __uclibc_locale_struct_header {
210 + const __ctype_mask_t *__ctype_b;
211 + const __ctype_touplow_t *__ctype_tolower;
212 + const __ctype_touplow_t *__ctype_toupper;
213 +};
214 +#endif
215 +
216 namespace std
217 {
218 // NB: The other ctype<char> specializations are in src/locale.cc and
219 @@ -46,9 +54,9 @@
220 {
221 _S_destroy_c_locale(_M_c_locale_ctype);
222 _S_create_c_locale(_M_c_locale_ctype, __s);
223 - _M_toupper = _M_c_locale_ctype->__ctype_toupper;
224 - _M_tolower = _M_c_locale_ctype->__ctype_tolower;
225 - _M_table = _M_c_locale_ctype->__ctype_b;
226 + _M_toupper = ((struct __uclibc_locale_struct_header *)_M_c_locale_ctype)->__ctype_toupper;
227 + _M_tolower = ((struct __uclibc_locale_struct_header *)_M_c_locale_ctype)->__ctype_tolower;
228 + _M_table = ((struct __uclibc_locale_struct_header *)_M_c_locale_ctype)->__ctype_b;
229 }
230
231 #ifdef _GLIBCPP_USE_WCHAR_T
232 diff -urN gcc-3.3.2-old/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h gcc-3.3.2/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h
233 --- gcc-3.3.2-old/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h 2002-10-08 18:32:22.000000000 -0500
234 +++ gcc-3.3.2/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h 2003-11-10 14:20:37.000000000 -0600
235 @@ -35,11 +35,21 @@
236 // Information as gleaned from /usr/include/ctype.h
237
238 #if _GLIBCPP_C_LOCALE_GNU
239 +#ifdef __UCLIBC_HAS_XLOCALE__
240 +struct __uclibc_locale_struct_header {
241 + const __ctype_mask_t *__ctype_b;
242 + const __ctype_touplow_t *__ctype_tolower;
243 + const __ctype_touplow_t *__ctype_toupper;
244 +};
245 +#endif
246 +#endif
247 +
248 +#if _GLIBCPP_C_LOCALE_GNU
249 const ctype_base::mask*
250 ctype<char>::classic_table() throw()
251 {
252 locale::classic();
253 - return _S_c_locale->__ctype_b;
254 + return ((struct __uclibc_locale_struct_header *)_S_c_locale)->__ctype_b;
255 }
256 #else
257 const ctype_base::mask*
258 @@ -65,9 +75,9 @@
259 : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
260 {
261 _M_c_locale_ctype = _S_clone_c_locale(__cloc);
262 - _M_toupper = _M_c_locale_ctype->__ctype_toupper;
263 - _M_tolower = _M_c_locale_ctype->__ctype_tolower;
264 - _M_table = __table ? __table : _M_c_locale_ctype->__ctype_b;
265 + _M_toupper = ((struct __uclibc_locale_struct_header *)_M_c_locale_ctype)->__ctype_toupper;
266 + _M_tolower = ((struct __uclibc_locale_struct_header *)_M_c_locale_ctype)->__ctype_tolower;
267 + _M_table = __table ? __table : ((struct __uclibc_locale_struct_header *)_M_c_locale_ctype)->__ctype_b;
268 }
269 #else
270 ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
271 @@ -96,9 +106,9 @@
272 __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del)
273 {
274 _M_c_locale_ctype = _S_c_locale;
275 - _M_toupper = _M_c_locale_ctype->__ctype_toupper;
276 - _M_tolower = _M_c_locale_ctype->__ctype_tolower;
277 - _M_table = __table ? __table : _M_c_locale_ctype->__ctype_b;
278 + _M_toupper = ((struct __uclibc_locale_struct_header *)_M_c_locale_ctype)->__ctype_toupper;
279 + _M_tolower = ((struct __uclibc_locale_struct_header *)_M_c_locale_ctype)->__ctype_tolower;
280 + _M_table = __table ? __table : ((struct __uclibc_locale_struct_header *)_M_c_locale_ctype)->__ctype_b;
281 }
282 #else
283 ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) :