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

Implement P2467R1 ios_base::noreplace: Exclusive Mode For fstreams (#2932) #3065

Merged
merged 12 commits into from
Nov 11, 2022

Conversation

Atari2
Copy link
Contributor

@Atari2 Atari2 commented Aug 31, 2022

As was pointed out by @StephanTLavavej, since this PR has changes to fiopen.cpp, it will be affects redist.
While writing the tests I tried to avoid having to change things that could affect binary compatibility but it seemed like the only option was to add the now-valid entries to the array in _Xfiopen, otherwise the calls to it would just fail.

Fixes #2932.

@Atari2 Atari2 requested a review from a team as a code owner August 31, 2022 08:59
stl/src/fiopen.cpp Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej added cxx23 C++23 feature affects redist Results in changes to separately compiled bits labels Aug 31, 2022
@StephanTLavavej
Copy link
Member

Thanks! I updated your PR description to say "Fixes <issue number>", which tells GitHub to link the tracking issue and close it when this PR is merged.

…`mode`

Remove macro guards from .cpp files and use _HAS_CXX23 for the .h files.
Additionally, as @MattStephanson pointed out, since _fsopen already handles the 'x' modifiers correctly, the masking out and additional check of ios_base::_Noreplace has been removed in favour of just passing it directly to _Xfsopen and adding strings for the modes there. This also avoids the "test open" to check if the file already exists which avoids a TOCTOU issue.
Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

Copy link
Member

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just style nits with the test, for which I'll push a cleanup.

tests/std/tests/P2467R1_exclusive_mode_fstreams/test.cpp Outdated Show resolved Hide resolved
tests/std/tests/P2467R1_exclusive_mode_fstreams/test.cpp Outdated Show resolved Hide resolved
tests/std/tests/P2467R1_exclusive_mode_fstreams/test.cpp Outdated Show resolved Hide resolved
@CaseyCarter CaseyCarter removed their assignment Sep 15, 2022
tests/std/tests/P2467R1_exclusive_mode_fstreams/test.cpp Outdated Show resolved Hide resolved
tests/std/tests/P2467R1_exclusive_mode_fstreams/test.cpp Outdated Show resolved Hide resolved
stl/src/fiopen.cpp Outdated Show resolved Hide resolved
stl/src/fiopen.cpp Show resolved Hide resolved
tests/std/tests/P2467R1_exclusive_mode_fstreams/test.cpp Outdated Show resolved Hide resolved
@StephanTLavavej
Copy link
Member

StephanTLavavej commented Sep 20, 2022

Thanks @Atari2, this looks great! I've pushed a merge with main in order to resolve trivial adjacent-add conflicts with the Modules PR that just landed (in yvals_core.h and tests/std/test.lst, as the paper numbers and macro names sorted close together), followed by fine-grained commits to address minor things I noticed. (The most significant being a pre-emptive fix for the /clr:pure internal build.) Also FYI @CaseyCarter @strega-nil-ms as I pushed after you approved.

While some affects redist PRs can be merged for locked-redist releases (when the redist's behavior changes, but we're comfortable with the compatibility implications), this feature requires an updated redist or it'll fail at runtime, so we'll place this PR in cryo-stasis (blocked status) until changes start flowing into VS 2022 17.6. I believe that this will happen at the end of October (note: this has no relationship to public release dates of Previews - it is purely when internal merges switch over from one release branch to another).

✅ Also, no changes are needed for modules, as this simply adds a static constexpr data member.

@StephanTLavavej StephanTLavavej added the blocked Something is preventing work on this label Sep 20, 2022
@StephanTLavavej StephanTLavavej removed the blocked Something is preventing work on this label Nov 10, 2022
@StephanTLavavej
Copy link
Member

VS 2022 17.6 Preview 1's redist will be unlocked, so we should be able to mirror this now. I've pushed a conflict-free merge with main to pick up the ~2 months of changes there (and submodule updates), to be careful.

@StephanTLavavej StephanTLavavej self-assigned this Nov 11, 2022
@StephanTLavavej
Copy link
Member

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

@StephanTLavavej StephanTLavavej merged commit c550bd0 into microsoft:main Nov 11, 2022
@StephanTLavavej
Copy link
Member

Thanks for implementing this feature in a binary-compatible way! 😻 🚀 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects redist Results in changes to separately compiled bits cxx23 C++23 feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

P2467R1 ios_base::noreplace: Exclusive Mode For fstreams
5 participants