diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4175d697798..b3ef9c0b46a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2008-09-10 Paolo Carlini + + PR libstdc++/37455 + * include/bits/locale_facets.h (ctype::_M_narrow_init, + ctype::_M_widen_init): Don't define inline. + * config/locale/darwin/ctype_members.cc: ... define here. + * config/locale/gnu/ctype_members.cc: ... likewise. + * config/locale/generic/ctype_members.cc: ... likewise. + * config/abi/pre/gnu.ver: Export. + 2008-09-09 Benjamin Kosnik * doc/xml/manual/abi.xml: Update for new releases. diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 260340174ea..a3529baac9b 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -950,6 +950,10 @@ GLIBCXX_3.4.11 { _ZNSbIwSt11char_traitsIwESaIwEEaSESt16initializer_listIwE; _ZNSbIwSt11char_traitsIwESaIwEEpLESt16initializer_listIwE; + # ctype::_M_narrow_init and _M_widen_init + _ZNKSt5ctypeIcE14_M_narrow_initEv; + _ZNKSt5ctypeIcE13_M_widen_initEv; + } GLIBCXX_3.4.10; # Symbols in the support library (libsupc++) have their own tag. diff --git a/libstdc++-v3/config/locale/darwin/ctype_members.cc b/libstdc++-v3/config/locale/darwin/ctype_members.cc index 63a422c396a..f839971469a 100644 --- a/libstdc++-v3/config/locale/darwin/ctype_members.cc +++ b/libstdc++-v3/config/locale/darwin/ctype_members.cc @@ -42,6 +42,47 @@ namespace std { + // Fill in the narrowing cache and flag whether all values are + // valid or not. _M_narrow_ok is set to 2 if memcpy can't + // be used. + void + ctype:: + _M_narrow_init() const + { + char __tmp[sizeof(_M_narrow)]; + for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i) + __tmp[__i] = __i; + do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow); + + _M_narrow_ok = 1; + if (__builtin_memcmp(__tmp, _M_narrow, sizeof(_M_narrow))) + _M_narrow_ok = 2; + else + { + // Deal with the special case of zero: renarrow with a + // different default and compare. + char __c; + do_narrow(__tmp, __tmp + 1, 1, &__c); + if (__c == 1) + _M_narrow_ok = 2; + } + } + + void + ctype:: + _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; + } + // NB: The other ctype specializations are in src/locale.cc and // various /config/os/* files. diff --git a/libstdc++-v3/config/locale/generic/ctype_members.cc b/libstdc++-v3/config/locale/generic/ctype_members.cc index 6b4fbd7ea7d..036f685d0e7 100644 --- a/libstdc++-v3/config/locale/generic/ctype_members.cc +++ b/libstdc++-v3/config/locale/generic/ctype_members.cc @@ -41,6 +41,47 @@ _GLIBCXX_BEGIN_NAMESPACE(std) + // Fill in the narrowing cache and flag whether all values are + // valid or not. _M_narrow_ok is set to 2 if memcpy can't + // be used. + void + ctype:: + _M_narrow_init() const + { + char __tmp[sizeof(_M_narrow)]; + for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i) + __tmp[__i] = __i; + do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow); + + _M_narrow_ok = 1; + if (__builtin_memcmp(__tmp, _M_narrow, sizeof(_M_narrow))) + _M_narrow_ok = 2; + else + { + // Deal with the special case of zero: renarrow with a + // different default and compare. + char __c; + do_narrow(__tmp, __tmp + 1, 1, &__c); + if (__c == 1) + _M_narrow_ok = 2; + } + } + + void + ctype:: + _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; + } + // NB: The other ctype specializations are in src/locale.cc and // various /config/os/* files. ctype_byname::ctype_byname(const char* __s, size_t __refs) diff --git a/libstdc++-v3/config/locale/gnu/ctype_members.cc b/libstdc++-v3/config/locale/gnu/ctype_members.cc index 9e517605914..f1243397698 100644 --- a/libstdc++-v3/config/locale/gnu/ctype_members.cc +++ b/libstdc++-v3/config/locale/gnu/ctype_members.cc @@ -40,6 +40,47 @@ _GLIBCXX_BEGIN_NAMESPACE(std) + // Fill in the narrowing cache and flag whether all values are + // valid or not. _M_narrow_ok is set to 2 if memcpy can't + // be used. + void + ctype:: + _M_narrow_init() const + { + char __tmp[sizeof(_M_narrow)]; + for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i) + __tmp[__i] = __i; + do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow); + + _M_narrow_ok = 1; + if (__builtin_memcmp(__tmp, _M_narrow, sizeof(_M_narrow))) + _M_narrow_ok = 2; + else + { + // Deal with the special case of zero: renarrow with a + // different default and compare. + char __c; + do_narrow(__tmp, __tmp + 1, 1, &__c); + if (__c == 1) + _M_narrow_ok = 2; + } + } + + void + ctype:: + _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; + } + // NB: The other ctype specializations are in src/locale.cc and // various /config/os/* files. ctype_byname::ctype_byname(const char* __s, size_t __refs) diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index cb9c021f353..340d21d7e04 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -1,7 +1,7 @@ // Locale support -*- C++ -*- // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2006, 2007 +// 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -1161,43 +1161,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } private: - - 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; - } - - // Fill in the narrowing cache and flag whether all values are - // valid or not. _M_narrow_ok is set to 2 if memcpy can't - // be used. - void _M_narrow_init() const - { - char __tmp[sizeof(_M_narrow)]; - for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i) - __tmp[__i] = __i; - do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow); - - _M_narrow_ok = 1; - if (__builtin_memcmp(__tmp, _M_narrow, sizeof(_M_narrow))) - _M_narrow_ok = 2; - else - { - // Deal with the special case of zero: renarrow with a - // different default and compare. - char __c; - do_narrow(__tmp, __tmp + 1, 1, &__c); - if (__c == 1) - _M_narrow_ok = 2; - } - } + void _M_narrow_init() const; + void _M_widen_init() const; }; template<>