[v3] io exception detangle

Benjamin Kosnik bkoz@redhat.com
Thu Oct 9 16:52:00 GMT 2003


As discussed in this thread.

http://gcc.gnu.org/ml/libstdc++/2003-09/msg00191.html

tested x86/linux

2003-10-09  Benjamin Kosnik  <bkoz@redhat.com>
 
        * src/string-inst.cc: Prune.
        * testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust line numbers.
        * testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
         
2003-10-09  Petur Runolfsson  <peturr02@ru.is>
 
        * src/io-inst.cc: Don't include iostream.
        * include/bits/ios_base.h (ios_base::failure): Use string.
        * src/Makefile.am: Add ios_failure.cc.
        * src/Makefile.in: Regenerate.
        * src/ios.cc: Move ios_base::failure definitions to...
        * src/ios_failure.cc: ...here. New.

Index: include/bits/ios_base.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/ios_base.h,v
retrieving revision 1.32
diff -c -p -r1.32 ios_base.h
*** include/bits/ios_base.h	11 Jul 2003 14:25:09 -0000	1.32
--- include/bits/ios_base.h	9 Oct 2003 16:49:20 -0000
***************
*** 29,35 ****
  // the GNU General Public License.
  
  //
! // ISO C++ 14882: 27.8  File-based streams
  //
  
  /** @file ios_base.h
--- 29,35 ----
  // the GNU General Public License.
  
  //
! // ISO C++ 14882: 27.4  Iostreams base classes
  //
  
  /** @file ios_base.h
*************** namespace std
*** 178,185 ****
        what() const throw();
        
      private:
!       enum { _S_bufsize = 256 };
!       char _M_name[_S_bufsize];
  #endif
      };
  
--- 178,184 ----
        what() const throw();
        
      private:
!       string _M_msg;
  #endif
      };
  
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/Makefile.am,v
retrieving revision 1.134
diff -c -p -r1.134 Makefile.am
*** src/Makefile.am	25 Sep 2003 12:56:10 -0000	1.134
--- src/Makefile.am	9 Oct 2003 16:49:20 -0000
*************** sources = \
*** 103,108 ****
--- 103,109 ----
  	globals.cc \
  	io-inst.cc \
  	ios.cc \
+ 	ios_failure.cc \
  	istream-inst.cc \
  	limits.cc \
  	locale.cc \
Index: src/io-inst.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/io-inst.cc,v
retrieving revision 1.3
diff -c -p -r1.3 io-inst.cc
*** src/io-inst.cc	5 Jul 2003 04:05:42 -0000	1.3
--- src/io-inst.cc	9 Oct 2003 16:49:20 -0000
***************
*** 1,6 ****
  // Explicit instantiation file.
  
! // 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
--- 1,6 ----
  // Explicit instantiation file.
  
! // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
  // Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
***************
*** 34,40 ****
  
  #include <ios>
  #include <iomanip>
- #include <iostream>
  
  namespace std
  {
--- 34,39 ----
Index: src/ios.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/ios.cc,v
retrieving revision 1.48
diff -c -p -r1.48 ios.cc
*** src/ios.cc	9 Sep 2003 01:08:48 -0000	1.48
--- src/ios.cc	9 Oct 2003 16:49:21 -0000
*************** namespace std 
*** 149,167 ****
    int ios_base::Init::_S_ios_base_init = 0;
    bool ios_base::Init::_S_synced_with_stdio = true;
  
-   ios_base::failure::failure(const string& __str) throw()
-   {
-     strncpy(_M_name, __str.c_str(), _S_bufsize);
-     _M_name[_S_bufsize - 1] = '\0';
-   }
- 
-   ios_base::failure::~failure() throw()
-   { }
- 
-   const char*
-   ios_base::failure::what() const throw()
-   { return _M_name; }
- 
    ios_base::Init::Init()
    {
      if (_S_ios_base_init == 0)
--- 149,154 ----
*************** namespace std 
*** 398,401 ****
        }
      return __ret; 
    }
! }  // namespace std
--- 385,388 ----
        }
      return __ret; 
    }
! } // namespace std
Index: src/string-inst.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/string-inst.cc,v
retrieving revision 1.26
diff -c -p -r1.26 string-inst.cc
*** src/string-inst.cc	2 Nov 2002 02:18:18 -0000	1.26
--- src/string-inst.cc	9 Oct 2003 16:49:21 -0000
***************
*** 1,6 ****
  // Components for manipulating sequences of characters -*- C++ -*-
  
! // 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
--- 1,6 ----
  // Components for manipulating sequences of characters -*- C++ -*-
  
! // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
  // Free Software Foundation, Inc.
  //
  // This file is part of the GNU ISO C++ Library.  This library is free
*************** namespace std
*** 73,95 ****
    template 
      S::basic_string(S::iterator, S::iterator, const allocator<C>&);
  
-   template 
-     S::basic_string(S::const_iterator, S::const_iterator, const allocator<C>&);
- 
-   template 
-     S& 
-     S::_M_replace(S::iterator, S::iterator, S::iterator, S::iterator, 
- 		  input_iterator_tag);
- 
-   template 
-     S& 
-     S::_M_replace(S::iterator, S::iterator, S::const_iterator, 
- 		  S::const_iterator, input_iterator_tag);
- 
-   template
-     S&
-     S::_M_replace(S::iterator, S::iterator, C*, C*, input_iterator_tag); 
- 
    template
      S&
      S::_M_replace(S::iterator, S::iterator, const C*, const C*, 
--- 73,78 ----
*************** namespace std
*** 99,113 ****
      S& 
      S::_M_replace_safe(S::iterator, S::iterator, S::iterator, S::iterator);
  
-   template 
-     S& 
-     S::_M_replace_safe(S::iterator, S::iterator, S::const_iterator, 
- 		  S::const_iterator);
- 
-   template
-     S&
-     S::_M_replace_safe(S::iterator, S::iterator, C*, C*); 
- 
    template
      S&
      S::_M_replace_safe(S::iterator, S::iterator, const C*, const C*);  
--- 82,87 ----
*************** namespace std
*** 117,127 ****
      S::_S_construct(S::iterator, S::iterator, 
  		    const allocator<C>&, forward_iterator_tag);
  
-   template 
-     C* 
-     S::_S_construct(S::const_iterator, S::const_iterator, 
- 		    const allocator<C>&, forward_iterator_tag);
- 
    template
      C*
      S::_S_construct(C*, C*, const allocator<C>&, forward_iterator_tag);
--- 91,96 ----
*************** namespace std
*** 130,137 ****
      C*
      S::_S_construct(const C*, const C*, const allocator<C>&,
  		    forward_iterator_tag);
- 
-   template
-     void
-     __destroy_aux<S*>(S*, S*, __false_type);
  } // namespace std
--- 99,102 ----
Index: testsuite/27_io/ios_base/cons/assign_neg.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc,v
retrieving revision 1.4
diff -c -p -r1.4 assign_neg.cc
*** testsuite/27_io/ios_base/cons/assign_neg.cc	14 Jul 2003 14:47:02 -0000	1.4
--- testsuite/27_io/ios_base/cons/assign_neg.cc	9 Oct 2003 16:49:22 -0000
*************** void test01()
*** 41,45 ****
    io1 = io2;
  }
  // { dg-error "within this context" "" { target *-*-* } 41 } 
! // { dg-error "is private" "" { target *-*-* } 748 } 
  // { dg-error "operator=" "" { target *-*-* } 0 } 
--- 41,45 ----
    io1 = io2;
  }
  // { dg-error "within this context" "" { target *-*-* } 41 } 
! // { dg-error "is private" "" { target *-*-* } 747 } 
  // { dg-error "operator=" "" { target *-*-* } 0 } 
Index: testsuite/27_io/ios_base/cons/copy_neg.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc,v
retrieving revision 1.4
diff -c -p -r1.4 copy_neg.cc
*** testsuite/27_io/ios_base/cons/copy_neg.cc	14 Jul 2003 14:47:03 -0000	1.4
--- testsuite/27_io/ios_base/cons/copy_neg.cc	9 Oct 2003 16:49:22 -0000
*************** void test02()
*** 41,45 ****
    test_base io2 = io1; 
  }
  // { dg-error "within this context" "" { target *-*-* } 41 } 
! // { dg-error "is private" "" { target *-*-* } 745 } 
  // { dg-error "copy constructor" "" { target *-*-* } 0 } 
--- 41,45 ----
    test_base io2 = io1; 
  }
  // { dg-error "within this context" "" { target *-*-* } 41 } 
! // { dg-error "is private" "" { target *-*-* } 744 } 
  // { dg-error "copy constructor" "" { target *-*-* } 0 } 



More information about the Libstdc++ mailing list