From 979f8bfd3164d23e6bd192a00e89eb1fc8f5b4a3 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 25 May 2023 10:06:14 +0100 Subject: [PATCH] libstdc++: Deprecate std::setfill for std::basic_istream [PR109922] 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(-) diff --git a/libstdc++-v3/doc/html/index.html b/libstdc++-v3/doc/html/index.html index ed7021bd4610..414fcacff69e 100644 --- a/libstdc++-v3/doc/html/index.html +++ b/libstdc++-v3/doc/html/index.html @@ -142,7 +142,7 @@ Existing tests
C++11 Requirements Test Sequence Descriptions -
ABI Policy and Guidelines
The C++ Interface
Versioning
Goals
History
Prerequisites
Configuring
Checking Active
Allowed Changes
Prohibited Changes
Implementation
Testing
Single ABI Testing
Multiple ABI Testing
Outstanding Issues
API Evolution and Deprecation History
3.0
3.1
3.2
3.3
3.4
4.0
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
5.3
6
7
7.2
7.3
8
9
10
11
12
12.3
13
Backwards Compatibility
First
Second
Third
Pre-ISO headers removed
Extension headers hash_map, hash_set moved to ext or backwards
No ios::nocreate/ios::noreplace. +
ABI Policy and Guidelines
The C++ Interface
Versioning
Goals
History
Prerequisites
Configuring
Checking Active
Allowed Changes
Prohibited Changes
Implementation
Testing
Single ABI Testing
Multiple ABI Testing
Outstanding Issues
API Evolution and Deprecation History
3.0
3.1
3.2
3.3
3.4
4.0
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
5.3
6
7
7.2
7.3
8
9
10
11
12
12.3
13
14
Backwards Compatibility
First
Second
Third
Pre-ISO headers removed
Extension headers hash_map, hash_set moved to ext or backwards
No ios::nocreate/ios::noreplace.
No stream::attach(int fd)
diff --git a/libstdc++-v3/doc/html/manual/api.html b/libstdc++-v3/doc/html/manual/api.html index d9857675c78e..7d5f754fb38a 100644 --- a/libstdc++-v3/doc/html/manual/api.html +++ b/libstdc++-v3/doc/html/manual/api.html @@ -476,4 +476,7 @@ and later.

13

Tunables <variable>glibcxx.eh_pool.obj_count</variable> and <variable>glibcxx.eh_pool.obj_size</variable> were added. +

14

+Deprecate the non-standard overload that allows std::setfill +to be used with std::basic_istream.

\ No newline at end of file diff --git a/libstdc++-v3/doc/html/manual/appendix.html b/libstdc++-v3/doc/html/manual/appendix.html index 3f8bac015877..cd9aff077652 100644 --- a/libstdc++-v3/doc/html/manual/appendix.html +++ b/libstdc++-v3/doc/html/manual/appendix.html @@ -16,7 +16,7 @@ Existing tests
C++11 Requirements Test Sequence Descriptions -
ABI Policy and Guidelines
The C++ Interface
Versioning
Goals
History
Prerequisites
Configuring
Checking Active
Allowed Changes
Prohibited Changes
Implementation
Testing
Single ABI Testing
Multiple ABI Testing
Outstanding Issues
API Evolution and Deprecation History
3.0
3.1
3.2
3.3
3.4
4.0
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
5.3
6
7
7.2
7.3
8
9
10
11
12
12.3
13
Backwards Compatibility
First
Second
Third
Pre-ISO headers removed
Extension headers hash_map, hash_set moved to ext or backwards
No ios::nocreate/ios::noreplace. +
ABI Policy and Guidelines
The C++ Interface
Versioning
Goals
History
Prerequisites
Configuring
Checking Active
Allowed Changes
Prohibited Changes
Implementation
Testing
Single ABI Testing
Multiple ABI Testing
Outstanding Issues
API Evolution and Deprecation History
3.0
3.1
3.2
3.3
3.4
4.0
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
5.3
6
7
7.2
7.3
8
9
10
11
12
12.3
13
14
Backwards Compatibility
First
Second
Third
Pre-ISO headers removed
Extension headers hash_map, hash_set moved to ext or backwards
No ios::nocreate/ios::noreplace.
No stream::attach(int fd)
diff --git a/libstdc++-v3/doc/html/manual/appendix_porting.html b/libstdc++-v3/doc/html/manual/appendix_porting.html index 4b3f06988036..a6d0c5028078 100644 --- a/libstdc++-v3/doc/html/manual/appendix_porting.html +++ b/libstdc++-v3/doc/html/manual/appendix_porting.html @@ -14,7 +14,7 @@ Existing tests
C++11 Requirements Test Sequence Descriptions -
ABI Policy and Guidelines
The C++ Interface
Versioning
Goals
History
Prerequisites
Configuring
Checking Active
Allowed Changes
Prohibited Changes
Implementation
Testing
Single ABI Testing
Multiple ABI Testing
Outstanding Issues
API Evolution and Deprecation History
3.0
3.1
3.2
3.3
3.4
4.0
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
5.3
6
7
7.2
7.3
8
9
10
11
12
12.3
13
Backwards Compatibility
First
Second
Third
Pre-ISO headers removed
Extension headers hash_map, hash_set moved to ext or backwards
No ios::nocreate/ios::noreplace. +
ABI Policy and Guidelines
The C++ Interface
Versioning
Goals
History
Prerequisites
Configuring
Checking Active
Allowed Changes
Prohibited Changes
Implementation
Testing
Single ABI Testing
Multiple ABI Testing
Outstanding Issues
API Evolution and Deprecation History
3.0
3.1
3.2
3.3
3.4
4.0
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
5.3
6
7
7.2
7.3
8
9
10
11
12
12.3
13
14
Backwards Compatibility
First
Second
Third
Pre-ISO headers removed
Extension headers hash_map, hash_set moved to ext or backwards
No ios::nocreate/ios::noreplace.
No stream::attach(int fd)
diff --git a/libstdc++-v3/doc/html/manual/index.html b/libstdc++-v3/doc/html/manual/index.html index e5441528890c..0e4cb8c91449 100644 --- a/libstdc++-v3/doc/html/manual/index.html +++ b/libstdc++-v3/doc/html/manual/index.html @@ -123,7 +123,7 @@ Existing tests
C++11 Requirements Test Sequence Descriptions -
ABI Policy and Guidelines
The C++ Interface
Versioning
Goals
History
Prerequisites
Configuring
Checking Active
Allowed Changes
Prohibited Changes
Implementation
Testing
Single ABI Testing
Multiple ABI Testing
Outstanding Issues
API Evolution and Deprecation History
3.0
3.1
3.2
3.3
3.4
4.0
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
5.3
6
7
7.2
7.3
8
9
10
11
12
12.3
13
Backwards Compatibility
First
Second
Third
Pre-ISO headers removed
Extension headers hash_map, hash_set moved to ext or backwards
No ios::nocreate/ios::noreplace. +
ABI Policy and Guidelines
The C++ Interface
Versioning
Goals
History
Prerequisites
Configuring
Checking Active
Allowed Changes
Prohibited Changes
Implementation
Testing
Single ABI Testing
Multiple ABI Testing
Outstanding Issues
API Evolution and Deprecation History
3.0
3.1
3.2
3.3
3.4
4.0
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
5
5.3
6
7
7.2
7.3
8
9
10
11
12
12.3
13
14
Backwards Compatibility
First
Second
Third
Pre-ISO headers removed
Extension headers hash_map, hash_set moved to ext or backwards
No ios::nocreate/ios::noreplace.
No stream::attach(int fd)
diff --git a/libstdc++-v3/doc/xml/manual/evolution.xml b/libstdc++-v3/doc/xml/manual/evolution.xml index a29e4df38224..4037a18d2dfd 100644 --- a/libstdc++-v3/doc/xml/manual/evolution.xml +++ b/libstdc++-v3/doc/xml/manual/evolution.xml @@ -1089,4 +1089,13 @@ Tunables glibcxx.eh_pool.obj_count and +
<constant>14</constant> + + +Deprecate the non-standard overload that allows std::setfill +to be used with std::basic_istream. + + +
+ diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip index 5c0fb09a60e7..eb82fc584b6c 100644 --- a/libstdc++-v3/include/std/iomanip +++ b/libstdc++-v3/include/std/iomanip @@ -168,6 +168,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return { __c }; } template + __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) { diff --git a/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc index d3eba45aac1c..4da43200fe59 100644 --- a/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc @@ -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()); diff --git a/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc index dc74e1983c75..9acc057ccbb8 100644 --- a/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc +++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc @@ -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; diff --git a/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/1.cc index 0c27e8b126ae..ebfab0cc7327 100644 --- a/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/1.cc @@ -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()); diff --git a/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/2.cc index 509c152a6d7e..78b812d4288e 100644 --- a/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/2.cc +++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/2.cc @@ -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; -- 2.47.2