-
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
Cleanup compiler bug workarounds and their comments #4362
Merged
StephanTLavavej
merged 30 commits into
microsoft:main
from
StephanTLavavej:workaround-comments
Feb 6, 2024
Merged
Cleanup compiler bug workarounds and their comments #4362
StephanTLavavej
merged 30 commits into
microsoft:main
from
StephanTLavavej:workaround-comments
Feb 6, 2024
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
…hat only MSVC has trouble with.
In C++23 mode, we should simply skip EDG instead of expecting it to give the wrong answer. This is VSO-1601179 "REPORTED: EDG's overload resolution incorrectly considers some ambiguous conversions to be unambiguous".
…cpp_lib_is_pointer_interconvertible`. This has the same effect, and is still marked with `// TRANSITION, LLVM-48860` as a reminder. I think this makes the `#endif` comment clearer, as it's separated by a huge distance and contains nested preprocessor logic. Checking the feature-test macros instead of the compiler also makes it clearer what to do in the future, even without "no workaround" to tell us.
… || defined(__EDG__)`.
…) && !defined(__EDG__)`.
This code is obviously desired.
…^ workaround ^^^`.
…^ no workaround ^^^`.
… no workaround ^^^`. This guards desired test code that we're skipping for Debug EDG.
…^^ no workaround ^^^`. This guards desired test code that we're skipping for `/analyze` (aka Prefast) and EDG.
These are all guarding desired test code that we're skipping for EDG.
This `tuple_tester` constructor works around an EDG bug with parenthesized aggregate initialization, and is undesired code.
… no workaround ^^^`. These are all guarding desired test code that we're skipping for MSVC.
… workaround ^^^`. All of this code is workaround machinery for separate Clang and EDG bugs.
…^^ no workaround ^^^`. This guards desired test code that we're skipping for Clang and EDG due to separate bugs.
…^^ workaround ^^^`. All of this code is MSVC-only workaround machinery.
These are all guarding desired test code that we're skipping for `/clr`.
This guards desired test code that we're skipping for `/clr:pure`.
This guards a C++/CX workaround, which is undesired code.
All of this guards desired code that we're skipping for Clang.
…^^^ no workaround ^^^`. All of this guards desired code that we're skipping for Clang x86.
All of this guards Clang-only workarounds, which are undesired code.
… ^^^`. This guards desired test code that we're skipping for ASan.
…workaround ^^^`. This is desired code that's waiting for compiler support.
frederick-vs-ja
added a commit
to frederick-vs-ja/STL
that referenced
this pull request
Feb 3, 2024
Possibly conflicts with microsoft#4362.
… removal of that line.
I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
CaseyCarter
approved these changes
Feb 5, 2024
I've pushed a merge with |
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.
Prologue
While reviewing code and adding/removing compiler bug workarounds, I became increasingly aware of our inconsistent comments. Sometimes we have extremely helpful
^^^ workaround ^^^
vs.^^^ no workaround ^^^
arrow comments, which makes it clear what code is "good", and what to do when removing the workarounds. Elsewhere, we have the older convention of just repeating the preprocessor condition (sometimes with arrows), which is fine in general but not for workarounds.For example, we have some lines
#if defined(__clang__) || defined(__EDG__)
that are performing their traditional function of guarding desired test code that we're skipping for MSVC. But we also have lines of the exact same form that are guarding workaround machinery for separate Clang and EDG bugs! This is too confusing, so I went on a cleanup spree.Along the way, I found a few compiler bug workarounds that were messed up, so I'm fixing those. These are called out under the "functional changes". I tried very hard to avoid making this a grab-bag PR, but I still wanted to clean up a few preprocessor lines for compiler bug workarounds, called out as "non-functional changes". There's a very small number of "miscellaneous comment cleanups", and then the rest is pure, highly systematic comment cleanups for the workaround arrows.
It might look like I mechanically performed these changes with a regex, but while I searched for them mechanically, I manually reviewed, categorized, and edited each of them. Manual changes with robotic precision - that's my trademark! 🤖
Preprocessor Functional Changes
Preprocessor Non-Functional Changes
__cpp_lib_is_layout_compatible
and__cpp_lib_is_pointer_interconvertible
.// TRANSITION, LLVM-48860
as a reminder. I think this makes the#endif
comment clearer, as it's separated by a huge distance and contains nested preprocessor logic. Checking the feature-test macros instead of the compiler also makes it clearer what to do in the future, even without "no workaround" to tell us.defined(__clang__) || defined(__EDG__)
.!defined(__clang__) && !defined(__EDG__)
.Miscellaneous Comment Cleanups
Workaround Arrow Comment Cleanups
no workaround
.#else // ^^^ no workaround / workaround vvv
with#endif // ^^^ workaround ^^^
.#else // ^^^ workaround / no workaround vvv
with#endif // ^^^ no workaround ^^^
.#if !(defined(_DEBUG) && defined(__EDG__))
with#endif // ^^^ no workaround ^^^
.#if !defined(_PREFAST_) && !defined(__EDG__)
with#endif // ^^^ no workaround ^^^
./analyze
(aka Prefast) and EDG.#ifndef __EDG__
with#endif // ^^^ no workaround ^^^
.#ifdef __EDG__
with#endif // ^^^ workaround ^^^
.tuple_tester
constructor works around an EDG bug with parenthesized aggregate initialization, and is undesired code.#if defined(__clang__) || defined(__EDG__)
with#endif // ^^^ no workaround ^^^
.#if defined(__clang__) || defined(__EDG__)
with#endif // ^^^ workaround ^^^
.#if !defined(__clang__) && !defined(__EDG__)
with#endif // ^^^ no workaround ^^^
.#if !defined(__clang__) && !defined(__EDG__)
with#endif // ^^^ workaround ^^^
.#ifndef _M_CEE
with#endif // ^^^ no workaround ^^^
./clr
.#ifndef _M_CEE_PURE
with#endif // ^^^ no workaround ^^^
./clr:pure
.#ifdef __cplusplus_winrt
with#endif // ^^^ workaround ^^^
.#ifndef __clang__
with#endif // ^^^ no workaround ^^^
.#if !(defined(__clang__) && defined(_M_IX86))
with#endif // ^^^ no workaround ^^^
.#ifdef __clang__
with#endif // ^^^ workaround ^^^
.#ifndef __SANITIZE_ADDRESS__
with#endif // ^^^ no workaround ^^^
.defined(_MSVC_EXECUTION_CHARACTER_SET)
with#endif // ^^^ no workaround ^^^
.<algorithm>
comment change to avoid conflicting with ADL-proof implementation of remaining sorting-related algorithms #4367's removal of that line.Epilogue
__cpp_lib_concepts
for EDG, part 3 #4298, which I will easily resolve when landing these PRs.prod/be
changes).