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