Skip to content

: Fix preprocessor logic - #2615

Merged
Stephan T. Lavavej (StephanTLavavej) merged 5 commits into
microsoft:mainfrom
barcharcraz:fix_stdatomic_preprocessor
Mar 28, 2022
Merged

Stephan T. Lavavej (StephanTLavavej) merged 5 commits into
microsoft:mainfrom
barcharcraz:fix_stdatomic_preprocessor

Conversation

@barcharcraz

Copy link
Copy Markdown
Contributor

Because this header needs to work in C and C++, we needed to move the check for a non-broken preprocessor outside of yvals_core, but we didn't actually skip the whole header if it failed!

This PR fixes that. In addition, it:

  • Reverses the conditional logic to avoid needing to use an "else" branch
  • Changes the #if _STL_COMPILER_PREPROCESSOR to _STL_INTERNAL_STATIC_ASSERT(_STL_COMPILER_PREPROCESSOR);

@barcharcraz
Charlie Barto (barcharcraz) requested a review from a team as a code owner March 23, 2022 20:17
@CaseyCarter Casey Carter (CaseyCarter) added the bug Something isn't working label Mar 23, 2022
Comment thread stl/inc/stdatomic.h Outdated
Comment thread stl/inc/stdatomic.h Outdated
@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) added enhancement Something can be improved and removed bug Something isn't working labels Mar 23, 2022
@StephanTLavavej

Copy link
Copy Markdown
Member

Relabeling - I don't think that this was a bug, strictly speaking, as for non-compiler tools we'd skip the C check, include yvals.h (which would skip its contents), and then skip the rest of the file - which should work (if my vague understanding of the non-compiler tools is correct).

I do believe that simply skipping the whole thing is an improvement.

@barcharcraz

Copy link
Copy Markdown
Contributor Author

Relabeling - I don't think that this was a bug, strictly speaking, as for non-compiler tools we'd skip the C check, include yvals.h (which would skip its contents), and then skip the rest of the file - which should work (if my vague understanding of the non-compiler tools is correct).

I do believe that simply skipping the whole thing is an improvement.

Good point, the comment was confusing though and it caused me to write my own bug when modifying the header, so I would also say it's an improvement

@StephanTLavavej

Copy link
Copy Markdown
Member

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

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 1b6fa43 into microsoft:main Mar 28, 2022
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for simplifying this code! ✨ 😸 ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants