Skip to content

Commit 2051a41

Browse files
committed
Revert "[libc++] Implement LWG3464(istream::gcount() can overflow)"
This reverts commit d57fe1d.
1 parent 1c4c9e8 commit 2051a41

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

libcxx/docs/Status/Cxx23Issues.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"`3432 <https://wg21.link/LWG3432>`__","Missing requirement for ``comparison_category``","November 2020","|Complete|","16.0","|spaceship|"
1111
"`3447 <https://wg21.link/LWG3447>`__","Deduction guides for ``take_view`` and ``drop_view`` have different constraints","November 2020","|Complete|","14.0","|ranges|"
1212
"`3450 <https://wg21.link/LWG3450>`__","The const overloads of ``take_while_view::begin/end`` are underconstrained","November 2020","|Complete|","16.0","|ranges|"
13-
"`3464 <https://wg21.link/LWG3464>`__","``istream::gcount()`` can overflow","November 2020","|Complete|","18.0"
13+
"`3464 <https://wg21.link/LWG3464>`__","``istream::gcount()`` can overflow","November 2020","",""
1414
"`2731 <https://wg21.link/LWG2731>`__","Existence of ``lock_guard<MutexTypes...>::mutex_type`` typedef unclear","November 2020","|Complete|","5.0"
1515
"`2743 <https://wg21.link/LWG2743>`__","P0083R3 ``node_handle`` private members missing ""exposition only"" comment","November 2020","|Nothing To Do|",""
1616
"`2820 <https://wg21.link/LWG2820>`__","Clarify ``<cstdint>`` macros","November 2020","|Nothing To Do|",""

libcxx/include/istream

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,6 @@ class _LIBCPP_TEMPLATE_VIS basic_istream
185185
: virtual public basic_ios<_CharT, _Traits>
186186
{
187187
streamsize __gc_;
188-
189-
_LIBCPP_HIDE_FROM_ABI void __inc_gcount() {
190-
if (__gc_ < numeric_limits<streamsize>::max())
191-
++__gc_;
192-
}
193188
public:
194189
// types (inherited from basic_ios (27.5.4)):
195190
typedef _CharT char_type;
@@ -719,7 +714,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
719714
__sb->sputc(traits_type::to_char_type(__i)),
720715
traits_type::eof()))
721716
break;
722-
__inc_gcount();
717+
++__gc_;
723718
this->rdbuf()->sbumpc();
724719
}
725720
if (__gc_ == 0)
@@ -811,7 +806,7 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
811806
if (traits_type::eq(__ch, __dlm))
812807
break;
813808
*__s++ = __ch;
814-
__inc_gcount();
809+
++__gc_;
815810
this->rdbuf()->sbumpc();
816811
}
817812
if (__gc_ == 0)
@@ -872,7 +867,7 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
872867
break;
873868
if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
874869
break;
875-
__inc_gcount();
870+
++__gc_;
876871
this->rdbuf()->sbumpc();
877872
}
878873
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
@@ -915,7 +910,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
915910
if (traits_type::eq(__ch, __dlm))
916911
{
917912
this->rdbuf()->sbumpc();
918-
__inc_gcount();
913+
++__gc_;
919914
break;
920915
}
921916
if (__gc_ >= __n-1)
@@ -925,7 +920,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
925920
}
926921
*__s++ = __ch;
927922
this->rdbuf()->sbumpc();
928-
__inc_gcount();
923+
++__gc_;
929924
}
930925
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
931926
}
@@ -975,7 +970,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
975970
__state |= ios_base::eofbit;
976971
break;
977972
}
978-
__inc_gcount();
973+
++__gc_;
979974
if (traits_type::eq_int_type(__i, __dlm))
980975
break;
981976
}
@@ -990,7 +985,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
990985
__state |= ios_base::eofbit;
991986
break;
992987
}
993-
__inc_gcount();
988+
++__gc_;
994989
if (traits_type::eq_int_type(__i, __dlm))
995990
break;
996991
}

0 commit comments

Comments
 (0)