diff options
author | Richard Purdie <richard@openedhand.com> | 2006-08-26 22:58:50 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-08-26 22:58:50 +0000 |
commit | 8800d8be25295dd7c7d84dde62c3be4df8e43346 (patch) | |
tree | 8ec8b868f4dc4ba56c74d1f7de0bb45ecb80664a /meta/packages/gcc | |
parent | 1562178b03be74528c52f70228d13ea257c2d445 (diff) | |
download | poky-8800d8be25295dd7c7d84dde62c3be4df8e43346.tar.gz |
gcc: Add 4.1.1
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@648 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/gcc')
24 files changed, 4442 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.1.1/100-uclibc-conf.patch b/meta/packages/gcc/gcc-4.1.1/100-uclibc-conf.patch new file mode 100644 index 0000000000..49d576c7dd --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/100-uclibc-conf.patch | |||
@@ -0,0 +1,544 @@ | |||
1 | --- gcc-4.1.0/gcc/config/t-linux-uclibc | ||
2 | +++ gcc-4.1.0/gcc/config/t-linux-uclibc | ||
3 | @@ -0,0 +1,5 @@ | ||
4 | +# Remove glibc specific files added in t-linux | ||
5 | +SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES)) | ||
6 | + | ||
7 | +# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc | ||
8 | +LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH)) | ||
9 | --- gcc-4.1.0/gcc/config.gcc | ||
10 | +++ gcc-4.1.0/gcc/config.gcc | ||
11 | @@ -1887,7 +1887,7 @@ s390x-ibm-tpf*) | ||
12 | ;; | ||
13 | sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \ | ||
14 | sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \ | ||
15 | - sh-*-linux* | sh[346lbe]*-*-linux* | \ | ||
16 | + sh*-*-linux* | sh[346lbe]*-*-linux* | \ | ||
17 | sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \ | ||
18 | sh64-*-netbsd* | sh64l*-*-netbsd*) | ||
19 | tmake_file="${tmake_file} sh/t-sh sh/t-elf" | ||
20 | @@ -2341,6 +2341,12 @@ m32c-*-elf*) | ||
21 | ;; | ||
22 | esac | ||
23 | |||
24 | +# Rather than hook into each target, just do it after all the linux | ||
25 | +# targets have been processed | ||
26 | +case ${target} in | ||
27 | +*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc" | ||
28 | +esac | ||
29 | + | ||
30 | case ${target} in | ||
31 | i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1) | ||
32 | tmake_file="${tmake_file} i386/t-gmm_malloc" | ||
33 | --- gcc-4.1.0/boehm-gc/configure | ||
34 | +++ gcc-4.1.0/boehm-gc/configure | ||
35 | @@ -4320,6 +4320,11 @@ linux-gnu*) | ||
36 | lt_cv_deplibs_check_method=pass_all | ||
37 | ;; | ||
38 | |||
39 | +linux-uclibc*) | ||
40 | + lt_cv_deplibs_check_method=pass_all | ||
41 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` | ||
42 | + ;; | ||
43 | + | ||
44 | netbsd* | knetbsd*-gnu) | ||
45 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then | ||
46 | lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' | ||
47 | --- gcc-4.1.0/configure | ||
48 | +++ gcc-4.1.0/configure | ||
49 | @@ -1133,7 +1133,7 @@ no) | ||
50 | ;; | ||
51 | "") | ||
52 | case "${target}" in | ||
53 | - *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) | ||
54 | + *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) | ||
55 | # Enable libmudflap by default in GNU and friends. | ||
56 | ;; | ||
57 | *-*-freebsd*) | ||
58 | --- gcc-4.1.0/configure.in | ||
59 | +++ gcc-4.1.0/configure.in | ||
60 | @@ -341,7 +341,7 @@ no) | ||
61 | ;; | ||
62 | "") | ||
63 | case "${target}" in | ||
64 | - *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu) | ||
65 | + *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*) | ||
66 | # Enable libmudflap by default in GNU and friends. | ||
67 | ;; | ||
68 | *-*-freebsd*) | ||
69 | --- gcc-4.1.0/contrib/regression/objs-gcc.sh | ||
70 | +++ gcc-4.1.0/contrib/regression/objs-gcc.sh | ||
71 | @@ -105,6 +105,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H | ||
72 | then | ||
73 | make all-gdb all-dejagnu all-ld || exit 1 | ||
74 | make install-gdb install-dejagnu install-ld || exit 1 | ||
75 | +elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] | ||
76 | + then | ||
77 | + make all-gdb all-dejagnu all-ld || exit 1 | ||
78 | + make install-gdb install-dejagnu install-ld || exit 1 | ||
79 | elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then | ||
80 | make bootstrap || exit 1 | ||
81 | make install || exit 1 | ||
82 | --- gcc-4.1.0/gcc/config/alpha/linux-elf.h | ||
83 | +++ gcc-4.1.0/gcc/config/alpha/linux-elf.h | ||
84 | @@ -27,7 +27,11 @@ Boston, MA 02110-1301, USA. */ | ||
85 | #define SUBTARGET_EXTRA_SPECS \ | ||
86 | { "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, | ||
87 | |||
88 | +#if defined USE_UCLIBC | ||
89 | +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
90 | +#else | ||
91 | #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" | ||
92 | +#endif | ||
93 | |||
94 | #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ | ||
95 | %{O*:-O3} %{!O*:-O1} \ | ||
96 | --- gcc-4.1.0/gcc/config/arm/linux-elf.h | ||
97 | +++ gcc-4.1.0/gcc/config/arm/linux-elf.h | ||
98 | @@ -51,7 +51,11 @@ | ||
99 | |||
100 | #define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" | ||
101 | |||
102 | +#ifdef USE_UCLIBC | ||
103 | +#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" | ||
104 | +#else | ||
105 | #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.2" | ||
106 | +#endif | ||
107 | |||
108 | #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \ | ||
109 | %{b} \ | ||
110 | --- gcc-4.1.0/gcc/config/cris/linux.h | ||
111 | +++ gcc-4.1.0/gcc/config/cris/linux.h | ||
112 | @@ -73,6 +73,25 @@ Boston, MA 02110-1301, USA. */ | ||
113 | #undef CRIS_DEFAULT_CPU_VERSION | ||
114 | #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG | ||
115 | |||
116 | +#ifdef USE_UCLIBC | ||
117 | + | ||
118 | +#undef CRIS_SUBTARGET_VERSION | ||
119 | +#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc" | ||
120 | + | ||
121 | +#undef CRIS_LINK_SUBTARGET_SPEC | ||
122 | +#define CRIS_LINK_SUBTARGET_SPEC \ | ||
123 | + "-mcrislinux\ | ||
124 | + -rpath-link include/asm/../..%s\ | ||
125 | + %{shared} %{static}\ | ||
126 | + %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\ | ||
127 | + %{!shared: \ | ||
128 | + %{!static: \ | ||
129 | + %{rdynamic:-export-dynamic} \ | ||
130 | + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \ | ||
131 | + %{!r:%{O2|O3: --gc-sections}}" | ||
132 | + | ||
133 | +#else /* USE_UCLIBC */ | ||
134 | + | ||
135 | #undef CRIS_SUBTARGET_VERSION | ||
136 | #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu" | ||
137 | |||
138 | @@ -87,6 +106,8 @@ Boston, MA 02110-1301, USA. */ | ||
139 | %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\ | ||
140 | %{!r:%{O2|O3: --gc-sections}}" | ||
141 | |||
142 | +#endif /* USE_UCLIBC */ | ||
143 | + | ||
144 | |||
145 | /* Node: Run-time Target */ | ||
146 | |||
147 | --- gcc-4.1.0/gcc/config/i386/linux.h | ||
148 | +++ gcc-4.1.0/gcc/config/i386/linux.h | ||
149 | @@ -107,6 +107,11 @@ Boston, MA 02110-1301, USA. */ | ||
150 | #define LINK_EMULATION "elf_i386" | ||
151 | #define DYNAMIC_LINKER "/lib/ld-linux.so.2" | ||
152 | |||
153 | +#if defined USE_UCLIBC | ||
154 | +#undef DYNAMIC_LINKER | ||
155 | +#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
156 | +#endif | ||
157 | + | ||
158 | #undef SUBTARGET_EXTRA_SPECS | ||
159 | #define SUBTARGET_EXTRA_SPECS \ | ||
160 | { "link_emulation", LINK_EMULATION },\ | ||
161 | --- gcc-4.1.0/gcc/config/i386/linux64.h | ||
162 | +++ gcc-4.1.0/gcc/config/i386/linux64.h | ||
163 | @@ -54,14 +54,21 @@ Boston, MA 02110-1301, USA. */ | ||
164 | When the -shared link option is used a final link is not being | ||
165 | done. */ | ||
166 | |||
167 | +#ifdef USE_UCLIBC | ||
168 | +#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
169 | +#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" | ||
170 | +#else | ||
171 | +#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2" | ||
172 | +#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2" | ||
173 | +#endif | ||
174 | #undef LINK_SPEC | ||
175 | #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \ | ||
176 | %{shared:-shared} \ | ||
177 | %{!shared: \ | ||
178 | %{!static: \ | ||
179 | %{rdynamic:-export-dynamic} \ | ||
180 | - %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ | ||
181 | - %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \ | ||
182 | + %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \ | ||
183 | + %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \ | ||
184 | %{static:-static}}" | ||
185 | |||
186 | /* Similar to standard Linux, but adding -ffast-math support. */ | ||
187 | --- gcc-4.1.0/gcc/config/ia64/linux.h | ||
188 | +++ gcc-4.1.0/gcc/config/ia64/linux.h | ||
189 | @@ -37,13 +37,18 @@ do { \ | ||
190 | /* Define this for shared library support because it isn't in the main | ||
191 | linux.h file. */ | ||
192 | |||
193 | +#ifdef USE_UCLIBC | ||
194 | +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
195 | +#else | ||
196 | +#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2" | ||
197 | +#endif | ||
198 | #undef LINK_SPEC | ||
199 | #define LINK_SPEC "\ | ||
200 | %{shared:-shared} \ | ||
201 | %{!shared: \ | ||
202 | %{!static: \ | ||
203 | %{rdynamic:-export-dynamic} \ | ||
204 | - %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \ | ||
205 | + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ | ||
206 | %{static:-static}}" | ||
207 | |||
208 | |||
209 | --- gcc-4.1.0/gcc/config/m68k/linux.h | ||
210 | +++ gcc-4.1.0/gcc/config/m68k/linux.h | ||
211 | @@ -123,12 +123,17 @@ Boston, MA 02110-1301, USA. */ | ||
212 | |||
213 | /* If ELF is the default format, we should not use /lib/elf. */ | ||
214 | |||
215 | +#ifdef USE_UCLIBC | ||
216 | +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
217 | +#else | ||
218 | +#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" | ||
219 | +#endif | ||
220 | #undef LINK_SPEC | ||
221 | #define LINK_SPEC "-m m68kelf %{shared} \ | ||
222 | %{!shared: \ | ||
223 | %{!static: \ | ||
224 | %{rdynamic:-export-dynamic} \ | ||
225 | - %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \ | ||
226 | + %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ | ||
227 | %{static}}" | ||
228 | |||
229 | /* For compatibility with linux/a.out */ | ||
230 | --- gcc-4.1.0/gcc/config/mips/linux.h | ||
231 | +++ gcc-4.1.0/gcc/config/mips/linux.h | ||
232 | @@ -105,6 +105,11 @@ Boston, MA 02110-1301, USA. */ | ||
233 | |||
234 | /* Borrowed from sparc/linux.h */ | ||
235 | #undef LINK_SPEC | ||
236 | +#ifdef USE_UCLIBC | ||
237 | +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
238 | +#else | ||
239 | +#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" | ||
240 | +#endif | ||
241 | #define LINK_SPEC \ | ||
242 | "%(endian_spec) \ | ||
243 | %{shared:-shared} \ | ||
244 | @@ -112,7 +117,7 @@ Boston, MA 02110-1301, USA. */ | ||
245 | %{!ibcs: \ | ||
246 | %{!static: \ | ||
247 | %{rdynamic:-export-dynamic} \ | ||
248 | - %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ | ||
249 | + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ | ||
250 | %{static:-static}}}" | ||
251 | |||
252 | #undef SUBTARGET_ASM_SPEC | ||
253 | --- gcc-4.1.0/gcc/config/pa/pa-linux.h | ||
254 | +++ gcc-4.1.0/gcc/config/pa/pa-linux.h | ||
255 | @@ -49,13 +49,18 @@ Boston, MA 02110-1301, USA. */ | ||
256 | /* Define this for shared library support because it isn't in the main | ||
257 | linux.h file. */ | ||
258 | |||
259 | +#ifdef USE_UCLIBC | ||
260 | +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
261 | +#else | ||
262 | +#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" | ||
263 | +#endif | ||
264 | #undef LINK_SPEC | ||
265 | #define LINK_SPEC "\ | ||
266 | %{shared:-shared} \ | ||
267 | %{!shared: \ | ||
268 | %{!static: \ | ||
269 | %{rdynamic:-export-dynamic} \ | ||
270 | - %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ | ||
271 | + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ | ||
272 | %{static:-static}}" | ||
273 | |||
274 | /* glibc's profiling functions don't need gcc to allocate counters. */ | ||
275 | --- gcc-4.1.0/gcc/config/rs6000/linux.h | ||
276 | +++ gcc-4.1.0/gcc/config/rs6000/linux.h | ||
277 | @@ -72,7 +72,11 @@ | ||
278 | #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" | ||
279 | |||
280 | #undef LINK_OS_DEFAULT_SPEC | ||
281 | +#ifdef USE_UCLIBC | ||
282 | +#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)" | ||
283 | +#else | ||
284 | #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" | ||
285 | +#endif | ||
286 | |||
287 | #define LINK_GCC_C_SEQUENCE_SPEC \ | ||
288 | "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" | ||
289 | --- gcc-4.1.0/gcc/config/rs6000/sysv4.h | ||
290 | +++ gcc-4.1.0/gcc/config/rs6000/sysv4.h | ||
291 | @@ -866,6 +866,7 @@ extern int fixuplabelno; | ||
292 | mcall-linux : %(link_os_linux) ; \ | ||
293 | mcall-gnu : %(link_os_gnu) ; \ | ||
294 | mcall-netbsd : %(link_os_netbsd) ; \ | ||
295 | + mcall-linux-uclibc : %(link_os_linux_uclibc); \ | ||
296 | mcall-openbsd: %(link_os_openbsd) ; \ | ||
297 | : %(link_os_default) }" | ||
298 | |||
299 | @@ -1043,6 +1044,10 @@ extern int fixuplabelno; | ||
300 | %{rdynamic:-export-dynamic} \ | ||
301 | %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" | ||
302 | |||
303 | +#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \ | ||
304 | + %{rdynamic:-export-dynamic} \ | ||
305 | + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}" | ||
306 | + | ||
307 | #if defined(HAVE_LD_EH_FRAME_HDR) | ||
308 | # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " | ||
309 | #endif | ||
310 | @@ -1209,6 +1214,7 @@ ncrtn.o%s" | ||
311 | { "link_os_sim", LINK_OS_SIM_SPEC }, \ | ||
312 | { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \ | ||
313 | { "link_os_linux", LINK_OS_LINUX_SPEC }, \ | ||
314 | + { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \ | ||
315 | { "link_os_gnu", LINK_OS_GNU_SPEC }, \ | ||
316 | { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ | ||
317 | { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ | ||
318 | --- gcc-4.1.0/gcc/config/s390/linux.h | ||
319 | +++ gcc-4.1.0/gcc/config/s390/linux.h | ||
320 | @@ -77,6 +77,13 @@ Software Foundation, 51 Franklin Street, | ||
321 | #define MULTILIB_DEFAULTS { "m31" } | ||
322 | #endif | ||
323 | |||
324 | +#ifdef USE_UCLIBC | ||
325 | +#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
326 | +#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0" | ||
327 | +#else | ||
328 | +#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1" | ||
329 | +#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1" | ||
330 | +#endif | ||
331 | #undef LINK_SPEC | ||
332 | #define LINK_SPEC \ | ||
333 | "%{m31:-m elf_s390}%{m64:-m elf64_s390} \ | ||
334 | @@ -86,8 +93,8 @@ Software Foundation, 51 Franklin Street, | ||
335 | %{!static: \ | ||
336 | %{rdynamic:-export-dynamic} \ | ||
337 | %{!dynamic-linker: \ | ||
338 | - %{m31:-dynamic-linker /lib/ld.so.1} \ | ||
339 | - %{m64:-dynamic-linker /lib/ld64.so.1}}}}" | ||
340 | + %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \ | ||
341 | + %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}" | ||
342 | |||
343 | |||
344 | #define TARGET_ASM_FILE_END file_end_indicate_exec_stack | ||
345 | --- gcc-4.1.0/gcc/config/sh/linux.h | ||
346 | +++ gcc-4.1.0/gcc/config/sh/linux.h | ||
347 | @@ -56,12 +56,21 @@ Boston, MA 02110-1301, USA. */ | ||
348 | #undef SUBTARGET_LINK_EMUL_SUFFIX | ||
349 | #define SUBTARGET_LINK_EMUL_SUFFIX "_linux" | ||
350 | #undef SUBTARGET_LINK_SPEC | ||
351 | +#ifdef USE_UCLIBC | ||
352 | +#define SUBTARGET_LINK_SPEC \ | ||
353 | + "%{shared:-shared} \ | ||
354 | + %{!static: \ | ||
355 | + %{rdynamic:-export-dynamic} \ | ||
356 | + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \ | ||
357 | + %{static:-static}" | ||
358 | +#else | ||
359 | #define SUBTARGET_LINK_SPEC \ | ||
360 | "%{shared:-shared} \ | ||
361 | %{!static: \ | ||
362 | %{rdynamic:-export-dynamic} \ | ||
363 | %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ | ||
364 | %{static:-static}" | ||
365 | +#endif | ||
366 | |||
367 | /* Output assembler code to STREAM to call the profiler. */ | ||
368 | |||
369 | --- gcc-4.1.0/gcc/config/sparc/linux.h | ||
370 | +++ gcc-4.1.0/gcc/config/sparc/linux.h | ||
371 | @@ -125,6 +125,11 @@ Boston, MA 02110-1301, USA. */ | ||
372 | |||
373 | /* If ELF is the default format, we should not use /lib/elf. */ | ||
374 | |||
375 | +#ifdef USE_UCLIBC | ||
376 | +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
377 | +#else | ||
378 | +#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" | ||
379 | +#endif | ||
380 | #undef LINK_SPEC | ||
381 | #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ | ||
382 | %{!mno-relax:%{!r:-relax}} \ | ||
383 | @@ -132,7 +137,7 @@ Boston, MA 02110-1301, USA. */ | ||
384 | %{!ibcs: \ | ||
385 | %{!static: \ | ||
386 | %{rdynamic:-export-dynamic} \ | ||
387 | - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ | ||
388 | + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ | ||
389 | %{static:-static}}}" | ||
390 | |||
391 | /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). | ||
392 | --- gcc-4.1.0/gcc/config/sparc/linux64.h | ||
393 | +++ gcc-4.1.0/gcc/config/sparc/linux64.h | ||
394 | @@ -162,12 +162,17 @@ Boston, MA 02110-1301, USA. */ | ||
395 | { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ | ||
396 | { "link_arch", LINK_ARCH_SPEC }, | ||
397 | |||
398 | +#ifdef USE_UCLIBC | ||
399 | +#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" | ||
400 | +#else | ||
401 | +#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" | ||
402 | +#endif | ||
403 | #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ | ||
404 | %{!shared: \ | ||
405 | %{!ibcs: \ | ||
406 | %{!static: \ | ||
407 | %{rdynamic:-export-dynamic} \ | ||
408 | - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ | ||
409 | + %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \ | ||
410 | %{static:-static}}} \ | ||
411 | " | ||
412 | |||
413 | --- gcc-4.1.0/libffi/configure | ||
414 | +++ gcc-4.1.0/libffi/configure | ||
415 | @@ -3457,6 +3457,11 @@ linux-gnu*) | ||
416 | lt_cv_deplibs_check_method=pass_all | ||
417 | ;; | ||
418 | |||
419 | +linux-uclibc*) | ||
420 | + lt_cv_deplibs_check_method=pass_all | ||
421 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` | ||
422 | + ;; | ||
423 | + | ||
424 | netbsd* | knetbsd*-gnu) | ||
425 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then | ||
426 | lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' | ||
427 | --- gcc-4.1.0/libgfortran/configure | ||
428 | +++ gcc-4.1.0/libgfortran/configure | ||
429 | @@ -3699,6 +3699,11 @@ linux-gnu*) | ||
430 | lt_cv_deplibs_check_method=pass_all | ||
431 | ;; | ||
432 | |||
433 | +linux-uclibc*) | ||
434 | + lt_cv_deplibs_check_method=pass_all | ||
435 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` | ||
436 | + ;; | ||
437 | + | ||
438 | netbsd* | knetbsd*-gnu) | ||
439 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then | ||
440 | lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' | ||
441 | --- gcc-4.1.0/libjava/configure | ||
442 | +++ gcc-4.1.0/libjava/configure | ||
443 | @@ -5137,6 +5137,11 @@ linux-gnu*) | ||
444 | lt_cv_deplibs_check_method=pass_all | ||
445 | ;; | ||
446 | |||
447 | +linux-uclibc*) | ||
448 | + lt_cv_deplibs_check_method=pass_all | ||
449 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` | ||
450 | + ;; | ||
451 | + | ||
452 | netbsd* | knetbsd*-gnu) | ||
453 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then | ||
454 | lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' | ||
455 | --- gcc-4.1.0/libmudflap/configure | ||
456 | +++ gcc-4.1.0/libmudflap/configure | ||
457 | @@ -5382,6 +5382,11 @@ linux-gnu*) | ||
458 | lt_cv_deplibs_check_method=pass_all | ||
459 | ;; | ||
460 | |||
461 | +linux-uclibc*) | ||
462 | + lt_cv_deplibs_check_method=pass_all | ||
463 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` | ||
464 | + ;; | ||
465 | + | ||
466 | netbsd* | knetbsd*-gnu) | ||
467 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then | ||
468 | lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' | ||
469 | --- gcc-4.1.0/libobjc/configure | ||
470 | +++ gcc-4.1.0/libobjc/configure | ||
471 | @@ -3312,6 +3312,11 @@ linux-gnu*) | ||
472 | lt_cv_deplibs_check_method=pass_all | ||
473 | ;; | ||
474 | |||
475 | +linux-uclibc*) | ||
476 | + lt_cv_deplibs_check_method=pass_all | ||
477 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` | ||
478 | + ;; | ||
479 | + | ||
480 | netbsd* | knetbsd*-gnu) | ||
481 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then | ||
482 | lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' | ||
483 | --- gcc-4.1.0/libtool.m4 | ||
484 | +++ gcc-4.1.0/libtool.m4 | ||
485 | @@ -743,6 +743,11 @@ linux-gnu*) | ||
486 | lt_cv_deplibs_check_method=pass_all | ||
487 | ;; | ||
488 | |||
489 | +linux-uclibc*) | ||
490 | + lt_cv_deplibs_check_method=pass_all | ||
491 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` | ||
492 | + ;; | ||
493 | + | ||
494 | netbsd* | knetbsd*-gnu) | ||
495 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then | ||
496 | [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'] | ||
497 | --- gcc-4.1.0/ltconfig | ||
498 | +++ gcc-4.1.0/ltconfig | ||
499 | @@ -603,6 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)- | ||
500 | |||
501 | # Transform linux* to *-*-linux-gnu*, to support old configure scripts. | ||
502 | case $host_os in | ||
503 | +linux-uclibc*) ;; | ||
504 | linux-gnu*) ;; | ||
505 | linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` | ||
506 | esac | ||
507 | @@ -1274,6 +1275,23 @@ linux-gnu*) | ||
508 | dynamic_linker='GNU/Linux ld.so' | ||
509 | ;; | ||
510 | |||
511 | +linux-uclibc*) | ||
512 | + version_type=linux | ||
513 | + need_lib_prefix=no | ||
514 | + need_version=no | ||
515 | + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' | ||
516 | + soname_spec='${libname}${release}.so$major' | ||
517 | + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' | ||
518 | + shlibpath_var=LD_LIBRARY_PATH | ||
519 | + shlibpath_overrides_runpath=no | ||
520 | + # This implies no fast_install, which is unacceptable. | ||
521 | + # Some rework will be needed to allow for fast_install | ||
522 | + # before this can be enabled. | ||
523 | + hardcode_into_libs=yes | ||
524 | + # Assume using the uClibc dynamic linker. | ||
525 | + dynamic_linker="uClibc ld.so" | ||
526 | + ;; | ||
527 | + | ||
528 | netbsd*) | ||
529 | need_lib_prefix=no | ||
530 | need_version=no | ||
531 | --- gcc-4.1.0/zlib/configure | ||
532 | +++ gcc-4.1.0/zlib/configure | ||
533 | @@ -3426,6 +3426,11 @@ linux-gnu*) | ||
534 | lt_cv_deplibs_check_method=pass_all | ||
535 | ;; | ||
536 | |||
537 | +linux-uclibc*) | ||
538 | + lt_cv_deplibs_check_method=pass_all | ||
539 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` | ||
540 | + ;; | ||
541 | + | ||
542 | netbsd* | knetbsd*-gnu) | ||
543 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then | ||
544 | lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/110-arm-eabi.patch b/meta/packages/gcc/gcc-4.1.1/110-arm-eabi.patch new file mode 100644 index 0000000000..acebe5308f --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/110-arm-eabi.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | --- gcc-2005q3-1.orig/gcc/config.gcc 2005-10-31 19:02:54.000000000 +0300 | ||
2 | +++ gcc-2005q3-1/gcc/config.gcc 2006-01-27 01:09:09.000000000 +0300 | ||
3 | @@ -674,7 +674,7 @@ | ||
4 | tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" | ||
5 | tmake_file="t-slibgcc-elf-ver t-linux arm/t-arm" | ||
6 | case ${target} in | ||
7 | - arm*-*-linux-gnueabi) | ||
8 | + arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi) | ||
9 | tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h" | ||
10 | tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi" | ||
11 | # The BPABI long long divmod functions return a 128-bit value in | ||
12 | |||
13 | diff -urN gcc-2005q3-2/gcc/config/arm/linux-eabi.h gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h | ||
14 | --- gcc-2005q3-2/gcc/config/arm/linux-eabi.h 2005-12-07 23:14:16.000000000 +0300 | ||
15 | +++ gcc-2005q3-2.new/gcc/config/arm/linux-eabi.h 2006-03-29 19:02:34.000000000 +0400 | ||
16 | @@ -53,7 +53,11 @@ | ||
17 | /* Use ld-linux.so.3 so that it will be possible to run "classic" | ||
18 | GNU/Linux binaries on an EABI system. */ | ||
19 | #undef LINUX_TARGET_INTERPRETER | ||
20 | +#ifdef USE_UCLIBC | ||
21 | +#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0" | ||
22 | +#else | ||
23 | #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.3" | ||
24 | +#endif | ||
25 | |||
26 | /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to | ||
27 | use the GNU/Linux version, not the generic BPABI version. */ | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/200-uclibc-locale.patch b/meta/packages/gcc/gcc-4.1.1/200-uclibc-locale.patch new file mode 100644 index 0000000000..9d65a6234e --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/200-uclibc-locale.patch | |||
@@ -0,0 +1,3261 @@ | |||
1 | diff -urN gcc-4.1.0-dist/libstdc++-v3/acinclude.m4 gcc-4.1.0/libstdc++-v3/acinclude.m4 | ||
2 | --- gcc-4.1.0-dist/libstdc++-v3/acinclude.m4 2006-03-26 12:08:28.000000000 -0700 | ||
3 | +++ gcc-4.1.0/libstdc++-v3/acinclude.m4 2006-03-25 22:06:30.000000000 -0700 | ||
4 | @@ -1071,7 +1071,7 @@ | ||
5 | AC_MSG_CHECKING([for C locale to use]) | ||
6 | GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], | ||
7 | [use MODEL for target locale package], | ||
8 | - [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) | ||
9 | + [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) | ||
10 | |||
11 | # If they didn't use this option switch, or if they specified --enable | ||
12 | # with no specific model, we'll have to look for one. If they | ||
13 | @@ -1087,6 +1087,9 @@ | ||
14 | # Default to "generic". | ||
15 | if test $enable_clocale_flag = auto; then | ||
16 | case ${target_os} in | ||
17 | + *-uclibc*) | ||
18 | + enable_clocale_flag=uclibc | ||
19 | + ;; | ||
20 | linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) | ||
21 | AC_EGREP_CPP([_GLIBCXX_ok], [ | ||
22 | #include <features.h> | ||
23 | @@ -1230,6 +1233,40 @@ | ||
24 | CTIME_CC=config/locale/generic/time_members.cc | ||
25 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h | ||
26 | ;; | ||
27 | + uclibc) | ||
28 | + AC_MSG_RESULT(uclibc) | ||
29 | + | ||
30 | + # Declare intention to use gettext, and add support for specific | ||
31 | + # languages. | ||
32 | + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT | ||
33 | + ALL_LINGUAS="de fr" | ||
34 | + | ||
35 | + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. | ||
36 | + AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) | ||
37 | + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then | ||
38 | + USE_NLS=yes | ||
39 | + fi | ||
40 | + # Export the build objects. | ||
41 | + for ling in $ALL_LINGUAS; do \ | ||
42 | + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ | ||
43 | + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ | ||
44 | + done | ||
45 | + AC_SUBST(glibcxx_MOFILES) | ||
46 | + AC_SUBST(glibcxx_POFILES) | ||
47 | + | ||
48 | + CLOCALE_H=config/locale/uclibc/c_locale.h | ||
49 | + CLOCALE_CC=config/locale/uclibc/c_locale.cc | ||
50 | + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc | ||
51 | + CCOLLATE_CC=config/locale/uclibc/collate_members.cc | ||
52 | + CCTYPE_CC=config/locale/uclibc/ctype_members.cc | ||
53 | + CMESSAGES_H=config/locale/uclibc/messages_members.h | ||
54 | + CMESSAGES_CC=config/locale/uclibc/messages_members.cc | ||
55 | + CMONEY_CC=config/locale/uclibc/monetary_members.cc | ||
56 | + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc | ||
57 | + CTIME_H=config/locale/uclibc/time_members.h | ||
58 | + CTIME_CC=config/locale/uclibc/time_members.cc | ||
59 | + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h | ||
60 | + ;; | ||
61 | esac | ||
62 | |||
63 | # This is where the testsuite looks for locale catalogs, using the | ||
64 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h | ||
65 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 17:00:00.000000000 -0700 | ||
66 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2006-03-25 22:18:37.000000000 -0700 | ||
67 | @@ -0,0 +1,63 @@ | ||
68 | +// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- | ||
69 | + | ||
70 | +// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. | ||
71 | +// | ||
72 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
73 | +// software; you can redistribute it and/or modify it under the | ||
74 | +// terms of the GNU General Public License as published by the | ||
75 | +// Free Software Foundation; either version 2, or (at your option) | ||
76 | +// any later version. | ||
77 | + | ||
78 | +// This library is distributed in the hope that it will be useful, | ||
79 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
80 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
81 | +// GNU General Public License for more details. | ||
82 | + | ||
83 | +// You should have received a copy of the GNU General Public License along | ||
84 | +// with this library; see the file COPYING. If not, write to the Free | ||
85 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
86 | +// USA. | ||
87 | + | ||
88 | +// As a special exception, you may use this file as part of a free software | ||
89 | +// library without restriction. Specifically, if other files instantiate | ||
90 | +// templates or use macros or inline functions from this file, or you compile | ||
91 | +// this file and link it with other files to produce an executable, this | ||
92 | +// file does not by itself cause the resulting executable to be covered by | ||
93 | +// the GNU General Public License. This exception does not however | ||
94 | +// invalidate any other reasons why the executable file might be covered by | ||
95 | +// the GNU General Public License. | ||
96 | + | ||
97 | +// Written by Jakub Jelinek <jakub@redhat.com> | ||
98 | + | ||
99 | +#include <bits/c++config.h> | ||
100 | +#include <clocale> | ||
101 | + | ||
102 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
103 | +#warning clean this up | ||
104 | +#endif | ||
105 | + | ||
106 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
107 | + | ||
108 | +extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; | ||
109 | +extern "C" __typeof(strcoll_l) __strcoll_l; | ||
110 | +extern "C" __typeof(strftime_l) __strftime_l; | ||
111 | +extern "C" __typeof(strtod_l) __strtod_l; | ||
112 | +extern "C" __typeof(strtof_l) __strtof_l; | ||
113 | +extern "C" __typeof(strtold_l) __strtold_l; | ||
114 | +extern "C" __typeof(strxfrm_l) __strxfrm_l; | ||
115 | +extern "C" __typeof(newlocale) __newlocale; | ||
116 | +extern "C" __typeof(freelocale) __freelocale; | ||
117 | +extern "C" __typeof(duplocale) __duplocale; | ||
118 | +extern "C" __typeof(uselocale) __uselocale; | ||
119 | + | ||
120 | +#ifdef _GLIBCXX_USE_WCHAR_T | ||
121 | +extern "C" __typeof(iswctype_l) __iswctype_l; | ||
122 | +extern "C" __typeof(towlower_l) __towlower_l; | ||
123 | +extern "C" __typeof(towupper_l) __towupper_l; | ||
124 | +extern "C" __typeof(wcscoll_l) __wcscoll_l; | ||
125 | +extern "C" __typeof(wcsftime_l) __wcsftime_l; | ||
126 | +extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; | ||
127 | +extern "C" __typeof(wctype_l) __wctype_l; | ||
128 | +#endif | ||
129 | + | ||
130 | +#endif // GLIBC 2.3 and later | ||
131 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.cc | ||
132 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 17:00:00.000000000 -0700 | ||
133 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2006-03-25 22:18:37.000000000 -0700 | ||
134 | @@ -0,0 +1,152 @@ | ||
135 | +// Wrapper for underlying C-language localization -*- C++ -*- | ||
136 | + | ||
137 | +// Copyright (C) 2001, 2002, 2003, 2004, 2005 | ||
138 | +// Free Software Foundation, Inc. | ||
139 | +// | ||
140 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
141 | +// software; you can redistribute it and/or modify it under the | ||
142 | +// terms of the GNU General Public License as published by the | ||
143 | +// Free Software Foundation; either version 2, or (at your option) | ||
144 | +// any later version. | ||
145 | + | ||
146 | +// This library is distributed in the hope that it will be useful, | ||
147 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
148 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
149 | +// GNU General Public License for more details. | ||
150 | + | ||
151 | +// You should have received a copy of the GNU General Public License along | ||
152 | +// with this library; see the file COPYING. If not, write to the Free | ||
153 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
154 | +// USA. | ||
155 | + | ||
156 | +// As a special exception, you may use this file as part of a free software | ||
157 | +// library without restriction. Specifically, if other files instantiate | ||
158 | +// templates or use macros or inline functions from this file, or you compile | ||
159 | +// this file and link it with other files to produce an executable, this | ||
160 | +// file does not by itself cause the resulting executable to be covered by | ||
161 | +// the GNU General Public License. This exception does not however | ||
162 | +// invalidate any other reasons why the executable file might be covered by | ||
163 | +// the GNU General Public License. | ||
164 | + | ||
165 | +// | ||
166 | +// ISO C++ 14882: 22.8 Standard locale categories. | ||
167 | +// | ||
168 | + | ||
169 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
170 | + | ||
171 | +#include <cerrno> // For errno | ||
172 | +#include <locale> | ||
173 | +#include <stdexcept> | ||
174 | +#include <langinfo.h> | ||
175 | +#include <bits/c++locale_internal.h> | ||
176 | + | ||
177 | +#ifndef __UCLIBC_HAS_XLOCALE__ | ||
178 | +#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) | ||
179 | +#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) | ||
180 | +#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) | ||
181 | +#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) | ||
182 | +#define __strtof_l(S, E, L) strtof((S), (E)) | ||
183 | +#define __strtod_l(S, E, L) strtod((S), (E)) | ||
184 | +#define __strtold_l(S, E, L) strtold((S), (E)) | ||
185 | +#warning should dummy __newlocale check for C|POSIX ? | ||
186 | +#define __newlocale(a, b, c) NULL | ||
187 | +#define __freelocale(a) ((void)0) | ||
188 | +#define __duplocale(a) __c_locale() | ||
189 | +#endif | ||
190 | + | ||
191 | +namespace std | ||
192 | +{ | ||
193 | + template<> | ||
194 | + void | ||
195 | + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, | ||
196 | + const __c_locale& __cloc) | ||
197 | + { | ||
198 | + char* __sanity; | ||
199 | + errno = 0; | ||
200 | + float __f = __strtof_l(__s, &__sanity, __cloc); | ||
201 | + if (__sanity != __s && errno != ERANGE) | ||
202 | + __v = __f; | ||
203 | + else | ||
204 | + __err |= ios_base::failbit; | ||
205 | + } | ||
206 | + | ||
207 | + template<> | ||
208 | + void | ||
209 | + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, | ||
210 | + const __c_locale& __cloc) | ||
211 | + { | ||
212 | + char* __sanity; | ||
213 | + errno = 0; | ||
214 | + double __d = __strtod_l(__s, &__sanity, __cloc); | ||
215 | + if (__sanity != __s && errno != ERANGE) | ||
216 | + __v = __d; | ||
217 | + else | ||
218 | + __err |= ios_base::failbit; | ||
219 | + } | ||
220 | + | ||
221 | + template<> | ||
222 | + void | ||
223 | + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, | ||
224 | + const __c_locale& __cloc) | ||
225 | + { | ||
226 | + char* __sanity; | ||
227 | + errno = 0; | ||
228 | + long double __ld = __strtold_l(__s, &__sanity, __cloc); | ||
229 | + if (__sanity != __s && errno != ERANGE) | ||
230 | + __v = __ld; | ||
231 | + else | ||
232 | + __err |= ios_base::failbit; | ||
233 | + } | ||
234 | + | ||
235 | + void | ||
236 | + locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, | ||
237 | + __c_locale __old) | ||
238 | + { | ||
239 | + __cloc = __newlocale(1 << LC_ALL, __s, __old); | ||
240 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
241 | + if (!__cloc) | ||
242 | + { | ||
243 | + // This named locale is not supported by the underlying OS. | ||
244 | + __throw_runtime_error(__N("locale::facet::_S_create_c_locale " | ||
245 | + "name not valid")); | ||
246 | + } | ||
247 | +#endif | ||
248 | + } | ||
249 | + | ||
250 | + void | ||
251 | + locale::facet::_S_destroy_c_locale(__c_locale& __cloc) | ||
252 | + { | ||
253 | + if (__cloc && _S_get_c_locale() != __cloc) | ||
254 | + __freelocale(__cloc); | ||
255 | + } | ||
256 | + | ||
257 | + __c_locale | ||
258 | + locale::facet::_S_clone_c_locale(__c_locale& __cloc) | ||
259 | + { return __duplocale(__cloc); } | ||
260 | +} // namespace std | ||
261 | + | ||
262 | +namespace __gnu_cxx | ||
263 | +{ | ||
264 | + const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = | ||
265 | + { | ||
266 | + "LC_CTYPE", | ||
267 | + "LC_NUMERIC", | ||
268 | + "LC_TIME", | ||
269 | + "LC_COLLATE", | ||
270 | + "LC_MONETARY", | ||
271 | + "LC_MESSAGES", | ||
272 | +#if _GLIBCXX_NUM_CATEGORIES != 0 | ||
273 | + "LC_PAPER", | ||
274 | + "LC_NAME", | ||
275 | + "LC_ADDRESS", | ||
276 | + "LC_TELEPHONE", | ||
277 | + "LC_MEASUREMENT", | ||
278 | + "LC_IDENTIFICATION" | ||
279 | +#endif | ||
280 | + }; | ||
281 | +} | ||
282 | + | ||
283 | +namespace std | ||
284 | +{ | ||
285 | + const char* const* const locale::_S_categories = __gnu_cxx::category_names; | ||
286 | +} // namespace std | ||
287 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.h | ||
288 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 17:00:00.000000000 -0700 | ||
289 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2006-03-26 13:03:42.000000000 -0700 | ||
290 | @@ -0,0 +1,117 @@ | ||
291 | +// Wrapper for underlying C-language localization -*- C++ -*- | ||
292 | + | ||
293 | +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. | ||
294 | +// | ||
295 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
296 | +// software; you can redistribute it and/or modify it under the | ||
297 | +// terms of the GNU General Public License as published by the | ||
298 | +// Free Software Foundation; either version 2, or (at your option) | ||
299 | +// any later version. | ||
300 | + | ||
301 | +// This library is distributed in the hope that it will be useful, | ||
302 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
303 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
304 | +// GNU General Public License for more details. | ||
305 | + | ||
306 | +// You should have received a copy of the GNU General Public License along | ||
307 | +// with this library; see the file COPYING. If not, write to the Free | ||
308 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
309 | +// USA. | ||
310 | + | ||
311 | +// As a special exception, you may use this file as part of a free software | ||
312 | +// library without restriction. Specifically, if other files instantiate | ||
313 | +// templates or use macros or inline functions from this file, or you compile | ||
314 | +// this file and link it with other files to produce an executable, this | ||
315 | +// file does not by itself cause the resulting executable to be covered by | ||
316 | +// the GNU General Public License. This exception does not however | ||
317 | +// invalidate any other reasons why the executable file might be covered by | ||
318 | +// the GNU General Public License. | ||
319 | + | ||
320 | +// | ||
321 | +// ISO C++ 14882: 22.8 Standard locale categories. | ||
322 | +// | ||
323 | + | ||
324 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
325 | + | ||
326 | +#ifndef _C_LOCALE_H | ||
327 | +#define _C_LOCALE_H 1 | ||
328 | + | ||
329 | +#pragma GCC system_header | ||
330 | + | ||
331 | +#include <cstring> // get std::strlen | ||
332 | +#include <cstdio> // get std::snprintf or std::sprintf | ||
333 | +#include <clocale> | ||
334 | +#include <langinfo.h> // For codecvt | ||
335 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
336 | +#warning fix this | ||
337 | +#endif | ||
338 | +#ifdef __UCLIBC_HAS_LOCALE__ | ||
339 | +#include <iconv.h> // For codecvt using iconv, iconv_t | ||
340 | +#endif | ||
341 | +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ | ||
342 | +#include <libintl.h> // For messages | ||
343 | +#endif | ||
344 | + | ||
345 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
346 | +#warning what is _GLIBCXX_C_LOCALE_GNU for | ||
347 | +#endif | ||
348 | +#define _GLIBCXX_C_LOCALE_GNU 1 | ||
349 | + | ||
350 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
351 | +#warning fix categories | ||
352 | +#endif | ||
353 | +// #define _GLIBCXX_NUM_CATEGORIES 6 | ||
354 | +#define _GLIBCXX_NUM_CATEGORIES 0 | ||
355 | + | ||
356 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
357 | +namespace __gnu_cxx | ||
358 | +{ | ||
359 | + extern "C" __typeof(uselocale) __uselocale; | ||
360 | +} | ||
361 | +#endif | ||
362 | + | ||
363 | +namespace std | ||
364 | +{ | ||
365 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
366 | + typedef __locale_t __c_locale; | ||
367 | +#else | ||
368 | + typedef int* __c_locale; | ||
369 | +#endif | ||
370 | + | ||
371 | + // Convert numeric value of type _Tv to string and return length of | ||
372 | + // string. If snprintf is available use it, otherwise fall back to | ||
373 | + // the unsafe sprintf which, in general, can be dangerous and should | ||
374 | + // be avoided. | ||
375 | + template<typename _Tv> | ||
376 | + int | ||
377 | + __convert_from_v(char* __out, | ||
378 | + const int __size __attribute__ ((__unused__)), | ||
379 | + const char* __fmt, | ||
380 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
381 | + _Tv __v, const __c_locale& __cloc, int __prec) | ||
382 | + { | ||
383 | + __c_locale __old = __gnu_cxx::__uselocale(__cloc); | ||
384 | +#else | ||
385 | + _Tv __v, const __c_locale&, int __prec) | ||
386 | + { | ||
387 | +# ifdef __UCLIBC_HAS_LOCALE__ | ||
388 | + char* __old = std::setlocale(LC_ALL, NULL); | ||
389 | + char* __sav = new char[std::strlen(__old) + 1]; | ||
390 | + std::strcpy(__sav, __old); | ||
391 | + std::setlocale(LC_ALL, "C"); | ||
392 | +# endif | ||
393 | +#endif | ||
394 | + | ||
395 | + const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); | ||
396 | + | ||
397 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
398 | + __gnu_cxx::__uselocale(__old); | ||
399 | +#elif defined __UCLIBC_HAS_LOCALE__ | ||
400 | + std::setlocale(LC_ALL, __sav); | ||
401 | + delete [] __sav; | ||
402 | +#endif | ||
403 | + return __ret; | ||
404 | + } | ||
405 | +} | ||
406 | + | ||
407 | +#endif | ||
408 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc | ||
409 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 17:00:00.000000000 -0700 | ||
410 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2006-03-25 22:18:37.000000000 -0700 | ||
411 | @@ -0,0 +1,306 @@ | ||
412 | +// std::codecvt implementation details, GNU version -*- C++ -*- | ||
413 | + | ||
414 | +// Copyright (C) 2002, 2003 Free Software Foundation, Inc. | ||
415 | +// | ||
416 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
417 | +// software; you can redistribute it and/or modify it under the | ||
418 | +// terms of the GNU General Public License as published by the | ||
419 | +// Free Software Foundation; either version 2, or (at your option) | ||
420 | +// any later version. | ||
421 | + | ||
422 | +// This library is distributed in the hope that it will be useful, | ||
423 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
424 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
425 | +// GNU General Public License for more details. | ||
426 | + | ||
427 | +// You should have received a copy of the GNU General Public License along | ||
428 | +// with this library; see the file COPYING. If not, write to the Free | ||
429 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
430 | +// USA. | ||
431 | + | ||
432 | +// As a special exception, you may use this file as part of a free software | ||
433 | +// library without restriction. Specifically, if other files instantiate | ||
434 | +// templates or use macros or inline functions from this file, or you compile | ||
435 | +// this file and link it with other files to produce an executable, this | ||
436 | +// file does not by itself cause the resulting executable to be covered by | ||
437 | +// the GNU General Public License. This exception does not however | ||
438 | +// invalidate any other reasons why the executable file might be covered by | ||
439 | +// the GNU General Public License. | ||
440 | + | ||
441 | +// | ||
442 | +// ISO C++ 14882: 22.2.1.5 - Template class codecvt | ||
443 | +// | ||
444 | + | ||
445 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
446 | + | ||
447 | +#include <locale> | ||
448 | +#include <bits/c++locale_internal.h> | ||
449 | + | ||
450 | +namespace std | ||
451 | +{ | ||
452 | + // Specializations. | ||
453 | +#ifdef _GLIBCXX_USE_WCHAR_T | ||
454 | + codecvt_base::result | ||
455 | + codecvt<wchar_t, char, mbstate_t>:: | ||
456 | + do_out(state_type& __state, const intern_type* __from, | ||
457 | + const intern_type* __from_end, const intern_type*& __from_next, | ||
458 | + extern_type* __to, extern_type* __to_end, | ||
459 | + extern_type*& __to_next) const | ||
460 | + { | ||
461 | + result __ret = ok; | ||
462 | + state_type __tmp_state(__state); | ||
463 | + | ||
464 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
465 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); | ||
466 | +#endif | ||
467 | + | ||
468 | + // wcsnrtombs is *very* fast but stops if encounters NUL characters: | ||
469 | + // in case we fall back to wcrtomb and then continue, in a loop. | ||
470 | + // NB: wcsnrtombs is a GNU extension | ||
471 | + for (__from_next = __from, __to_next = __to; | ||
472 | + __from_next < __from_end && __to_next < __to_end | ||
473 | + && __ret == ok;) | ||
474 | + { | ||
475 | + const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0', | ||
476 | + __from_end - __from_next); | ||
477 | + if (!__from_chunk_end) | ||
478 | + __from_chunk_end = __from_end; | ||
479 | + | ||
480 | + __from = __from_next; | ||
481 | + const size_t __conv = wcsnrtombs(__to_next, &__from_next, | ||
482 | + __from_chunk_end - __from_next, | ||
483 | + __to_end - __to_next, &__state); | ||
484 | + if (__conv == static_cast<size_t>(-1)) | ||
485 | + { | ||
486 | + // In case of error, in order to stop at the exact place we | ||
487 | + // have to start again from the beginning with a series of | ||
488 | + // wcrtomb. | ||
489 | + for (; __from < __from_next; ++__from) | ||
490 | + __to_next += wcrtomb(__to_next, *__from, &__tmp_state); | ||
491 | + __state = __tmp_state; | ||
492 | + __ret = error; | ||
493 | + } | ||
494 | + else if (__from_next && __from_next < __from_chunk_end) | ||
495 | + { | ||
496 | + __to_next += __conv; | ||
497 | + __ret = partial; | ||
498 | + } | ||
499 | + else | ||
500 | + { | ||
501 | + __from_next = __from_chunk_end; | ||
502 | + __to_next += __conv; | ||
503 | + } | ||
504 | + | ||
505 | + if (__from_next < __from_end && __ret == ok) | ||
506 | + { | ||
507 | + extern_type __buf[MB_LEN_MAX]; | ||
508 | + __tmp_state = __state; | ||
509 | + const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state); | ||
510 | + if (__conv > static_cast<size_t>(__to_end - __to_next)) | ||
511 | + __ret = partial; | ||
512 | + else | ||
513 | + { | ||
514 | + memcpy(__to_next, __buf, __conv); | ||
515 | + __state = __tmp_state; | ||
516 | + __to_next += __conv; | ||
517 | + ++__from_next; | ||
518 | + } | ||
519 | + } | ||
520 | + } | ||
521 | + | ||
522 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
523 | + __uselocale(__old); | ||
524 | +#endif | ||
525 | + | ||
526 | + return __ret; | ||
527 | + } | ||
528 | + | ||
529 | + codecvt_base::result | ||
530 | + codecvt<wchar_t, char, mbstate_t>:: | ||
531 | + do_in(state_type& __state, const extern_type* __from, | ||
532 | + const extern_type* __from_end, const extern_type*& __from_next, | ||
533 | + intern_type* __to, intern_type* __to_end, | ||
534 | + intern_type*& __to_next) const | ||
535 | + { | ||
536 | + result __ret = ok; | ||
537 | + state_type __tmp_state(__state); | ||
538 | + | ||
539 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
540 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); | ||
541 | +#endif | ||
542 | + | ||
543 | + // mbsnrtowcs is *very* fast but stops if encounters NUL characters: | ||
544 | + // in case we store a L'\0' and then continue, in a loop. | ||
545 | + // NB: mbsnrtowcs is a GNU extension | ||
546 | + for (__from_next = __from, __to_next = __to; | ||
547 | + __from_next < __from_end && __to_next < __to_end | ||
548 | + && __ret == ok;) | ||
549 | + { | ||
550 | + const extern_type* __from_chunk_end; | ||
551 | + __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0', | ||
552 | + __from_end | ||
553 | + - __from_next)); | ||
554 | + if (!__from_chunk_end) | ||
555 | + __from_chunk_end = __from_end; | ||
556 | + | ||
557 | + __from = __from_next; | ||
558 | + size_t __conv = mbsnrtowcs(__to_next, &__from_next, | ||
559 | + __from_chunk_end - __from_next, | ||
560 | + __to_end - __to_next, &__state); | ||
561 | + if (__conv == static_cast<size_t>(-1)) | ||
562 | + { | ||
563 | + // In case of error, in order to stop at the exact place we | ||
564 | + // have to start again from the beginning with a series of | ||
565 | + // mbrtowc. | ||
566 | + for (;; ++__to_next, __from += __conv) | ||
567 | + { | ||
568 | + __conv = mbrtowc(__to_next, __from, __from_end - __from, | ||
569 | + &__tmp_state); | ||
570 | + if (__conv == static_cast<size_t>(-1) | ||
571 | + || __conv == static_cast<size_t>(-2)) | ||
572 | + break; | ||
573 | + } | ||
574 | + __from_next = __from; | ||
575 | + __state = __tmp_state; | ||
576 | + __ret = error; | ||
577 | + } | ||
578 | + else if (__from_next && __from_next < __from_chunk_end) | ||
579 | + { | ||
580 | + // It is unclear what to return in this case (see DR 382). | ||
581 | + __to_next += __conv; | ||
582 | + __ret = partial; | ||
583 | + } | ||
584 | + else | ||
585 | + { | ||
586 | + __from_next = __from_chunk_end; | ||
587 | + __to_next += __conv; | ||
588 | + } | ||
589 | + | ||
590 | + if (__from_next < __from_end && __ret == ok) | ||
591 | + { | ||
592 | + if (__to_next < __to_end) | ||
593 | + { | ||
594 | + // XXX Probably wrong for stateful encodings | ||
595 | + __tmp_state = __state; | ||
596 | + ++__from_next; | ||
597 | + *__to_next++ = L'\0'; | ||
598 | + } | ||
599 | + else | ||
600 | + __ret = partial; | ||
601 | + } | ||
602 | + } | ||
603 | + | ||
604 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
605 | + __uselocale(__old); | ||
606 | +#endif | ||
607 | + | ||
608 | + return __ret; | ||
609 | + } | ||
610 | + | ||
611 | + int | ||
612 | + codecvt<wchar_t, char, mbstate_t>:: | ||
613 | + do_encoding() const throw() | ||
614 | + { | ||
615 | + // XXX This implementation assumes that the encoding is | ||
616 | + // stateless and is either single-byte or variable-width. | ||
617 | + int __ret = 0; | ||
618 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
619 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); | ||
620 | +#endif | ||
621 | + if (MB_CUR_MAX == 1) | ||
622 | + __ret = 1; | ||
623 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
624 | + __uselocale(__old); | ||
625 | +#endif | ||
626 | + return __ret; | ||
627 | + } | ||
628 | + | ||
629 | + int | ||
630 | + codecvt<wchar_t, char, mbstate_t>:: | ||
631 | + do_max_length() const throw() | ||
632 | + { | ||
633 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
634 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); | ||
635 | +#endif | ||
636 | + // XXX Probably wrong for stateful encodings. | ||
637 | + int __ret = MB_CUR_MAX; | ||
638 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
639 | + __uselocale(__old); | ||
640 | +#endif | ||
641 | + return __ret; | ||
642 | + } | ||
643 | + | ||
644 | + int | ||
645 | + codecvt<wchar_t, char, mbstate_t>:: | ||
646 | + do_length(state_type& __state, const extern_type* __from, | ||
647 | + const extern_type* __end, size_t __max) const | ||
648 | + { | ||
649 | + int __ret = 0; | ||
650 | + state_type __tmp_state(__state); | ||
651 | + | ||
652 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
653 | + __c_locale __old = __uselocale(_M_c_locale_codecvt); | ||
654 | +#endif | ||
655 | + | ||
656 | + // mbsnrtowcs is *very* fast but stops if encounters NUL characters: | ||
657 | + // in case we advance past it and then continue, in a loop. | ||
658 | + // NB: mbsnrtowcs is a GNU extension | ||
659 | + | ||
660 | + // A dummy internal buffer is needed in order for mbsnrtocws to consider | ||
661 | + // its fourth parameter (it wouldn't with NULL as first parameter). | ||
662 | + wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t) | ||
663 | + * __max)); | ||
664 | + while (__from < __end && __max) | ||
665 | + { | ||
666 | + const extern_type* __from_chunk_end; | ||
667 | + __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0', | ||
668 | + __end | ||
669 | + - __from)); | ||
670 | + if (!__from_chunk_end) | ||
671 | + __from_chunk_end = __end; | ||
672 | + | ||
673 | + const extern_type* __tmp_from = __from; | ||
674 | + size_t __conv = mbsnrtowcs(__to, &__from, | ||
675 | + __from_chunk_end - __from, | ||
676 | + __max, &__state); | ||
677 | + if (__conv == static_cast<size_t>(-1)) | ||
678 | + { | ||
679 | + // In case of error, in order to stop at the exact place we | ||
680 | + // have to start again from the beginning with a series of | ||
681 | + // mbrtowc. | ||
682 | + for (__from = __tmp_from;; __from += __conv) | ||
683 | + { | ||
684 | + __conv = mbrtowc(NULL, __from, __end - __from, | ||
685 | + &__tmp_state); | ||
686 | + if (__conv == static_cast<size_t>(-1) | ||
687 | + || __conv == static_cast<size_t>(-2)) | ||
688 | + break; | ||
689 | + } | ||
690 | + __state = __tmp_state; | ||
691 | + __ret += __from - __tmp_from; | ||
692 | + break; | ||
693 | + } | ||
694 | + if (!__from) | ||
695 | + __from = __from_chunk_end; | ||
696 | + | ||
697 | + __ret += __from - __tmp_from; | ||
698 | + __max -= __conv; | ||
699 | + | ||
700 | + if (__from < __end && __max) | ||
701 | + { | ||
702 | + // XXX Probably wrong for stateful encodings | ||
703 | + __tmp_state = __state; | ||
704 | + ++__from; | ||
705 | + ++__ret; | ||
706 | + --__max; | ||
707 | + } | ||
708 | + } | ||
709 | + | ||
710 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
711 | + __uselocale(__old); | ||
712 | +#endif | ||
713 | + | ||
714 | + return __ret; | ||
715 | + } | ||
716 | +#endif | ||
717 | +} | ||
718 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/collate_members.cc | ||
719 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 17:00:00.000000000 -0700 | ||
720 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2006-03-25 22:18:37.000000000 -0700 | ||
721 | @@ -0,0 +1,80 @@ | ||
722 | +// std::collate implementation details, GNU version -*- C++ -*- | ||
723 | + | ||
724 | +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. | ||
725 | +// | ||
726 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
727 | +// software; you can redistribute it and/or modify it under the | ||
728 | +// terms of the GNU General Public License as published by the | ||
729 | +// Free Software Foundation; either version 2, or (at your option) | ||
730 | +// any later version. | ||
731 | + | ||
732 | +// This library is distributed in the hope that it will be useful, | ||
733 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
734 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
735 | +// GNU General Public License for more details. | ||
736 | + | ||
737 | +// You should have received a copy of the GNU General Public License along | ||
738 | +// with this library; see the file COPYING. If not, write to the Free | ||
739 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
740 | +// USA. | ||
741 | + | ||
742 | +// As a special exception, you may use this file as part of a free software | ||
743 | +// library without restriction. Specifically, if other files instantiate | ||
744 | +// templates or use macros or inline functions from this file, or you compile | ||
745 | +// this file and link it with other files to produce an executable, this | ||
746 | +// file does not by itself cause the resulting executable to be covered by | ||
747 | +// the GNU General Public License. This exception does not however | ||
748 | +// invalidate any other reasons why the executable file might be covered by | ||
749 | +// the GNU General Public License. | ||
750 | + | ||
751 | +// | ||
752 | +// ISO C++ 14882: 22.2.4.1.2 collate virtual functions | ||
753 | +// | ||
754 | + | ||
755 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
756 | + | ||
757 | +#include <locale> | ||
758 | +#include <bits/c++locale_internal.h> | ||
759 | + | ||
760 | +#ifndef __UCLIBC_HAS_XLOCALE__ | ||
761 | +#define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) | ||
762 | +#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) | ||
763 | +#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) | ||
764 | +#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) | ||
765 | +#endif | ||
766 | + | ||
767 | +namespace std | ||
768 | +{ | ||
769 | + // These are basically extensions to char_traits, and perhaps should | ||
770 | + // be put there instead of here. | ||
771 | + template<> | ||
772 | + int | ||
773 | + collate<char>::_M_compare(const char* __one, const char* __two) const | ||
774 | + { | ||
775 | + int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); | ||
776 | + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); | ||
777 | + } | ||
778 | + | ||
779 | + template<> | ||
780 | + size_t | ||
781 | + collate<char>::_M_transform(char* __to, const char* __from, | ||
782 | + size_t __n) const | ||
783 | + { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } | ||
784 | + | ||
785 | +#ifdef _GLIBCXX_USE_WCHAR_T | ||
786 | + template<> | ||
787 | + int | ||
788 | + collate<wchar_t>::_M_compare(const wchar_t* __one, | ||
789 | + const wchar_t* __two) const | ||
790 | + { | ||
791 | + int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); | ||
792 | + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); | ||
793 | + } | ||
794 | + | ||
795 | + template<> | ||
796 | + size_t | ||
797 | + collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from, | ||
798 | + size_t __n) const | ||
799 | + { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } | ||
800 | +#endif | ||
801 | +} | ||
802 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc | ||
803 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 17:00:00.000000000 -0700 | ||
804 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2006-03-25 22:18:37.000000000 -0700 | ||
805 | @@ -0,0 +1,314 @@ | ||
806 | +// std::ctype implementation details, GNU version -*- C++ -*- | ||
807 | + | ||
808 | +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. | ||
809 | +// | ||
810 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
811 | +// software; you can redistribute it and/or modify it under the | ||
812 | +// terms of the GNU General Public License as published by the | ||
813 | +// Free Software Foundation; either version 2, or (at your option) | ||
814 | +// any later version. | ||
815 | + | ||
816 | +// This library is distributed in the hope that it will be useful, | ||
817 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
818 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
819 | +// GNU General Public License for more details. | ||
820 | + | ||
821 | +// You should have received a copy of the GNU General Public License along | ||
822 | +// with this library; see the file COPYING. If not, write to the Free | ||
823 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
824 | +// USA. | ||
825 | + | ||
826 | +// As a special exception, you may use this file as part of a free software | ||
827 | +// library without restriction. Specifically, if other files instantiate | ||
828 | +// templates or use macros or inline functions from this file, or you compile | ||
829 | +// this file and link it with other files to produce an executable, this | ||
830 | +// file does not by itself cause the resulting executable to be covered by | ||
831 | +// the GNU General Public License. This exception does not however | ||
832 | +// invalidate any other reasons why the executable file might be covered by | ||
833 | +// the GNU General Public License. | ||
834 | + | ||
835 | +// | ||
836 | +// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. | ||
837 | +// | ||
838 | + | ||
839 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
840 | + | ||
841 | +#define _LIBC | ||
842 | +#include <locale> | ||
843 | +#undef _LIBC | ||
844 | +#include <bits/c++locale_internal.h> | ||
845 | + | ||
846 | +#ifndef __UCLIBC_HAS_XLOCALE__ | ||
847 | +#define __wctype_l(S, L) wctype((S)) | ||
848 | +#define __towupper_l(C, L) towupper((C)) | ||
849 | +#define __towlower_l(C, L) towlower((C)) | ||
850 | +#define __iswctype_l(C, M, L) iswctype((C), (M)) | ||
851 | +#endif | ||
852 | + | ||
853 | +namespace std | ||
854 | +{ | ||
855 | + // NB: The other ctype<char> specializations are in src/locale.cc and | ||
856 | + // various /config/os/* files. | ||
857 | + template<> | ||
858 | + ctype_byname<char>::ctype_byname(const char* __s, size_t __refs) | ||
859 | + : ctype<char>(0, false, __refs) | ||
860 | + { | ||
861 | + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) | ||
862 | + { | ||
863 | + this->_S_destroy_c_locale(this->_M_c_locale_ctype); | ||
864 | + this->_S_create_c_locale(this->_M_c_locale_ctype, __s); | ||
865 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
866 | + this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper; | ||
867 | + this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower; | ||
868 | + this->_M_table = this->_M_c_locale_ctype->__ctype_b; | ||
869 | +#endif | ||
870 | + } | ||
871 | + } | ||
872 | + | ||
873 | +#ifdef _GLIBCXX_USE_WCHAR_T | ||
874 | + ctype<wchar_t>::__wmask_type | ||
875 | + ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const | ||
876 | + { | ||
877 | + __wmask_type __ret; | ||
878 | + switch (__m) | ||
879 | + { | ||
880 | + case space: | ||
881 | + __ret = __wctype_l("space", _M_c_locale_ctype); | ||
882 | + break; | ||
883 | + case print: | ||
884 | + __ret = __wctype_l("print", _M_c_locale_ctype); | ||
885 | + break; | ||
886 | + case cntrl: | ||
887 | + __ret = __wctype_l("cntrl", _M_c_locale_ctype); | ||
888 | + break; | ||
889 | + case upper: | ||
890 | + __ret = __wctype_l("upper", _M_c_locale_ctype); | ||
891 | + break; | ||
892 | + case lower: | ||
893 | + __ret = __wctype_l("lower", _M_c_locale_ctype); | ||
894 | + break; | ||
895 | + case alpha: | ||
896 | + __ret = __wctype_l("alpha", _M_c_locale_ctype); | ||
897 | + break; | ||
898 | + case digit: | ||
899 | + __ret = __wctype_l("digit", _M_c_locale_ctype); | ||
900 | + break; | ||
901 | + case punct: | ||
902 | + __ret = __wctype_l("punct", _M_c_locale_ctype); | ||
903 | + break; | ||
904 | + case xdigit: | ||
905 | + __ret = __wctype_l("xdigit", _M_c_locale_ctype); | ||
906 | + break; | ||
907 | + case alnum: | ||
908 | + __ret = __wctype_l("alnum", _M_c_locale_ctype); | ||
909 | + break; | ||
910 | + case graph: | ||
911 | + __ret = __wctype_l("graph", _M_c_locale_ctype); | ||
912 | + break; | ||
913 | + default: | ||
914 | + __ret = __wmask_type(); | ||
915 | + } | ||
916 | + return __ret; | ||
917 | + } | ||
918 | + | ||
919 | + wchar_t | ||
920 | + ctype<wchar_t>::do_toupper(wchar_t __c) const | ||
921 | + { return __towupper_l(__c, _M_c_locale_ctype); } | ||
922 | + | ||
923 | + const wchar_t* | ||
924 | + ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const | ||
925 | + { | ||
926 | + while (__lo < __hi) | ||
927 | + { | ||
928 | + *__lo = __towupper_l(*__lo, _M_c_locale_ctype); | ||
929 | + ++__lo; | ||
930 | + } | ||
931 | + return __hi; | ||
932 | + } | ||
933 | + | ||
934 | + wchar_t | ||
935 | + ctype<wchar_t>::do_tolower(wchar_t __c) const | ||
936 | + { return __towlower_l(__c, _M_c_locale_ctype); } | ||
937 | + | ||
938 | + const wchar_t* | ||
939 | + ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const | ||
940 | + { | ||
941 | + while (__lo < __hi) | ||
942 | + { | ||
943 | + *__lo = __towlower_l(*__lo, _M_c_locale_ctype); | ||
944 | + ++__lo; | ||
945 | + } | ||
946 | + return __hi; | ||
947 | + } | ||
948 | + | ||
949 | + bool | ||
950 | + ctype<wchar_t>:: | ||
951 | + do_is(mask __m, wchar_t __c) const | ||
952 | + { | ||
953 | + // The case of __m == ctype_base::space is particularly important, | ||
954 | + // due to its use in many istream functions. Therefore we deal with | ||
955 | + // it first, exploiting the knowledge that on GNU systems _M_bit[5] | ||
956 | + // is the mask corresponding to ctype_base::space. NB: an encoding | ||
957 | + // change would not affect correctness! | ||
958 | + bool __ret = false; | ||
959 | + if (__m == _M_bit[5]) | ||
960 | + __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype); | ||
961 | + else | ||
962 | + { | ||
963 | + // Highest bitmask in ctype_base == 10, but extra in "C" | ||
964 | + // library for blank. | ||
965 | + const size_t __bitmasksize = 11; | ||
966 | + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) | ||
967 | + if (__m & _M_bit[__bitcur]) | ||
968 | + { | ||
969 | + if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) | ||
970 | + { | ||
971 | + __ret = true; | ||
972 | + break; | ||
973 | + } | ||
974 | + else if (__m == _M_bit[__bitcur]) | ||
975 | + break; | ||
976 | + } | ||
977 | + } | ||
978 | + return __ret; | ||
979 | + } | ||
980 | + | ||
981 | + const wchar_t* | ||
982 | + ctype<wchar_t>:: | ||
983 | + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const | ||
984 | + { | ||
985 | + for (; __lo < __hi; ++__vec, ++__lo) | ||
986 | + { | ||
987 | + // Highest bitmask in ctype_base == 10, but extra in "C" | ||
988 | + // library for blank. | ||
989 | + const size_t __bitmasksize = 11; | ||
990 | + mask __m = 0; | ||
991 | + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) | ||
992 | + if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype)) | ||
993 | + __m |= _M_bit[__bitcur]; | ||
994 | + *__vec = __m; | ||
995 | + } | ||
996 | + return __hi; | ||
997 | + } | ||
998 | + | ||
999 | + const wchar_t* | ||
1000 | + ctype<wchar_t>:: | ||
1001 | + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const | ||
1002 | + { | ||
1003 | + while (__lo < __hi && !this->do_is(__m, *__lo)) | ||
1004 | + ++__lo; | ||
1005 | + return __lo; | ||
1006 | + } | ||
1007 | + | ||
1008 | + const wchar_t* | ||
1009 | + ctype<wchar_t>:: | ||
1010 | + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const | ||
1011 | + { | ||
1012 | + while (__lo < __hi && this->do_is(__m, *__lo) != 0) | ||
1013 | + ++__lo; | ||
1014 | + return __lo; | ||
1015 | + } | ||
1016 | + | ||
1017 | + wchar_t | ||
1018 | + ctype<wchar_t>:: | ||
1019 | + do_widen(char __c) const | ||
1020 | + { return _M_widen[static_cast<unsigned char>(__c)]; } | ||
1021 | + | ||
1022 | + const char* | ||
1023 | + ctype<wchar_t>:: | ||
1024 | + do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const | ||
1025 | + { | ||
1026 | + while (__lo < __hi) | ||
1027 | + { | ||
1028 | + *__dest = _M_widen[static_cast<unsigned char>(*__lo)]; | ||
1029 | + ++__lo; | ||
1030 | + ++__dest; | ||
1031 | + } | ||
1032 | + return __hi; | ||
1033 | + } | ||
1034 | + | ||
1035 | + char | ||
1036 | + ctype<wchar_t>:: | ||
1037 | + do_narrow(wchar_t __wc, char __dfault) const | ||
1038 | + { | ||
1039 | + if (__wc >= 0 && __wc < 128 && _M_narrow_ok) | ||
1040 | + return _M_narrow[__wc]; | ||
1041 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1042 | + __c_locale __old = __uselocale(_M_c_locale_ctype); | ||
1043 | +#endif | ||
1044 | + const int __c = wctob(__wc); | ||
1045 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1046 | + __uselocale(__old); | ||
1047 | +#endif | ||
1048 | + return (__c == EOF ? __dfault : static_cast<char>(__c)); | ||
1049 | + } | ||
1050 | + | ||
1051 | + const wchar_t* | ||
1052 | + ctype<wchar_t>:: | ||
1053 | + do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, | ||
1054 | + char* __dest) const | ||
1055 | + { | ||
1056 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1057 | + __c_locale __old = __uselocale(_M_c_locale_ctype); | ||
1058 | +#endif | ||
1059 | + if (_M_narrow_ok) | ||
1060 | + while (__lo < __hi) | ||
1061 | + { | ||
1062 | + if (*__lo >= 0 && *__lo < 128) | ||
1063 | + *__dest = _M_narrow[*__lo]; | ||
1064 | + else | ||
1065 | + { | ||
1066 | + const int __c = wctob(*__lo); | ||
1067 | + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); | ||
1068 | + } | ||
1069 | + ++__lo; | ||
1070 | + ++__dest; | ||
1071 | + } | ||
1072 | + else | ||
1073 | + while (__lo < __hi) | ||
1074 | + { | ||
1075 | + const int __c = wctob(*__lo); | ||
1076 | + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c)); | ||
1077 | + ++__lo; | ||
1078 | + ++__dest; | ||
1079 | + } | ||
1080 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1081 | + __uselocale(__old); | ||
1082 | +#endif | ||
1083 | + return __hi; | ||
1084 | + } | ||
1085 | + | ||
1086 | + void | ||
1087 | + ctype<wchar_t>::_M_initialize_ctype() | ||
1088 | + { | ||
1089 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1090 | + __c_locale __old = __uselocale(_M_c_locale_ctype); | ||
1091 | +#endif | ||
1092 | + wint_t __i; | ||
1093 | + for (__i = 0; __i < 128; ++__i) | ||
1094 | + { | ||
1095 | + const int __c = wctob(__i); | ||
1096 | + if (__c == EOF) | ||
1097 | + break; | ||
1098 | + else | ||
1099 | + _M_narrow[__i] = static_cast<char>(__c); | ||
1100 | + } | ||
1101 | + if (__i == 128) | ||
1102 | + _M_narrow_ok = true; | ||
1103 | + else | ||
1104 | + _M_narrow_ok = false; | ||
1105 | + for (size_t __j = 0; | ||
1106 | + __j < sizeof(_M_widen) / sizeof(wint_t); ++__j) | ||
1107 | + _M_widen[__j] = btowc(__j); | ||
1108 | + | ||
1109 | + for (size_t __k = 0; __k <= 11; ++__k) | ||
1110 | + { | ||
1111 | + _M_bit[__k] = static_cast<mask>(_ISbit(__k)); | ||
1112 | + _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); | ||
1113 | + } | ||
1114 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1115 | + __uselocale(__old); | ||
1116 | +#endif | ||
1117 | + } | ||
1118 | +#endif // _GLIBCXX_USE_WCHAR_T | ||
1119 | +} | ||
1120 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.cc | ||
1121 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 17:00:00.000000000 -0700 | ||
1122 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2006-03-25 22:18:37.000000000 -0700 | ||
1123 | @@ -0,0 +1,100 @@ | ||
1124 | +// std::messages implementation details, GNU version -*- C++ -*- | ||
1125 | + | ||
1126 | +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. | ||
1127 | +// | ||
1128 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
1129 | +// software; you can redistribute it and/or modify it under the | ||
1130 | +// terms of the GNU General Public License as published by the | ||
1131 | +// Free Software Foundation; either version 2, or (at your option) | ||
1132 | +// any later version. | ||
1133 | + | ||
1134 | +// This library is distributed in the hope that it will be useful, | ||
1135 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1136 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1137 | +// GNU General Public License for more details. | ||
1138 | + | ||
1139 | +// You should have received a copy of the GNU General Public License along | ||
1140 | +// with this library; see the file COPYING. If not, write to the Free | ||
1141 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
1142 | +// USA. | ||
1143 | + | ||
1144 | +// As a special exception, you may use this file as part of a free software | ||
1145 | +// library without restriction. Specifically, if other files instantiate | ||
1146 | +// templates or use macros or inline functions from this file, or you compile | ||
1147 | +// this file and link it with other files to produce an executable, this | ||
1148 | +// file does not by itself cause the resulting executable to be covered by | ||
1149 | +// the GNU General Public License. This exception does not however | ||
1150 | +// invalidate any other reasons why the executable file might be covered by | ||
1151 | +// the GNU General Public License. | ||
1152 | + | ||
1153 | +// | ||
1154 | +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions | ||
1155 | +// | ||
1156 | + | ||
1157 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
1158 | + | ||
1159 | +#include <locale> | ||
1160 | +#include <bits/c++locale_internal.h> | ||
1161 | + | ||
1162 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
1163 | +#warning fix gettext stuff | ||
1164 | +#endif | ||
1165 | +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ | ||
1166 | +extern "C" char *__dcgettext(const char *domainname, | ||
1167 | + const char *msgid, int category); | ||
1168 | +#undef gettext | ||
1169 | +#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES) | ||
1170 | +#else | ||
1171 | +#undef gettext | ||
1172 | +#define gettext(msgid) (msgid) | ||
1173 | +#endif | ||
1174 | + | ||
1175 | +namespace std | ||
1176 | +{ | ||
1177 | + // Specializations. | ||
1178 | + template<> | ||
1179 | + string | ||
1180 | + messages<char>::do_get(catalog, int, int, const string& __dfault) const | ||
1181 | + { | ||
1182 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1183 | + __c_locale __old = __uselocale(_M_c_locale_messages); | ||
1184 | + const char* __msg = const_cast<const char*>(gettext(__dfault.c_str())); | ||
1185 | + __uselocale(__old); | ||
1186 | + return string(__msg); | ||
1187 | +#elif defined __UCLIBC_HAS_LOCALE__ | ||
1188 | + char* __old = strdup(setlocale(LC_ALL, NULL)); | ||
1189 | + setlocale(LC_ALL, _M_name_messages); | ||
1190 | + const char* __msg = gettext(__dfault.c_str()); | ||
1191 | + setlocale(LC_ALL, __old); | ||
1192 | + free(__old); | ||
1193 | + return string(__msg); | ||
1194 | +#else | ||
1195 | + const char* __msg = gettext(__dfault.c_str()); | ||
1196 | + return string(__msg); | ||
1197 | +#endif | ||
1198 | + } | ||
1199 | + | ||
1200 | +#ifdef _GLIBCXX_USE_WCHAR_T | ||
1201 | + template<> | ||
1202 | + wstring | ||
1203 | + messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const | ||
1204 | + { | ||
1205 | +# ifdef __UCLIBC_HAS_XLOCALE__ | ||
1206 | + __c_locale __old = __uselocale(_M_c_locale_messages); | ||
1207 | + char* __msg = gettext(_M_convert_to_char(__dfault)); | ||
1208 | + __uselocale(__old); | ||
1209 | + return _M_convert_from_char(__msg); | ||
1210 | +# elif defined __UCLIBC_HAS_LOCALE__ | ||
1211 | + char* __old = strdup(setlocale(LC_ALL, NULL)); | ||
1212 | + setlocale(LC_ALL, _M_name_messages); | ||
1213 | + char* __msg = gettext(_M_convert_to_char(__dfault)); | ||
1214 | + setlocale(LC_ALL, __old); | ||
1215 | + free(__old); | ||
1216 | + return _M_convert_from_char(__msg); | ||
1217 | +# else | ||
1218 | + char* __msg = gettext(_M_convert_to_char(__dfault)); | ||
1219 | + return _M_convert_from_char(__msg); | ||
1220 | +# endif | ||
1221 | + } | ||
1222 | +#endif | ||
1223 | +} | ||
1224 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.h | ||
1225 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 17:00:00.000000000 -0700 | ||
1226 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-03-25 22:18:37.000000000 -0700 | ||
1227 | @@ -0,0 +1,121 @@ | ||
1228 | +// std::messages implementation details, GNU version -*- C++ -*- | ||
1229 | + | ||
1230 | +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. | ||
1231 | +// | ||
1232 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
1233 | +// software; you can redistribute it and/or modify it under the | ||
1234 | +// terms of the GNU General Public License as published by the | ||
1235 | +// Free Software Foundation; either version 2, or (at your option) | ||
1236 | +// any later version. | ||
1237 | + | ||
1238 | +// This library is distributed in the hope that it will be useful, | ||
1239 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1240 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1241 | +// GNU General Public License for more details. | ||
1242 | + | ||
1243 | +// You should have received a copy of the GNU General Public License along | ||
1244 | +// with this library; see the file COPYING. If not, write to the Free | ||
1245 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
1246 | +// USA. | ||
1247 | + | ||
1248 | +// As a special exception, you may use this file as part of a free software | ||
1249 | +// library without restriction. Specifically, if other files instantiate | ||
1250 | +// templates or use macros or inline functions from this file, or you compile | ||
1251 | +// this file and link it with other files to produce an executable, this | ||
1252 | +// file does not by itself cause the resulting executable to be covered by | ||
1253 | +// the GNU General Public License. This exception does not however | ||
1254 | +// invalidate any other reasons why the executable file might be covered by | ||
1255 | +// the GNU General Public License. | ||
1256 | + | ||
1257 | +// | ||
1258 | +// ISO C++ 14882: 22.2.7.1.2 messages functions | ||
1259 | +// | ||
1260 | + | ||
1261 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
1262 | + | ||
1263 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
1264 | +#warning fix prototypes for *textdomain funcs | ||
1265 | +#endif | ||
1266 | +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ | ||
1267 | +extern "C" char *__textdomain(const char *domainname); | ||
1268 | +extern "C" char *__bindtextdomain(const char *domainname, | ||
1269 | + const char *dirname); | ||
1270 | +#else | ||
1271 | +#undef __textdomain | ||
1272 | +#undef __bindtextdomain | ||
1273 | +#define __textdomain(D) ((void)0) | ||
1274 | +#define __bindtextdomain(D,P) ((void)0) | ||
1275 | +#endif | ||
1276 | + | ||
1277 | + // Non-virtual member functions. | ||
1278 | + template<typename _CharT> | ||
1279 | + messages<_CharT>::messages(size_t __refs) | ||
1280 | + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), | ||
1281 | + _M_name_messages(_S_get_c_name()) | ||
1282 | + { } | ||
1283 | + | ||
1284 | + template<typename _CharT> | ||
1285 | + messages<_CharT>::messages(__c_locale __cloc, const char* __s, | ||
1286 | + size_t __refs) | ||
1287 | + : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL) | ||
1288 | + { | ||
1289 | + const size_t __len = std::strlen(__s) + 1; | ||
1290 | + char* __tmp = new char[__len]; | ||
1291 | + std::memcpy(__tmp, __s, __len); | ||
1292 | + _M_name_messages = __tmp; | ||
1293 | + | ||
1294 | + // Last to avoid leaking memory if new throws. | ||
1295 | + _M_c_locale_messages = _S_clone_c_locale(__cloc); | ||
1296 | + } | ||
1297 | + | ||
1298 | + template<typename _CharT> | ||
1299 | + typename messages<_CharT>::catalog | ||
1300 | + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, | ||
1301 | + const char* __dir) const | ||
1302 | + { | ||
1303 | + __bindtextdomain(__s.c_str(), __dir); | ||
1304 | + return this->do_open(__s, __loc); | ||
1305 | + } | ||
1306 | + | ||
1307 | + // Virtual member functions. | ||
1308 | + template<typename _CharT> | ||
1309 | + messages<_CharT>::~messages() | ||
1310 | + { | ||
1311 | + if (_M_name_messages != _S_get_c_name()) | ||
1312 | + delete [] _M_name_messages; | ||
1313 | + _S_destroy_c_locale(_M_c_locale_messages); | ||
1314 | + } | ||
1315 | + | ||
1316 | + template<typename _CharT> | ||
1317 | + typename messages<_CharT>::catalog | ||
1318 | + messages<_CharT>::do_open(const basic_string<char>& __s, | ||
1319 | + const locale&) const | ||
1320 | + { | ||
1321 | + // No error checking is done, assume the catalog exists and can | ||
1322 | + // be used. | ||
1323 | + __textdomain(__s.c_str()); | ||
1324 | + return 0; | ||
1325 | + } | ||
1326 | + | ||
1327 | + template<typename _CharT> | ||
1328 | + void | ||
1329 | + messages<_CharT>::do_close(catalog) const | ||
1330 | + { } | ||
1331 | + | ||
1332 | + // messages_byname | ||
1333 | + template<typename _CharT> | ||
1334 | + messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) | ||
1335 | + : messages<_CharT>(__refs) | ||
1336 | + { | ||
1337 | + if (this->_M_name_messages != locale::facet::_S_get_c_name()) | ||
1338 | + delete [] this->_M_name_messages; | ||
1339 | + char* __tmp = new char[std::strlen(__s) + 1]; | ||
1340 | + std::strcpy(__tmp, __s); | ||
1341 | + this->_M_name_messages = __tmp; | ||
1342 | + | ||
1343 | + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) | ||
1344 | + { | ||
1345 | + this->_S_destroy_c_locale(this->_M_c_locale_messages); | ||
1346 | + this->_S_create_c_locale(this->_M_c_locale_messages, __s); | ||
1347 | + } | ||
1348 | + } | ||
1349 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc | ||
1350 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 17:00:00.000000000 -0700 | ||
1351 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-25 22:18:37.000000000 -0700 | ||
1352 | @@ -0,0 +1,692 @@ | ||
1353 | +// std::moneypunct implementation details, GNU version -*- C++ -*- | ||
1354 | + | ||
1355 | +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. | ||
1356 | +// | ||
1357 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
1358 | +// software; you can redistribute it and/or modify it under the | ||
1359 | +// terms of the GNU General Public License as published by the | ||
1360 | +// Free Software Foundation; either version 2, or (at your option) | ||
1361 | +// any later version. | ||
1362 | + | ||
1363 | +// This library is distributed in the hope that it will be useful, | ||
1364 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1365 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1366 | +// GNU General Public License for more details. | ||
1367 | + | ||
1368 | +// You should have received a copy of the GNU General Public License along | ||
1369 | +// with this library; see the file COPYING. If not, write to the Free | ||
1370 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
1371 | +// USA. | ||
1372 | + | ||
1373 | +// As a special exception, you may use this file as part of a free software | ||
1374 | +// library without restriction. Specifically, if other files instantiate | ||
1375 | +// templates or use macros or inline functions from this file, or you compile | ||
1376 | +// this file and link it with other files to produce an executable, this | ||
1377 | +// file does not by itself cause the resulting executable to be covered by | ||
1378 | +// the GNU General Public License. This exception does not however | ||
1379 | +// invalidate any other reasons why the executable file might be covered by | ||
1380 | +// the GNU General Public License. | ||
1381 | + | ||
1382 | +// | ||
1383 | +// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions | ||
1384 | +// | ||
1385 | + | ||
1386 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
1387 | + | ||
1388 | +#define _LIBC | ||
1389 | +#include <locale> | ||
1390 | +#undef _LIBC | ||
1391 | +#include <bits/c++locale_internal.h> | ||
1392 | + | ||
1393 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
1394 | +#warning optimize this for uclibc | ||
1395 | +#warning tailor for stub locale support | ||
1396 | +#endif | ||
1397 | + | ||
1398 | +#ifndef __UCLIBC_HAS_XLOCALE__ | ||
1399 | +#define __nl_langinfo_l(N, L) nl_langinfo((N)) | ||
1400 | +#endif | ||
1401 | + | ||
1402 | +namespace std | ||
1403 | +{ | ||
1404 | + // Construct and return valid pattern consisting of some combination of: | ||
1405 | + // space none symbol sign value | ||
1406 | + money_base::pattern | ||
1407 | + money_base::_S_construct_pattern(char __precedes, char __space, char __posn) | ||
1408 | + { | ||
1409 | + pattern __ret; | ||
1410 | + | ||
1411 | + // This insanely complicated routine attempts to construct a valid | ||
1412 | + // pattern for use with monyepunct. A couple of invariants: | ||
1413 | + | ||
1414 | + // if (__precedes) symbol -> value | ||
1415 | + // else value -> symbol | ||
1416 | + | ||
1417 | + // if (__space) space | ||
1418 | + // else none | ||
1419 | + | ||
1420 | + // none == never first | ||
1421 | + // space never first or last | ||
1422 | + | ||
1423 | + // Any elegant implementations of this are welcome. | ||
1424 | + switch (__posn) | ||
1425 | + { | ||
1426 | + case 0: | ||
1427 | + case 1: | ||
1428 | + // 1 The sign precedes the value and symbol. | ||
1429 | + __ret.field[0] = sign; | ||
1430 | + if (__space) | ||
1431 | + { | ||
1432 | + // Pattern starts with sign. | ||
1433 | + if (__precedes) | ||
1434 | + { | ||
1435 | + __ret.field[1] = symbol; | ||
1436 | + __ret.field[3] = value; | ||
1437 | + } | ||
1438 | + else | ||
1439 | + { | ||
1440 | + __ret.field[1] = value; | ||
1441 | + __ret.field[3] = symbol; | ||
1442 | + } | ||
1443 | + __ret.field[2] = space; | ||
1444 | + } | ||
1445 | + else | ||
1446 | + { | ||
1447 | + // Pattern starts with sign and ends with none. | ||
1448 | + if (__precedes) | ||
1449 | + { | ||
1450 | + __ret.field[1] = symbol; | ||
1451 | + __ret.field[2] = value; | ||
1452 | + } | ||
1453 | + else | ||
1454 | + { | ||
1455 | + __ret.field[1] = value; | ||
1456 | + __ret.field[2] = symbol; | ||
1457 | + } | ||
1458 | + __ret.field[3] = none; | ||
1459 | + } | ||
1460 | + break; | ||
1461 | + case 2: | ||
1462 | + // 2 The sign follows the value and symbol. | ||
1463 | + if (__space) | ||
1464 | + { | ||
1465 | + // Pattern either ends with sign. | ||
1466 | + if (__precedes) | ||
1467 | + { | ||
1468 | + __ret.field[0] = symbol; | ||
1469 | + __ret.field[2] = value; | ||
1470 | + } | ||
1471 | + else | ||
1472 | + { | ||
1473 | + __ret.field[0] = value; | ||
1474 | + __ret.field[2] = symbol; | ||
1475 | + } | ||
1476 | + __ret.field[1] = space; | ||
1477 | + __ret.field[3] = sign; | ||
1478 | + } | ||
1479 | + else | ||
1480 | + { | ||
1481 | + // Pattern ends with sign then none. | ||
1482 | + if (__precedes) | ||
1483 | + { | ||
1484 | + __ret.field[0] = symbol; | ||
1485 | + __ret.field[1] = value; | ||
1486 | + } | ||
1487 | + else | ||
1488 | + { | ||
1489 | + __ret.field[0] = value; | ||
1490 | + __ret.field[1] = symbol; | ||
1491 | + } | ||
1492 | + __ret.field[2] = sign; | ||
1493 | + __ret.field[3] = none; | ||
1494 | + } | ||
1495 | + break; | ||
1496 | + case 3: | ||
1497 | + // 3 The sign immediately precedes the symbol. | ||
1498 | + if (__precedes) | ||
1499 | + { | ||
1500 | + __ret.field[0] = sign; | ||
1501 | + __ret.field[1] = symbol; | ||
1502 | + if (__space) | ||
1503 | + { | ||
1504 | + __ret.field[2] = space; | ||
1505 | + __ret.field[3] = value; | ||
1506 | + } | ||
1507 | + else | ||
1508 | + { | ||
1509 | + __ret.field[2] = value; | ||
1510 | + __ret.field[3] = none; | ||
1511 | + } | ||
1512 | + } | ||
1513 | + else | ||
1514 | + { | ||
1515 | + __ret.field[0] = value; | ||
1516 | + if (__space) | ||
1517 | + { | ||
1518 | + __ret.field[1] = space; | ||
1519 | + __ret.field[2] = sign; | ||
1520 | + __ret.field[3] = symbol; | ||
1521 | + } | ||
1522 | + else | ||
1523 | + { | ||
1524 | + __ret.field[1] = sign; | ||
1525 | + __ret.field[2] = symbol; | ||
1526 | + __ret.field[3] = none; | ||
1527 | + } | ||
1528 | + } | ||
1529 | + break; | ||
1530 | + case 4: | ||
1531 | + // 4 The sign immediately follows the symbol. | ||
1532 | + if (__precedes) | ||
1533 | + { | ||
1534 | + __ret.field[0] = symbol; | ||
1535 | + __ret.field[1] = sign; | ||
1536 | + if (__space) | ||
1537 | + { | ||
1538 | + __ret.field[2] = space; | ||
1539 | + __ret.field[3] = value; | ||
1540 | + } | ||
1541 | + else | ||
1542 | + { | ||
1543 | + __ret.field[2] = value; | ||
1544 | + __ret.field[3] = none; | ||
1545 | + } | ||
1546 | + } | ||
1547 | + else | ||
1548 | + { | ||
1549 | + __ret.field[0] = value; | ||
1550 | + if (__space) | ||
1551 | + { | ||
1552 | + __ret.field[1] = space; | ||
1553 | + __ret.field[2] = symbol; | ||
1554 | + __ret.field[3] = sign; | ||
1555 | + } | ||
1556 | + else | ||
1557 | + { | ||
1558 | + __ret.field[1] = symbol; | ||
1559 | + __ret.field[2] = sign; | ||
1560 | + __ret.field[3] = none; | ||
1561 | + } | ||
1562 | + } | ||
1563 | + break; | ||
1564 | + default: | ||
1565 | + __ret = pattern(); | ||
1566 | + } | ||
1567 | + return __ret; | ||
1568 | + } | ||
1569 | + | ||
1570 | + template<> | ||
1571 | + void | ||
1572 | + moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, | ||
1573 | + const char*) | ||
1574 | + { | ||
1575 | + if (!_M_data) | ||
1576 | + _M_data = new __moneypunct_cache<char, true>; | ||
1577 | + | ||
1578 | + if (!__cloc) | ||
1579 | + { | ||
1580 | + // "C" locale | ||
1581 | + _M_data->_M_decimal_point = '.'; | ||
1582 | + _M_data->_M_thousands_sep = ','; | ||
1583 | + _M_data->_M_grouping = ""; | ||
1584 | + _M_data->_M_grouping_size = 0; | ||
1585 | + _M_data->_M_curr_symbol = ""; | ||
1586 | + _M_data->_M_curr_symbol_size = 0; | ||
1587 | + _M_data->_M_positive_sign = ""; | ||
1588 | + _M_data->_M_positive_sign_size = 0; | ||
1589 | + _M_data->_M_negative_sign = ""; | ||
1590 | + _M_data->_M_negative_sign_size = 0; | ||
1591 | + _M_data->_M_frac_digits = 0; | ||
1592 | + _M_data->_M_pos_format = money_base::_S_default_pattern; | ||
1593 | + _M_data->_M_neg_format = money_base::_S_default_pattern; | ||
1594 | + | ||
1595 | + for (size_t __i = 0; __i < money_base::_S_end; ++__i) | ||
1596 | + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; | ||
1597 | + } | ||
1598 | + else | ||
1599 | + { | ||
1600 | + // Named locale. | ||
1601 | + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, | ||
1602 | + __cloc)); | ||
1603 | + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, | ||
1604 | + __cloc)); | ||
1605 | + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); | ||
1606 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); | ||
1607 | + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); | ||
1608 | + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); | ||
1609 | + | ||
1610 | + char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); | ||
1611 | + if (!__nposn) | ||
1612 | + _M_data->_M_negative_sign = "()"; | ||
1613 | + else | ||
1614 | + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, | ||
1615 | + __cloc); | ||
1616 | + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); | ||
1617 | + | ||
1618 | + // _Intl == true | ||
1619 | + _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); | ||
1620 | + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); | ||
1621 | + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, | ||
1622 | + __cloc)); | ||
1623 | + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); | ||
1624 | + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); | ||
1625 | + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); | ||
1626 | + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, | ||
1627 | + __pposn); | ||
1628 | + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); | ||
1629 | + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); | ||
1630 | + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, | ||
1631 | + __nposn); | ||
1632 | + } | ||
1633 | + } | ||
1634 | + | ||
1635 | + template<> | ||
1636 | + void | ||
1637 | + moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, | ||
1638 | + const char*) | ||
1639 | + { | ||
1640 | + if (!_M_data) | ||
1641 | + _M_data = new __moneypunct_cache<char, false>; | ||
1642 | + | ||
1643 | + if (!__cloc) | ||
1644 | + { | ||
1645 | + // "C" locale | ||
1646 | + _M_data->_M_decimal_point = '.'; | ||
1647 | + _M_data->_M_thousands_sep = ','; | ||
1648 | + _M_data->_M_grouping = ""; | ||
1649 | + _M_data->_M_grouping_size = 0; | ||
1650 | + _M_data->_M_curr_symbol = ""; | ||
1651 | + _M_data->_M_curr_symbol_size = 0; | ||
1652 | + _M_data->_M_positive_sign = ""; | ||
1653 | + _M_data->_M_positive_sign_size = 0; | ||
1654 | + _M_data->_M_negative_sign = ""; | ||
1655 | + _M_data->_M_negative_sign_size = 0; | ||
1656 | + _M_data->_M_frac_digits = 0; | ||
1657 | + _M_data->_M_pos_format = money_base::_S_default_pattern; | ||
1658 | + _M_data->_M_neg_format = money_base::_S_default_pattern; | ||
1659 | + | ||
1660 | + for (size_t __i = 0; __i < money_base::_S_end; ++__i) | ||
1661 | + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; | ||
1662 | + } | ||
1663 | + else | ||
1664 | + { | ||
1665 | + // Named locale. | ||
1666 | + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, | ||
1667 | + __cloc)); | ||
1668 | + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, | ||
1669 | + __cloc)); | ||
1670 | + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); | ||
1671 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); | ||
1672 | + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); | ||
1673 | + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); | ||
1674 | + | ||
1675 | + char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); | ||
1676 | + if (!__nposn) | ||
1677 | + _M_data->_M_negative_sign = "()"; | ||
1678 | + else | ||
1679 | + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, | ||
1680 | + __cloc); | ||
1681 | + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); | ||
1682 | + | ||
1683 | + // _Intl == false | ||
1684 | + _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); | ||
1685 | + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); | ||
1686 | + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); | ||
1687 | + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); | ||
1688 | + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); | ||
1689 | + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); | ||
1690 | + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, | ||
1691 | + __pposn); | ||
1692 | + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); | ||
1693 | + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); | ||
1694 | + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, | ||
1695 | + __nposn); | ||
1696 | + } | ||
1697 | + } | ||
1698 | + | ||
1699 | + template<> | ||
1700 | + moneypunct<char, true>::~moneypunct() | ||
1701 | + { delete _M_data; } | ||
1702 | + | ||
1703 | + template<> | ||
1704 | + moneypunct<char, false>::~moneypunct() | ||
1705 | + { delete _M_data; } | ||
1706 | + | ||
1707 | +#ifdef _GLIBCXX_USE_WCHAR_T | ||
1708 | + template<> | ||
1709 | + void | ||
1710 | + moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, | ||
1711 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1712 | + const char*) | ||
1713 | +#else | ||
1714 | + const char* __name) | ||
1715 | +#endif | ||
1716 | + { | ||
1717 | + if (!_M_data) | ||
1718 | + _M_data = new __moneypunct_cache<wchar_t, true>; | ||
1719 | + | ||
1720 | + if (!__cloc) | ||
1721 | + { | ||
1722 | + // "C" locale | ||
1723 | + _M_data->_M_decimal_point = L'.'; | ||
1724 | + _M_data->_M_thousands_sep = L','; | ||
1725 | + _M_data->_M_grouping = ""; | ||
1726 | + _M_data->_M_grouping_size = 0; | ||
1727 | + _M_data->_M_curr_symbol = L""; | ||
1728 | + _M_data->_M_curr_symbol_size = 0; | ||
1729 | + _M_data->_M_positive_sign = L""; | ||
1730 | + _M_data->_M_positive_sign_size = 0; | ||
1731 | + _M_data->_M_negative_sign = L""; | ||
1732 | + _M_data->_M_negative_sign_size = 0; | ||
1733 | + _M_data->_M_frac_digits = 0; | ||
1734 | + _M_data->_M_pos_format = money_base::_S_default_pattern; | ||
1735 | + _M_data->_M_neg_format = money_base::_S_default_pattern; | ||
1736 | + | ||
1737 | + // Use ctype::widen code without the facet... | ||
1738 | + for (size_t __i = 0; __i < money_base::_S_end; ++__i) | ||
1739 | + _M_data->_M_atoms[__i] = | ||
1740 | + static_cast<wchar_t>(money_base::_S_atoms[__i]); | ||
1741 | + } | ||
1742 | + else | ||
1743 | + { | ||
1744 | + // Named locale. | ||
1745 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1746 | + __c_locale __old = __uselocale(__cloc); | ||
1747 | +#else | ||
1748 | + // Switch to named locale so that mbsrtowcs will work. | ||
1749 | + char* __old = strdup(setlocale(LC_ALL, NULL)); | ||
1750 | + setlocale(LC_ALL, __name); | ||
1751 | +#endif | ||
1752 | + | ||
1753 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
1754 | +#warning fix this... should be monetary | ||
1755 | +#endif | ||
1756 | +#ifdef __UCLIBC__ | ||
1757 | +# ifdef __UCLIBC_HAS_XLOCALE__ | ||
1758 | + _M_data->_M_decimal_point = __cloc->decimal_point_wc; | ||
1759 | + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; | ||
1760 | +# else | ||
1761 | + _M_data->_M_decimal_point = __global_locale->decimal_point_wc; | ||
1762 | + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; | ||
1763 | +# endif | ||
1764 | +#else | ||
1765 | + union { char *__s; wchar_t __w; } __u; | ||
1766 | + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); | ||
1767 | + _M_data->_M_decimal_point = __u.__w; | ||
1768 | + | ||
1769 | + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); | ||
1770 | + _M_data->_M_thousands_sep = __u.__w; | ||
1771 | +#endif | ||
1772 | + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); | ||
1773 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); | ||
1774 | + | ||
1775 | + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); | ||
1776 | + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); | ||
1777 | + const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); | ||
1778 | + | ||
1779 | + wchar_t* __wcs_ps = 0; | ||
1780 | + wchar_t* __wcs_ns = 0; | ||
1781 | + const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); | ||
1782 | + try | ||
1783 | + { | ||
1784 | + mbstate_t __state; | ||
1785 | + size_t __len = strlen(__cpossign); | ||
1786 | + if (__len) | ||
1787 | + { | ||
1788 | + ++__len; | ||
1789 | + memset(&__state, 0, sizeof(mbstate_t)); | ||
1790 | + __wcs_ps = new wchar_t[__len]; | ||
1791 | + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); | ||
1792 | + _M_data->_M_positive_sign = __wcs_ps; | ||
1793 | + } | ||
1794 | + else | ||
1795 | + _M_data->_M_positive_sign = L""; | ||
1796 | + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); | ||
1797 | + | ||
1798 | + __len = strlen(__cnegsign); | ||
1799 | + if (!__nposn) | ||
1800 | + _M_data->_M_negative_sign = L"()"; | ||
1801 | + else if (__len) | ||
1802 | + { | ||
1803 | + ++__len; | ||
1804 | + memset(&__state, 0, sizeof(mbstate_t)); | ||
1805 | + __wcs_ns = new wchar_t[__len]; | ||
1806 | + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); | ||
1807 | + _M_data->_M_negative_sign = __wcs_ns; | ||
1808 | + } | ||
1809 | + else | ||
1810 | + _M_data->_M_negative_sign = L""; | ||
1811 | + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); | ||
1812 | + | ||
1813 | + // _Intl == true. | ||
1814 | + __len = strlen(__ccurr); | ||
1815 | + if (__len) | ||
1816 | + { | ||
1817 | + ++__len; | ||
1818 | + memset(&__state, 0, sizeof(mbstate_t)); | ||
1819 | + wchar_t* __wcs = new wchar_t[__len]; | ||
1820 | + mbsrtowcs(__wcs, &__ccurr, __len, &__state); | ||
1821 | + _M_data->_M_curr_symbol = __wcs; | ||
1822 | + } | ||
1823 | + else | ||
1824 | + _M_data->_M_curr_symbol = L""; | ||
1825 | + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); | ||
1826 | + } | ||
1827 | + catch (...) | ||
1828 | + { | ||
1829 | + delete _M_data; | ||
1830 | + _M_data = 0; | ||
1831 | + delete __wcs_ps; | ||
1832 | + delete __wcs_ns; | ||
1833 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1834 | + __uselocale(__old); | ||
1835 | +#else | ||
1836 | + setlocale(LC_ALL, __old); | ||
1837 | + free(__old); | ||
1838 | +#endif | ||
1839 | + __throw_exception_again; | ||
1840 | + } | ||
1841 | + | ||
1842 | + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, | ||
1843 | + __cloc)); | ||
1844 | + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); | ||
1845 | + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); | ||
1846 | + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); | ||
1847 | + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, | ||
1848 | + __pposn); | ||
1849 | + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); | ||
1850 | + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); | ||
1851 | + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, | ||
1852 | + __nposn); | ||
1853 | + | ||
1854 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1855 | + __uselocale(__old); | ||
1856 | +#else | ||
1857 | + setlocale(LC_ALL, __old); | ||
1858 | + free(__old); | ||
1859 | +#endif | ||
1860 | + } | ||
1861 | + } | ||
1862 | + | ||
1863 | + template<> | ||
1864 | + void | ||
1865 | + moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc, | ||
1866 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1867 | + const char*) | ||
1868 | +#else | ||
1869 | + const char* __name) | ||
1870 | +#endif | ||
1871 | + { | ||
1872 | + if (!_M_data) | ||
1873 | + _M_data = new __moneypunct_cache<wchar_t, false>; | ||
1874 | + | ||
1875 | + if (!__cloc) | ||
1876 | + { | ||
1877 | + // "C" locale | ||
1878 | + _M_data->_M_decimal_point = L'.'; | ||
1879 | + _M_data->_M_thousands_sep = L','; | ||
1880 | + _M_data->_M_grouping = ""; | ||
1881 | + _M_data->_M_grouping_size = 0; | ||
1882 | + _M_data->_M_curr_symbol = L""; | ||
1883 | + _M_data->_M_curr_symbol_size = 0; | ||
1884 | + _M_data->_M_positive_sign = L""; | ||
1885 | + _M_data->_M_positive_sign_size = 0; | ||
1886 | + _M_data->_M_negative_sign = L""; | ||
1887 | + _M_data->_M_negative_sign_size = 0; | ||
1888 | + _M_data->_M_frac_digits = 0; | ||
1889 | + _M_data->_M_pos_format = money_base::_S_default_pattern; | ||
1890 | + _M_data->_M_neg_format = money_base::_S_default_pattern; | ||
1891 | + | ||
1892 | + // Use ctype::widen code without the facet... | ||
1893 | + for (size_t __i = 0; __i < money_base::_S_end; ++__i) | ||
1894 | + _M_data->_M_atoms[__i] = | ||
1895 | + static_cast<wchar_t>(money_base::_S_atoms[__i]); | ||
1896 | + } | ||
1897 | + else | ||
1898 | + { | ||
1899 | + // Named locale. | ||
1900 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1901 | + __c_locale __old = __uselocale(__cloc); | ||
1902 | +#else | ||
1903 | + // Switch to named locale so that mbsrtowcs will work. | ||
1904 | + char* __old = strdup(setlocale(LC_ALL, NULL)); | ||
1905 | + setlocale(LC_ALL, __name); | ||
1906 | +#endif | ||
1907 | + | ||
1908 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
1909 | +#warning fix this... should be monetary | ||
1910 | +#endif | ||
1911 | +#ifdef __UCLIBC__ | ||
1912 | +# ifdef __UCLIBC_HAS_XLOCALE__ | ||
1913 | + _M_data->_M_decimal_point = __cloc->decimal_point_wc; | ||
1914 | + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; | ||
1915 | +# else | ||
1916 | + _M_data->_M_decimal_point = __global_locale->decimal_point_wc; | ||
1917 | + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; | ||
1918 | +# endif | ||
1919 | +#else | ||
1920 | + union { char *__s; wchar_t __w; } __u; | ||
1921 | + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); | ||
1922 | + _M_data->_M_decimal_point = __u.__w; | ||
1923 | + | ||
1924 | + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); | ||
1925 | + _M_data->_M_thousands_sep = __u.__w; | ||
1926 | +#endif | ||
1927 | + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); | ||
1928 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); | ||
1929 | + | ||
1930 | + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); | ||
1931 | + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); | ||
1932 | + const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); | ||
1933 | + | ||
1934 | + wchar_t* __wcs_ps = 0; | ||
1935 | + wchar_t* __wcs_ns = 0; | ||
1936 | + const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); | ||
1937 | + try | ||
1938 | + { | ||
1939 | + mbstate_t __state; | ||
1940 | + size_t __len; | ||
1941 | + __len = strlen(__cpossign); | ||
1942 | + if (__len) | ||
1943 | + { | ||
1944 | + ++__len; | ||
1945 | + memset(&__state, 0, sizeof(mbstate_t)); | ||
1946 | + __wcs_ps = new wchar_t[__len]; | ||
1947 | + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); | ||
1948 | + _M_data->_M_positive_sign = __wcs_ps; | ||
1949 | + } | ||
1950 | + else | ||
1951 | + _M_data->_M_positive_sign = L""; | ||
1952 | + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); | ||
1953 | + | ||
1954 | + __len = strlen(__cnegsign); | ||
1955 | + if (!__nposn) | ||
1956 | + _M_data->_M_negative_sign = L"()"; | ||
1957 | + else if (__len) | ||
1958 | + { | ||
1959 | + ++__len; | ||
1960 | + memset(&__state, 0, sizeof(mbstate_t)); | ||
1961 | + __wcs_ns = new wchar_t[__len]; | ||
1962 | + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); | ||
1963 | + _M_data->_M_negative_sign = __wcs_ns; | ||
1964 | + } | ||
1965 | + else | ||
1966 | + _M_data->_M_negative_sign = L""; | ||
1967 | + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); | ||
1968 | + | ||
1969 | + // _Intl == true. | ||
1970 | + __len = strlen(__ccurr); | ||
1971 | + if (__len) | ||
1972 | + { | ||
1973 | + ++__len; | ||
1974 | + memset(&__state, 0, sizeof(mbstate_t)); | ||
1975 | + wchar_t* __wcs = new wchar_t[__len]; | ||
1976 | + mbsrtowcs(__wcs, &__ccurr, __len, &__state); | ||
1977 | + _M_data->_M_curr_symbol = __wcs; | ||
1978 | + } | ||
1979 | + else | ||
1980 | + _M_data->_M_curr_symbol = L""; | ||
1981 | + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); | ||
1982 | + } | ||
1983 | + catch (...) | ||
1984 | + { | ||
1985 | + delete _M_data; | ||
1986 | + _M_data = 0; | ||
1987 | + delete __wcs_ps; | ||
1988 | + delete __wcs_ns; | ||
1989 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
1990 | + __uselocale(__old); | ||
1991 | +#else | ||
1992 | + setlocale(LC_ALL, __old); | ||
1993 | + free(__old); | ||
1994 | +#endif | ||
1995 | + __throw_exception_again; | ||
1996 | + } | ||
1997 | + | ||
1998 | + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); | ||
1999 | + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); | ||
2000 | + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); | ||
2001 | + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); | ||
2002 | + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, | ||
2003 | + __pposn); | ||
2004 | + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); | ||
2005 | + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); | ||
2006 | + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, | ||
2007 | + __nposn); | ||
2008 | + | ||
2009 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
2010 | + __uselocale(__old); | ||
2011 | +#else | ||
2012 | + setlocale(LC_ALL, __old); | ||
2013 | + free(__old); | ||
2014 | +#endif | ||
2015 | + } | ||
2016 | + } | ||
2017 | + | ||
2018 | + template<> | ||
2019 | + moneypunct<wchar_t, true>::~moneypunct() | ||
2020 | + { | ||
2021 | + if (_M_data->_M_positive_sign_size) | ||
2022 | + delete [] _M_data->_M_positive_sign; | ||
2023 | + if (_M_data->_M_negative_sign_size | ||
2024 | + && wcscmp(_M_data->_M_negative_sign, L"()") != 0) | ||
2025 | + delete [] _M_data->_M_negative_sign; | ||
2026 | + if (_M_data->_M_curr_symbol_size) | ||
2027 | + delete [] _M_data->_M_curr_symbol; | ||
2028 | + delete _M_data; | ||
2029 | + } | ||
2030 | + | ||
2031 | + template<> | ||
2032 | + moneypunct<wchar_t, false>::~moneypunct() | ||
2033 | + { | ||
2034 | + if (_M_data->_M_positive_sign_size) | ||
2035 | + delete [] _M_data->_M_positive_sign; | ||
2036 | + if (_M_data->_M_negative_sign_size | ||
2037 | + && wcscmp(_M_data->_M_negative_sign, L"()") != 0) | ||
2038 | + delete [] _M_data->_M_negative_sign; | ||
2039 | + if (_M_data->_M_curr_symbol_size) | ||
2040 | + delete [] _M_data->_M_curr_symbol; | ||
2041 | + delete _M_data; | ||
2042 | + } | ||
2043 | +#endif | ||
2044 | +} | ||
2045 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc | ||
2046 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 17:00:00.000000000 -0700 | ||
2047 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-25 22:18:37.000000000 -0700 | ||
2048 | @@ -0,0 +1,173 @@ | ||
2049 | +// std::numpunct implementation details, GNU version -*- C++ -*- | ||
2050 | + | ||
2051 | +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. | ||
2052 | +// | ||
2053 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
2054 | +// software; you can redistribute it and/or modify it under the | ||
2055 | +// terms of the GNU General Public License as published by the | ||
2056 | +// Free Software Foundation; either version 2, or (at your option) | ||
2057 | +// any later version. | ||
2058 | + | ||
2059 | +// This library is distributed in the hope that it will be useful, | ||
2060 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2061 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2062 | +// GNU General Public License for more details. | ||
2063 | + | ||
2064 | +// You should have received a copy of the GNU General Public License along | ||
2065 | +// with this library; see the file COPYING. If not, write to the Free | ||
2066 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
2067 | +// USA. | ||
2068 | + | ||
2069 | +// As a special exception, you may use this file as part of a free software | ||
2070 | +// library without restriction. Specifically, if other files instantiate | ||
2071 | +// templates or use macros or inline functions from this file, or you compile | ||
2072 | +// this file and link it with other files to produce an executable, this | ||
2073 | +// file does not by itself cause the resulting executable to be covered by | ||
2074 | +// the GNU General Public License. This exception does not however | ||
2075 | +// invalidate any other reasons why the executable file might be covered by | ||
2076 | +// the GNU General Public License. | ||
2077 | + | ||
2078 | +// | ||
2079 | +// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions | ||
2080 | +// | ||
2081 | + | ||
2082 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
2083 | + | ||
2084 | +#define _LIBC | ||
2085 | +#include <locale> | ||
2086 | +#undef _LIBC | ||
2087 | +#include <bits/c++locale_internal.h> | ||
2088 | + | ||
2089 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
2090 | +#warning tailor for stub locale support | ||
2091 | +#endif | ||
2092 | +#ifndef __UCLIBC_HAS_XLOCALE__ | ||
2093 | +#define __nl_langinfo_l(N, L) nl_langinfo((N)) | ||
2094 | +#endif | ||
2095 | + | ||
2096 | +namespace std | ||
2097 | +{ | ||
2098 | + template<> | ||
2099 | + void | ||
2100 | + numpunct<char>::_M_initialize_numpunct(__c_locale __cloc) | ||
2101 | + { | ||
2102 | + if (!_M_data) | ||
2103 | + _M_data = new __numpunct_cache<char>; | ||
2104 | + | ||
2105 | + if (!__cloc) | ||
2106 | + { | ||
2107 | + // "C" locale | ||
2108 | + _M_data->_M_grouping = ""; | ||
2109 | + _M_data->_M_grouping_size = 0; | ||
2110 | + _M_data->_M_use_grouping = false; | ||
2111 | + | ||
2112 | + _M_data->_M_decimal_point = '.'; | ||
2113 | + _M_data->_M_thousands_sep = ','; | ||
2114 | + | ||
2115 | + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) | ||
2116 | + _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; | ||
2117 | + | ||
2118 | + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) | ||
2119 | + _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j]; | ||
2120 | + } | ||
2121 | + else | ||
2122 | + { | ||
2123 | + // Named locale. | ||
2124 | + _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, | ||
2125 | + __cloc)); | ||
2126 | + _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, | ||
2127 | + __cloc)); | ||
2128 | + | ||
2129 | + // Check for NULL, which implies no grouping. | ||
2130 | + if (_M_data->_M_thousands_sep == '\0') | ||
2131 | + _M_data->_M_grouping = ""; | ||
2132 | + else | ||
2133 | + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); | ||
2134 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); | ||
2135 | + } | ||
2136 | + | ||
2137 | + // NB: There is no way to extact this info from posix locales. | ||
2138 | + // _M_truename = __nl_langinfo_l(YESSTR, __cloc); | ||
2139 | + _M_data->_M_truename = "true"; | ||
2140 | + _M_data->_M_truename_size = 4; | ||
2141 | + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); | ||
2142 | + _M_data->_M_falsename = "false"; | ||
2143 | + _M_data->_M_falsename_size = 5; | ||
2144 | + } | ||
2145 | + | ||
2146 | + template<> | ||
2147 | + numpunct<char>::~numpunct() | ||
2148 | + { delete _M_data; } | ||
2149 | + | ||
2150 | +#ifdef _GLIBCXX_USE_WCHAR_T | ||
2151 | + template<> | ||
2152 | + void | ||
2153 | + numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc) | ||
2154 | + { | ||
2155 | + if (!_M_data) | ||
2156 | + _M_data = new __numpunct_cache<wchar_t>; | ||
2157 | + | ||
2158 | + if (!__cloc) | ||
2159 | + { | ||
2160 | + // "C" locale | ||
2161 | + _M_data->_M_grouping = ""; | ||
2162 | + _M_data->_M_grouping_size = 0; | ||
2163 | + _M_data->_M_use_grouping = false; | ||
2164 | + | ||
2165 | + _M_data->_M_decimal_point = L'.'; | ||
2166 | + _M_data->_M_thousands_sep = L','; | ||
2167 | + | ||
2168 | + // Use ctype::widen code without the facet... | ||
2169 | + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) | ||
2170 | + _M_data->_M_atoms_out[__i] = | ||
2171 | + static_cast<wchar_t>(__num_base::_S_atoms_out[__i]); | ||
2172 | + | ||
2173 | + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) | ||
2174 | + _M_data->_M_atoms_in[__j] = | ||
2175 | + static_cast<wchar_t>(__num_base::_S_atoms_in[__j]); | ||
2176 | + } | ||
2177 | + else | ||
2178 | + { | ||
2179 | + // Named locale. | ||
2180 | + // NB: In the GNU model wchar_t is always 32 bit wide. | ||
2181 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
2182 | +#warning fix this | ||
2183 | +#endif | ||
2184 | +#ifdef __UCLIBC__ | ||
2185 | +# ifdef __UCLIBC_HAS_XLOCALE__ | ||
2186 | + _M_data->_M_decimal_point = __cloc->decimal_point_wc; | ||
2187 | + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; | ||
2188 | +# else | ||
2189 | + _M_data->_M_decimal_point = __global_locale->decimal_point_wc; | ||
2190 | + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; | ||
2191 | +# endif | ||
2192 | +#else | ||
2193 | + union { char *__s; wchar_t __w; } __u; | ||
2194 | + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); | ||
2195 | + _M_data->_M_decimal_point = __u.__w; | ||
2196 | + | ||
2197 | + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); | ||
2198 | + _M_data->_M_thousands_sep = __u.__w; | ||
2199 | +#endif | ||
2200 | + | ||
2201 | + if (_M_data->_M_thousands_sep == L'\0') | ||
2202 | + _M_data->_M_grouping = ""; | ||
2203 | + else | ||
2204 | + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); | ||
2205 | + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); | ||
2206 | + } | ||
2207 | + | ||
2208 | + // NB: There is no way to extact this info from posix locales. | ||
2209 | + // _M_truename = __nl_langinfo_l(YESSTR, __cloc); | ||
2210 | + _M_data->_M_truename = L"true"; | ||
2211 | + _M_data->_M_truename_size = 4; | ||
2212 | + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); | ||
2213 | + _M_data->_M_falsename = L"false"; | ||
2214 | + _M_data->_M_falsename_size = 5; | ||
2215 | + } | ||
2216 | + | ||
2217 | + template<> | ||
2218 | + numpunct<wchar_t>::~numpunct() | ||
2219 | + { delete _M_data; } | ||
2220 | + #endif | ||
2221 | +} | ||
2222 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.cc | ||
2223 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 17:00:00.000000000 -0700 | ||
2224 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2006-03-25 22:18:37.000000000 -0700 | ||
2225 | @@ -0,0 +1,406 @@ | ||
2226 | +// std::time_get, std::time_put implementation, GNU version -*- C++ -*- | ||
2227 | + | ||
2228 | +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. | ||
2229 | +// | ||
2230 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
2231 | +// software; you can redistribute it and/or modify it under the | ||
2232 | +// terms of the GNU General Public License as published by the | ||
2233 | +// Free Software Foundation; either version 2, or (at your option) | ||
2234 | +// any later version. | ||
2235 | + | ||
2236 | +// This library is distributed in the hope that it will be useful, | ||
2237 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2238 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2239 | +// GNU General Public License for more details. | ||
2240 | + | ||
2241 | +// You should have received a copy of the GNU General Public License along | ||
2242 | +// with this library; see the file COPYING. If not, write to the Free | ||
2243 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
2244 | +// USA. | ||
2245 | + | ||
2246 | +// As a special exception, you may use this file as part of a free software | ||
2247 | +// library without restriction. Specifically, if other files instantiate | ||
2248 | +// templates or use macros or inline functions from this file, or you compile | ||
2249 | +// this file and link it with other files to produce an executable, this | ||
2250 | +// file does not by itself cause the resulting executable to be covered by | ||
2251 | +// the GNU General Public License. This exception does not however | ||
2252 | +// invalidate any other reasons why the executable file might be covered by | ||
2253 | +// the GNU General Public License. | ||
2254 | + | ||
2255 | +// | ||
2256 | +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions | ||
2257 | +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions | ||
2258 | +// | ||
2259 | + | ||
2260 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
2261 | + | ||
2262 | +#include <locale> | ||
2263 | +#include <bits/c++locale_internal.h> | ||
2264 | + | ||
2265 | +#ifdef __UCLIBC_MJN3_ONLY__ | ||
2266 | +#warning tailor for stub locale support | ||
2267 | +#endif | ||
2268 | +#ifndef __UCLIBC_HAS_XLOCALE__ | ||
2269 | +#define __nl_langinfo_l(N, L) nl_langinfo((N)) | ||
2270 | +#endif | ||
2271 | + | ||
2272 | +namespace std | ||
2273 | +{ | ||
2274 | + template<> | ||
2275 | + void | ||
2276 | + __timepunct<char>:: | ||
2277 | + _M_put(char* __s, size_t __maxlen, const char* __format, | ||
2278 | + const tm* __tm) const | ||
2279 | + { | ||
2280 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
2281 | + const size_t __len = __strftime_l(__s, __maxlen, __format, __tm, | ||
2282 | + _M_c_locale_timepunct); | ||
2283 | +#else | ||
2284 | + char* __old = strdup(setlocale(LC_ALL, NULL)); | ||
2285 | + setlocale(LC_ALL, _M_name_timepunct); | ||
2286 | + const size_t __len = strftime(__s, __maxlen, __format, __tm); | ||
2287 | + setlocale(LC_ALL, __old); | ||
2288 | + free(__old); | ||
2289 | +#endif | ||
2290 | + // Make sure __s is null terminated. | ||
2291 | + if (__len == 0) | ||
2292 | + __s[0] = '\0'; | ||
2293 | + } | ||
2294 | + | ||
2295 | + template<> | ||
2296 | + void | ||
2297 | + __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc) | ||
2298 | + { | ||
2299 | + if (!_M_data) | ||
2300 | + _M_data = new __timepunct_cache<char>; | ||
2301 | + | ||
2302 | + if (!__cloc) | ||
2303 | + { | ||
2304 | + // "C" locale | ||
2305 | + _M_c_locale_timepunct = _S_get_c_locale(); | ||
2306 | + | ||
2307 | + _M_data->_M_date_format = "%m/%d/%y"; | ||
2308 | + _M_data->_M_date_era_format = "%m/%d/%y"; | ||
2309 | + _M_data->_M_time_format = "%H:%M:%S"; | ||
2310 | + _M_data->_M_time_era_format = "%H:%M:%S"; | ||
2311 | + _M_data->_M_date_time_format = ""; | ||
2312 | + _M_data->_M_date_time_era_format = ""; | ||
2313 | + _M_data->_M_am = "AM"; | ||
2314 | + _M_data->_M_pm = "PM"; | ||
2315 | + _M_data->_M_am_pm_format = ""; | ||
2316 | + | ||
2317 | + // Day names, starting with "C"'s Sunday. | ||
2318 | + _M_data->_M_day1 = "Sunday"; | ||
2319 | + _M_data->_M_day2 = "Monday"; | ||
2320 | + _M_data->_M_day3 = "Tuesday"; | ||
2321 | + _M_data->_M_day4 = "Wednesday"; | ||
2322 | + _M_data->_M_day5 = "Thursday"; | ||
2323 | + _M_data->_M_day6 = "Friday"; | ||
2324 | + _M_data->_M_day7 = "Saturday"; | ||
2325 | + | ||
2326 | + // Abbreviated day names, starting with "C"'s Sun. | ||
2327 | + _M_data->_M_aday1 = "Sun"; | ||
2328 | + _M_data->_M_aday2 = "Mon"; | ||
2329 | + _M_data->_M_aday3 = "Tue"; | ||
2330 | + _M_data->_M_aday4 = "Wed"; | ||
2331 | + _M_data->_M_aday5 = "Thu"; | ||
2332 | + _M_data->_M_aday6 = "Fri"; | ||
2333 | + _M_data->_M_aday7 = "Sat"; | ||
2334 | + | ||
2335 | + // Month names, starting with "C"'s January. | ||
2336 | + _M_data->_M_month01 = "January"; | ||
2337 | + _M_data->_M_month02 = "February"; | ||
2338 | + _M_data->_M_month03 = "March"; | ||
2339 | + _M_data->_M_month04 = "April"; | ||
2340 | + _M_data->_M_month05 = "May"; | ||
2341 | + _M_data->_M_month06 = "June"; | ||
2342 | + _M_data->_M_month07 = "July"; | ||
2343 | + _M_data->_M_month08 = "August"; | ||
2344 | + _M_data->_M_month09 = "September"; | ||
2345 | + _M_data->_M_month10 = "October"; | ||
2346 | + _M_data->_M_month11 = "November"; | ||
2347 | + _M_data->_M_month12 = "December"; | ||
2348 | + | ||
2349 | + // Abbreviated month names, starting with "C"'s Jan. | ||
2350 | + _M_data->_M_amonth01 = "Jan"; | ||
2351 | + _M_data->_M_amonth02 = "Feb"; | ||
2352 | + _M_data->_M_amonth03 = "Mar"; | ||
2353 | + _M_data->_M_amonth04 = "Apr"; | ||
2354 | + _M_data->_M_amonth05 = "May"; | ||
2355 | + _M_data->_M_amonth06 = "Jun"; | ||
2356 | + _M_data->_M_amonth07 = "Jul"; | ||
2357 | + _M_data->_M_amonth08 = "Aug"; | ||
2358 | + _M_data->_M_amonth09 = "Sep"; | ||
2359 | + _M_data->_M_amonth10 = "Oct"; | ||
2360 | + _M_data->_M_amonth11 = "Nov"; | ||
2361 | + _M_data->_M_amonth12 = "Dec"; | ||
2362 | + } | ||
2363 | + else | ||
2364 | + { | ||
2365 | + _M_c_locale_timepunct = _S_clone_c_locale(__cloc); | ||
2366 | + | ||
2367 | + _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc); | ||
2368 | + _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); | ||
2369 | + _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc); | ||
2370 | + _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); | ||
2371 | + _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); | ||
2372 | + _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, | ||
2373 | + __cloc); | ||
2374 | + _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc); | ||
2375 | + _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc); | ||
2376 | + _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); | ||
2377 | + | ||
2378 | + // Day names, starting with "C"'s Sunday. | ||
2379 | + _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc); | ||
2380 | + _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc); | ||
2381 | + _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc); | ||
2382 | + _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc); | ||
2383 | + _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc); | ||
2384 | + _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc); | ||
2385 | + _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc); | ||
2386 | + | ||
2387 | + // Abbreviated day names, starting with "C"'s Sun. | ||
2388 | + _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc); | ||
2389 | + _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc); | ||
2390 | + _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc); | ||
2391 | + _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc); | ||
2392 | + _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc); | ||
2393 | + _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc); | ||
2394 | + _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc); | ||
2395 | + | ||
2396 | + // Month names, starting with "C"'s January. | ||
2397 | + _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc); | ||
2398 | + _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc); | ||
2399 | + _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc); | ||
2400 | + _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc); | ||
2401 | + _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc); | ||
2402 | + _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc); | ||
2403 | + _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc); | ||
2404 | + _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc); | ||
2405 | + _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc); | ||
2406 | + _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc); | ||
2407 | + _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc); | ||
2408 | + _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc); | ||
2409 | + | ||
2410 | + // Abbreviated month names, starting with "C"'s Jan. | ||
2411 | + _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc); | ||
2412 | + _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc); | ||
2413 | + _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc); | ||
2414 | + _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc); | ||
2415 | + _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc); | ||
2416 | + _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc); | ||
2417 | + _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc); | ||
2418 | + _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc); | ||
2419 | + _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc); | ||
2420 | + _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc); | ||
2421 | + _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc); | ||
2422 | + _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc); | ||
2423 | + } | ||
2424 | + } | ||
2425 | + | ||
2426 | +#ifdef _GLIBCXX_USE_WCHAR_T | ||
2427 | + template<> | ||
2428 | + void | ||
2429 | + __timepunct<wchar_t>:: | ||
2430 | + _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, | ||
2431 | + const tm* __tm) const | ||
2432 | + { | ||
2433 | +#ifdef __UCLIBC_HAS_XLOCALE__ | ||
2434 | + __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); | ||
2435 | + const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm, | ||
2436 | + _M_c_locale_timepunct); | ||
2437 | +#else | ||
2438 | + char* __old = strdup(setlocale(LC_ALL, NULL)); | ||
2439 | + setlocale(LC_ALL, _M_name_timepunct); | ||
2440 | + const size_t __len = wcsftime(__s, __maxlen, __format, __tm); | ||
2441 | + setlocale(LC_ALL, __old); | ||
2442 | + free(__old); | ||
2443 | +#endif | ||
2444 | + // Make sure __s is null terminated. | ||
2445 | + if (__len == 0) | ||
2446 | + __s[0] = L'\0'; | ||
2447 | + } | ||
2448 | + | ||
2449 | + template<> | ||
2450 | + void | ||
2451 | + __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc) | ||
2452 | + { | ||
2453 | + if (!_M_data) | ||
2454 | + _M_data = new __timepunct_cache<wchar_t>; | ||
2455 | + | ||
2456 | +#warning wide time stuff | ||
2457 | +// if (!__cloc) | ||
2458 | + { | ||
2459 | + // "C" locale | ||
2460 | + _M_c_locale_timepunct = _S_get_c_locale(); | ||
2461 | + | ||
2462 | + _M_data->_M_date_format = L"%m/%d/%y"; | ||
2463 | + _M_data->_M_date_era_format = L"%m/%d/%y"; | ||
2464 | + _M_data->_M_time_format = L"%H:%M:%S"; | ||
2465 | + _M_data->_M_time_era_format = L"%H:%M:%S"; | ||
2466 | + _M_data->_M_date_time_format = L""; | ||
2467 | + _M_data->_M_date_time_era_format = L""; | ||
2468 | + _M_data->_M_am = L"AM"; | ||
2469 | + _M_data->_M_pm = L"PM"; | ||
2470 | + _M_data->_M_am_pm_format = L""; | ||
2471 | + | ||
2472 | + // Day names, starting with "C"'s Sunday. | ||
2473 | + _M_data->_M_day1 = L"Sunday"; | ||
2474 | + _M_data->_M_day2 = L"Monday"; | ||
2475 | + _M_data->_M_day3 = L"Tuesday"; | ||
2476 | + _M_data->_M_day4 = L"Wednesday"; | ||
2477 | + _M_data->_M_day5 = L"Thursday"; | ||
2478 | + _M_data->_M_day6 = L"Friday"; | ||
2479 | + _M_data->_M_day7 = L"Saturday"; | ||
2480 | + | ||
2481 | + // Abbreviated day names, starting with "C"'s Sun. | ||
2482 | + _M_data->_M_aday1 = L"Sun"; | ||
2483 | + _M_data->_M_aday2 = L"Mon"; | ||
2484 | + _M_data->_M_aday3 = L"Tue"; | ||
2485 | + _M_data->_M_aday4 = L"Wed"; | ||
2486 | + _M_data->_M_aday5 = L"Thu"; | ||
2487 | + _M_data->_M_aday6 = L"Fri"; | ||
2488 | + _M_data->_M_aday7 = L"Sat"; | ||
2489 | + | ||
2490 | + // Month names, starting with "C"'s January. | ||
2491 | + _M_data->_M_month01 = L"January"; | ||
2492 | + _M_data->_M_month02 = L"February"; | ||
2493 | + _M_data->_M_month03 = L"March"; | ||
2494 | + _M_data->_M_month04 = L"April"; | ||
2495 | + _M_data->_M_month05 = L"May"; | ||
2496 | + _M_data->_M_month06 = L"June"; | ||
2497 | + _M_data->_M_month07 = L"July"; | ||
2498 | + _M_data->_M_month08 = L"August"; | ||
2499 | + _M_data->_M_month09 = L"September"; | ||
2500 | + _M_data->_M_month10 = L"October"; | ||
2501 | + _M_data->_M_month11 = L"November"; | ||
2502 | + _M_data->_M_month12 = L"December"; | ||
2503 | + | ||
2504 | + // Abbreviated month names, starting with "C"'s Jan. | ||
2505 | + _M_data->_M_amonth01 = L"Jan"; | ||
2506 | + _M_data->_M_amonth02 = L"Feb"; | ||
2507 | + _M_data->_M_amonth03 = L"Mar"; | ||
2508 | + _M_data->_M_amonth04 = L"Apr"; | ||
2509 | + _M_data->_M_amonth05 = L"May"; | ||
2510 | + _M_data->_M_amonth06 = L"Jun"; | ||
2511 | + _M_data->_M_amonth07 = L"Jul"; | ||
2512 | + _M_data->_M_amonth08 = L"Aug"; | ||
2513 | + _M_data->_M_amonth09 = L"Sep"; | ||
2514 | + _M_data->_M_amonth10 = L"Oct"; | ||
2515 | + _M_data->_M_amonth11 = L"Nov"; | ||
2516 | + _M_data->_M_amonth12 = L"Dec"; | ||
2517 | + } | ||
2518 | +#if 0 | ||
2519 | + else | ||
2520 | + { | ||
2521 | + _M_c_locale_timepunct = _S_clone_c_locale(__cloc); | ||
2522 | + | ||
2523 | + union { char *__s; wchar_t *__w; } __u; | ||
2524 | + | ||
2525 | + __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); | ||
2526 | + _M_data->_M_date_format = __u.__w; | ||
2527 | + __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); | ||
2528 | + _M_data->_M_date_era_format = __u.__w; | ||
2529 | + __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); | ||
2530 | + _M_data->_M_time_format = __u.__w; | ||
2531 | + __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); | ||
2532 | + _M_data->_M_time_era_format = __u.__w; | ||
2533 | + __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); | ||
2534 | + _M_data->_M_date_time_format = __u.__w; | ||
2535 | + __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); | ||
2536 | + _M_data->_M_date_time_era_format = __u.__w; | ||
2537 | + __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); | ||
2538 | + _M_data->_M_am = __u.__w; | ||
2539 | + __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); | ||
2540 | + _M_data->_M_pm = __u.__w; | ||
2541 | + __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); | ||
2542 | + _M_data->_M_am_pm_format = __u.__w; | ||
2543 | + | ||
2544 | + // Day names, starting with "C"'s Sunday. | ||
2545 | + __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); | ||
2546 | + _M_data->_M_day1 = __u.__w; | ||
2547 | + __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); | ||
2548 | + _M_data->_M_day2 = __u.__w; | ||
2549 | + __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); | ||
2550 | + _M_data->_M_day3 = __u.__w; | ||
2551 | + __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); | ||
2552 | + _M_data->_M_day4 = __u.__w; | ||
2553 | + __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); | ||
2554 | + _M_data->_M_day5 = __u.__w; | ||
2555 | + __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); | ||
2556 | + _M_data->_M_day6 = __u.__w; | ||
2557 | + __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); | ||
2558 | + _M_data->_M_day7 = __u.__w; | ||
2559 | + | ||
2560 | + // Abbreviated day names, starting with "C"'s Sun. | ||
2561 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); | ||
2562 | + _M_data->_M_aday1 = __u.__w; | ||
2563 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); | ||
2564 | + _M_data->_M_aday2 = __u.__w; | ||
2565 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); | ||
2566 | + _M_data->_M_aday3 = __u.__w; | ||
2567 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); | ||
2568 | + _M_data->_M_aday4 = __u.__w; | ||
2569 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); | ||
2570 | + _M_data->_M_aday5 = __u.__w; | ||
2571 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); | ||
2572 | + _M_data->_M_aday6 = __u.__w; | ||
2573 | + __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); | ||
2574 | + _M_data->_M_aday7 = __u.__w; | ||
2575 | + | ||
2576 | + // Month names, starting with "C"'s January. | ||
2577 | + __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); | ||
2578 | + _M_data->_M_month01 = __u.__w; | ||
2579 | + __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); | ||
2580 | + _M_data->_M_month02 = __u.__w; | ||
2581 | + __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); | ||
2582 | + _M_data->_M_month03 = __u.__w; | ||
2583 | + __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); | ||
2584 | + _M_data->_M_month04 = __u.__w; | ||
2585 | + __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); | ||
2586 | + _M_data->_M_month05 = __u.__w; | ||
2587 | + __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); | ||
2588 | + _M_data->_M_month06 = __u.__w; | ||
2589 | + __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); | ||
2590 | + _M_data->_M_month07 = __u.__w; | ||
2591 | + __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); | ||
2592 | + _M_data->_M_month08 = __u.__w; | ||
2593 | + __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); | ||
2594 | + _M_data->_M_month09 = __u.__w; | ||
2595 | + __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); | ||
2596 | + _M_data->_M_month10 = __u.__w; | ||
2597 | + __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); | ||
2598 | + _M_data->_M_month11 = __u.__w; | ||
2599 | + __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); | ||
2600 | + _M_data->_M_month12 = __u.__w; | ||
2601 | + | ||
2602 | + // Abbreviated month names, starting with "C"'s Jan. | ||
2603 | + __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); | ||
2604 | + _M_data->_M_amonth01 = __u.__w; | ||
2605 | + __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); | ||
2606 | + _M_data->_M_amonth02 = __u.__w; | ||
2607 | + __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); | ||
2608 | + _M_data->_M_amonth03 = __u.__w; | ||
2609 | + __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); | ||
2610 | + _M_data->_M_amonth04 = __u.__w; | ||
2611 | + __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); | ||
2612 | + _M_data->_M_amonth05 = __u.__w; | ||
2613 | + __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); | ||
2614 | + _M_data->_M_amonth06 = __u.__w; | ||
2615 | + __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); | ||
2616 | + _M_data->_M_amonth07 = __u.__w; | ||
2617 | + __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); | ||
2618 | + _M_data->_M_amonth08 = __u.__w; | ||
2619 | + __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); | ||
2620 | + _M_data->_M_amonth09 = __u.__w; | ||
2621 | + __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); | ||
2622 | + _M_data->_M_amonth10 = __u.__w; | ||
2623 | + __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); | ||
2624 | + _M_data->_M_amonth11 = __u.__w; | ||
2625 | + __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); | ||
2626 | + _M_data->_M_amonth12 = __u.__w; | ||
2627 | + } | ||
2628 | +#endif // 0 | ||
2629 | + } | ||
2630 | +#endif | ||
2631 | +} | ||
2632 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.h | ||
2633 | --- gcc-4.1.0-dist/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 17:00:00.000000000 -0700 | ||
2634 | +++ gcc-4.1.0/libstdc++-v3/config/locale/uclibc/time_members.h 2005-10-21 02:34:06.000000000 -0600 | ||
2635 | @@ -0,0 +1,76 @@ | ||
2636 | +// std::time_get, std::time_put implementation, GNU version -*- C++ -*- | ||
2637 | + | ||
2638 | +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. | ||
2639 | +// | ||
2640 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
2641 | +// software; you can redistribute it and/or modify it under the | ||
2642 | +// terms of the GNU General Public License as published by the | ||
2643 | +// Free Software Foundation; either version 2, or (at your option) | ||
2644 | +// any later version. | ||
2645 | + | ||
2646 | +// This library is distributed in the hope that it will be useful, | ||
2647 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2648 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2649 | +// GNU General Public License for more details. | ||
2650 | + | ||
2651 | +// You should have received a copy of the GNU General Public License along | ||
2652 | +// with this library; see the file COPYING. If not, write to the Free | ||
2653 | +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
2654 | +// USA. | ||
2655 | + | ||
2656 | +// As a special exception, you may use this file as part of a free software | ||
2657 | +// library without restriction. Specifically, if other files instantiate | ||
2658 | +// templates or use macros or inline functions from this file, or you compile | ||
2659 | +// this file and link it with other files to produce an executable, this | ||
2660 | +// file does not by itself cause the resulting executable to be covered by | ||
2661 | +// the GNU General Public License. This exception does not however | ||
2662 | +// invalidate any other reasons why the executable file might be covered by | ||
2663 | +// the GNU General Public License. | ||
2664 | + | ||
2665 | +// | ||
2666 | +// ISO C++ 14882: 22.2.5.1.2 - time_get functions | ||
2667 | +// ISO C++ 14882: 22.2.5.3.2 - time_put functions | ||
2668 | +// | ||
2669 | + | ||
2670 | +// Written by Benjamin Kosnik <bkoz@redhat.com> | ||
2671 | + | ||
2672 | + template<typename _CharT> | ||
2673 | + __timepunct<_CharT>::__timepunct(size_t __refs) | ||
2674 | + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), | ||
2675 | + _M_name_timepunct(_S_get_c_name()) | ||
2676 | + { _M_initialize_timepunct(); } | ||
2677 | + | ||
2678 | + template<typename _CharT> | ||
2679 | + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) | ||
2680 | + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), | ||
2681 | + _M_name_timepunct(_S_get_c_name()) | ||
2682 | + { _M_initialize_timepunct(); } | ||
2683 | + | ||
2684 | + template<typename _CharT> | ||
2685 | + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, | ||
2686 | + size_t __refs) | ||
2687 | + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), | ||
2688 | + _M_name_timepunct(NULL) | ||
2689 | + { | ||
2690 | + const size_t __len = std::strlen(__s) + 1; | ||
2691 | + char* __tmp = new char[__len]; | ||
2692 | + std::memcpy(__tmp, __s, __len); | ||
2693 | + _M_name_timepunct = __tmp; | ||
2694 | + | ||
2695 | + try | ||
2696 | + { _M_initialize_timepunct(__cloc); } | ||
2697 | + catch(...) | ||
2698 | + { | ||
2699 | + delete [] _M_name_timepunct; | ||
2700 | + __throw_exception_again; | ||
2701 | + } | ||
2702 | + } | ||
2703 | + | ||
2704 | + template<typename _CharT> | ||
2705 | + __timepunct<_CharT>::~__timepunct() | ||
2706 | + { | ||
2707 | + if (_M_name_timepunct != _S_get_c_name()) | ||
2708 | + delete [] _M_name_timepunct; | ||
2709 | + delete _M_data; | ||
2710 | + _S_destroy_c_locale(_M_c_locale_timepunct); | ||
2711 | + } | ||
2712 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_base.h | ||
2713 | --- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 17:00:00.000000000 -0700 | ||
2714 | +++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2006-03-25 22:06:30.000000000 -0700 | ||
2715 | @@ -0,0 +1,64 @@ | ||
2716 | +// Locale support -*- C++ -*- | ||
2717 | + | ||
2718 | +// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 | ||
2719 | +// Free Software Foundation, Inc. | ||
2720 | +// | ||
2721 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
2722 | +// software; you can redistribute it and/or modify it under the | ||
2723 | +// terms of the GNU General Public License as published by the | ||
2724 | +// Free Software Foundation; either version 2, or (at your option) | ||
2725 | +// any later version. | ||
2726 | + | ||
2727 | +// This library is distributed in the hope that it will be useful, | ||
2728 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2729 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2730 | +// GNU General Public License for more details. | ||
2731 | + | ||
2732 | +// You should have received a copy of the GNU General Public License along | ||
2733 | +// with this library; see the file COPYING. If not, write to the Free | ||
2734 | +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
2735 | +// USA. | ||
2736 | + | ||
2737 | +// As a special exception, you may use this file as part of a free software | ||
2738 | +// library without restriction. Specifically, if other files instantiate | ||
2739 | +// templates or use macros or inline functions from this file, or you compile | ||
2740 | +// this file and link it with other files to produce an executable, this | ||
2741 | +// file does not by itself cause the resulting executable to be covered by | ||
2742 | +// the GNU General Public License. This exception does not however | ||
2743 | +// invalidate any other reasons why the executable file might be covered by | ||
2744 | +// the GNU General Public License. | ||
2745 | + | ||
2746 | +// | ||
2747 | +// ISO C++ 14882: 22.1 Locales | ||
2748 | +// | ||
2749 | + | ||
2750 | +/** @file ctype_base.h | ||
2751 | + * This is an internal header file, included by other library headers. | ||
2752 | + * You should not attempt to use it directly. | ||
2753 | + */ | ||
2754 | + | ||
2755 | +// Information as gleaned from /usr/include/ctype.h | ||
2756 | + | ||
2757 | + /// @brief Base class for ctype. | ||
2758 | + struct ctype_base | ||
2759 | + { | ||
2760 | + // Note: In uClibc, the following two types depend on configuration. | ||
2761 | + | ||
2762 | + // Non-standard typedefs. | ||
2763 | + typedef const __ctype_touplow_t* __to_type; | ||
2764 | + | ||
2765 | + // NB: Offsets into ctype<char>::_M_table force a particular size | ||
2766 | + // on the mask type. Because of this, we don't use an enum. | ||
2767 | + typedef __ctype_mask_t mask; | ||
2768 | + static const mask upper = _ISupper; | ||
2769 | + static const mask lower = _ISlower; | ||
2770 | + static const mask alpha = _ISalpha; | ||
2771 | + static const mask digit = _ISdigit; | ||
2772 | + static const mask xdigit = _ISxdigit; | ||
2773 | + static const mask space = _ISspace; | ||
2774 | + static const mask print = _ISprint; | ||
2775 | + static const mask graph = _ISalpha | _ISdigit | _ISpunct; | ||
2776 | + static const mask cntrl = _IScntrl; | ||
2777 | + static const mask punct = _ISpunct; | ||
2778 | + static const mask alnum = _ISalpha | _ISdigit; | ||
2779 | + }; | ||
2780 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_inline.h | ||
2781 | --- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 17:00:00.000000000 -0700 | ||
2782 | +++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2006-03-25 22:06:30.000000000 -0700 | ||
2783 | @@ -0,0 +1,69 @@ | ||
2784 | +// Locale support -*- C++ -*- | ||
2785 | + | ||
2786 | +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. | ||
2787 | +// | ||
2788 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
2789 | +// software; you can redistribute it and/or modify it under the | ||
2790 | +// terms of the GNU General Public License as published by the | ||
2791 | +// Free Software Foundation; either version 2, or (at your option) | ||
2792 | +// any later version. | ||
2793 | + | ||
2794 | +// This library is distributed in the hope that it will be useful, | ||
2795 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2796 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2797 | +// GNU General Public License for more details. | ||
2798 | + | ||
2799 | +// You should have received a copy of the GNU General Public License along | ||
2800 | +// with this library; see the file COPYING. If not, write to the Free | ||
2801 | +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
2802 | +// USA. | ||
2803 | + | ||
2804 | +// As a special exception, you may use this file as part of a free software | ||
2805 | +// library without restriction. Specifically, if other files instantiate | ||
2806 | +// templates or use macros or inline functions from this file, or you compile | ||
2807 | +// this file and link it with other files to produce an executable, this | ||
2808 | +// file does not by itself cause the resulting executable to be covered by | ||
2809 | +// the GNU General Public License. This exception does not however | ||
2810 | +// invalidate any other reasons why the executable file might be covered by | ||
2811 | +// the GNU General Public License. | ||
2812 | + | ||
2813 | +// | ||
2814 | +// ISO C++ 14882: 22.1 Locales | ||
2815 | +// | ||
2816 | + | ||
2817 | +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) | ||
2818 | +// functions go in ctype.cc | ||
2819 | + | ||
2820 | + bool | ||
2821 | + ctype<char>:: | ||
2822 | + is(mask __m, char __c) const | ||
2823 | + { return _M_table[static_cast<unsigned char>(__c)] & __m; } | ||
2824 | + | ||
2825 | + const char* | ||
2826 | + ctype<char>:: | ||
2827 | + is(const char* __low, const char* __high, mask* __vec) const | ||
2828 | + { | ||
2829 | + while (__low < __high) | ||
2830 | + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)]; | ||
2831 | + return __high; | ||
2832 | + } | ||
2833 | + | ||
2834 | + const char* | ||
2835 | + ctype<char>:: | ||
2836 | + scan_is(mask __m, const char* __low, const char* __high) const | ||
2837 | + { | ||
2838 | + while (__low < __high | ||
2839 | + && !(_M_table[static_cast<unsigned char>(*__low)] & __m)) | ||
2840 | + ++__low; | ||
2841 | + return __low; | ||
2842 | + } | ||
2843 | + | ||
2844 | + const char* | ||
2845 | + ctype<char>:: | ||
2846 | + scan_not(mask __m, const char* __low, const char* __high) const | ||
2847 | + { | ||
2848 | + while (__low < __high | ||
2849 | + && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0) | ||
2850 | + ++__low; | ||
2851 | + return __low; | ||
2852 | + } | ||
2853 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h | ||
2854 | --- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 17:00:00.000000000 -0700 | ||
2855 | +++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2006-03-25 22:06:30.000000000 -0700 | ||
2856 | @@ -0,0 +1,92 @@ | ||
2857 | +// Locale support -*- C++ -*- | ||
2858 | + | ||
2859 | +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004 | ||
2860 | +// Free Software Foundation, Inc. | ||
2861 | +// | ||
2862 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
2863 | +// software; you can redistribute it and/or modify it under the | ||
2864 | +// terms of the GNU General Public License as published by the | ||
2865 | +// Free Software Foundation; either version 2, or (at your option) | ||
2866 | +// any later version. | ||
2867 | + | ||
2868 | +// This library is distributed in the hope that it will be useful, | ||
2869 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2870 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2871 | +// GNU General Public License for more details. | ||
2872 | + | ||
2873 | +// You should have received a copy of the GNU General Public License along | ||
2874 | +// with this library; see the file COPYING. If not, write to the Free | ||
2875 | +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
2876 | +// USA. | ||
2877 | + | ||
2878 | +// As a special exception, you may use this file as part of a free software | ||
2879 | +// library without restriction. Specifically, if other files instantiate | ||
2880 | +// templates or use macros or inline functions from this file, or you compile | ||
2881 | +// this file and link it with other files to produce an executable, this | ||
2882 | +// file does not by itself cause the resulting executable to be covered by | ||
2883 | +// the GNU General Public License. This exception does not however | ||
2884 | +// invalidate any other reasons why the executable file might be covered by | ||
2885 | +// the GNU General Public License. | ||
2886 | + | ||
2887 | +// | ||
2888 | +// ISO C++ 14882: 22.1 Locales | ||
2889 | +// | ||
2890 | + | ||
2891 | +// Information as gleaned from /usr/include/ctype.h | ||
2892 | + | ||
2893 | + const ctype_base::mask* | ||
2894 | + ctype<char>::classic_table() throw() | ||
2895 | + { return __C_ctype_b; } | ||
2896 | + | ||
2897 | + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, | ||
2898 | + size_t __refs) | ||
2899 | + : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), | ||
2900 | + _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) | ||
2901 | + { | ||
2902 | + _M_toupper = __C_ctype_toupper; | ||
2903 | + _M_tolower = __C_ctype_tolower; | ||
2904 | + _M_table = __table ? __table : __C_ctype_b; | ||
2905 | + memset(_M_widen, 0, sizeof(_M_widen)); | ||
2906 | + memset(_M_narrow, 0, sizeof(_M_narrow)); | ||
2907 | + } | ||
2908 | + | ||
2909 | + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) | ||
2910 | + : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), | ||
2911 | + _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0) | ||
2912 | + { | ||
2913 | + _M_toupper = __C_ctype_toupper; | ||
2914 | + _M_tolower = __C_ctype_tolower; | ||
2915 | + _M_table = __table ? __table : __C_ctype_b; | ||
2916 | + memset(_M_widen, 0, sizeof(_M_widen)); | ||
2917 | + memset(_M_narrow, 0, sizeof(_M_narrow)); | ||
2918 | + } | ||
2919 | + | ||
2920 | + char | ||
2921 | + ctype<char>::do_toupper(char __c) const | ||
2922 | + { return _M_toupper[static_cast<unsigned char>(__c)]; } | ||
2923 | + | ||
2924 | + const char* | ||
2925 | + ctype<char>::do_toupper(char* __low, const char* __high) const | ||
2926 | + { | ||
2927 | + while (__low < __high) | ||
2928 | + { | ||
2929 | + *__low = _M_toupper[static_cast<unsigned char>(*__low)]; | ||
2930 | + ++__low; | ||
2931 | + } | ||
2932 | + return __high; | ||
2933 | + } | ||
2934 | + | ||
2935 | + char | ||
2936 | + ctype<char>::do_tolower(char __c) const | ||
2937 | + { return _M_tolower[static_cast<unsigned char>(__c)]; } | ||
2938 | + | ||
2939 | + const char* | ||
2940 | + ctype<char>::do_tolower(char* __low, const char* __high) const | ||
2941 | + { | ||
2942 | + while (__low < __high) | ||
2943 | + { | ||
2944 | + *__low = _M_tolower[static_cast<unsigned char>(*__low)]; | ||
2945 | + ++__low; | ||
2946 | + } | ||
2947 | + return __high; | ||
2948 | + } | ||
2949 | diff -urN gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.1.0/libstdc++-v3/config/os/uclibc/os_defines.h | ||
2950 | --- gcc-4.1.0-dist/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 17:00:00.000000000 -0700 | ||
2951 | +++ gcc-4.1.0/libstdc++-v3/config/os/uclibc/os_defines.h 2006-03-25 22:06:30.000000000 -0700 | ||
2952 | @@ -0,0 +1,44 @@ | ||
2953 | +// Specific definitions for GNU/Linux -*- C++ -*- | ||
2954 | + | ||
2955 | +// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. | ||
2956 | +// | ||
2957 | +// This file is part of the GNU ISO C++ Library. This library is free | ||
2958 | +// software; you can redistribute it and/or modify it under the | ||
2959 | +// terms of the GNU General Public License as published by the | ||
2960 | +// Free Software Foundation; either version 2, or (at your option) | ||
2961 | +// any later version. | ||
2962 | + | ||
2963 | +// This library is distributed in the hope that it will be useful, | ||
2964 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2965 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2966 | +// GNU General Public License for more details. | ||
2967 | + | ||
2968 | +// You should have received a copy of the GNU General Public License along | ||
2969 | +// with this library; see the file COPYING. If not, write to the Free | ||
2970 | +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
2971 | +// USA. | ||
2972 | + | ||
2973 | +// As a special exception, you may use this file as part of a free software | ||
2974 | +// library without restriction. Specifically, if other files instantiate | ||
2975 | +// templates or use macros or inline functions from this file, or you compile | ||
2976 | +// this file and link it with other files to produce an executable, this | ||
2977 | +// file does not by itself cause the resulting executable to be covered by | ||
2978 | +// the GNU General Public License. This exception does not however | ||
2979 | +// invalidate any other reasons why the executable file might be covered by | ||
2980 | +// the GNU General Public License. | ||
2981 | + | ||
2982 | +#ifndef _GLIBCXX_OS_DEFINES | ||
2983 | +#define _GLIBCXX_OS_DEFINES 1 | ||
2984 | + | ||
2985 | +// System-specific #define, typedefs, corrections, etc, go here. This | ||
2986 | +// file will come before all others. | ||
2987 | + | ||
2988 | +// This keeps isanum, et al from being propagated as macros. | ||
2989 | +#define __NO_CTYPE 1 | ||
2990 | + | ||
2991 | +#include <features.h> | ||
2992 | + | ||
2993 | +// We must not see the optimized string functions GNU libc defines. | ||
2994 | +#define __NO_STRING_INLINES | ||
2995 | + | ||
2996 | +#endif | ||
2997 | diff -urN gcc-4.1.0-dist/libstdc++-v3/configure gcc-4.1.0/libstdc++-v3/configure | ||
2998 | --- gcc-4.1.0-dist/libstdc++-v3/configure 2006-03-26 12:08:28.000000000 -0700 | ||
2999 | +++ gcc-4.1.0/libstdc++-v3/configure 2006-03-25 22:06:30.000000000 -0700 | ||
3000 | @@ -4005,6 +4005,11 @@ | ||
3001 | lt_cv_deplibs_check_method=pass_all | ||
3002 | ;; | ||
3003 | |||
3004 | +linux-uclibc*) | ||
3005 | + lt_cv_deplibs_check_method=pass_all | ||
3006 | + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so` | ||
3007 | + ;; | ||
3008 | + | ||
3009 | netbsd* | knetbsd*-gnu) | ||
3010 | if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then | ||
3011 | lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' | ||
3012 | @@ -5740,7 +5745,7 @@ | ||
3013 | enableval="$enable_clocale" | ||
3014 | |||
3015 | case "$enableval" in | ||
3016 | - generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; | ||
3017 | + generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; | ||
3018 | *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 | ||
3019 | echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} | ||
3020 | { (exit 1); exit 1; }; } ;; | ||
3021 | @@ -5765,6 +5770,9 @@ | ||
3022 | # Default to "generic". | ||
3023 | if test $enable_clocale_flag = auto; then | ||
3024 | case ${target_os} in | ||
3025 | + linux-uclibc*) | ||
3026 | + enable_clocale_flag=uclibc | ||
3027 | + ;; | ||
3028 | linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) | ||
3029 | cat >conftest.$ac_ext <<_ACEOF | ||
3030 | /* confdefs.h. */ | ||
3031 | @@ -5995,6 +6003,76 @@ | ||
3032 | CTIME_CC=config/locale/generic/time_members.cc | ||
3033 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h | ||
3034 | ;; | ||
3035 | + uclibc) | ||
3036 | + echo "$as_me:$LINENO: result: uclibc" >&5 | ||
3037 | +echo "${ECHO_T}uclibc" >&6 | ||
3038 | + | ||
3039 | + # Declare intention to use gettext, and add support for specific | ||
3040 | + # languages. | ||
3041 | + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT | ||
3042 | + ALL_LINGUAS="de fr" | ||
3043 | + | ||
3044 | + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. | ||
3045 | + # Extract the first word of "msgfmt", so it can be a program name with args. | ||
3046 | +set dummy msgfmt; ac_word=$2 | ||
3047 | +echo "$as_me:$LINENO: checking for $ac_word" >&5 | ||
3048 | +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 | ||
3049 | +if test "${ac_cv_prog_check_msgfmt+set}" = set; then | ||
3050 | + echo $ECHO_N "(cached) $ECHO_C" >&6 | ||
3051 | +else | ||
3052 | + if test -n "$check_msgfmt"; then | ||
3053 | + ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. | ||
3054 | +else | ||
3055 | +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | ||
3056 | +for as_dir in $PATH | ||
3057 | +do | ||
3058 | + IFS=$as_save_IFS | ||
3059 | + test -z "$as_dir" && as_dir=. | ||
3060 | + for ac_exec_ext in '' $ac_executable_extensions; do | ||
3061 | + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | ||
3062 | + ac_cv_prog_check_msgfmt="yes" | ||
3063 | + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 | ||
3064 | + break 2 | ||
3065 | + fi | ||
3066 | +done | ||
3067 | +done | ||
3068 | + | ||
3069 | + test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" | ||
3070 | +fi | ||
3071 | +fi | ||
3072 | +check_msgfmt=$ac_cv_prog_check_msgfmt | ||
3073 | +if test -n "$check_msgfmt"; then | ||
3074 | + echo "$as_me:$LINENO: result: $check_msgfmt" >&5 | ||
3075 | +echo "${ECHO_T}$check_msgfmt" >&6 | ||
3076 | +else | ||
3077 | + echo "$as_me:$LINENO: result: no" >&5 | ||
3078 | +echo "${ECHO_T}no" >&6 | ||
3079 | +fi | ||
3080 | + | ||
3081 | + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then | ||
3082 | + USE_NLS=yes | ||
3083 | + fi | ||
3084 | + # Export the build objects. | ||
3085 | + for ling in $ALL_LINGUAS; do \ | ||
3086 | + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ | ||
3087 | + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ | ||
3088 | + done | ||
3089 | + | ||
3090 | + | ||
3091 | + | ||
3092 | + CLOCALE_H=config/locale/uclibc/c_locale.h | ||
3093 | + CLOCALE_CC=config/locale/uclibc/c_locale.cc | ||
3094 | + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc | ||
3095 | + CCOLLATE_CC=config/locale/uclibc/collate_members.cc | ||
3096 | + CCTYPE_CC=config/locale/uclibc/ctype_members.cc | ||
3097 | + CMESSAGES_H=config/locale/uclibc/messages_members.h | ||
3098 | + CMESSAGES_CC=config/locale/uclibc/messages_members.cc | ||
3099 | + CMONEY_CC=config/locale/uclibc/monetary_members.cc | ||
3100 | + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc | ||
3101 | + CTIME_H=config/locale/uclibc/time_members.h | ||
3102 | + CTIME_CC=config/locale/uclibc/time_members.cc | ||
3103 | + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h | ||
3104 | + ;; | ||
3105 | esac | ||
3106 | |||
3107 | # This is where the testsuite looks for locale catalogs, using the | ||
3108 | diff -urN gcc-4.1.0-dist/libstdc++-v3/configure.host gcc-4.1.0/libstdc++-v3/configure.host | ||
3109 | --- gcc-4.1.0-dist/libstdc++-v3/configure.host 2006-03-26 12:08:28.000000000 -0700 | ||
3110 | +++ gcc-4.1.0/libstdc++-v3/configure.host 2006-03-25 22:06:30.000000000 -0700 | ||
3111 | @@ -261,6 +261,12 @@ | ||
3112 | ;; | ||
3113 | esac | ||
3114 | |||
3115 | +# Override for uClibc since linux-uclibc gets mishandled above. | ||
3116 | +case "${host_os}" in | ||
3117 | + *-uclibc*) | ||
3118 | + os_include_dir="os/uclibc" | ||
3119 | + ;; | ||
3120 | +esac | ||
3121 | |||
3122 | # Set any OS-dependent and CPU-dependent bits. | ||
3123 | # THIS TABLE IS SORTED. KEEP IT THAT WAY. | ||
3124 | diff -urN gcc-4.1.0-dist/libstdc++-v3/crossconfig.m4 gcc-4.1.0/libstdc++-v3/crossconfig.m4 | ||
3125 | --- gcc-4.1.0-dist/libstdc++-v3/crossconfig.m4 2006-03-26 12:08:28.000000000 -0700 | ||
3126 | +++ gcc-4.1.0/libstdc++-v3/crossconfig.m4 2006-03-25 22:06:30.000000000 -0700 | ||
3127 | @@ -143,6 +143,99 @@ | ||
3128 | ;; | ||
3129 | esac | ||
3130 | ;; | ||
3131 | + *-uclibc*) | ||
3132 | +# Temporary hack until we implement the float versions of the libm funcs | ||
3133 | + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ | ||
3134 | + machine/endian.h machine/param.h sys/machine.h sys/types.h \ | ||
3135 | + fp.h float.h endian.h inttypes.h locale.h float.h stdint.h]) | ||
3136 | + SECTION_FLAGS='-ffunction-sections -fdata-sections' | ||
3137 | + AC_SUBST(SECTION_FLAGS) | ||
3138 | + GLIBCXX_CHECK_LINKER_FEATURES | ||
3139 | + GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT | ||
3140 | + GLIBCXX_CHECK_WCHAR_T_SUPPORT | ||
3141 | + | ||
3142 | + # For LFS. | ||
3143 | + AC_DEFINE(HAVE_INT64_T) | ||
3144 | + case "$target" in | ||
3145 | + *-uclinux*) | ||
3146 | + # Don't enable LFS with uClinux | ||
3147 | + ;; | ||
3148 | + *) | ||
3149 | + AC_DEFINE(_GLIBCXX_USE_LFS) | ||
3150 | + esac | ||
3151 | + | ||
3152 | + # For showmanyc_helper(). | ||
3153 | + AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) | ||
3154 | + GLIBCXX_CHECK_POLL | ||
3155 | + GLIBCXX_CHECK_S_ISREG_OR_S_IFREG | ||
3156 | + | ||
3157 | + # For xsputn_2(). | ||
3158 | + AC_CHECK_HEADERS(sys/uio.h) | ||
3159 | + GLIBCXX_CHECK_WRITEV | ||
3160 | + | ||
3161 | +# AC_DEFINE(HAVE_ACOSF) | ||
3162 | +# AC_DEFINE(HAVE_ASINF) | ||
3163 | +# AC_DEFINE(HAVE_ATANF) | ||
3164 | +# AC_DEFINE(HAVE_ATAN2F) | ||
3165 | + AC_DEFINE(HAVE_CEILF) | ||
3166 | + AC_DEFINE(HAVE_COPYSIGN) | ||
3167 | +# AC_DEFINE(HAVE_COPYSIGNF) | ||
3168 | +# AC_DEFINE(HAVE_COSF) | ||
3169 | +# AC_DEFINE(HAVE_COSHF) | ||
3170 | +# AC_DEFINE(HAVE_EXPF) | ||
3171 | +# AC_DEFINE(HAVE_FABSF) | ||
3172 | + AC_DEFINE(HAVE_FINITE) | ||
3173 | + AC_DEFINE(HAVE_FINITEF) | ||
3174 | + AC_DEFINE(HAVE_FLOORF) | ||
3175 | +# AC_DEFINE(HAVE_FMODF) | ||
3176 | +# AC_DEFINE(HAVE_FREXPF) | ||
3177 | + AC_DEFINE(HAVE_HYPOT) | ||
3178 | +# AC_DEFINE(HAVE_HYPOTF) | ||
3179 | + AC_DEFINE(HAVE_ISINF) | ||
3180 | + AC_DEFINE(HAVE_ISINFF) | ||
3181 | + AC_DEFINE(HAVE_ISNAN) | ||
3182 | + AC_DEFINE(HAVE_ISNANF) | ||
3183 | +# AC_DEFINE(HAVE_LOGF) | ||
3184 | +# AC_DEFINE(HAVE_LOG10F) | ||
3185 | +# AC_DEFINE(HAVE_MODFF) | ||
3186 | +# AC_DEFINE(HAVE_SINF) | ||
3187 | +# AC_DEFINE(HAVE_SINHF) | ||
3188 | +# AC_DEFINE(HAVE_SINCOS) | ||
3189 | +# AC_DEFINE(HAVE_SINCOSF) | ||
3190 | + AC_DEFINE(HAVE_SQRTF) | ||
3191 | +# AC_DEFINE(HAVE_TANF) | ||
3192 | +# AC_DEFINE(HAVE_TANHF) | ||
3193 | + if test x"long_double_math_on_this_cpu" = x"yes"; then | ||
3194 | + AC_MSG_ERROR([long_double_math_on_this_cpu is yes!]) | ||
3195 | +# AC_DEFINE(HAVE_ACOSL) | ||
3196 | +# AC_DEFINE(HAVE_ASINL) | ||
3197 | +# AC_DEFINE(HAVE_ATANL) | ||
3198 | +# AC_DEFINE(HAVE_ATAN2L) | ||
3199 | +# AC_DEFINE(HAVE_CEILL) | ||
3200 | +# AC_DEFINE(HAVE_COPYSIGNL) | ||
3201 | +# AC_DEFINE(HAVE_COSL) | ||
3202 | +# AC_DEFINE(HAVE_COSHL) | ||
3203 | +# AC_DEFINE(HAVE_EXPL) | ||
3204 | +# AC_DEFINE(HAVE_FABSL) | ||
3205 | +# AC_DEFINE(HAVE_FINITEL) | ||
3206 | +# AC_DEFINE(HAVE_FLOORL) | ||
3207 | +# AC_DEFINE(HAVE_FMODL) | ||
3208 | +# AC_DEFINE(HAVE_FREXPL) | ||
3209 | +# AC_DEFINE(HAVE_HYPOTL) | ||
3210 | +# AC_DEFINE(HAVE_ISINFL) | ||
3211 | +# AC_DEFINE(HAVE_ISNANL) | ||
3212 | +# AC_DEFINE(HAVE_LOGL) | ||
3213 | +# AC_DEFINE(HAVE_LOG10L) | ||
3214 | +# AC_DEFINE(HAVE_MODFL) | ||
3215 | +# AC_DEFINE(HAVE_POWL) | ||
3216 | +# AC_DEFINE(HAVE_SINL) | ||
3217 | +# AC_DEFINE(HAVE_SINHL) | ||
3218 | +# AC_DEFINE(HAVE_SINCOSL) | ||
3219 | +# AC_DEFINE(HAVE_SQRTL) | ||
3220 | +# AC_DEFINE(HAVE_TANL) | ||
3221 | +# AC_DEFINE(HAVE_TANHL) | ||
3222 | + fi | ||
3223 | + ;; | ||
3224 | *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu) | ||
3225 | AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ | ||
3226 | machine/endian.h machine/param.h sys/machine.h sys/types.h \ | ||
3227 | @@ -157,7 +250,7 @@ | ||
3228 | AC_DEFINE(HAVE_INT64_T) | ||
3229 | case "$target" in | ||
3230 | *-uclinux*) | ||
3231 | - # Don't enable LFS with uClibc | ||
3232 | + # Don't enable LFS with uClinux | ||
3233 | ;; | ||
3234 | *) | ||
3235 | AC_DEFINE(_GLIBCXX_USE_LFS) | ||
3236 | diff -urN gcc-4.1.0-dist/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.1.0/libstdc++-v3/include/c_compatibility/wchar.h | ||
3237 | --- gcc-4.1.0-dist/libstdc++-v3/include/c_compatibility/wchar.h 2006-03-26 12:08:28.000000000 -0700 | ||
3238 | +++ gcc-4.1.0/libstdc++-v3/include/c_compatibility/wchar.h 2006-03-25 22:06:30.000000000 -0700 | ||
3239 | @@ -101,7 +101,9 @@ | ||
3240 | using std::wmemcpy; | ||
3241 | using std::wmemmove; | ||
3242 | using std::wmemset; | ||
3243 | +#if _GLIBCXX_HAVE_WCSFTIME | ||
3244 | using std::wcsftime; | ||
3245 | +#endif | ||
3246 | |||
3247 | #if _GLIBCXX_USE_C99 | ||
3248 | using std::wcstold; | ||
3249 | diff -urN gcc-4.1.0-dist/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.1.0/libstdc++-v3/include/c_std/std_cwchar.h | ||
3250 | --- gcc-4.1.0-dist/libstdc++-v3/include/c_std/std_cwchar.h 2006-03-26 12:08:28.000000000 -0700 | ||
3251 | +++ gcc-4.1.0/libstdc++-v3/include/c_std/std_cwchar.h 2006-03-25 22:06:30.000000000 -0700 | ||
3252 | @@ -180,7 +180,9 @@ | ||
3253 | using ::wcscoll; | ||
3254 | using ::wcscpy; | ||
3255 | using ::wcscspn; | ||
3256 | +#if _GLIBCXX_HAVE_WCSFTIME | ||
3257 | using ::wcsftime; | ||
3258 | +#endif | ||
3259 | using ::wcslen; | ||
3260 | using ::wcsncat; | ||
3261 | using ::wcsncmp; | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/300-libstdc++-pic.patch b/meta/packages/gcc/gcc-4.1.1/300-libstdc++-pic.patch new file mode 100644 index 0000000000..89d03a85e5 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/300-libstdc++-pic.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | # DP: Build and install libstdc++_pic.a library. | ||
2 | |||
3 | --- gcc-4.1.0/libstdc++-v3/src/Makefile.am 2004-11-15 17:33:05.000000000 -0600 | ||
4 | +++ gcc-4.1.0-patched/libstdc++-v3/src/Makefile.am 2005-04-25 20:05:59.186930896 -0500 | ||
5 | @@ -214,6 +214,10 @@ | ||
6 | $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ | ||
7 | |||
8 | |||
9 | +install-exec-local: | ||
10 | + $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o | ||
11 | + $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) | ||
12 | + | ||
13 | # Added bits to build debug library. | ||
14 | if GLIBCXX_BUILD_DEBUG | ||
15 | all-local: build_debug | ||
16 | --- gcc-4.1.0/libstdc++-v3/src/Makefile.in 2005-04-11 19:13:08.000000000 -0500 | ||
17 | +++ gcc-4.1.0-patched/libstdc++-v3/src/Makefile.in 2005-04-25 20:12:33.284316275 -0500 | ||
18 | @@ -627,7 +627,7 @@ | ||
19 | |||
20 | install-data-am: install-data-local | ||
21 | |||
22 | -install-exec-am: install-toolexeclibLTLIBRARIES | ||
23 | +install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local | ||
24 | |||
25 | install-info: install-info-am | ||
26 | |||
27 | @@ -660,6 +660,7 @@ | ||
28 | distclean-libtool distclean-tags distdir dvi dvi-am html \ | ||
29 | html-am info info-am install install-am install-data \ | ||
30 | install-data-am install-data-local install-exec \ | ||
31 | + install-exec-local \ | ||
32 | install-exec-am install-info install-info-am install-man \ | ||
33 | install-strip install-toolexeclibLTLIBRARIES installcheck \ | ||
34 | installcheck-am installdirs maintainer-clean \ | ||
35 | @@ -745,6 +746,11 @@ | ||
36 | install_debug: | ||
37 | (cd ${debugdir} && $(MAKE) \ | ||
38 | toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) | ||
39 | + | ||
40 | +install-exec-local: | ||
41 | + $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o | ||
42 | + $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) | ||
43 | + | ||
44 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
45 | # Otherwise a system limit (for SysV at least) may be exceeded. | ||
46 | .NOEXPORT: | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/301-missing-execinfo_h.patch b/meta/packages/gcc/gcc-4.1.1/301-missing-execinfo_h.patch new file mode 100644 index 0000000000..0e2092f3fb --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/301-missing-execinfo_h.patch | |||
@@ -0,0 +1,11 @@ | |||
1 | --- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500 | ||
2 | +++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500 | ||
3 | @@ -500,7 +500,7 @@ | ||
4 | #ifdef __linux__ | ||
5 | # include <features.h> | ||
6 | # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ | ||
7 | - && !defined(__ia64__) | ||
8 | + && !defined(__ia64__) && !defined(__UCLIBC__) | ||
9 | # ifndef GC_HAVE_BUILTIN_BACKTRACE | ||
10 | # define GC_HAVE_BUILTIN_BACKTRACE | ||
11 | # endif | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/302-c99-snprintf.patch b/meta/packages/gcc/gcc-4.1.1/302-c99-snprintf.patch new file mode 100644 index 0000000000..dfb22d681b --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/302-c99-snprintf.patch | |||
@@ -0,0 +1,11 @@ | |||
1 | --- gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h-orig 2005-04-29 00:08:41.000000000 -0500 | ||
2 | +++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cstdio.h 2005-04-29 00:08:45.000000000 -0500 | ||
3 | @@ -142,7 +142,7 @@ | ||
4 | using ::vsprintf; | ||
5 | } | ||
6 | |||
7 | -#if _GLIBCXX_USE_C99 | ||
8 | +#if _GLIBCXX_USE_C99 || defined(__UCLIBC__) | ||
9 | |||
10 | #undef snprintf | ||
11 | #undef vfscanf | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/303-c99-complex-ugly-hack.patch b/meta/packages/gcc/gcc-4.1.1/303-c99-complex-ugly-hack.patch new file mode 100644 index 0000000000..2ccc80d9bb --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/303-c99-complex-ugly-hack.patch | |||
@@ -0,0 +1,12 @@ | |||
1 | --- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500 | ||
2 | +++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500 | ||
3 | @@ -7194,6 +7194,9 @@ | ||
4 | cat >>conftest.$ac_ext <<_ACEOF | ||
5 | /* end confdefs.h. */ | ||
6 | #include <complex.h> | ||
7 | +#ifdef __UCLIBC__ | ||
8 | +#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs | ||
9 | +#endif | ||
10 | int | ||
11 | main () | ||
12 | { | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/304-index_macro.patch b/meta/packages/gcc/gcc-4.1.1/304-index_macro.patch new file mode 100644 index 0000000000..1fac112fa9 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/304-index_macro.patch | |||
@@ -0,0 +1,24 @@ | |||
1 | --- gcc-4.1.0/libstdc++-v3/include/ext/rope.mps 2006-03-24 01:49:51 +0100 | ||
2 | +++ gcc-4.1.0/libstdc++-v3/include/ext/rope 2006-03-24 01:49:37 +0100 | ||
3 | @@ -59,6 +59,9 @@ | ||
4 | #include <bits/allocator.h> | ||
5 | #include <ext/hash_fun.h> | ||
6 | |||
7 | +/* cope w/ index defined as macro, SuSv3 proposal */ | ||
8 | +#undef index | ||
9 | + | ||
10 | # ifdef __GC | ||
11 | # define __GC_CONST const | ||
12 | # else | ||
13 | --- gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h.mps 2006-03-24 01:50:04 +0100 | ||
14 | +++ gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h 2006-03-24 01:50:28 +0100 | ||
15 | @@ -53,6 +53,9 @@ | ||
16 | #include <ext/memory> // For uninitialized_copy_n | ||
17 | #include <ext/numeric> // For power | ||
18 | |||
19 | +/* cope w/ index defined as macro, SuSv3 proposal */ | ||
20 | +#undef index | ||
21 | + | ||
22 | namespace __gnu_cxx | ||
23 | { | ||
24 | using std::size_t; | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/602-sdk-libstdc++-includes.patch b/meta/packages/gcc/gcc-4.1.1/602-sdk-libstdc++-includes.patch new file mode 100644 index 0000000000..23fce7544d --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/602-sdk-libstdc++-includes.patch | |||
@@ -0,0 +1,20 @@ | |||
1 | --- gcc-4.1.0/libstdc++-v3/fragment.am 2005-03-21 11:40:14.000000000 -0600 | ||
2 | +++ gcc-4.1.0-patched/libstdc++-v3/fragment.am 2005-04-25 20:14:39.856251785 -0500 | ||
3 | @@ -21,5 +21,5 @@ | ||
4 | $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once | ||
5 | |||
6 | # -I/-D flags to pass when compiling. | ||
7 | -AM_CPPFLAGS = $(GLIBCXX_INCLUDES) | ||
8 | +AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -I$(toplevel_srcdir)/include | ||
9 | |||
10 | --- gcc-4.1.0/libstdc++-v3/libmath/Makefile.am 2005-03-21 11:40:18.000000000 -0600 | ||
11 | +++ gcc-4.1.0-patched/libstdc++-v3/libmath/Makefile.am 2005-04-25 20:14:39.682280735 -0500 | ||
12 | @@ -35,7 +35,7 @@ | ||
13 | |||
14 | libmath_la_SOURCES = stubs.c | ||
15 | |||
16 | -AM_CPPFLAGS = $(CANADIAN_INCLUDES) | ||
17 | +AM_CPPFLAGS = $(CANADIAN_INCLUDES) -I$(toplevel_srcdir)/include | ||
18 | |||
19 | # Only compiling "C" sources in this directory. | ||
20 | LIBTOOL = @LIBTOOL@ --tag CC | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/740-sh-pr24836.patch b/meta/packages/gcc/gcc-4.1.1/740-sh-pr24836.patch new file mode 100644 index 0000000000..7992282cff --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/740-sh-pr24836.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | http://sourceforge.net/mailarchive/forum.php?thread_id=8959304&forum_id=5348 | ||
2 | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24836 | ||
3 | |||
4 | --- gcc/gcc/configure.ac (revision 106699) | ||
5 | +++ gcc/gcc/configure.ac (working copy) | ||
6 | @@ -2446,7 +2446,7 @@ | ||
7 | tls_first_minor=14 | ||
8 | tls_as_opt="-m64 -Aesame --fatal-warnings" | ||
9 | ;; | ||
10 | - sh-*-* | sh[34]-*-*) | ||
11 | + sh-*-* | sh[34]*-*-*) | ||
12 | conftest_s=' | ||
13 | .section ".tdata","awT",@progbits | ||
14 | foo: .long 25 | ||
15 | --- gcc/gcc/configure | ||
16 | +++ gcc/gcc/configure | ||
17 | @@ -14846,7 +14846,7 @@ | ||
18 | tls_first_minor=14 | ||
19 | tls_as_opt="-m64 -Aesame --fatal-warnings" | ||
20 | ;; | ||
21 | - sh-*-* | sh[34]-*-*) | ||
22 | + sh-*-* | sh[34]*-*-*) | ||
23 | conftest_s=' | ||
24 | .section ".tdata","awT",@progbits | ||
25 | foo: .long 25 | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/800-arm-bigendian.patch b/meta/packages/gcc/gcc-4.1.1/800-arm-bigendian.patch new file mode 100644 index 0000000000..1fa5ae1cd2 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/800-arm-bigendian.patch | |||
@@ -0,0 +1,67 @@ | |||
1 | By Lennert Buytenhek <buytenh@wantstofly.org> | ||
2 | Adds support for arm*b-linux* big-endian ARM targets | ||
3 | |||
4 | See http://gcc.gnu.org/PR16350 | ||
5 | |||
6 | --- gcc-4.1.0/gcc/config/arm/linux-elf.h | ||
7 | +++ gcc-4.1.0/gcc/config/arm/linux-elf.h | ||
8 | @@ -28,19 +28,33 @@ | ||
9 | #undef TARGET_VERSION | ||
10 | #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr); | ||
11 | |||
12 | +/* | ||
13 | + * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-* | ||
14 | + * (big endian) configurations. | ||
15 | + */ | ||
16 | +#if TARGET_BIG_ENDIAN_DEFAULT | ||
17 | +#define TARGET_ENDIAN_DEFAULT MASK_BIG_END | ||
18 | +#define TARGET_ENDIAN_OPTION "mbig-endian" | ||
19 | +#define TARGET_LINKER_EMULATION "armelfb_linux" | ||
20 | +#else | ||
21 | +#define TARGET_ENDIAN_DEFAULT 0 | ||
22 | +#define TARGET_ENDIAN_OPTION "mlittle-endian" | ||
23 | +#define TARGET_LINKER_EMULATION "armelf_linux" | ||
24 | +#endif | ||
25 | + | ||
26 | #undef TARGET_DEFAULT_FLOAT_ABI | ||
27 | #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD | ||
28 | |||
29 | #undef TARGET_DEFAULT | ||
30 | -#define TARGET_DEFAULT (0) | ||
31 | +#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT) | ||
32 | |||
33 | #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6 | ||
34 | |||
35 | -#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p" | ||
36 | +#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" | ||
37 | |||
38 | #undef MULTILIB_DEFAULTS | ||
39 | #define MULTILIB_DEFAULTS \ | ||
40 | - { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" } | ||
41 | + { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" } | ||
42 | |||
43 | /* Now we define the strings used to build the spec file. */ | ||
44 | #undef LIB_SPEC | ||
45 | @@ -61,7 +75,7 @@ | ||
46 | %{rdynamic:-export-dynamic} \ | ||
47 | %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \ | ||
48 | -X \ | ||
49 | - %{mbig-endian:-EB}" \ | ||
50 | + %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ | ||
51 | SUBTARGET_EXTRA_LINK_SPEC | ||
52 | |||
53 | #undef LINK_SPEC | ||
54 | --- gcc-4.1.0/gcc/config.gcc | ||
55 | +++ gcc-4.1.0/gcc/config.gcc | ||
56 | @@ -672,6 +672,11 @@ | ||
57 | ;; | ||
58 | arm*-*-linux*) # ARM GNU/Linux with ELF | ||
59 | tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h" | ||
60 | + case $target in | ||
61 | + arm*b-*) | ||
62 | + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" | ||
63 | + ;; | ||
64 | + esac | ||
65 | tmake_file="${tmake_file} t-linux arm/t-arm" | ||
66 | case ${target} in | ||
67 | arm*-*-linux-gnueabi) | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/README b/meta/packages/gcc/gcc-4.1.1/README new file mode 100644 index 0000000000..b85840dc20 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/README | |||
@@ -0,0 +1,4 @@ | |||
1 | The numbered patches come from | ||
2 | http://www.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/gcc/4.1.1/ | ||
3 | Other patches are locally added to fix things (mostly inherited and reapplied | ||
4 | from gcc 3.4.4 where applicable) | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/arm-nolibfloat.patch b/meta/packages/gcc/gcc-4.1.1/arm-nolibfloat.patch new file mode 100644 index 0000000000..c4897c0330 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/arm-nolibfloat.patch | |||
@@ -0,0 +1,24 @@ | |||
1 | # Dimitry Andric <dimitry@andric.com>, 2004-05-01 | ||
2 | # | ||
3 | # * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed | ||
4 | # anymore. (The required functions are now in libgcc.) | ||
5 | # | ||
6 | # Fixes errors like | ||
7 | # arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat | ||
8 | # collect2: ld returned 1 exit status | ||
9 | # make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1 | ||
10 | # when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat | ||
11 | |||
12 | Index: gcc-4.0.2/gcc/config/arm/linux-elf.h | ||
13 | =================================================================== | ||
14 | --- gcc-4.0.2.orig/gcc/config/arm/linux-elf.h 2005-03-04 16:14:01.000000000 +0000 | ||
15 | +++ gcc-4.0.2/gcc/config/arm/linux-elf.h 2005-11-11 18:02:54.000000000 +0000 | ||
16 | @@ -56,7 +56,7 @@ | ||
17 | %{shared:-lc} \ | ||
18 | %{!shared:%{profile:-lc_p}%{!profile:-lc}}" | ||
19 | |||
20 | -#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc" | ||
21 | +#define LIBGCC_SPEC "-lgcc" | ||
22 | |||
23 | /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add | ||
24 | the GNU/Linux magical crtbegin.o file (see crtstuff.c) which | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/arm-softfloat.patch b/meta/packages/gcc/gcc-4.1.1/arm-softfloat.patch new file mode 100644 index 0000000000..c86c83ed15 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/arm-softfloat.patch | |||
@@ -0,0 +1,16 @@ | |||
1 | Index: gcc-4.0.2/gcc/config/arm/t-linux | ||
2 | =================================================================== | ||
3 | --- gcc-4.0.2.orig/gcc/config/arm/t-linux 2004-05-15 12:41:35.000000000 +0000 | ||
4 | +++ gcc-4.0.2/gcc/config/arm/t-linux 2005-11-11 16:07:53.000000000 +0000 | ||
5 | @@ -4,7 +4,10 @@ | ||
6 | LIBGCC2_DEBUG_CFLAGS = -g0 | ||
7 | |||
8 | LIB1ASMSRC = arm/lib1funcs.asm | ||
9 | -LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx | ||
10 | +LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ | ||
11 | + _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ | ||
12 | + _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ | ||
13 | + _fixsfsi _fixunssfsi _floatdidf _floatdisf | ||
14 | |||
15 | # MULTILIB_OPTIONS = mhard-float/msoft-float | ||
16 | # MULTILIB_DIRNAMES = hard-float soft-float | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/arm-thumb-cache.patch b/meta/packages/gcc/gcc-4.1.1/arm-thumb-cache.patch new file mode 100644 index 0000000000..fa63846c8c --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/arm-thumb-cache.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | --- gcc-4.1.1/gcc/config/arm/linux-gas.h- 2005-06-25 03:22:41.000000000 +0200 | ||
2 | +++ gcc-4.1.1/gcc/config/arm/linux-gas.h 2006-06-18 10:23:46.000000000 +0200 | ||
3 | @@ -44,6 +44,7 @@ | ||
4 | |||
5 | /* Clear the instruction cache from `beg' to `end'. This makes an | ||
6 | inline system call to SYS_cacheflush. */ | ||
7 | +#if !defined(__thumb__) | ||
8 | #define CLEAR_INSN_CACHE(BEG, END) \ | ||
9 | { \ | ||
10 | register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ | ||
11 | @@ -53,3 +54,18 @@ | ||
12 | : "=r" (_beg) \ | ||
13 | : "0" (_beg), "r" (_end), "r" (_flg)); \ | ||
14 | } | ||
15 | +#else | ||
16 | +#define CLEAR_INSN_CACHE(BEG, END) \ | ||
17 | +{ \ | ||
18 | + register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ | ||
19 | + register unsigned long _end __asm ("a2") = (unsigned long) (END); \ | ||
20 | + register unsigned long _flg __asm ("a3") = 0; \ | ||
21 | + register unsigned long _swi __asm ("a4") = 0xf0002; \ | ||
22 | + __asm __volatile ("push {r7}\n" \ | ||
23 | + " mov r7,a4\n" \ | ||
24 | + " swi 0 @ sys_cacheflush\n" \ | ||
25 | + " pop {r7}\n" \ | ||
26 | + : "=r" (_beg) \ | ||
27 | + : "0" (_beg), "r" (_end), "r" (_flg), "r" (_swi)); \ | ||
28 | +} | ||
29 | +#endif | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/arm-thumb.patch b/meta/packages/gcc/gcc-4.1.1/arm-thumb.patch new file mode 100644 index 0000000000..69e2f68cf2 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/arm-thumb.patch | |||
@@ -0,0 +1,64 @@ | |||
1 | |||
2 | # | ||
3 | # Patch managed by http://www.holgerschurig.de/patcher.html | ||
4 | # | ||
5 | |||
6 | --- gcc-4.1.1/gcc/config/arm/lib1funcs.asm~gcc | ||
7 | +++ gcc-4.1.1/gcc/config/arm/lib1funcs.asm | ||
8 | @@ -995,10 +995,24 @@ | ||
9 | .code 32 | ||
10 | FUNC_START div0 | ||
11 | |||
12 | +#if ! defined __thumb__ | ||
13 | stmfd sp!, {r1, lr} | ||
14 | mov r0, #SIGFPE | ||
15 | bl SYM(raise) __PLT__ | ||
16 | RETLDM r1 | ||
17 | +#else | ||
18 | + push {r1, lr} | ||
19 | + mov r0, #SIGFPE | ||
20 | + bl SYM(raise) __PLT__ | ||
21 | +#if __ARM_ARCH__ > 4 | ||
22 | + pop {r1, pc} | ||
23 | +#else | ||
24 | + @ on 4T that won't work | ||
25 | + pop {r1} | ||
26 | + pop {r3} | ||
27 | + bx r3 | ||
28 | +#endif | ||
29 | +#endif | ||
30 | |||
31 | FUNC_END div0 | ||
32 | |||
33 | @@ -1141,11 +1155,12 @@ | ||
34 | code here switches to the correct mode before executing the function. */ | ||
35 | |||
36 | .text | ||
37 | - .align 0 | ||
38 | + .align 1 | ||
39 | .force_thumb | ||
40 | |||
41 | .macro call_via register | ||
42 | THUMB_FUNC_START _call_via_\register | ||
43 | + .hidden SYM (_call_via_\register) | ||
44 | |||
45 | bx \register | ||
46 | nop | ||
47 | @@ -1242,6 +1257,7 @@ | ||
48 | .code 16 | ||
49 | |||
50 | THUMB_FUNC_START _interwork_call_via_\register | ||
51 | + .hidden SYM (_interwork_call_via_\register) | ||
52 | |||
53 | bx pc | ||
54 | nop | ||
55 | --- gcc-4.1.1/gcc/config/arm/t-linux~gcc | ||
56 | +++ gcc-4.1.1/gcc/config/arm/t-linux | ||
57 | @@ -7,6 +7,7 @@ | ||
58 | LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \ | ||
59 | _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \ | ||
60 | _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ | ||
61 | + _call_via_rX \ | ||
62 | _fixsfsi _fixunssfsi _floatdidf _floatdisf | ||
63 | |||
64 | # MULTILIB_OPTIONS = mhard-float/msoft-float | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/cse.patch b/meta/packages/gcc/gcc-4.1.1/cse.patch new file mode 100644 index 0000000000..88b22c714f --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/cse.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | -- gcc-4_1-branch/gcc/cse.c 2006/07/20 14:20:26 115619 | ||
2 | +++ gcc-4_1-branch/gcc/cse.c 2006/07/20 15:07:25 115620 | ||
3 | @@ -4697,6 +4697,8 @@ | ||
4 | unsigned src_const_hash; | ||
5 | /* Table entry for constant equivalent for SET_SRC, if any. */ | ||
6 | struct table_elt *src_const_elt; | ||
7 | + /* Table entry for the destination address. */ | ||
8 | + struct table_elt *dest_addr_elt; | ||
9 | }; | ||
10 | |||
11 | static void | ||
12 | @@ -5936,6 +5938,40 @@ | ||
13 | so that the destination goes into that class. */ | ||
14 | sets[i].src_elt = src_eqv_elt; | ||
15 | |||
16 | + /* Record destination addresses in the hash table. This allows us to | ||
17 | + check if they are invalidated by other sets. */ | ||
18 | + for (i = 0; i < n_sets; i++) | ||
19 | + { | ||
20 | + if (sets[i].rtl) | ||
21 | + { | ||
22 | + rtx x = sets[i].inner_dest; | ||
23 | + struct table_elt *elt; | ||
24 | + enum machine_mode mode; | ||
25 | + unsigned hash; | ||
26 | + | ||
27 | + if (MEM_P (x)) | ||
28 | + { | ||
29 | + x = XEXP (x, 0); | ||
30 | + mode = GET_MODE (x); | ||
31 | + hash = HASH (x, mode); | ||
32 | + elt = lookup (x, hash, mode); | ||
33 | + if (!elt) | ||
34 | + { | ||
35 | + if (insert_regs (x, NULL, 0)) | ||
36 | + { | ||
37 | + rehash_using_reg (x); | ||
38 | + hash = HASH (x, mode); | ||
39 | + } | ||
40 | + elt = insert (x, NULL, hash, mode); | ||
41 | + } | ||
42 | + | ||
43 | + sets[i].dest_addr_elt = elt; | ||
44 | + } | ||
45 | + else | ||
46 | + sets[i].dest_addr_elt = NULL; | ||
47 | + } | ||
48 | + } | ||
49 | + | ||
50 | invalidate_from_clobbers (x); | ||
51 | |||
52 | /* Some registers are invalidated by subroutine calls. Memory is | ||
53 | @@ -6028,12 +6064,20 @@ | ||
54 | } | ||
55 | |||
56 | /* We may have just removed some of the src_elt's from the hash table. | ||
57 | - So replace each one with the current head of the same class. */ | ||
58 | + So replace each one with the current head of the same class. | ||
59 | + Also check if destination addresses have been removed. */ | ||
60 | |||
61 | for (i = 0; i < n_sets; i++) | ||
62 | if (sets[i].rtl) | ||
63 | { | ||
64 | - if (sets[i].src_elt && sets[i].src_elt->first_same_value == 0) | ||
65 | + if (sets[i].dest_addr_elt | ||
66 | + && sets[i].dest_addr_elt->first_same_value == 0) | ||
67 | + { | ||
68 | + /* The elt was removed, which means this destination s not | ||
69 | + valid after this instruction. */ | ||
70 | + sets[i].rtl = NULL_RTX; | ||
71 | + } | ||
72 | + else if (sets[i].src_elt && sets[i].src_elt->first_same_value == 0) | ||
73 | /* If elt was removed, find current head of same class, | ||
74 | or 0 if nothing remains of that class. */ | ||
75 | { | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/gcc41-configure.in.patch b/meta/packages/gcc/gcc-4.1.1/gcc41-configure.in.patch new file mode 100644 index 0000000000..3d33bcb978 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/gcc41-configure.in.patch | |||
@@ -0,0 +1,22 @@ | |||
1 | --- gcc-3.4.4/configure.in.orig 2005-08-09 19:57:51.504323183 -0700 | ||
2 | +++ gcc-3.4.4/configure.in 2005-08-09 20:00:12.073168623 -0700 | ||
3 | @@ -1907,7 +1907,7 @@ | ||
4 | *) gxx_include_dir=${with_gxx_include_dir} ;; | ||
5 | esac | ||
6 | |||
7 | -FLAGS_FOR_TARGET= | ||
8 | +FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET" | ||
9 | case " $target_configdirs " in | ||
10 | *" newlib "*) | ||
11 | case " $target_configargs " in | ||
12 | --- gcc-3.4.4/configure.orig 2005-08-09 21:02:29.668360660 -0700 | ||
13 | +++ gcc-3.4.4/configure 2005-08-09 21:02:50.157649970 -0700 | ||
14 | @@ -2669,7 +2669,7 @@ | ||
15 | *) gxx_include_dir=${with_gxx_include_dir} ;; | ||
16 | esac | ||
17 | |||
18 | -FLAGS_FOR_TARGET= | ||
19 | +FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET" | ||
20 | case " $target_configdirs " in | ||
21 | *" newlib "*) | ||
22 | case " $target_configargs " in | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/ldflags.patch b/meta/packages/gcc/gcc-4.1.1/ldflags.patch new file mode 100644 index 0000000000..9576f60778 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/ldflags.patch | |||
@@ -0,0 +1,22 @@ | |||
1 | --- /tmp/Makefile.in 2006-02-23 20:56:01.399758728 +0100 | ||
2 | +++ gcc-4.1-20060217/Makefile.in 2006-02-23 20:56:16.874406224 +0100 | ||
3 | @@ -334,7 +334,7 @@ | ||
4 | CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) | ||
5 | LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) | ||
6 | LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates | ||
7 | -LDFLAGS_FOR_TARGET = | ||
8 | +LDFLAGS_FOR_TARGET = @LDFLAGS@ | ||
9 | PICFLAG_FOR_TARGET = | ||
10 | |||
11 | # ------------------------------------ | ||
12 | --- /tmp/Makefile.tpl 2006-02-23 20:50:34.077519272 +0100 | ||
13 | +++ gcc-4.1-20060217/Makefile.tpl 2006-02-23 21:04:31.092273688 +0100 | ||
14 | @@ -337,7 +337,7 @@ | ||
15 | CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) | ||
16 | LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) | ||
17 | LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates | ||
18 | -LDFLAGS_FOR_TARGET = | ||
19 | +LDFLAGS_FOR_TARGET = @LDFLAGS@ | ||
20 | PICFLAG_FOR_TARGET = | ||
21 | |||
22 | # ------------------------------------ | ||
diff --git a/meta/packages/gcc/gcc-4.1.1/zecke-no-host-includes.patch b/meta/packages/gcc/gcc-4.1.1/zecke-no-host-includes.patch new file mode 100644 index 0000000000..6afb10d6ef --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/zecke-no-host-includes.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | Index: gcc-4.0.2/gcc/c-incpath.c | ||
2 | =================================================================== | ||
3 | --- gcc-4.0.2.orig/gcc/c-incpath.c 2005-01-23 16:05:27.000000000 +0100 | ||
4 | +++ gcc-4.0.2/gcc/c-incpath.c 2006-05-15 21:23:02.000000000 +0200 | ||
5 | @@ -350,6 +350,26 @@ | ||
6 | p->construct = 0; | ||
7 | p->user_supplied_p = user_supplied_p; | ||
8 | |||
9 | +#ifdef CROSS_COMPILE | ||
10 | + /* A common error when cross compiling is including | ||
11 | + host headers. This code below will try to fail fast | ||
12 | + for cross compiling. Currently we consider /usr/include, | ||
13 | + /opt/include and /sw/include as harmful. */ | ||
14 | + { | ||
15 | + /* printf("Adding Path: %s\n", p->name ); */ | ||
16 | + if( strstr(p->name, "/usr/include" ) == p->name ) { | ||
17 | + fprintf(stderr, _("CROSS COMPILE Badness: /usr/include in INCLUDEPATH: %s\n"), p->name); | ||
18 | + abort(); | ||
19 | + } else if( strstr(p->name, "/sw/include") == p->name ) { | ||
20 | + fprintf(stderr, _("CROSS COMPILE Badness: /sw/include in INCLUDEPATH: %s\n"), p->name); | ||
21 | + abort(); | ||
22 | + } else if( strstr(p->name, "/opt/include") == p->name ) { | ||
23 | + fprintf(stderr, _("CROSS COMPILE Badness: /opt/include in INCLUDEPATH: %s\n"), p->name); | ||
24 | + abort(); | ||
25 | + } | ||
26 | + } | ||
27 | +#endif | ||
28 | + | ||
29 | add_cpp_dir_path (p, chain); | ||
30 | } | ||
31 | |||
diff --git a/meta/packages/gcc/gcc-4.1.1/zecke-xgcc-cpp.patch b/meta/packages/gcc/gcc-4.1.1/zecke-xgcc-cpp.patch new file mode 100644 index 0000000000..42ec190600 --- /dev/null +++ b/meta/packages/gcc/gcc-4.1.1/zecke-xgcc-cpp.patch | |||
@@ -0,0 +1,12 @@ | |||
1 | Index: gcc-4.1.1/Makefile.in | ||
2 | =================================================================== | ||
3 | --- gcc-4.1.1.orig/Makefile.in 2006-08-06 13:32:44.000000000 +0200 | ||
4 | +++ gcc-4.1.1/Makefile.in 2006-08-06 13:32:46.000000000 +0200 | ||
5 | @@ -194,6 +194,7 @@ | ||
6 | AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \ | ||
7 | CC="$(CC_FOR_TARGET)"; export CC; \ | ||
8 | CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ | ||
9 | + CPP="$(CC_FOR_TARGET) -E"; export CCP; \ | ||
10 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ | ||
11 | CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ | ||
12 | CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ | ||
diff --git a/meta/packages/gcc/gcc-cross-initial_4.1.1.bb b/meta/packages/gcc/gcc-cross-initial_4.1.1.bb new file mode 100644 index 0000000000..1e23ef9330 --- /dev/null +++ b/meta/packages/gcc/gcc-cross-initial_4.1.1.bb | |||
@@ -0,0 +1,30 @@ | |||
1 | require gcc-cross_${PV}.bb | ||
2 | |||
3 | DEPENDS = "virtual/${TARGET_PREFIX}binutils" | ||
4 | DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel']]}" | ||
5 | PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial" | ||
6 | PACKAGES = "" | ||
7 | |||
8 | # This is intended to be a -very- basic config | ||
9 | EXTRA_OECONF = "--with-local-prefix=${CROSS_DIR}/${TARGET_SYS} \ | ||
10 | --with-newlib \ | ||
11 | --disable-shared \ | ||
12 | --disable-threads \ | ||
13 | --disable-multilib \ | ||
14 | --disable-__cxa_atexit \ | ||
15 | --disable-libmudflap \ | ||
16 | --disable-libssp \ | ||
17 | --enable-languages=c \ | ||
18 | --enable-target-optspace \ | ||
19 | --program-prefix=${TARGET_PREFIX} \ | ||
20 | ${@get_gcc_fpu_setting(bb, d)}" | ||
21 | |||
22 | do_stage_prepend () { | ||
23 | mkdir -p ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV} | ||
24 | ln -sf libgcc.a ${CROSS_DIR}/lib/gcc/${TARGET_SYS}/${BINV}/libgcc_eh.a | ||
25 | } | ||
26 | |||
27 | # Override the method from gcc-cross so we don't try to install libgcc | ||
28 | do_install () { | ||
29 | oe_runmake 'DESTDIR=${D}' install | ||
30 | } | ||
diff --git a/meta/packages/gcc/gcc-cross_4.1.1.bb b/meta/packages/gcc/gcc-cross_4.1.1.bb new file mode 100644 index 0000000000..4c530175f3 --- /dev/null +++ b/meta/packages/gcc/gcc-cross_4.1.1.bb | |||
@@ -0,0 +1,18 @@ | |||
1 | require gcc_${PV}.bb | ||
2 | # path mangling, needed by the cross packaging | ||
3 | require gcc-paths-cross.inc | ||
4 | inherit cross | ||
5 | FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}" | ||
6 | # NOTE: split PR. If the main .oe changes something that affects its *build* | ||
7 | # remember to increment this one too. | ||
8 | PR = "r6" | ||
9 | |||
10 | DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc gmp-native mpfr-native" | ||
11 | PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" | ||
12 | |||
13 | # cross build | ||
14 | require gcc3-build-cross.inc | ||
15 | # cross packaging | ||
16 | require gcc-package-cross.inc | ||
17 | |||
18 | EXTRA_OECONF += "--with-mpfr=${STAGING_DIR}/${BUILD_SYS}" | ||
diff --git a/meta/packages/gcc/gcc_4.1.1.bb b/meta/packages/gcc/gcc_4.1.1.bb new file mode 100644 index 0000000000..e2d3d25ea8 --- /dev/null +++ b/meta/packages/gcc/gcc_4.1.1.bb | |||
@@ -0,0 +1,47 @@ | |||
1 | PR = "r6" | ||
2 | DESCRIPTION = "The GNU cc and gcc C compilers." | ||
3 | HOMEPAGE = "http://www.gnu.org/software/gcc/" | ||
4 | SECTION = "devel" | ||
5 | LICENSE = "GPL" | ||
6 | |||
7 | inherit autotools gettext | ||
8 | |||
9 | require gcc-package.inc | ||
10 | |||
11 | SRC_URI = "http://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.1/gcc-4.1.1.tar.bz2 \ | ||
12 | file://100-uclibc-conf.patch;patch=1 \ | ||
13 | file://110-arm-eabi.patch;patch=1 \ | ||
14 | file://200-uclibc-locale.patch;patch=1 \ | ||
15 | file://300-libstdc++-pic.patch;patch=1 \ | ||
16 | file://301-missing-execinfo_h.patch;patch=1 \ | ||
17 | file://302-c99-snprintf.patch;patch=1 \ | ||
18 | file://303-c99-complex-ugly-hack.patch;patch=1 \ | ||
19 | file://304-index_macro.patch;patch=1 \ | ||
20 | file://602-sdk-libstdc++-includes.patch;patch=1 \ | ||
21 | file://740-sh-pr24836.patch;patch=1 \ | ||
22 | file://800-arm-bigendian.patch;patch=1 \ | ||
23 | file://arm-nolibfloat.patch;patch=1 \ | ||
24 | file://arm-softfloat.patch;patch=1 \ | ||
25 | file://gcc41-configure.in.patch;patch=1 \ | ||
26 | file://arm-thumb.patch;patch=1 \ | ||
27 | file://arm-thumb-cache.patch;patch=1 \ | ||
28 | file://ldflags.patch;patch=1 \ | ||
29 | file://cse.patch;patch=1 \ | ||
30 | file://zecke-xgcc-cpp.patch;patch=1 " | ||
31 | |||
32 | SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch;patch=1 " | ||
33 | |||
34 | #Set the fortran bits | ||
35 | FORTRAN = "" | ||
36 | HAS_GFORTRAN = "no" | ||
37 | HAS_G2C = "no" | ||
38 | |||
39 | #Set the java bits | ||
40 | JAVA_arm = "" | ||
41 | |||
42 | LANGUAGES = "c,c++" | ||
43 | require gcc3-build.inc | ||
44 | |||
45 | |||
46 | EXTRA_OECONF += " --disable-libssp " | ||
47 | |||