[committed] libstdc++: Deprecate std::setfill for std::basic_istream [PR109922]
Checks
Commit Message
Tested powerpc64le-linux. Pushed to trunk.
-- >8 --
Prior to N0966 (July 1996) the std::setfill manipulator was specified to
work with both input and output streams. In the final C++98 standard it
is only specified to work with output streams.
We have always supported it for input streams, despite that never being
in the standard, and having no meaning for any input streams defined by
the standard. This commit adds a deprecated attribute to the overload
for input streams, so that we can stop supporting this some day.
libstdc++-v3/ChangeLog:
PR libstdc++/109922
* include/std/iomanip (operator>>(basic_istream&, _Setfill)):
Add deprecated attribute to non-standard overload.
* doc/xml/manual/evolution.xml: Document deprecation.
* doc/html/*: Regenerate.
* testsuite/27_io/manipulators/standard/char/1.cc: Add
dg-warning for expected deprecated warning.
* testsuite/27_io/manipulators/standard/char/2.cc: Likewise.
* testsuite/27_io/manipulators/standard/wchar_t/1.cc: Likewise.
* testsuite/27_io/manipulators/standard/wchar_t/2.cc: Likewise.
---
libstdc++-v3/doc/html/index.html | 2 +-
libstdc++-v3/doc/html/manual/api.html | 3 +++
libstdc++-v3/doc/html/manual/appendix.html | 2 +-
libstdc++-v3/doc/html/manual/appendix_porting.html | 2 +-
libstdc++-v3/doc/html/manual/index.html | 2 +-
libstdc++-v3/doc/xml/manual/evolution.xml | 9 +++++++++
libstdc++-v3/include/std/iomanip | 2 ++
.../testsuite/27_io/manipulators/standard/char/1.cc | 4 ++--
.../testsuite/27_io/manipulators/standard/char/2.cc | 2 +-
.../testsuite/27_io/manipulators/standard/wchar_t/1.cc | 4 ++--
.../testsuite/27_io/manipulators/standard/wchar_t/2.cc | 2 +-
11 files changed, 24 insertions(+), 10 deletions(-)
@@ -1089,4 +1089,13 @@ Tunables <variable>glibcxx.eh_pool.obj_count</variable> and
</section>
+<section xml:id="api.rel_141"><info><title><constant>14</constant></title></info>
+
+<para>
+Deprecate the non-standard overload that allows <code>std::setfill</code>
+to be used with <code>std::basic_istream</code>.
+</para>
+
+</section>
+
</section>
@@ -168,6 +168,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return { __c }; }
template<typename _CharT, typename _Traits>
+ __attribute__((__deprecated__("'std::setfill' should only be used with "
+ "output streams")))
inline basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
{
@@ -51,9 +51,9 @@ test01()
oss << setbase(8);
VERIFY(oss.good());
- // setfil
+ // setfill
setfill('a');
- iss >> setfill('a');
+ iss >> setfill('a'); // { dg-warning "deprecated" }
VERIFY(iss.good());
oss << setfill('a');
VERIFY(oss.good());
@@ -40,7 +40,7 @@ test01()
sin >> resetiosflags(ios_base::dec)
>> setiosflags(ios_base::dec)
>> setbase(ios_base::dec)
- >> setfill('c')
+ >> setfill('c') // { dg-warning "deprecated" }
>> setprecision(5)
>> setw(20)
>> ws;
@@ -51,9 +51,9 @@ test01()
oss << setbase(8);
VERIFY(oss.good());
- // setfil
+ // setfill
setfill(L'a');
- iss >> setfill(L'a');
+ iss >> setfill(L'a'); // { dg-warning "deprecated" }
VERIFY(iss.good());
oss << setfill(L'a');
VERIFY(oss.good());
@@ -40,7 +40,7 @@ test01()
sin >> resetiosflags(ios_base::dec)
>> setiosflags(ios_base::dec)
>> setbase(ios_base::dec)
- >> setfill(L'c')
+ >> setfill(L'c') // { dg-warning "deprecated" }
>> setprecision(5)
>> setw(20)
>> ws;