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

Simplify thread0.cpp and xthrow.cpp. #320

Merged
merged 2 commits into from
Nov 21, 2019

Conversation

StephanTLavavej
Copy link
Member

Description

I verified with #error that these files are always compiled with _HAS_EXCEPTIONS=1.

thread0.cpp
Include only necessary headers.

Move the lookup tables within _STD_BEGIN to avoid repeated _STD qualification. They're static, so this doesn't affect bincompat.

Add trailing commas for readability.

Make codes a table of errc so we don't need to cast each value.

Mark _Throw_Cpp_error as [[noreturn]], matching its declaration in the header. (No bincompat effect.)

Use _THROW for consistency. (Even though exceptions are enabled, we conventionally use this in src.)

system_error is a type, so we don't need to _STD qualify it.

static_cast<int> the errc, once.

xthrow.cpp
Coalesce headers. Coalesce std regions.

Remove unnecessary comments.

Mark value parameters as const.

Checklist

Be sure you've read README.md and understand the scope of this repo.

If you're unsure about a box, leave it unchecked. A maintainer will help you.

  • Identifiers in product code changes are properly _Ugly as per
    https://eel.is/c++draft/lex.name#3.1 or there are no product code changes.
  • The STL builds successfully and all tests have passed (must be manually
    verified by an STL maintainer before automated testing is enabled on GitHub,
    leave this unchecked for initial submission).
  • These changes introduce no known ABI breaks (adding members, renaming
    members, adding virtual functions, changing whether a type is an aggregate
    or trivially copyable, etc.).
  • These changes were written from scratch using only this repository,
    the C++ Working Draft (including any cited standards), other WG21 papers
    (excluding reference implementations outside of proposed standard wording),
    and LWG issues as reference material. If they were derived from a project
    that's already listed in NOTICE.txt, that's fine, but please mention it.
    If they were derived from any other project (including Boost and libc++,
    which are not yet listed in NOTICE.txt), you must mention it here,
    so we can determine whether the license is compatible and what else needs
    to be done.

I verified with `#error` that these files are always compiled with
`_HAS_EXCEPTIONS=1`.

thread0.cpp
Include only necessary headers.

Move the lookup tables within `_STD_BEGIN` to avoid repeated `_STD`
qualification. They're `static`, so this doesn't affect bincompat.

Add trailing commas for readability.

Make `codes` a table of `errc` so we don't need to cast each value.

Mark `_Throw_Cpp_error` as `[[noreturn]]`, matching its declaration
in the header. (No bincompat effect.)

Use `_THROW` for consistency. (Even though exceptions are enabled,
we conventionally use this in `src`.)

`system_error` is a type, so we don't need to `_STD` qualify it.

`static_cast<int>` the `errc`, once.

xthrow.cpp
Coalesce headers. Coalesce `std` regions.

Remove unnecessary comments.

Mark value parameters as const.
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner November 20, 2019 04:51
@StephanTLavavej StephanTLavavej merged commit 8f4c816 into microsoft:master Nov 21, 2019
@StephanTLavavej StephanTLavavej deleted the simplify_src branch November 21, 2019 01:10
@StephanTLavavej
Copy link
Member Author

Microsoft-internal MSVC-PR-215268 succeeded.

fengjixuchui added a commit to fengjixuchui/STL that referenced this pull request Nov 21, 2019
Simplify thread0.cpp and xthrow.cpp. (microsoft#320)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants