[libstdc++] Partial implementation of DR 60.
Phil Edwards
phil@jaj.com
Sun Apr 20 22:59:00 GMT 2003
DR 60 makes changes to which functions affect, or do not affect, subsequent
calls to gcount(). Easily implemented as below. I'd actually noticed
these back when doxygenating the I/O library, but never checked them in. (?)
DR 60 also changes other things, not done here.
Tested on athlon_mp/linux, no regressions.
Should this go in 3.3? *shrug*
2003-04-20 Phil Edwards <pme@gcc.gnu.org>
* docs/html/ext/howto.html ('LWG Issues'): Add issue 60, partial
implementation only.
* include/bits/istream.tcc (putback, unget, sync, seekg): Comment
and change to comply with DR 60 and the effect on gcount().
* include/std/std_istream.h: Update comments.
Index: docs/html/ext/howto.html
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/ext/howto.html,v
retrieving revision 1.27
diff -u -3 -p -r1.27 howto.html
--- docs/html/ext/howto.html 20 Apr 2003 22:18:49 -0000 1.27
+++ docs/html/ext/howto.html 20 Apr 2003 22:55:15 -0000
@@ -464,6 +464,13 @@
"copying stream state" was deemed too complicated.
</dd>
+ <dt><a href="lwg-defects.html#60">60</a>:
+ <em>What is a formatted input function?</em>
+ </dt>
+ <dd>This DR made many widespread changes to <code>basic_istream</code>,
+ not all of which have been implemented.
+ </dd>
+
<dt><a href="lwg-defects.html#68">68</a>:
<em>Extractors for char* should store null at end</em>
</dt>
Index: include/bits/istream.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/istream.tcc,v
retrieving revision 1.43
diff -u -3 -p -r1.43 istream.tcc
--- include/bits/istream.tcc 18 Apr 2003 03:46:43 -0000 1.43
+++ include/bits/istream.tcc 20 Apr 2003 22:55:15 -0000
@@ -841,7 +841,10 @@ namespace std
basic_istream<_CharT, _Traits>::
putback(char_type __c)
{
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+// 60. What is a formatted input function?
_M_gcount = 0;
+#endif
sentry __cerb(*this, true);
if (__cerb)
{
@@ -872,7 +875,10 @@ namespace std
basic_istream<_CharT, _Traits>::
unget(void)
{
+#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
+// 60. What is a formatted input function?
_M_gcount = 0;
+#endif
sentry __cerb(*this, true);
if (__cerb)
{
@@ -903,8 +909,8 @@ namespace std
basic_istream<_CharT, _Traits>::
sync(void)
{
+ // DR60. Do not change _M_gcount.
int __ret = -1;
- _M_gcount = 0;
sentry __cerb(*this, true);
if (__cerb)
{
@@ -948,7 +954,7 @@ namespace std
basic_istream<_CharT, _Traits>::
seekg(pos_type __pos)
{
- _M_gcount = 0;
+ // DR60. Do not change _M_gcount.
if (!this->fail())
{
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
@@ -968,7 +974,7 @@ namespace std
basic_istream<_CharT, _Traits>::
seekg(off_type __off, ios_base::seekdir __dir)
{
- _M_gcount = 0;
+ // DR60. Do not change _M_gcount.
if (!this->fail())
{
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
Index: include/std/std_istream.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/std/std_istream.h,v
retrieving revision 1.8
diff -u -3 -p -r1.8 std_istream.h
--- include/std/std_istream.h 28 Mar 2003 19:45:44 -0000 1.8
+++ include/std/std_istream.h 20 Apr 2003 22:55:15 -0000
@@ -476,10 +476,6 @@ namespace std
*
* @note Since no characters are extracted, the next call to
* @c gcount() will return 0, as required by DR 60.
- *
- * @if maint
- * FIXME We don't comply with DR 60 here, _M_gcount is untouched.
- * @endif
*/
__istream_type&
putback(char_type __c);
@@ -513,9 +509,6 @@ namespace std
* @note This function does not count the number of characters
* extracted, if any, and therefore does not affect the next
* call to @c gcount().
- * @if maint
- * FIXME We don't comply with DR 60 here, _M_gcount is zeroed.
- * @endif
*/
int
sync();
@@ -545,9 +538,6 @@ namespace std
* @note This function does not count the number of characters
* extracted, if any, and therefore does not affect the next
* call to @c gcount().
- * @if maint
- * FIXME We don't comply with DR 60 here, _M_gcount is zeroed.
- * @endif
*/
__istream_type&
seekg(pos_type);
@@ -564,9 +554,6 @@ namespace std
* @note This function does not count the number of characters
* extracted, if any, and therefore does not affect the next
* call to @c gcount().
- * @if maint
- * FIXME We don't comply with DR 60 here, _M_gcount is zeroed.
- * @endif
*/
__istream_type&
seekg(off_type, ios_base::seekdir);
More information about the Libstdc++
mailing list