Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanups 8: Deprecate <strstream> classes instead of the entire header #2680

Merged

Conversation

StephanTLavavej
Copy link
Member

Deprecating the entire <strstream> header is problematic for the proposed Standard Library Modules, as <strstream> is still Standard C++23 and must be part of import std;.

This change makes it so that merely including <strstream> no longer emits a deprecation warning (via the two-typedef trick). Instead, the deprecation is applied to the 4 classes within. The warning message is still appropriate:

STL/stl/inc/yvals_core.h

Lines 787 to 790 in 314f65f

#define _CXX17_DEPRECATE_STRSTREAM \
[[deprecated("warning STL4005: <strstream> is deprecated in C++17. " \
"You can define _SILENCE_CXX17_STRSTREAM_DEPRECATION_WARNING " \
"or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]]

We must wrap the header in _STL_DISABLE_DEPRECATED_WARNING / _STL_RESTORE_DEPRECATED_WARNING as the classes mention each other.

I am not deprecating the non-Standard swap() overloads - there is little point in doing so when the Standard classes are already marked.

I am also detaching comments on the classes.

Then, this allows _SILENCE_CXX17_STRSTREAM_DEPRECATION_WARNING to be removed in various places that were merely including <strstream> but not attempting to use its machinery. (Silencing is still necessary in tests/std/tests/P1502R1_standard_library_header_units and tests/tr1/tests/strstream which exercise the machinery.)

Note that the "deprecate the entire header" technique is still being applied to the <ccomplex>, <cstdalign>, <cstdbool>, and <ctgmath> headers, as they are super useless, removed in C++20, and I won't be adding them to Standard Library Modules. (<experimental/filesystem> and <hash_meow> have the even stronger #error-unless-escape-hatch technique; they are non-Standard so they are also unchanged here.)

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Apr 27, 2022
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner April 27, 2022 22:46
@strega-nil-ms strega-nil-ms self-assigned this Apr 27, 2022
@CaseyCarter CaseyCarter removed their assignment Apr 28, 2022
@strega-nil-ms strega-nil-ms removed their assignment Apr 28, 2022
@StephanTLavavej StephanTLavavej self-assigned this Apr 30, 2022
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit e9c2444 into microsoft:main May 1, 2022
@StephanTLavavej StephanTLavavej deleted the cleanups-8-strstream branch May 1, 2022 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
  翻译: