| diff -Naur a/gcc-4.6/libstdc++-v3/include/bits/locale_facets.h b/gcc-4.6/libstdc++-v3/include/bits/locale_facets.h |
| --- a/gcc-4.6/libstdc++-v3/include/bits/locale_facets.h 2012-03-07 13:20:10.422803306 -0800 |
| +++ b/gcc-4.6/libstdc++-v3/include/bits/locale_facets.h 2012-03-09 14:12:25.004494019 -0800 |
| @@ -1157,7 +1157,20 @@ |
| |
| private: |
| void _M_narrow_init() const; |
| - void _M_widen_init() const; |
| + /* The following member function is moved from src/ctype.cc. |
| + See comment there for reason why */ |
| + void _M_widen_init() const |
| + { |
| + char __tmp[sizeof(_M_widen)]; |
| + for (size_t __i = 0; __i < sizeof(_M_widen); ++__i) |
| + __tmp[__i] = __i; |
| + do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen); |
| + |
| + _M_widen_ok = 1; |
| + // Set _M_widen_ok to 2 if memcpy can't be used. |
| + if (__builtin_memcmp(__tmp, _M_widen, sizeof(_M_widen))) |
| + _M_widen_ok = 2; |
| + } |
| }; |
| |
| #ifdef _GLIBCXX_USE_WCHAR_T |
| diff -Naur a/gcc-4.6/libstdc++-v3/src/ctype.cc b/gcc-4.6/libstdc++-v3/src/ctype.cc |
| --- a/gcc-4.6/libstdc++-v3/src/ctype.cc 2012-03-07 13:20:10.502804305 -0800 |
| +++ b/gcc-4.6/libstdc++-v3/src/ctype.cc 2012-03-09 14:08:12.900648282 -0800 |
| @@ -89,6 +89,20 @@ |
| _M_narrow_ok = 2; |
| } |
| } |
| +#if 0 |
| +/* |
| + The following member function is moved to header <bits/locale_facets.h> |
| + to avoid dependencies on more recent libstdc++. |
| + M_widen_init() was moved from <bits/locale_facets.h> to here post gcc 4.2 |
| + and annotated with version GLIBCXX_3.4.11. Running code compiled with |
| + this GCC 4.6 on Ubuntu 8.04 (where gcc 4.2 is the norm) may result in |
| + the following error message: |
| + |
| + ./a.out: /usr/lib32/libstdc++.so.6: version GLIBCXX_3.4.11' not found (required by ./a.out) |
| + |
| + This workaround is to allow binary generated by this GCC 4.6 to |
| + run on older platform. |
| +*/ |
| |
| void |
| ctype<char>:: |
| @@ -104,6 +118,7 @@ |
| if (__builtin_memcmp(__tmp, _M_widen, sizeof(_M_widen))) |
| _M_widen_ok = 2; |
| } |
| +#endif // 0 |
| |
| #ifdef _GLIBCXX_USE_WCHAR_T |
| ctype<wchar_t>::ctype(size_t __refs) |