diff options
21 files changed, 200 insertions, 84 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d1d7992d94f..d2f7cf32605 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,4 +1,39 @@ 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> + Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> + + * include/bits/stl_iterator.h (reverse_iterator::_M_current): + Deuglify, should be current. + (back_insert_iterator::_M_container): Deuglify, should be container. + (front_insert_iterator::_M_container): Same. + (insert_iterator::_M_container): Same. + * testsuite/24_iterators/reverse_iterator.cc: Add check. + * testsuite/24_iterators/back_insert_iterator.cc: Add check. + * testsuite/24_iterators/front_insert_iterator.cc: Same. + * testsuite/24_iterators/insert_iterator.cc: Same. + +2002-01-16 Benjamin Kosnik <bkoz@redhat.com> + + * include/bits/locale_facets.h (ctype<char>::classic_table): Make + static. + (ctype<char>::_M_ctable): Make static, change name to _S_ctable. + * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. + * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. + * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. + * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. + * config/os/newlib/bits/ctype_noninline.h: Same. + * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. + * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. + * config/os/hpux/bits/ctype_noninline.h: Same. + * config/os/djgpp/bits/ctype_noninline.h: Same. + * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. + * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. + * config/os/aix/bits/ctype_noninline.h: Same. + + Testcase by Dietmar Kühl via Peter Schmid + * testsuite/22_locale/ctype_members_char.cc (char>): Add test for + classic_table(). + +2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * libmath/signbitl.c: Copyright years as list, not range. * libmath/Makefile.am: Same. diff --git a/libstdc++-v3/config/os/aix/bits/ctype_noninline.h b/libstdc++-v3/config/os/aix/bits/ctype_noninline.h index 2e13e3f5988..dabcae981bf 100644 --- a/libstdc++-v3/config/os/aix/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/aix/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -32,18 +32,19 @@ // // Information as gleaned from /usr/include/ctype.h + + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) { } char diff --git a/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h b/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h index 3aee4dabe3f..db58ecb27c4 100644 --- a/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,17 +33,18 @@ // Information as gleaned from /usr/include/ctype.h + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) { } char diff --git a/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h b/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h index dcadbbed26b..f27d93dbdc7 100644 --- a/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,17 +33,19 @@ // Information as gleaned from /usr/include/ctype.h + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL), _M_table(__table == 0 ? (_ctype_ + 1) : __table) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _ctype_ + 1) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL), _M_table(__table == 0 ? (_ctype_ + 1) : __table) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _ctype_ + 1) { } char diff --git a/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h b/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h index 2b075733a96..fd68e814231 100644 --- a/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,18 +33,21 @@ // Information as gleaned from DJGPP <ctype.h> + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; + ctype<char>::ctype(__c_locale, const mask* __table = 0, bool __del = false, size_t __refs = 0) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower), - _M_ctable(NULL), _M_table(__table == 0 ? __dj_ctype_flags : __table) + _M_table(__table ? __table : __dj_ctype_flags) { } ctype<char>::ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower), - _M_ctable(NULL), _M_table(__table == 0 ? __dj_ctype_flags : __table) + _M_table(__table ? __table : __dj_ctype_flags) { } char diff --git a/libstdc++-v3/config/os/generic/bits/ctype_noninline.h b/libstdc++-v3/config/os/generic/bits/ctype_noninline.h index 90f9d75d93b..36846d74a08 100644 --- a/libstdc++-v3/config/os/generic/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/generic/bits/ctype_noninline.h @@ -1,6 +1,7 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -32,18 +33,21 @@ // // Information as gleaned from /usr/include/ctype.h + + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), - _M_table(__table == 0 ? _M_ctable : __table) + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table == 0 ? _S_ctable : __table) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), - _M_table(__table == 0 ? _M_ctable : __table) + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table == 0 ? _S_ctable : __table) { } char diff --git a/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h b/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h index 91562dd0c4d..1f2bdcf9e65 100644 --- a/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h @@ -1,6 +1,7 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -39,11 +40,13 @@ using _C_legacy::__ctype_b; #endif + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable = __ctype_b; + #if _GLIBCPP_C_LOCALE_GNU ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del, size_t __refs) - : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_ctable(__ctype_b) + : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del) { _M_c_locale_ctype = _S_clone_c_locale(__cloc); _M_toupper = _M_c_locale_ctype->__ctype_toupper; @@ -55,14 +58,14 @@ size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), - _M_ctable(__ctype_b), _M_table(__table ? __table : __ctype_b) + _M_table(__table ? __table : _S_ctable) { _M_c_locale_ctype = NULL; } #endif ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), - _M_ctable(__ctype_b), _M_table(__table == 0 ? _M_ctable : __table) + _M_table(__table ? __table : _S_ctable) { _M_c_locale_ctype = NULL; } char diff --git a/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h b/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h index 5e91e512042..fae41de2ca0 100644 --- a/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h @@ -33,18 +33,21 @@ // // Information as gleaned from /usr/include/ctype.h + + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), - _M_table(__table == 0 ? (const mask *) __SB_masks : __table) + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : (const mask *) __SB_masks) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), - _M_table(__table == 0 ? (const mask *) __SB_masks : __table) + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : (const mask *) __SB_masks) { } char diff --git a/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h index dbf13ee60d5..10fef4e5bca 100644 --- a/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h @@ -1,6 +1,7 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997-1999, 2001 Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2001, 2002 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,16 +34,19 @@ // Information as gleaned from /usr/include/ctype.h + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), + _M_toupper(NULL), _M_tolower(NULL), _M_table(!__table ? __ctype : __table) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), + _M_toupper(NULL), _M_tolower(NULL), _M_table(!__table ? __ctype : __table) { } diff --git a/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h b/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h index a2f5e10ec44..f53f601fcb8 100644 --- a/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997-1999, 2001 Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,17 +33,21 @@ // Information as gleaned from /usr/include/ctype.h + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; + + ctype<char>::ctype(const mask* __tab ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), + _M_toupper(NULL), _M_tolower(NULL), _M_table(!__table ? (const mask*) (__libc_attr._ctype_tbl->_class + 1) : __table) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), + _M_toupper(NULL), _M_tolower(NULL), _M_table(!__table ? (const mask*) (__libc_attr._ctype_tbl->_class + 1) : __table) { } diff --git a/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h b/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h index ed2867f8f92..89a486bcd5a 100644 --- a/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,17 +33,20 @@ // Information as gleaned from /usr/include/ctype.h + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(_ctype_), - _M_table(__table == 0 ? _M_ctable : __table) + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : _S_ctable) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(_ctype_), - _M_table(__table == 0 ? _M_ctable : __table) + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : _S_ctable) { } char diff --git a/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h b/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h index a7ec22329cb..a37df89eebb 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -32,18 +32,21 @@ // // Information as gleaned from /usr/include/ctype.h + + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(__ctype), - _M_table(__table == 0 ? _M_ctable: __table) + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : _S_ctable) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_ctable(__ctype), - _M_table(__table == 0 ? _M_ctable: __table) + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : _S_ctable) { } char diff --git a/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h b/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h index 7f702a49642..ab873389c8b 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997-2001 Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,17 +33,20 @@ // Information as gleaned from /usr/include/ctype.h + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable; + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_ctable(__ctype_mask), _M_table(__table == 0 ? _M_ctable: __table) + _M_ctable(__ctype_mask), _M_table(__table ? __table : _M_ctable) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_ctable(__ctype_mask), _M_table(__table == 0 ? _M_ctable: __table) + _M_ctable(__ctype_mask), _M_table(__table ? __table : _M_ctable) { } char diff --git a/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h b/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h index 73951815bde..c668ae2a3dd 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h @@ -1,6 +1,7 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997-2001 Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,17 +34,20 @@ // Information as gleaned from /usr/include/ctype.h + // Data for classic_table(). + const ctype_base::mask* ctype<char>::_S_ctable = __ctype_mask; + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_ctable(__ctype_mask), _M_table(__table == 0 ? _M_ctable: __table) + _M_table(__table ? __table : _S_ctable) { } ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_ctable(__ctype_mask), _M_table(__table == 0 ? _M_ctable: __table) + _M_table(__table == 0 ? __table : _S_ctable) { } char diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index 7fad2e0e8fa..8108bf0c6fc 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -233,12 +233,12 @@ namespace std bool _M_del; __to_type _M_toupper; __to_type _M_tolower; - const mask* _M_ctable; const mask* _M_table; public: static locale::id id; static const size_t table_size = 1 + static_cast<unsigned char>(-1); + static const mask* _S_ctable; explicit ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0); @@ -264,9 +264,9 @@ namespace std table() const throw() { return _M_table; } - const mask* + static const mask* classic_table() throw() - { return _M_ctable; } + { return _S_ctable; } virtual ~ctype(); diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 5cfb5791e9a..7acf4f41d14 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -1,6 +1,6 @@ // Iterators -*- C++ -*- -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -73,7 +73,7 @@ namespace std typename iterator_traits<_Iterator>::reference> { protected: - _Iterator _M_current; + _Iterator current; public: typedef _Iterator iterator_type; @@ -86,22 +86,22 @@ namespace std reverse_iterator() { } explicit - reverse_iterator(iterator_type __x) : _M_current(__x) { } + reverse_iterator(iterator_type __x) : current(__x) { } reverse_iterator(const reverse_iterator& __x) - : _M_current(__x._M_current) { } + : current(__x.current) { } template<typename _Iter> reverse_iterator(const reverse_iterator<_Iter>& __x) - : _M_current(__x.base()) { } + : current(__x.base()) { } iterator_type - base() const { return _M_current; } + base() const { return current; } reference operator*() const { - _Iterator __tmp = _M_current; + _Iterator __tmp = current; return *--__tmp; } @@ -111,7 +111,7 @@ namespace std reverse_iterator& operator++() { - --_M_current; + --current; return *this; } @@ -119,43 +119,43 @@ namespace std operator++(int) { reverse_iterator __tmp = *this; - --_M_current; + --current; return __tmp; } reverse_iterator& operator--() { - ++_M_current; + ++current; return *this; } reverse_iterator operator--(int) { reverse_iterator __tmp = *this; - ++_M_current; + ++current; return __tmp; } reverse_iterator operator+(difference_type __n) const - { return reverse_iterator(_M_current - __n); } + { return reverse_iterator(current - __n); } reverse_iterator& operator+=(difference_type __n) { - _M_current -= __n; + current -= __n; return *this; } reverse_iterator operator-(difference_type __n) const - { return reverse_iterator(_M_current + __n); } + { return reverse_iterator(current + __n); } reverse_iterator& operator-=(difference_type __n) { - _M_current += __n; + current += __n; return *this; } @@ -217,18 +217,18 @@ namespace std : public iterator<output_iterator_tag, void, void, void, void> { protected: - _Container* _M_container; + _Container* container; public: typedef _Container container_type; explicit - back_insert_iterator(_Container& __x) : _M_container(&__x) { } + back_insert_iterator(_Container& __x) : container(&__x) { } back_insert_iterator& operator=(typename _Container::const_reference __value) { - _M_container->push_back(__value); + container->push_back(__value); return *this; } @@ -252,17 +252,17 @@ namespace std : public iterator<output_iterator_tag, void, void, void, void> { protected: - _Container* _M_container; + _Container* container; public: typedef _Container container_type; - explicit front_insert_iterator(_Container& __x) : _M_container(&__x) { } + explicit front_insert_iterator(_Container& __x) : container(&__x) { } front_insert_iterator& operator=(typename _Container::const_reference __value) { - _M_container->push_front(__value); + container->push_front(__value); return *this; } @@ -286,19 +286,19 @@ namespace std : public iterator<output_iterator_tag, void, void, void, void> { protected: - _Container* _M_container; + _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; insert_iterator(_Container& __x, typename _Container::iterator __i) - : _M_container(&__x), iter(__i) {} + : container(&__x), iter(__i) {} insert_iterator& operator=(const typename _Container::const_reference __value) { - iter = _M_container->insert(iter, __value); + iter = container->insert(iter, __value); ++iter; return *this; } diff --git a/libstdc++-v3/testsuite/22_locale/ctype_members_char.cc b/libstdc++-v3/testsuite/22_locale/ctype_members_char.cc index 46f1256e8ef..2ce966851b9 100644 --- a/libstdc++-v3/testsuite/22_locale/ctype_members_char.cc +++ b/libstdc++-v3/testsuite/22_locale/ctype_members_char.cc @@ -234,9 +234,19 @@ void test02() VERIFY( v_c != v_de ); } +// Dietmar Kühl via Peter Schmid +class comma_ctype: public std::ctype<char> +{ +public: + comma_ctype(): std::ctype<char>() { } + static void get_table() + { classic_table(); } +}; + int main() { test01(); test02(); + return 0; } diff --git a/libstdc++-v3/testsuite/24_iterators/back_insert_iterator.cc b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator.cc index 60e7c231911..63f64ea08e8 100644 --- a/libstdc++-v3/testsuite/24_iterators/back_insert_iterator.cc +++ b/libstdc++-v3/testsuite/24_iterators/back_insert_iterator.cc @@ -1,6 +1,6 @@ // 2001-06-21 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -54,6 +54,15 @@ void test02() iterator_type it = std::back_inserter(li); } +// Check data member 'container' accessible. +class test_dm : public std::back_insert_iterator<std::list<int> > +{ + container_type l; + container_type* p; +public: + test_dm(): std::back_insert_iterator<std::list<int> >(l), p(container) { } +}; + int main() { test01(); diff --git a/libstdc++-v3/testsuite/24_iterators/front_insert_iterator.cc b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator.cc index 4be3346a5ed..cf446f63ddb 100644 --- a/libstdc++-v3/testsuite/24_iterators/front_insert_iterator.cc +++ b/libstdc++-v3/testsuite/24_iterators/front_insert_iterator.cc @@ -53,6 +53,15 @@ void test02() iterator_type it = std::front_inserter(li); } +// Check data member 'container' accessible. +class test_dm : public std::front_insert_iterator<std::list<int> > +{ + container_type l; + container_type* p; +public: + test_dm(): std::front_insert_iterator<std::list<int> >(l), p(container) { } +}; + int main() { test01(); diff --git a/libstdc++-v3/testsuite/24_iterators/insert_iterator.cc b/libstdc++-v3/testsuite/24_iterators/insert_iterator.cc index d3dcd8816a9..fda88332777 100644 --- a/libstdc++-v3/testsuite/24_iterators/insert_iterator.cc +++ b/libstdc++-v3/testsuite/24_iterators/insert_iterator.cc @@ -60,6 +60,16 @@ void test02() iterator_type it02 = std::inserter(li, liit); } +// Check data member 'container' accessible. +class test_dm : public std::insert_iterator<std::list<int> > +{ + container_type l; + container_type::iterator i; + container_type* p; +public: + test_dm(): std::insert_iterator<std::list<int> >(l, i), p(container) { } +}; + int main() { test01(); diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator.cc index d20a44f8691..f828a02218d 100644 --- a/libstdc++-v3/testsuite/24_iterators/reverse_iterator.cc +++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator.cc @@ -1,6 +1,6 @@ // 2001-06-21 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -67,6 +67,13 @@ void test02() 5 + it02; } +// Check data member 'current' accessible. +class test_dm : public std::reverse_iterator<int*> +{ + int* p; +public: + test_dm(): p(current) { } +}; int main() { @@ -74,5 +81,3 @@ int main() test02(); return 0; } - - |