Commit 95b147fe by Simon Marshall Committed by Benjamin Kosnik

re PR libstdc++/15090 (-fno-for-scope vs. libstdc++)


2004-05-13  Simon Marshall <simon.marshall@misys.com>
	    Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/15090
	* include/bits/locale_facets.h: Fix for -fno-for-scope.
	* include/debug/safe_sequence.h: Same.
	* include/debug/safe_iterator.tcc: Same.
	* src/debug.cc: Same.
	* src/locale.cc: Same.
	* src/locale_init.cc: Same.
	* src/localename.cc: Same.
	* config/locale/gnu/ctype_members.cc: Same.
	* config/locale/gnu/numeric_members.cc: Same.
	* testsuite/testsuite_abi.cc: Same.
	* testsuite/testsuite_hooks.cc: Same.

Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>

From-SVN: r81795
parent d7f30833
2004-05-13 Simon Marshall <simon.marshall@misys.com>
Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/15090
* include/bits/locale_facets.h: Fix for -fno-for-scope.
* include/debug/safe_sequence.h: Same.
* include/debug/safe_iterator.tcc: Same.
* src/debug.cc: Same.
* src/locale.cc: Same.
* src/locale_init.cc: Same.
* src/localename.cc: Same.
* config/locale/gnu/ctype_members.cc: Same.
* config/locale/gnu/numeric_members.cc: Same.
* testsuite/testsuite_abi.cc: Same.
* testsuite/testsuite_hooks.cc: Same.
2004-05-13 Jonathan Wakely <redi@gcc.gnu.org> 2004-05-13 Jonathan Wakely <redi@gcc.gnu.org>
* docs/html/abi.html: Document effect of -fabi-version on value * docs/html/abi.html: Document effect of -fabi-version on value
......
...@@ -272,14 +272,14 @@ namespace std ...@@ -272,14 +272,14 @@ namespace std
_M_narrow_ok = true; _M_narrow_ok = true;
else else
_M_narrow_ok = false; _M_narrow_ok = false;
for (size_t __i = 0; for (size_t __j = 0;
__i < sizeof(_M_widen) / sizeof(wint_t); ++__i) __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
_M_widen[__i] = btowc(__i); _M_widen[__j] = btowc(__j);
for (size_t __i = 0; __i <= 11; ++__i) for (size_t __k = 0; __k <= 11; ++__k)
{ {
_M_bit[__i] = static_cast<mask>(_ISbit(__i)); _M_bit[__k] = static_cast<mask>(_ISbit(__k));
_M_wmask[__i] = _M_convert_to_wmask(_M_bit[__i]); _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
} }
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old); __uselocale(__old);
......
...@@ -58,14 +58,16 @@ namespace std ...@@ -58,14 +58,16 @@ namespace std
for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
_M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
for (size_t __i = 0; __i < __num_base::_S_iend; ++__i) for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
_M_data->_M_atoms_in[__i] = __num_base::_S_atoms_in[__i]; _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
} }
else else
{ {
// Named locale. // Named locale.
_M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, __cloc)); _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
_M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, __cloc)); __cloc));
_M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
__cloc));
// Check for NULL, which implies no grouping. // Check for NULL, which implies no grouping.
if (_M_data->_M_thousands_sep == '\0') if (_M_data->_M_thousands_sep == '\0')
...@@ -111,9 +113,9 @@ namespace std ...@@ -111,9 +113,9 @@ namespace std
_M_data->_M_atoms_out[__i] = _M_data->_M_atoms_out[__i] =
static_cast<wchar_t>(__num_base::_S_atoms_out[__i]); static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
for (size_t __i = 0; __i < __num_base::_S_iend; ++__i) for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
_M_data->_M_atoms_in[__i] = _M_data->_M_atoms_in[__j] =
static_cast<wchar_t>(__num_base::_S_atoms_in[__i]); static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
} }
else else
{ {
......
...@@ -1161,8 +1161,8 @@ namespace std ...@@ -1161,8 +1161,8 @@ namespace std
_M_widen_ok = 1; _M_widen_ok = 1;
// Set _M_widen_ok to 2 if memcpy can't be used. // Set _M_widen_ok to 2 if memcpy can't be used.
for (size_t __i = 0; __i < sizeof(_M_widen); ++__i) for (size_t __j = 0; __j < sizeof(_M_widen); ++__j)
if (__tmp[__i] != _M_widen[__i]) if (__tmp[__j] != _M_widen[__j])
{ {
_M_widen_ok = 2; _M_widen_ok = 2;
break; break;
...@@ -1182,11 +1182,11 @@ namespace std ...@@ -1182,11 +1182,11 @@ namespace std
// Check if any default values were created. Do this by // Check if any default values were created. Do this by
// renarrowing with a different default value and comparing. // renarrowing with a different default value and comparing.
bool __consecutive = true; bool __consecutive = true;
for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i) for (size_t __j = 0; __j < sizeof(_M_narrow); ++__j)
if (!_M_narrow[__i]) if (!_M_narrow[__j])
{ {
char __c; char __c;
do_narrow(__tmp + __i, __tmp + __i + 1, 1, &__c); do_narrow(__tmp + __j, __tmp + __j + 1, 1, &__c);
if (__c == 1) if (__c == 1)
{ {
__consecutive = false; __consecutive = false;
......
// Debugging iterator implementation (out of line) -*- C++ -*- // Debugging iterator implementation (out of line) -*- C++ -*-
// Copyright (C) 2003 // Copyright (C) 2003, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -123,11 +123,11 @@ namespace __gnu_debug ...@@ -123,11 +123,11 @@ namespace __gnu_debug
if (this->base() == __victim->base()) if (this->base() == __victim->base())
__victim->_M_version = 0; __victim->_M_version = 0;
} }
for (_Safe_iterator_base* iter = _M_sequence->_M_const_iterators; for (_Safe_iterator_base* iter2 = _M_sequence->_M_const_iterators;
iter; /* increment in loop */) iter2; /* increment in loop */)
{ {
const_iterator* __victim = static_cast<const_iterator*>(iter); const_iterator* __victim = static_cast<const_iterator*>(iter2);
iter = iter->_M_next; iter2 = iter2->_M_next;
if (this->base() == __victim->base()) if (this->base() == __victim->base())
__victim->_M_version = 0; __victim->_M_version = 0;
} }
......
// Safe sequence implementation -*- C++ -*- // Safe sequence implementation -*- C++ -*-
// Copyright (C) 2003 // Copyright (C) 2003, 2004
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -133,10 +133,10 @@ namespace __gnu_debug ...@@ -133,10 +133,10 @@ namespace __gnu_debug
} }
} }
for (_Safe_iterator_base* __iter = _M_const_iterators; __iter; ) for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2; )
{ {
const_iterator* __victim = static_cast<const_iterator*>(__iter); const_iterator* __victim = static_cast<const_iterator*>(__iter2);
__iter = __iter->_M_next; __iter2 = __iter2->_M_next;
if (!__victim->_M_singular()) if (!__victim->_M_singular())
{ {
if (__pred(__victim->base())) if (__pred(__victim->base()))
...@@ -166,10 +166,11 @@ namespace __gnu_debug ...@@ -166,10 +166,11 @@ namespace __gnu_debug
__victim->_M_attach(static_cast<_Sequence*>(this)); __victim->_M_attach(static_cast<_Sequence*>(this));
} }
for (_Safe_iterator_base* __iter = __from->_M_const_iterators; __iter;) for (_Safe_iterator_base* __iter2 = __from->_M_const_iterators;
__iter2;)
{ {
const_iterator* __victim = static_cast<const_iterator*>(__iter); const_iterator* __victim = static_cast<const_iterator*>(__iter2);
__iter = __iter->_M_next; __iter2 = __iter2->_M_next;
if (!__victim->_M_singular() && __victim->base() == __x.base()) if (!__victim->_M_singular() && __victim->base() == __x.base())
__victim->_M_attach(static_cast<_Sequence*>(this)); __victim->_M_attach(static_cast<_Sequence*>(this));
} }
......
...@@ -114,10 +114,10 @@ namespace __gnu_debug ...@@ -114,10 +114,10 @@ namespace __gnu_debug
__old->_M_attach(0, false); __old->_M_attach(0, false);
} }
for (_Safe_iterator_base* __iter = _M_const_iterators; __iter; ) for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2; )
{ {
_Safe_iterator_base* __old = __iter; _Safe_iterator_base* __old = __iter2;
__iter = __iter->_M_next; __iter2 = __iter2->_M_next;
__old->_M_attach(0, true); __old->_M_attach(0, true);
} }
} }
...@@ -134,10 +134,10 @@ namespace __gnu_debug ...@@ -134,10 +134,10 @@ namespace __gnu_debug
__old->_M_attach(0, false); __old->_M_attach(0, false);
} }
for (_Safe_iterator_base* __iter = _M_const_iterators; __iter; ) for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2; )
{ {
_Safe_iterator_base* __old = __iter; _Safe_iterator_base* __old = __iter2;
__iter = __iter->_M_next; __iter2 = __iter2->_M_next;
if (__old->_M_singular()) if (__old->_M_singular())
__old->_M_attach(0, true); __old->_M_attach(0, true);
} }
......
...@@ -241,23 +241,23 @@ namespace std ...@@ -241,23 +241,23 @@ namespace std
_M_facets[__i]->_M_add_reference(); _M_facets[__i]->_M_add_reference();
} }
_M_caches = new const facet*[_M_facets_size]; _M_caches = new const facet*[_M_facets_size];
for (size_t __i = 0; __i < _M_facets_size; ++__i) for (size_t __j = 0; __j < _M_facets_size; ++__j)
{ {
_M_caches[__i] = __imp._M_caches[__i]; _M_caches[__j] = __imp._M_caches[__j];
if (_M_caches[__i]) if (_M_caches[__j])
_M_caches[__i]->_M_add_reference(); _M_caches[__j]->_M_add_reference();
} }
_M_names = new char*[_S_categories_size]; _M_names = new char*[_S_categories_size];
for (size_t __i = 0; __i < _S_categories_size; ++__i) for (size_t __k = 0; __k < _S_categories_size; ++__k)
_M_names[__i] = 0; _M_names[__k] = 0;
// Name the categories. // Name the categories.
for (size_t __i = 0; (__i < _S_categories_size for (size_t __l = 0; (__l < _S_categories_size
&& __imp._M_names[__i]); ++__i) && __imp._M_names[__l]); ++__l)
{ {
const size_t __len = std::strlen(__imp._M_names[__i]) + 1; const size_t __len = std::strlen(__imp._M_names[__l]) + 1;
_M_names[__i] = new char[__len]; _M_names[__l] = new char[__len];
std::memcpy(_M_names[__i], __imp._M_names[__i], __len); std::memcpy(_M_names[__l], __imp._M_names[__l], __len);
} }
} }
catch(...) catch(...)
...@@ -269,7 +269,8 @@ namespace std ...@@ -269,7 +269,8 @@ namespace std
void void
locale::_Impl:: locale::_Impl::
_M_replace_category(const _Impl* __imp, const locale::id* const* __idpp) _M_replace_category(const _Impl* __imp,
const locale::id* const* __idpp)
{ {
for (; *__idpp; ++__idpp) for (; *__idpp; ++__idpp)
_M_replace_facet(__imp, *__idpp); _M_replace_facet(__imp, *__idpp);
...@@ -280,7 +281,8 @@ namespace std ...@@ -280,7 +281,8 @@ namespace std
_M_replace_facet(const _Impl* __imp, const locale::id* __idp) _M_replace_facet(const _Impl* __imp, const locale::id* __idp)
{ {
size_t __index = __idp->_M_id(); size_t __index = __idp->_M_id();
if ((__index > (__imp->_M_facets_size - 1)) || !__imp->_M_facets[__index]) if ((__index > (__imp->_M_facets_size - 1))
|| !__imp->_M_facets[__index])
__throw_runtime_error(__N("locale::_Impl::_M_replace_facet")); __throw_runtime_error(__N("locale::_Impl::_M_replace_facet"));
_M_install_facet(__idp, __imp->_M_facets[__index]); _M_install_facet(__idp, __imp->_M_facets[__index]);
} }
...@@ -304,8 +306,8 @@ namespace std ...@@ -304,8 +306,8 @@ namespace std
__newf = new const facet*[__new_size]; __newf = new const facet*[__new_size];
for (size_t __i = 0; __i < _M_facets_size; ++__i) for (size_t __i = 0; __i < _M_facets_size; ++__i)
__newf[__i] = _M_facets[__i]; __newf[__i] = _M_facets[__i];
for (size_t __i2 = _M_facets_size; __i2 < __new_size; ++__i2) for (size_t __l = _M_facets_size; __l < __new_size; ++__l)
__newf[__i2] = 0; __newf[__l] = 0;
// New cache array. // New cache array.
const facet** __oldc = _M_caches; const facet** __oldc = _M_caches;
...@@ -319,10 +321,10 @@ namespace std ...@@ -319,10 +321,10 @@ namespace std
delete [] __newf; delete [] __newf;
__throw_exception_again; __throw_exception_again;
} }
for (size_t __i = 0; __i < _M_facets_size; ++__i) for (size_t __j = 0; __j < _M_facets_size; ++__j)
__newc[__i] = _M_caches[__i]; __newc[__j] = _M_caches[__j];
for (size_t __i2 = _M_facets_size; __i2 < __new_size; ++__i2) for (size_t __k = _M_facets_size; __k < __new_size; ++__k)
__newc[__i2] = 0; __newc[__k] = 0;
_M_facets_size = __new_size; _M_facets_size = __new_size;
_M_facets = __newf; _M_facets = __newf;
......
...@@ -260,8 +260,8 @@ namespace std ...@@ -260,8 +260,8 @@ namespace std
_M_names = new (&name_vec) char*[_S_categories_size]; _M_names = new (&name_vec) char*[_S_categories_size];
_M_names[0] = new (&name_c[0]) char[2]; _M_names[0] = new (&name_c[0]) char[2];
std::memcpy(_M_names[0], locale::facet::_S_get_c_name(), 2); std::memcpy(_M_names[0], locale::facet::_S_get_c_name(), 2);
for (size_t __i = 1; __i < _S_categories_size; ++__i) for (size_t __j = 1; __j < _S_categories_size; ++__j)
_M_names[__i] = 0; _M_names[__j] = 0;
// This is needed as presently the C++ version of "C" locales // This is needed as presently the C++ version of "C" locales
// != data in the underlying locale model for __timepunct, // != data in the underlying locale model for __timepunct,
......
...@@ -193,11 +193,11 @@ namespace std ...@@ -193,11 +193,11 @@ namespace std
for (size_t __i = 0; __i < _M_facets_size; ++__i) for (size_t __i = 0; __i < _M_facets_size; ++__i)
_M_facets[__i] = 0; _M_facets[__i] = 0;
_M_caches = new const facet*[_M_facets_size]; _M_caches = new const facet*[_M_facets_size];
for (size_t __i = 0; __i < _M_facets_size; ++__i) for (size_t __j = 0; __j < _M_facets_size; ++__j)
_M_caches[__i] = 0; _M_caches[__j] = 0;
_M_names = new char*[_S_categories_size]; _M_names = new char*[_S_categories_size];
for (size_t __i = 0; __i < _S_categories_size; ++__i) for (size_t __k = 0; __k < _S_categories_size; ++__k)
_M_names[__i] = 0; _M_names[__k] = 0;
// Name the categories. // Name the categories.
const size_t __len = std::strlen(__s); const size_t __len = std::strlen(__s);
......
...@@ -328,25 +328,25 @@ compare_symbols(const char* baseline_file, const char* test_file, ...@@ -328,25 +328,25 @@ compare_symbols(const char* baseline_file, const char* test_file,
// Check missing names for compatibility. // Check missing names for compatibility.
typedef pair<symbol, symbol> symbol_pair; typedef pair<symbol, symbol> symbol_pair;
vector<symbol_pair> incompatible; vector<symbol_pair> incompatible;
for (size_t i = 0; i < missing_names.size(); ++i) for (size_t j = 0; j < missing_names.size(); ++j)
{ {
symbol base = baseline_objects[missing_names[i]]; symbol base = baseline_objects[missing_names[j]];
incompatible.push_back(symbol_pair(base, base)); incompatible.push_back(symbol_pair(base, base));
} }
// Check shared names for compatibility. // Check shared names for compatibility.
for (size_t i = 0; i < shared_names.size(); ++i) for (size_t k = 0; k < shared_names.size(); ++k)
{ {
symbol base = baseline_objects[shared_names[i]]; symbol base = baseline_objects[shared_names[k]];
symbol test = test_objects[shared_names[i]]; symbol test = test_objects[shared_names[k]];
if (!check_compatible(base, test)) if (!check_compatible(base, test))
incompatible.push_back(symbol_pair(base, test)); incompatible.push_back(symbol_pair(base, test));
} }
// Check added names for compatibility. // Check added names for compatibility.
for (size_t i = 0; i < added_names.size(); ++i) for (size_t l = 0; l < added_names.size(); ++l)
{ {
symbol test = test_objects[added_names[i]]; symbol test = test_objects[added_names[l]];
if (!check_version(test, true)) if (!check_version(test, true))
incompatible.push_back(symbol_pair(test, test)); incompatible.push_back(symbol_pair(test, test));
} }
......
// -*- C++ -*- // -*- C++ -*-
// Utility subroutines for the C++ library testsuite. // Utility subroutines for the C++ library testsuite.
// //
// Copyright (C) 2002, 2003 Free Software Foundation, Inc. // Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -373,8 +373,8 @@ namespace std ...@@ -373,8 +373,8 @@ namespace std
} }
_M_data->_M_atoms_out[__num_base::_S_oend] = pod_type(); _M_data->_M_atoms_out[__num_base::_S_oend] = pod_type();
for (size_t i = 0; i < __num_base::_S_iend; ++i) for (size_t j = 0; j < __num_base::_S_iend; ++j)
_M_data->_M_atoms_in[i].value = value_type(__num_base::_S_atoms_in[i]); _M_data->_M_atoms_in[j].value = value_type(__num_base::_S_atoms_in[j]);
_M_data->_M_atoms_in[__num_base::_S_iend] = pod_type(); _M_data->_M_atoms_in[__num_base::_S_iend] = pod_type();
// "true" // "true"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment