This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] libstdc++/28080, fourth installment
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: Bo Persson <bop at gmb dot dk>, libstdc++ <libstdc++ at gcc dot gnu dot org>, Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Date: Tue, 27 Feb 2007 18:30:17 +0100
- Subject: Re: [Patch] libstdc++/28080, fourth installment
- References: <45E36E84.5000209@suse.de> <002401c75a8d$84c39fd0$0207a8c0@Bettan> <45E46049.6080309@suse.de>
Paolo Carlini wrote:
Oh, yes, thanks for noticing, and, I must add, I didn't know 26.2.6/15
was mandating that exact behavior, sigh. To be safe, for now I will
punt on the <complex> bits...
Therefore, I'm committing the below: no improvements for now to
<complex> and additionally a minor one for <iosfwd>, which was including
unnecessarily <cctype>, delay that to locale_facets.h, just before
<bits/ctype_base.h>, where it's really used.
Tested x86/x86_64-linux, without PCHs, gnu/generic locale.
Paolo.
/////////////////////
2007-02-27 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/bitset: Do not include <ios>, <iosfwd> is enough.
(operator>>(std::basic_istream<>&, bitset<>&)): Tweak, refer to
ios_base as a base of basic_istream.
* include/std/iomanip: Do not include <ios>, <iosfwd> +
<bits/ios_base.h> is enough.
* include/std/iosfwd: Do not include <cctype> here...
* include/bits/locale_facets.h: ... do it here, when needed.
* include/bits/ostream.tcc: Clean up, do not include <locale> here...
* include/std/ostream: ... here instead.
* include/bits/istream.tcc: Likewise for <locale> and <ostream>...
* include/std/istream: ... here.
* include/bits/sstream.tcc: Do not include <sstream>.
Index: include/bits/locale_facets.h
===================================================================
--- include/bits/locale_facets.h (revision 122374)
+++ include/bits/locale_facets.h (working copy)
@@ -45,6 +45,7 @@
#include <ctime> // For struct tm
#include <cwctype> // For wctype_t
+#include <cctype>
#include <bits/ctype_base.h>
#include <iosfwd>
#include <bits/ios_base.h> // For ios_base, ios_base::iostate
Index: include/bits/istream.tcc
===================================================================
--- include/bits/istream.tcc (revision 122374)
+++ include/bits/istream.tcc (working copy)
@@ -43,9 +43,6 @@
#pragma GCC system_header
-#include <locale>
-#include <ostream> // For flush()
-
_GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT, typename _Traits>
Index: include/bits/ostream.tcc
===================================================================
--- include/bits/ostream.tcc (revision 122374)
+++ include/bits/ostream.tcc (working copy)
@@ -1,6 +1,7 @@
// ostream classes -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -42,8 +43,6 @@
#pragma GCC system_header
-#include <locale>
-
_GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT, typename _Traits>
Index: include/bits/sstream.tcc
===================================================================
--- include/bits/sstream.tcc (revision 122374)
+++ include/bits/sstream.tcc (working copy)
@@ -1,6 +1,7 @@
// String based streams -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -42,8 +43,6 @@
#pragma GCC system_header
-#include <sstream>
-
_GLIBCXX_BEGIN_NAMESPACE(std)
template <class _CharT, class _Traits, class _Alloc>
Index: include/std/bitset
===================================================================
--- include/std/bitset (revision 122374)
+++ include/std/bitset (working copy)
@@ -55,7 +55,7 @@
#include <string>
#include <bits/functexcept.h> // For invalid_argument, out_of_range,
// overflow_error
-#include <ios>
+#include <iosfwd>
#define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * sizeof(unsigned long))
#define _GLIBCXX_BITSET_WORDS(__n) \
@@ -1227,12 +1227,15 @@
std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
{
- typedef typename _Traits::char_type char_type;
+ typedef typename _Traits::char_type char_type;
+ typedef std::basic_istream<_CharT, _Traits> __istream_type;
+ typedef typename __istream_type::ios_base __ios_base;
+
std::basic_string<_CharT, _Traits> __tmp;
__tmp.reserve(_Nb);
- std::ios_base::iostate __state = std::ios_base::goodbit;
- typename std::basic_istream<_CharT, _Traits>::sentry __sentry(__is);
+ typename __ios_base::iostate __state = __ios_base::goodbit;
+ typename __istream_type::sentry __sentry(__is);
if (__sentry)
{
try
@@ -1249,7 +1252,7 @@
typename _Traits::int_type __c1 = __buf->sbumpc();
if (_Traits::eq_int_type(__c1, __eof))
{
- __state |= std::ios_base::eofbit;
+ __state |= __ios_base::eofbit;
break;
}
else
@@ -1262,18 +1265,18 @@
else if (_Traits::eq_int_type(__buf->sputbackc(__c2),
__eof))
{
- __state |= std::ios_base::failbit;
+ __state |= __ios_base::failbit;
break;
}
}
}
}
catch(...)
- { __is._M_setstate(std::ios_base::badbit); }
+ { __is._M_setstate(__ios_base::badbit); }
}
if (__tmp.empty() && _Nb)
- __state |= std::ios_base::failbit;
+ __state |= __ios_base::failbit;
else
__x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb);
if (__state)
Index: include/std/iosfwd
===================================================================
--- include/std/iosfwd (revision 122374)
+++ include/std/iosfwd (working copy)
@@ -1,6 +1,7 @@
// Forwarding declarations -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -44,7 +45,6 @@
#include <bits/c++config.h>
#include <bits/c++locale.h>
#include <bits/c++io.h>
-#include <cctype> // For isspace, etc.
#include <bits/stringfwd.h> // For string forward declarations.
#include <bits/postypes.h>
#include <bits/functexcept.h>
Index: include/std/iomanip
===================================================================
--- include/std/iomanip (revision 122374)
+++ include/std/iomanip (working copy)
@@ -43,7 +43,8 @@
#pragma GCC system_header
#include <bits/c++config.h>
-#include <ios>
+#include <iosfwd>
+#include <bits/ios_base.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
@@ -111,7 +112,7 @@
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)
+ operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f)
{
__os.setf(__f._M_mask);
return __os;
Index: include/std/istream
===================================================================
--- include/std/istream (revision 122374)
+++ include/std/istream (working copy)
@@ -1,6 +1,7 @@
// Input streams -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -42,6 +43,8 @@
#pragma GCC system_header
#include <ios>
+#include <locale>
+#include <ostream>
#include <limits> // For numeric_limits
_GLIBCXX_BEGIN_NAMESPACE(std)
Index: include/std/ostream
===================================================================
--- include/std/ostream (revision 122374)
+++ include/std/ostream (working copy)
@@ -1,6 +1,7 @@
// Output streams -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -42,6 +43,7 @@
#pragma GCC system_header
#include <ios>
+#include <locale>
_GLIBCXX_BEGIN_NAMESPACE(std)