-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Remove non-Standard TR1 #5763
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
Remove non-Standard TR1 #5763
Conversation
…:_Write()`. They were unused by `subtract_with_carry_engine`.
They were unused by `subtract_with_carry_engine`.
We don't need to `static_cast` when calling `_Left._Equals(_Right)`.
…ct_with_carry_engine` to make fusion easier and avoid shadowing.
They were unused.
Avoid redundant seeding in `subtract_with_carry_engine(_Seed_seq&)`.
`_Readcy` was always `false`.
Note that `_Setx` and `_Carry` are now directly `private`; they were previously inherited privately.
…ll()`! Also drop now-unused `_Mod_t` and `_Seed_t`.
`_Reset()` and `_Reduce()` are becoming non-static member functions.
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #define xtime delete | ||
| #define xtime_get delete | ||
|
|
||
| #define discard_block delete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a new trick to me: what's the purpose of these macros mapping to delete (and previously to known constants)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It ensures that if we ever mention them in our headers, the test will catastrophically fail to compile.
The #define meow 1729 ones are for when we want to mention them (because they're non-Standard extensions), but need to push-undef-pop, and at the end we check that the specific macro value has been restored.
This test is probably overkill but it's cheap to maintain.
Overview
This permanently removes our non-Standard TR1 implementation, which was superseded by C++11.
Fixes #183. Fixes #1002. (And DevCom-381099 / Microsoft-internal VSO-729899.)
The
std::tr1namespace mostly consisted of aliases for Standard machinery. For example,std::tr1::shared_ptrwas just an alias forstd::shared_ptr. One member function was affected: in<array>, TR1array::assign()was superseded by Standardarray::fill(). The most significant differences were in<random>, where the old engines and distributions were superseded by ones with new names and superior interfaces. For example, TR1mersenne_twisteranduniform_intwere superseded by Standardmersenne_twister_engineanduniform_int_distribution.Eliminating TR1 removes unnecessary complexity from this fiendishly complex library. For users, it removes ways to write non-portable code. For library implementers, it reduces our maintenance burden, making it easier for us to reason about the remaining Standard code. We've been working towards TR1 removal for a long time:
In Aug 2017, VS 2017 15.3 shipped, removing most of TR1's machinery by default in C++17 mode and later.
In Dec 2017, VS 2017 15.5 shipped a warning to users that "The non-Standard
std::tr1namespace and TR1-only machinery are deprecated and will be REMOVED."In May 2024, VS 2022 17.10 shipped #4284, which extended the deprecation warnings to the non-Standard TR1 engines and distributions in
<random>that were also available in thestdnamespace because they served as base classes for the Standard engines and distributions.Very recently, my #5712 disconnected the Standard engines and distributions from their TR1 ancestors, making it possible to finally remove TR1. And now, the conclusion.
In addition to removing the
std::tr1namespace, the oldarraymember function, and the old engines and distributions lurking in thestdnamespace, this makes two more significant simplifications possible. Because the old engines had a different interface, various algorithms had to accept either old or new engines. We can now drop that logic, always using the more efficient new interface. Also,subtract_with_carry_enginehad a complicated implementation, which was previously tangled up with somewhat different TR1 engines that had been abandoned during Standardization. Following up on #5712, I can fuse another base class, and a traits class, away. (This is the bulk of the commits and complexity in this PR.)Commits
_HAS_TR1_NAMESPACE._SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING._SILENCE_TR1_RANDOM_DEPRECATION_WARNING._Swc_baseoperator>>()andoperator<<(), and_Swc_traits::_Write().subtract_with_carry_engine._Swc_basemin()andmax(), and_Swc_traits::_Max.subtract_with_carry_engine._Swc_baseoperator()()with strengthenednoexcept._Swc_basediscard()._Swc_baseoperator==().static_castwhen calling_Left._Equals(_Right)._Swc_basedefault_seed._Mytraitsin_Swc_baseandsubtract_with_carry_engineto make fusion easier and avoid shadowing._Swc_base_Write_full()._Swc_basedefault ctor and ctor/seed()from_Gen&._Swc_baseconstruction.subtract_with_carry_engine(_Seed_seq&)._Swc_baseseed()._Readcywas alwaysfalse._Swc_base._Setxand_Carryare now directlyprivate; they were previously inherited privately._Carryis now a direct data member._Swc_traits::_Reset()as_Readcyis alwaysfalse._Swc_traits_Cyand_Mod, avoiding shadowing in_Write_full()!_Mod_tand_Seed_t._Swc_traits_Write_full()._Swc_traits._Reset()and_Reduce()are becoming non-static member functions._Reset()intoseed().%=.subtract_with_carry_engineRepresentationI verified that
subtract_with_carry_engine's representation isn't being changed by removing_Swc_baseinheritance. I checked 32-bit and 64-bit engines, on both x64 and x86. I compared against the MSVC Build Tools 14.50 Preview 1, so the differences here also include #5712's recent removal of TR1subtract_with_carryinheritance.Click to expand test case and output:
Test Case
Old x64
New x64
Old x86
New x86