concept-inst.cc (vector<locale::facet*>): Remove instantiations.
authorBenjamin Kosnik <bkoz@redhat.com>
Wed, 17 Apr 2002 06:20:20 +0000 (06:20 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Wed, 17 Apr 2002 06:20:20 +0000 (06:20 +0000)
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.

From-SVN: r52405

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/istream.tcc
libstdc++-v3/src/concept-inst.cc
libstdc++-v3/src/stl-inst.cc
libstdc++-v3/testsuite/19_diagnostics/stdexceptions.cc

index 632ea3d5469f7a25880ca9d8822bbfc5cbef6396..26af65c93d6bb391fce2cfebf03959b540db3c8f 100644 (file)
@@ -1,4 +1,15 @@
+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.
+       
 2002-04-16  Paolo Carlini <pcarlini@unitus.it>
+
        * testsuite/24_iterators/rel_ops.cc: New test.
        
 2002-04-16  Gabriel Dos Reis  <gdr@merlin.codesourcery.com>
index 7f985594f9b531dc288d58485be52046c49f0530..9ee38a42fc7e7043a666d68c793d0922d4edefe0 100644 (file)
@@ -579,28 +579,22 @@ namespace std
     {
       _M_gcount = 0;
       sentry __cerb(*this, true);
-      if (__cerb && __n > 1
+      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->sbumpc();    
-             bool __testdelim = __c == __idelim;
-             bool __testeof =  __c == __eof;
+             int_type __c = __sb->sgetc();     
              
-             while (_M_gcount < __n - 1 && !__testeof && !__testdelim)
+             while (_M_gcount + 1 < __n && __c != __eof && __c != __idelim)
                {
                  *__s++ = traits_type::to_char_type(__c);
+                 __c = __sb->snextc();
                  ++_M_gcount;
-                 __c = __sb->sbumpc();
-                 __testeof = __c == __eof;
-                 __testdelim = __c == __idelim;
                }
-             if (__testdelim || _M_gcount == __n - 1)
-               __sb->sputbackc(__c);
-             if (__testeof)
+             if (__c == __eof)
                this->setstate(ios_base::eofbit);
            }
          catch(exception& __fail)
@@ -627,35 +621,29 @@ namespace std
       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;
+             __streambuf_type* __this_sb = this->rdbuf();
+             int_type __c = __this_sb->sgetc();
              
-             while (!__testeof && !__testdelim 
-                   && (__testput = __sb.sputc(traits_type::to_char_type(__c)) 
-                        != __eof))
+             while (__c != __eof && __c != __idelim 
+                    && (__sb.sputc(traits_type::to_char_type(__c)) != __eof))
                {
                  ++_M_gcount;
-                 __c = __this_sb->sbumpc();
-                 __testeof = __c == __eof;
-                 __testdelim = __c == __idelim;
+                 __c = __this_sb->snextc();
                }
-             if (__testdelim || !__testput)
-               __this_sb->sputbackc(traits_type::to_char_type(__c));
-             if (__testeof)
+             if (__c == __eof)
                this->setstate(ios_base::eofbit);
            }
          catch(exception& __fail)
            {
-             // Exception may result from sputc->overflow.
-             __this_sb->sputbackc(traits_type::to_char_type(__c));
+             // 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)
@@ -674,33 +662,28 @@ namespace std
        {
           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;
+             __streambuf_type* __sb = this->rdbuf();
+             int_type __c = __sb->sgetc();
            
-             while (_M_gcount < __n && !__testeof && !__testdelim)
+             while (_M_gcount + 1 < __n && __c != __eof && __c != __idelim)
                {
                  *__s++ = traits_type::to_char_type(__c);
-                 __c = __sb->sbumpc();
+                 __c = __sb->snextc();
                  ++_M_gcount;
-                 __testeof = __c == __eof;
-                 __testdelim = __c == __idelim;
                }
-             
-             if (__testeof)
-               {
-                 --_M_gcount;
-                 this->setstate(ios_base::eofbit);
-               }
-             else if (!__testdelim)
+             if (__c == __eof)
+               this->setstate(ios_base::eofbit);
+             else
                {
-                 --_M_gcount;
-                 __sb->sputbackc(traits_type::to_char_type(__c));
-                 this->setstate(ios_base::failbit);
+                 if (__c == __idelim)
+                   {
+                     __sb->snextc();
+                     ++_M_gcount;
+                   }
+                 else
+                   this->setstate(ios_base::failbit);
                }
            }
          catch(exception& __fail)
@@ -1102,22 +1085,16 @@ namespace std
              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);
+             int_type __c = __sb->sgetc();
              
-             while (__extracted < __num - 1 && !__testeof && !__testsp)
+             while (__extracted < __num - 1 
+                    && __c != __eof && !__ctype.is(ctype_base::space, __c))
                {
                  *__s++ = __c;
                  ++__extracted;
-                 __c = __sb->sbumpc();
-                 __testeof = __c == __eof;
-                 __testsp = __ctype.is(ctype_base::space, __c);
+                 __c = __sb->snextc();
                }
-             
-             if (!__testeof)
-               __sb->sputbackc(__c);
-             else
+             if (__c == __eof)
                __in.setstate(ios_base::eofbit);
 
 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
@@ -1149,26 +1126,15 @@ namespace std
       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);
+      __streambuf_type* __sb = __in.rdbuf();
+      __int_type __c = __sb->sgetc();
 
-      if (!__testeof && !__testsp)
-       __sb->sputbackc(__c);
-      else
+      while (__c != __eof && __ctype.is(ctype_base::space, __c))
+       __c = __sb->snextc();
+      if (__c == __eof)
        __in.setstate(ios_base::eofbit);
 
       return __in;
@@ -1199,21 +1165,16 @@ namespace std
          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)
+         __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->sbumpc();
-             __testeof = __c == __eof;
-             __testsp = __ctype.is(ctype_base::space, __c);
+             __c = __sb->snextc();
            }
-         if (!__testeof)
-           __sb->sputbackc(__c);
-         else
+         if (__c == __eof)
            __in.setstate(ios_base::eofbit);
          __in.width(0);
        }
@@ -1250,17 +1211,15 @@ namespace std
          __int_type __c = __sb->sbumpc();
          const __int_type __eof = _Traits::eof();
          __testdelim = __c ==  __idelim;
-         bool __testeof =  __c == __eof;
 
-         while (__extracted <= __n && !__testeof && !__testdelim)
+         while (__extracted <= __n && __c != __eof && !__testdelim)
            {
              __str += _Traits::to_char_type(__c);
              ++__extracted;
              __c = __sb->sbumpc();
-             __testeof = __c == __eof;
              __testdelim = __c == __idelim;
            }
-         if (__testeof)
+         if (__c == __eof)
            __in.setstate(ios_base::eofbit);
        }
       if (!__extracted && !__testdelim)
index a467a810c81b9f7fec7d697b025e49393fea7ac7..01cc030da8da1222ab9e9172e6d43261d8b4ec29 100644 (file)
@@ -1,6 +1,6 @@
 // Concept checking instantiations -*- C++ -*-
 
-// Copyright (C) 2001 Free Software Foundation
+// Copyright (C) 2001, 2002 Free Software Foundation
 //
 // This file is part of GNU CC.
 //
@@ -40,7 +40,6 @@
 #ifdef _GLIBCPP_CONCEPT_CHECKS
 
 #include <memory>
-#include <vector>
 #include <ostream>
 
 #define _Instantiate(...) template void __function_requires< __VA_ARGS__ > ()
@@ -49,36 +48,12 @@ namespace __gnu_cxx
 {
   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*> );
 
@@ -97,29 +72,6 @@ namespace __gnu_cxx
 
   _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> );
 
@@ -153,7 +105,6 @@ namespace __gnu_cxx
 
   _Instantiate(_RandomAccessIteratorConcept<wchar_t const*> );
 #endif
-
 } // namespace __gnu_cxx
 
 #undef _Instantiate
index 94d26b33d2375456c0755fbf1c32cdafa6821ac5..d8879a7bccd82984378b4272e1dcc6d83b28354e 100644 (file)
 
 #include <bits/c++config.h>
 #include <memory>
-#include <vector>
 
 namespace std
 {
   template class allocator<char>;
   template class allocator<wchar_t>;
 
+#ifdef __USE_MALLOC
   template class __malloc_alloc_template<0>;
-
-#ifndef __USE_MALLOC
+#else
   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
index c118580ce5072da2118d5d1e6e8b28cbf4c6a7e9..1b11118da5d92beff543a64e54d3cddccee3553c 100644 (file)
@@ -1,6 +1,6 @@
 // 2001-02-26 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
@@ -29,8 +29,6 @@ void test01()
 {
   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);