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
This commit is contained in:
Simon Marshall 2004-05-13 16:29:39 +00:00 committed by Benjamin Kosnik
parent d7f3083354
commit 95b147fe4a
12 changed files with 92 additions and 71 deletions

View File

@ -1,3 +1,19 @@
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>
* docs/html/abi.html: Document effect of -fabi-version on value

View File

@ -272,14 +272,14 @@ namespace std
_M_narrow_ok = true;
else
_M_narrow_ok = false;
for (size_t __i = 0;
__i < sizeof(_M_widen) / sizeof(wint_t); ++__i)
_M_widen[__i] = btowc(__i);
for (size_t __j = 0;
__j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
_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_wmask[__i] = _M_convert_to_wmask(_M_bit[__i]);
_M_bit[__k] = static_cast<mask>(_ISbit(__k));
_M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
}
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
__uselocale(__old);

View File

@ -58,14 +58,16 @@ namespace std
for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
_M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
for (size_t __i = 0; __i < __num_base::_S_iend; ++__i)
_M_data->_M_atoms_in[__i] = __num_base::_S_atoms_in[__i];
for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
_M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
}
else
{
// Named locale.
_M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, __cloc));
_M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, __cloc));
_M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
__cloc));
_M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
__cloc));
// Check for NULL, which implies no grouping.
if (_M_data->_M_thousands_sep == '\0')
@ -111,9 +113,9 @@ namespace std
_M_data->_M_atoms_out[__i] =
static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
for (size_t __i = 0; __i < __num_base::_S_iend; ++__i)
_M_data->_M_atoms_in[__i] =
static_cast<wchar_t>(__num_base::_S_atoms_in[__i]);
for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
_M_data->_M_atoms_in[__j] =
static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
}
else
{

View File

@ -1161,8 +1161,8 @@ namespace std
_M_widen_ok = 1;
// Set _M_widen_ok to 2 if memcpy can't be used.
for (size_t __i = 0; __i < sizeof(_M_widen); ++__i)
if (__tmp[__i] != _M_widen[__i])
for (size_t __j = 0; __j < sizeof(_M_widen); ++__j)
if (__tmp[__j] != _M_widen[__j])
{
_M_widen_ok = 2;
break;
@ -1182,11 +1182,11 @@ namespace std
// Check if any default values were created. Do this by
// renarrowing with a different default value and comparing.
bool __consecutive = true;
for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i)
if (!_M_narrow[__i])
for (size_t __j = 0; __j < sizeof(_M_narrow); ++__j)
if (!_M_narrow[__j])
{
char __c;
do_narrow(__tmp + __i, __tmp + __i + 1, 1, &__c);
do_narrow(__tmp + __j, __tmp + __j + 1, 1, &__c);
if (__c == 1)
{
__consecutive = false;

View File

@ -1,6 +1,6 @@
// Debugging iterator implementation (out of line) -*- C++ -*-
// Copyright (C) 2003
// Copyright (C) 2003, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -123,11 +123,11 @@ namespace __gnu_debug
if (this->base() == __victim->base())
__victim->_M_version = 0;
}
for (_Safe_iterator_base* iter = _M_sequence->_M_const_iterators;
iter; /* increment in loop */)
for (_Safe_iterator_base* iter2 = _M_sequence->_M_const_iterators;
iter2; /* increment in loop */)
{
const_iterator* __victim = static_cast<const_iterator*>(iter);
iter = iter->_M_next;
const_iterator* __victim = static_cast<const_iterator*>(iter2);
iter2 = iter2->_M_next;
if (this->base() == __victim->base())
__victim->_M_version = 0;
}

View File

@ -1,6 +1,6 @@
// Safe sequence implementation -*- C++ -*-
// Copyright (C) 2003
// Copyright (C) 2003, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -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);
__iter = __iter->_M_next;
const_iterator* __victim = static_cast<const_iterator*>(__iter2);
__iter2 = __iter2->_M_next;
if (!__victim->_M_singular())
{
if (__pred(__victim->base()))
@ -166,10 +166,11 @@ namespace __gnu_debug
__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);
__iter = __iter->_M_next;
const_iterator* __victim = static_cast<const_iterator*>(__iter2);
__iter2 = __iter2->_M_next;
if (!__victim->_M_singular() && __victim->base() == __x.base())
__victim->_M_attach(static_cast<_Sequence*>(this));
}

View File

@ -114,10 +114,10 @@ namespace __gnu_debug
__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;
__iter = __iter->_M_next;
_Safe_iterator_base* __old = __iter2;
__iter2 = __iter2->_M_next;
__old->_M_attach(0, true);
}
}
@ -134,10 +134,10 @@ namespace __gnu_debug
__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;
__iter = __iter->_M_next;
_Safe_iterator_base* __old = __iter2;
__iter2 = __iter2->_M_next;
if (__old->_M_singular())
__old->_M_attach(0, true);
}

View File

@ -241,23 +241,23 @@ namespace std
_M_facets[__i]->_M_add_reference();
}
_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];
if (_M_caches[__i])
_M_caches[__i]->_M_add_reference();
_M_caches[__j] = __imp._M_caches[__j];
if (_M_caches[__j])
_M_caches[__j]->_M_add_reference();
}
_M_names = new char*[_S_categories_size];
for (size_t __i = 0; __i < _S_categories_size; ++__i)
_M_names[__i] = 0;
for (size_t __k = 0; __k < _S_categories_size; ++__k)
_M_names[__k] = 0;
// Name the categories.
for (size_t __i = 0; (__i < _S_categories_size
&& __imp._M_names[__i]); ++__i)
for (size_t __l = 0; (__l < _S_categories_size
&& __imp._M_names[__l]); ++__l)
{
const size_t __len = std::strlen(__imp._M_names[__i]) + 1;
_M_names[__i] = new char[__len];
std::memcpy(_M_names[__i], __imp._M_names[__i], __len);
const size_t __len = std::strlen(__imp._M_names[__l]) + 1;
_M_names[__l] = new char[__len];
std::memcpy(_M_names[__l], __imp._M_names[__l], __len);
}
}
catch(...)
@ -269,7 +269,8 @@ namespace std
void
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)
_M_replace_facet(__imp, *__idpp);
@ -280,7 +281,8 @@ namespace std
_M_replace_facet(const _Impl* __imp, const locale::id* __idp)
{
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"));
_M_install_facet(__idp, __imp->_M_facets[__index]);
}
@ -304,8 +306,8 @@ namespace std
__newf = new const facet*[__new_size];
for (size_t __i = 0; __i < _M_facets_size; ++__i)
__newf[__i] = _M_facets[__i];
for (size_t __i2 = _M_facets_size; __i2 < __new_size; ++__i2)
__newf[__i2] = 0;
for (size_t __l = _M_facets_size; __l < __new_size; ++__l)
__newf[__l] = 0;
// New cache array.
const facet** __oldc = _M_caches;
@ -319,10 +321,10 @@ namespace std
delete [] __newf;
__throw_exception_again;
}
for (size_t __i = 0; __i < _M_facets_size; ++__i)
__newc[__i] = _M_caches[__i];
for (size_t __i2 = _M_facets_size; __i2 < __new_size; ++__i2)
__newc[__i2] = 0;
for (size_t __j = 0; __j < _M_facets_size; ++__j)
__newc[__j] = _M_caches[__j];
for (size_t __k = _M_facets_size; __k < __new_size; ++__k)
__newc[__k] = 0;
_M_facets_size = __new_size;
_M_facets = __newf;

View File

@ -260,8 +260,8 @@ namespace std
_M_names = new (&name_vec) char*[_S_categories_size];
_M_names[0] = new (&name_c[0]) char[2];
std::memcpy(_M_names[0], locale::facet::_S_get_c_name(), 2);
for (size_t __i = 1; __i < _S_categories_size; ++__i)
_M_names[__i] = 0;
for (size_t __j = 1; __j < _S_categories_size; ++__j)
_M_names[__j] = 0;
// This is needed as presently the C++ version of "C" locales
// != data in the underlying locale model for __timepunct,

View File

@ -193,11 +193,11 @@ namespace std
for (size_t __i = 0; __i < _M_facets_size; ++__i)
_M_facets[__i] = 0;
_M_caches = new const facet*[_M_facets_size];
for (size_t __i = 0; __i < _M_facets_size; ++__i)
_M_caches[__i] = 0;
for (size_t __j = 0; __j < _M_facets_size; ++__j)
_M_caches[__j] = 0;
_M_names = new char*[_S_categories_size];
for (size_t __i = 0; __i < _S_categories_size; ++__i)
_M_names[__i] = 0;
for (size_t __k = 0; __k < _S_categories_size; ++__k)
_M_names[__k] = 0;
// Name the categories.
const size_t __len = std::strlen(__s);

View File

@ -328,25 +328,25 @@ compare_symbols(const char* baseline_file, const char* test_file,
// Check missing names for compatibility.
typedef pair<symbol, symbol> symbol_pair;
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));
}
// 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 test = test_objects[shared_names[i]];
symbol base = baseline_objects[shared_names[k]];
symbol test = test_objects[shared_names[k]];
if (!check_compatible(base, test))
incompatible.push_back(symbol_pair(base, test));
}
// 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))
incompatible.push_back(symbol_pair(test, test));
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
// 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
// software; you can redistribute it and/or modify it under the
@ -373,8 +373,8 @@ namespace std
}
_M_data->_M_atoms_out[__num_base::_S_oend] = pod_type();
for (size_t i = 0; i < __num_base::_S_iend; ++i)
_M_data->_M_atoms_in[i].value = value_type(__num_base::_S_atoms_in[i]);
for (size_t j = 0; j < __num_base::_S_iend; ++j)
_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();
// "true"