-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Various cleanups #3935
Merged
StephanTLavavej
merged 23 commits into
microsoft:main
from
StephanTLavavej:stl-cleanups
Aug 11, 2023
Merged
Various cleanups #3935
StephanTLavavej
merged 23 commits into
microsoft:main
from
StephanTLavavej:stl-cleanups
Aug 11, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…onditionally included headers.
The only usage of `_Cx_exp2()` is initializing `static constexpr _Cy_t _Cy` and `static constexpr _Ty _Scale1`, so it's always being evaluated at compile-time.
This skips a domain redirection. This also updates a `support.microsoft.com` URL in the README that's being redirected. Finally, this adds specific links to `StlCompareStringA.cpp`, `StlCompareStringW.cpp`, `StlLCMapStringA.cpp`, `StlLCMapStringW.cpp`. Intentionally not changing `SECURITY.md`.
We **never** defined `_THREAD_CHECK` in the internal or GitHub builds, so this code simply collapses to `#ifdef _DEBUG`.
We don't need to qualify `size_t` at all. Intentionally not attempting to make `<hash_map>` and `<hash_set>` less polluting.
It appears that we don't usually mark the definitions (but perhaps we should).
This is more lines, but easier to follow. Note that the result of the compound assignment is the left operand. The if-return-else-return is deliberate.
The `stl_condition_variable_max_MEOW` constants in `primitives.hpp` were exactly identical to the `_Cnd_internal_imp_MEOW` constants in `xthreads.h`, because we use `_Aligned_storage` with no other data members. This unifies them, keeping the `xthreads.h` names but the simpler `primitives.hpp` definition technique and clearer comments. Finally, this makes the `static_assert`s in `cond.cpp` tautological, so this removes them.
AlexGuteniev
reviewed
Aug 8, 2023
CaseyCarter
approved these changes
Aug 9, 2023
@CaseyCarter I've pushed a commit to address one of your comments. |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
CaseyCarter
approved these changes
Aug 10, 2023
I've pushed a merge with
|
CaseyCarter
approved these changes
Aug 10, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is admittedly somewhat hypocritical as I've mentioned that maintainer capacity is sharply limited and cleanups take time away from features and bugfixes (including libcxx skip reduction which I'd like to see). That said, while reviewing PRs, I notice a lot of things that aren't worth resetting testing of those PRs, but collectively add up.
We strongly discourage "grab bag" PRs, so I've separated out #3934 as a fairly large semi-mechanical test change. The remaining changes here are numerous, but individually small and safe, so it's easier to review (and merge) one PR with well-structured commits instead of 20 ultra-tiny PRs. (The problem with "grab bag" PRs is when large changes are mixed with other changes, or when major semantic changes are mixed with cleanups. The impact of each change here is very small.)
Nevertheless, I can decompose this into smaller PRs if desired (that's the great thing about having fine-grained commits).
The commits:
_Xtime_diff_to_millis2
with#ifdef _CRTBLD
.stl/inc
headers, so we don't need to emit this declaration for users. (This doesn't affect the export surface since we continue to declare it forstl/src
and the declaration matches the definition. We shouldn't have exported it at all, which we can fix during vNext - we don't really need an explicit comment saying so, since the presence of#ifdef _CRTBLD
is sufficient.)_Execute_once
,_Execute_once_fp_t
with#ifdef _CRTBLD
.__msvc_sanitizer_annotate_container.hpp
with other unconditionally included headers.basic_istream
constructor._CONSTEVAL
,_Cx_exp2()
can be plainconstexpr
._Cx_exp2()
is initializingstatic constexpr _Cy_t _Cy
andstatic constexpr _Ty _Scale1
, so it's always being evaluated at compile-time.const _Auto_id_tag
unnamed parameters.const
.explicit _Auto_id_tag() = default;
to defend against mistakes.{}
), so we should do this for our own tags.docs.microsoft.com
=>learn.microsoft.com
support.microsoft.com
URL in the README that's being redirected. Finally, this adds specific links toStlCompareStringA.cpp
,StlCompareStringW.cpp
,StlLCMapStringA.cpp
,StlLCMapStringW.cpp
. Intentionally not changingSECURITY.md
.typename
=>class
in product code._THREAD_CHECK
,_THREAD_CHECKX
._THREAD_CHECK
in the internal or GitHub builds, so this code simply collapses to#ifdef _DEBUG
.stdext
.size_t
at all. Intentionally not attempting to make<hash_map>
and<hash_set>
less polluting._Big_uint128::operator<
as_NODISCARD
.uncaught_exception()
anduncaught_exceptions()
as_NODISCARD
._EXPORT_STD extern "C++"
is intentionally not repeated as the separately compiled STL is always built clasically.MATCHES "\^(\w+)\$"
=>STREQUAL "$1"
STATIC_ASSERT(CanViewElements<Rng&>)
, assume it's true.<random>
: Decompose complicated conditional expression.if
-return
-else
-return
is deliberate._Cnd_internal_imp_t
size/align constants.stl_condition_variable_max_MEOW
constants inprimitives.hpp
were exactly identical to the_Cnd_internal_imp_MEOW
constants inxthreads.h
, because we use_Aligned_storage
with no other data members. This unifies them, keeping thexthreads.h
names but the simplerprimitives.hpp
definition technique and clearer comments. Finally, this makes thestatic_assert
s incond.cpp
tautological, so this removes them.