This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] refine instantiations
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 16 Apr 2002 23:24:21 -0700
- Subject: [v3] refine instantiations
Many of the stl/concept check instantiations are no longer
necessary. I removed them.
Preliminary work for 5820
tested x86/linux
tested x86/linux --enable-concept-checks
2002-04-16 Benjamin Kosnik <bkoz@redhat.com>
* src/concept-inst.cc (vector<locale::facet*>): Remove instantiations.
* src/stl-inst.cc (vector::_M_insert_aux): Remove instantiation.
(__malloc_alloc_template): Conditionalize.
* include/bits/istream.tcc: Remove sputbackc calls.
* testsuite/19_diagnostics/stdexceptions.cc: Fix comment.
Index: include/bits/istream.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/istream.tcc,v
retrieving revision 1.25
diff -c -p -r1.25 istream.tcc
*** include/bits/istream.tcc 3 Apr 2002 02:32:52 -0000 1.25
--- include/bits/istream.tcc 17 Apr 2002 06:18:21 -0000
*************** namespace std
*** 579,606 ****
{
_M_gcount = 0;
sentry __cerb(*this, true);
! if (__cerb && __n > 1)
{
try
{
const int_type __idelim = traits_type::to_int_type(__delim);
const int_type __eof = traits_type::eof();
__streambuf_type* __sb = this->rdbuf();
! int_type __c = __sb->sbumpc();
! bool __testdelim = __c == __idelim;
! bool __testeof = __c == __eof;
! while (_M_gcount < __n - 1 && !__testeof && !__testdelim)
{
*__s++ = traits_type::to_char_type(__c);
++_M_gcount;
- __c = __sb->sbumpc();
- __testeof = __c == __eof;
- __testdelim = __c == __idelim;
}
! if (__testdelim || _M_gcount == __n - 1)
! __sb->sputbackc(__c);
! if (__testeof)
this->setstate(ios_base::eofbit);
}
catch(exception& __fail)
--- 579,600 ----
{
_M_gcount = 0;
sentry __cerb(*this, true);
! if (__cerb)
{
try
{
const int_type __idelim = traits_type::to_int_type(__delim);
const int_type __eof = traits_type::eof();
__streambuf_type* __sb = this->rdbuf();
! int_type __c = __sb->sgetc();
! while (_M_gcount + 1 < __n && __c != __eof && __c != __idelim)
{
*__s++ = traits_type::to_char_type(__c);
+ __c = __sb->snextc();
++_M_gcount;
}
! if (__c == __eof)
this->setstate(ios_base::eofbit);
}
catch(exception& __fail)
*************** namespace std
*** 627,661 ****
sentry __cerb(*this, true);
if (__cerb)
{
- int_type __c;
- __streambuf_type* __this_sb = this->rdbuf();
try
{
const int_type __idelim = traits_type::to_int_type(__delim);
const int_type __eof = traits_type::eof();
! __c = __this_sb->sbumpc();
! bool __testdelim = __c == __idelim;
! bool __testeof = __c == __eof;
! bool __testput = true;
! while (!__testeof && !__testdelim
! && (__testput = __sb.sputc(traits_type::to_char_type(__c))
! != __eof))
{
++_M_gcount;
! __c = __this_sb->sbumpc();
! __testeof = __c == __eof;
! __testdelim = __c == __idelim;
}
! if (__testdelim || !__testput)
! __this_sb->sputbackc(traits_type::to_char_type(__c));
! if (__testeof)
this->setstate(ios_base::eofbit);
}
catch(exception& __fail)
{
! // Exception may result from sputc->overflow.
! __this_sb->sputbackc(traits_type::to_char_type(__c));
}
}
if (!_M_gcount)
--- 621,649 ----
sentry __cerb(*this, true);
if (__cerb)
{
try
{
const int_type __idelim = traits_type::to_int_type(__delim);
const int_type __eof = traits_type::eof();
! __streambuf_type* __this_sb = this->rdbuf();
! int_type __c = __this_sb->sgetc();
! while (__c != __eof && __c != __idelim
! && (__sb.sputc(traits_type::to_char_type(__c)) != __eof))
{
++_M_gcount;
! __c = __this_sb->snextc();
}
! if (__c == __eof)
this->setstate(ios_base::eofbit);
}
catch(exception& __fail)
{
! // 27.6.1.3 paragraph 1
! // Turn this on without causing an ios::failure to be thrown.
! this->setstate(ios_base::badbit);
! if ((this->exceptions() & ios_base::badbit) != 0)
! __throw_exception_again;
}
}
if (!_M_gcount)
*************** namespace std
*** 674,706 ****
{
try
{
- __streambuf_type* __sb = this->rdbuf();
- int_type __c = __sb->sbumpc();
- ++_M_gcount;
const int_type __idelim = traits_type::to_int_type(__delim);
const int_type __eof = traits_type::eof();
! bool __testdelim = __c == __idelim;
! bool __testeof = __c == __eof;
! while (_M_gcount < __n && !__testeof && !__testdelim)
{
*__s++ = traits_type::to_char_type(__c);
! __c = __sb->sbumpc();
++_M_gcount;
- __testeof = __c == __eof;
- __testdelim = __c == __idelim;
}
!
! if (__testeof)
! {
! --_M_gcount;
! this->setstate(ios_base::eofbit);
! }
! else if (!__testdelim)
{
! --_M_gcount;
! __sb->sputbackc(traits_type::to_char_type(__c));
! this->setstate(ios_base::failbit);
}
}
catch(exception& __fail)
--- 662,689 ----
{
try
{
const int_type __idelim = traits_type::to_int_type(__delim);
const int_type __eof = traits_type::eof();
! __streambuf_type* __sb = this->rdbuf();
! int_type __c = __sb->sgetc();
! while (_M_gcount + 1 < __n && __c != __eof && __c != __idelim)
{
*__s++ = traits_type::to_char_type(__c);
! __c = __sb->snextc();
++_M_gcount;
}
! if (__c == __eof)
! this->setstate(ios_base::eofbit);
! else
{
! if (__c == __idelim)
! {
! __sb->snextc();
! ++_M_gcount;
! }
! else
! this->setstate(ios_base::failbit);
}
}
catch(exception& __fail)
*************** namespace std
*** 1102,1123 ****
const __ctype_type& __ctype = use_facet<__ctype_type>(__in.getloc());
const int_type __eof = _Traits::eof();
__streambuf_type* __sb = __in.rdbuf();
! int_type __c = __sb->sbumpc();
! bool __testeof = __c == __eof;
! bool __testsp = __ctype.is(ctype_base::space, __c);
! while (__extracted < __num - 1 && !__testeof && !__testsp)
{
*__s++ = __c;
++__extracted;
! __c = __sb->sbumpc();
! __testeof = __c == __eof;
! __testsp = __ctype.is(ctype_base::space, __c);
}
!
! if (!__testeof)
! __sb->sputbackc(__c);
! else
__in.setstate(ios_base::eofbit);
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
--- 1085,1100 ----
const __ctype_type& __ctype = use_facet<__ctype_type>(__in.getloc());
const int_type __eof = _Traits::eof();
__streambuf_type* __sb = __in.rdbuf();
! int_type __c = __sb->sgetc();
! while (__extracted < __num - 1
! && __c != __eof && !__ctype.is(ctype_base::space, __c))
{
*__s++ = __c;
++__extracted;
! __c = __sb->snextc();
}
! if (__c == __eof)
__in.setstate(ios_base::eofbit);
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
*************** namespace std
*** 1149,1174 ****
typedef typename __istream_type::__streambuf_type __streambuf_type;
typedef typename __istream_type::__ctype_type __ctype_type;
typedef typename __istream_type::int_type __int_type;
- typedef typename __istream_type::char_type __char_type;
const __ctype_type& __ctype = use_facet<__ctype_type>(__in.getloc());
- __streambuf_type* __sb = __in.rdbuf();
const __int_type __eof = _Traits::eof();
! __int_type __c;
! bool __testeof;
! bool __testsp;
!
! do
! {
! __c = __sb->sbumpc();
! __testeof = __c == __eof;
! __testsp = __ctype.is(ctype_base::space, __c);
! }
! while (!__testeof && __testsp);
! if (!__testeof && !__testsp)
! __sb->sputbackc(__c);
! else
__in.setstate(ios_base::eofbit);
return __in;
--- 1126,1140 ----
typedef typename __istream_type::__streambuf_type __streambuf_type;
typedef typename __istream_type::__ctype_type __ctype_type;
typedef typename __istream_type::int_type __int_type;
const __ctype_type& __ctype = use_facet<__ctype_type>(__in.getloc());
const __int_type __eof = _Traits::eof();
! __streambuf_type* __sb = __in.rdbuf();
! __int_type __c = __sb->sgetc();
! while (__c != __eof && __ctype.is(ctype_base::space, __c))
! __c = __sb->snextc();
! if (__c == __eof)
__in.setstate(ios_base::eofbit);
return __in;
*************** namespace std
*** 1199,1219 ****
const __ctype_type& __ctype = use_facet<__ctype_type>(__in.getloc());
const __int_type __eof = _Traits::eof();
__streambuf_type* __sb = __in.rdbuf();
! __int_type __c = __sb->sbumpc();
! bool __testeof = __c == __eof;
! bool __testsp = __ctype.is(ctype_base::space, __c);
!
! while (__extracted < __n && !__testeof && !__testsp)
{
__str += _Traits::to_char_type(__c);
++__extracted;
! __c = __sb->sbumpc();
! __testeof = __c == __eof;
! __testsp = __ctype.is(ctype_base::space, __c);
}
! if (!__testeof)
! __sb->sputbackc(__c);
! else
__in.setstate(ios_base::eofbit);
__in.width(0);
}
--- 1165,1180 ----
const __ctype_type& __ctype = use_facet<__ctype_type>(__in.getloc());
const __int_type __eof = _Traits::eof();
__streambuf_type* __sb = __in.rdbuf();
! __int_type __c = __sb->sgetc();
!
! while (__extracted < __n
! && __c != __eof && !__ctype.is(ctype_base::space, __c))
{
__str += _Traits::to_char_type(__c);
++__extracted;
! __c = __sb->snextc();
}
! if (__c == __eof)
__in.setstate(ios_base::eofbit);
__in.width(0);
}
*************** namespace std
*** 1250,1266 ****
__int_type __c = __sb->sbumpc();
const __int_type __eof = _Traits::eof();
__testdelim = __c == __idelim;
- bool __testeof = __c == __eof;
! while (__extracted <= __n && !__testeof && !__testdelim)
{
__str += _Traits::to_char_type(__c);
++__extracted;
__c = __sb->sbumpc();
- __testeof = __c == __eof;
__testdelim = __c == __idelim;
}
! if (__testeof)
__in.setstate(ios_base::eofbit);
}
if (!__extracted && !__testdelim)
--- 1211,1225 ----
__int_type __c = __sb->sbumpc();
const __int_type __eof = _Traits::eof();
__testdelim = __c == __idelim;
! while (__extracted <= __n && __c != __eof && !__testdelim)
{
__str += _Traits::to_char_type(__c);
++__extracted;
__c = __sb->sbumpc();
__testdelim = __c == __idelim;
}
! if (__c == __eof)
__in.setstate(ios_base::eofbit);
}
if (!__extracted && !__testdelim)
Index: src/concept-inst.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/concept-inst.cc,v
retrieving revision 1.4
diff -c -p -r1.4 concept-inst.cc
*** src/concept-inst.cc 16 Apr 2002 02:29:21 -0000 1.4
--- src/concept-inst.cc 17 Apr 2002 06:18:23 -0000
***************
*** 1,6 ****
// Concept checking instantiations -*- C++ -*-
! // Copyright (C) 2001 Free Software Foundation
//
// This file is part of GNU CC.
//
--- 1,6 ----
// Concept checking instantiations -*- C++ -*-
! // Copyright (C) 2001, 2002 Free Software Foundation
//
// This file is part of GNU CC.
//
***************
*** 40,46 ****
#ifdef _GLIBCPP_CONCEPT_CHECKS
#include <memory>
- #include <vector>
#include <ostream>
#define _Instantiate(...) template void __function_requires< __VA_ARGS__ > ()
--- 40,45 ----
*************** namespace __gnu_cxx
*** 49,84 ****
{
template void __aux_require_boolean_expr<bool>(bool const&);
- _Instantiate(_BidirectionalIteratorConcept<
- __normal_iterator< std::locale::facet**,
- std::vector<std::locale::facet*,std::allocator<std::locale::facet*> > > > );
-
- _Instantiate(_BidirectionalIteratorConcept<
- __normal_iterator< unsigned*,
- std::vector<unsigned, std::allocator<unsigned> > > > );
-
- _Instantiate(_ConvertibleConcept<std::locale::facet*, std::locale::facet*> );
-
_Instantiate(_ConvertibleConcept<unsigned, unsigned> );
_Instantiate(_InputIteratorConcept<char*> );
_Instantiate(_InputIteratorConcept<char const*> );
- _Instantiate(_InputIteratorConcept<std::locale::facet**> );
-
- _Instantiate(_InputIteratorConcept<
- __normal_iterator< std::locale::facet* const*,
- std::vector<std::locale::facet*,std::allocator<std::locale::facet*> > > > );
-
- _Instantiate(_InputIteratorConcept<
- __normal_iterator< std::locale::facet**,
- std::vector<std::locale::facet*,std::allocator<std::locale::facet*> > > > );
-
- _Instantiate(_InputIteratorConcept<
- __normal_iterator< unsigned*,
- std::vector<unsigned, std::allocator<unsigned> > > > );
-
#ifdef _GLIBCPP_USE_WCHAR_T
_Instantiate(_InputIteratorConcept<wchar_t*> );
--- 48,59 ----
*************** namespace __gnu_cxx
*** 97,125 ****
_Instantiate(_LessThanComparableConcept<unsigned> );
- _Instantiate(_Mutable_BidirectionalIteratorConcept<
- __normal_iterator< std::locale::facet**,
- std::vector<std::locale::facet*,std::allocator<std::locale::facet*> > > > );
-
- _Instantiate(_Mutable_BidirectionalIteratorConcept<
- __normal_iterator< unsigned*,
- std::vector<unsigned, std::allocator<unsigned> > > > );
-
- _Instantiate(_Mutable_ForwardIteratorConcept<
- __normal_iterator< std::locale::facet**,
- std::vector<std::locale::facet*,std::allocator<std::locale::facet*> > > > );
-
- _Instantiate(_OutputIteratorConcept<
- std::locale::facet**, std::locale::facet*> );
-
- _Instantiate(_OutputIteratorConcept<
- __normal_iterator< std::locale::facet**,
- std::vector<std::locale::facet*, std::allocator<std::locale::facet* > > >,
- std::locale::facet* > );
-
- _Instantiate(_OutputIteratorConcept<__normal_iterator<
- unsigned*, std::vector<unsigned, std::allocator<unsigned> > >, unsigned> );
-
_Instantiate(_OutputIteratorConcept<std::ostreambuf_iterator<
char, std::char_traits<char> >, char> );
--- 72,77 ----
*************** namespace __gnu_cxx
*** 153,159 ****
_Instantiate(_RandomAccessIteratorConcept<wchar_t const*> );
#endif
-
} // namespace __gnu_cxx
#undef _Instantiate
--- 105,110 ----
Index: src/stl-inst.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/stl-inst.cc,v
retrieving revision 1.13
diff -c -p -r1.13 stl-inst.cc
*** src/stl-inst.cc 8 Mar 2002 06:05:20 -0000 1.13
--- src/stl-inst.cc 17 Apr 2002 06:18:23 -0000
***************
*** 33,53 ****
#include <bits/c++config.h>
#include <memory>
- #include <vector>
namespace std
{
template class allocator<char>;
template class allocator<wchar_t>;
template class __malloc_alloc_template<0>;
!
! #ifndef __USE_MALLOC
template class __default_alloc_template<true, 0>;
#endif
-
- template
- void
- vector<unsigned int>::
- _M_insert_aux(vector<unsigned int>::iterator, unsigned int const &);
} // namespace std
--- 33,47 ----
#include <bits/c++config.h>
#include <memory>
namespace std
{
template class allocator<char>;
template class allocator<wchar_t>;
+ #ifdef __USE_MALLOC
template class __malloc_alloc_template<0>;
! #else
template class __default_alloc_template<true, 0>;
#endif
} // namespace std
Index: testsuite/19_diagnostics/stdexceptions.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/19_diagnostics/stdexceptions.cc,v
retrieving revision 1.6
diff -c -p -r1.6 stdexceptions.cc
*** testsuite/19_diagnostics/stdexceptions.cc 7 Aug 2001 03:38:27 -0000 1.6
--- testsuite/19_diagnostics/stdexceptions.cc 17 Apr 2002 06:18:23 -0000
***************
*** 1,6 ****
// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com>
! // Copyright (C) 2001 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
--- 1,6 ----
// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com>
! // 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
*************** void test01()
*** 29,36 ****
{
bool test = true;
std::string s("lack of sunlight, no water error");
- // XXX work around long-standing, pathalogical, hostility-inducing parser bug
- // std::logic_error obj(std::string(strlit));
// 1
std::logic_error obj = std::logic_error(s);
--- 29,34 ----