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

Avoid evil macros #3776

Merged
merged 5 commits into from Jun 22, 2023
Merged

Conversation

StephanTLavavej
Copy link
Member

@StephanTLavavej StephanTLavavej commented Jun 16, 2023

ICU previously macroized these reserved names. This was fixed by unicode-org/icu#1555 on 2021-02-01, but old versions of ICU are still being used by various projects. Let's avoid these names for now. I haven't added test coverage because the UCRT uses some of these reserved names (which it's getting away with, due to the specific order in which headers are being included).

Fixes VSO-1837381 "[RWC][prod/fe][Regression] PDFium failed with error C2209: 'std::_Aligned_storage_t<64,8>': aliases cannot be used in constructor declarations".

  • _Cs => _Cs_storage
  • _No => _Nope
    • This makes <deque> _Is_bidi consistent with <format> _Add_newline, <xlocale> _Case_sensitive, etc.
  • _Mn => _Min_, also _Mx => _Max_ for consistency
    • This is our conventional pattern for avoiding parameters shadowing data members.
  • _Cc => _Cx, also _Yy => _Yx and _Nn => _Nx for consistency
    • This is our common pattern for "single letter" variable names.
  • _Pi => _Pi_val

This introduces a slight but acceptable asymmetry with mutex.cpp.
This makes `<deque>` `_Is_bidi` consistent with `<format>` `_Add_newline`, `<xlocale>` `_Case_sensitive`, etc.
This is our conventional pattern for avoiding parameters shadowing data members.
This is our common pattern for "single letter" variable names.
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jun 16, 2023
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner June 16, 2023 20:01
@github-actions github-actions bot added this to Initial Review in Code Reviews Jun 16, 2023
@StephanTLavavej StephanTLavavej moved this from Initial Review to Final Review in Code Reviews Jun 16, 2023
@strega-nil-ms strega-nil-ms moved this from Final Review to Ready To Merge in Code Reviews Jun 19, 2023
@StephanTLavavej StephanTLavavej self-assigned this Jun 22, 2023
@StephanTLavavej
Copy link
Member Author

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

@StephanTLavavej StephanTLavavej merged commit 51fd0c0 into microsoft:main Jun 22, 2023
37 checks passed
Code Reviews automation moved this from Ready To Merge to Done Jun 22, 2023
@StephanTLavavej StephanTLavavej deleted the evil-macros branch June 22, 2023 18:53
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
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants