[libcxx-commits] [libcxx] 2051a41 - Revert "[libc++] Implement LWG3464(istream::gcount() can overflow)"

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 26 22:35:42 PDT 2023


Author: yronglin
Date: 2023-08-27T13:34:32+08:00
New Revision: 2051a4121957a4bfc015b5102d06ffd6d0852d33

URL: https://github.com/llvm/llvm-project/commit/2051a4121957a4bfc015b5102d06ffd6d0852d33
DIFF: https://github.com/llvm/llvm-project/commit/2051a4121957a4bfc015b5102d06ffd6d0852d33.diff

LOG: Revert "[libc++] Implement LWG3464(istream::gcount() can overflow)"

This reverts commit d57fe1dbe0506c006d8f082101a7c00fde798ddb.

Added: 
    

Modified: 
    libcxx/docs/Status/Cxx23Issues.csv
    libcxx/include/istream

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Status/Cxx23Issues.csv b/libcxx/docs/Status/Cxx23Issues.csv
index 2a00289af37692..a27158e6040943 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -10,7 +10,7 @@
 "`3432 <https://wg21.link/LWG3432>`__","Missing requirement for ``comparison_category``","November 2020","|Complete|","16.0","|spaceship|"
 "`3447 <https://wg21.link/LWG3447>`__","Deduction guides for ``take_view`` and ``drop_view`` have 
diff erent constraints","November 2020","|Complete|","14.0","|ranges|"
 "`3450 <https://wg21.link/LWG3450>`__","The const overloads of ``take_while_view::begin/end`` are underconstrained","November 2020","|Complete|","16.0","|ranges|"
-"`3464 <https://wg21.link/LWG3464>`__","``istream::gcount()`` can overflow","November 2020","|Complete|","18.0"
+"`3464 <https://wg21.link/LWG3464>`__","``istream::gcount()`` can overflow","November 2020","",""
 "`2731 <https://wg21.link/LWG2731>`__","Existence of ``lock_guard<MutexTypes...>::mutex_type`` typedef unclear","November 2020","|Complete|","5.0"
 "`2743 <https://wg21.link/LWG2743>`__","P0083R3 ``node_handle`` private members missing ""exposition only"" comment","November 2020","|Nothing To Do|",""
 "`2820 <https://wg21.link/LWG2820>`__","Clarify ``<cstdint>`` macros","November 2020","|Nothing To Do|",""

diff  --git a/libcxx/include/istream b/libcxx/include/istream
index 60f7e7c966dea8..8b440c036ddb2f 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -185,11 +185,6 @@ class _LIBCPP_TEMPLATE_VIS basic_istream
     : virtual public basic_ios<_CharT, _Traits>
 {
     streamsize __gc_;
-
-    _LIBCPP_HIDE_FROM_ABI void __inc_gcount() {
-      if (__gc_ < numeric_limits<streamsize>::max())
-        ++__gc_;
-    }
 public:
     // types (inherited from basic_ios (27.5.4)):
     typedef _CharT                         char_type;
@@ -719,7 +714,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
                             __sb->sputc(traits_type::to_char_type(__i)),
                             traits_type::eof()))
                         break;
-                    __inc_gcount();
+                    ++__gc_;
                     this->rdbuf()->sbumpc();
                 }
                 if (__gc_ == 0)
@@ -811,7 +806,7 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
                     if (traits_type::eq(__ch, __dlm))
                         break;
                     *__s++ = __ch;
-                    __inc_gcount();
+                    ++__gc_;
                      this->rdbuf()->sbumpc();
                 }
                 if (__gc_ == 0)
@@ -872,7 +867,7 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
                     break;
                 if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
                     break;
-                __inc_gcount();
+                ++__gc_;
                 this->rdbuf()->sbumpc();
             }
 #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
@@ -915,7 +910,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
                 if (traits_type::eq(__ch, __dlm))
                 {
                     this->rdbuf()->sbumpc();
-                    __inc_gcount();
+                    ++__gc_;
                     break;
                 }
                 if (__gc_ >= __n-1)
@@ -925,7 +920,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
                 }
                 *__s++ = __ch;
                 this->rdbuf()->sbumpc();
-                __inc_gcount();
+                ++__gc_;
             }
 #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
         }
@@ -975,7 +970,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
                        __state |= ios_base::eofbit;
                        break;
                     }
-                    __inc_gcount();
+                    ++__gc_;
                     if (traits_type::eq_int_type(__i, __dlm))
                         break;
                 }
@@ -990,7 +985,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
                        __state |= ios_base::eofbit;
                        break;
                     }
-                    __inc_gcount();
+                    ++__gc_;
                     if (traits_type::eq_int_type(__i, __dlm))
                         break;
                 }


        


More information about the libcxx-commits mailing list