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 bitfields #1393

Closed
wants to merge 2 commits into from
Closed

Conversation

NickGerleman
Copy link
Contributor

Summary:
These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are efftively int32_t, along with GCC -Wconversion being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

Differential Revision: D49265967

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Sep 16, 2023
Summary:
Pull Request resolved: facebook#39485

X-link: facebook/yoga#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are efftively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

Differential Revision: D49265967

fbshipit-source-id: 7aeb613352943f57f8a2f8a7274514996b0a0917
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 16, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are efftively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

Differential Revision: D49265967

fbshipit-source-id: f72f9dec4caf0acaccf49902f2d3537187445fbe
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 18, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are efftively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

Differential Revision: D49265967

fbshipit-source-id: 0a5c7a24dc0eade1ca037f0c8660a9e442da198f
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Sep 18, 2023
Summary:
Pull Request resolved: facebook#39485

X-link: facebook/yoga#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are efftively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

Differential Revision: D49265967

fbshipit-source-id: adaa2973d671f6fbd79ffc063f572fb9c725b1ba
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 18, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are efftively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

Differential Revision: D49265967

fbshipit-source-id: 2fa14d74f60cafcbbba9956cd6f9ce069a9b1c7c
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Sep 18, 2023
Summary:
Pull Request resolved: facebook#39485

X-link: facebook/yoga#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are efftively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

Differential Revision: D49265967

fbshipit-source-id: c4c8a9392f68c9b398827e50880fed400554b738
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Sep 18, 2023
Summary:
Pull Request resolved: facebook#39485

X-link: facebook/yoga#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are efftively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

Differential Revision: D49265967

fbshipit-source-id: 787382a31cadf37aece0842c8788cfd51ba2f055
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 18, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are efftively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

Differential Revision: D49265967

fbshipit-source-id: f368d342d7c2a18b5b61469ded5dd6e1b2b939f5
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 19, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: 6eddef135c0105e6f3d535849091550ffc5c05e7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 19, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: 21f3e852510d21b7c3db184eb5886a808474aade
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 19, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: b4d23585831f9db16ad32e58189843ade6408427
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 19, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: 2a5b07f286cd7704594ba5ce92a3d29b734235b0
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 19, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: eda30a80d4948b950a11b52f63b9036479df05aa
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 19, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: 4e5a6de77f7b8bab07004b3c5886923fa9567290
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 19, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: a2d7ff728ffddb5b4bf9beccd08078247414fbca
Summary:
Pull Request resolved: facebook#1382

X-link: facebook/react-native#39437

Have been running into places where C++ 20 makes life easier for use like `std::bit_cast` (that one is easy to polyfill), in-class member initializer support for bitfields, designated initializers, defaulted comparison operator, concepts instead of SFINAE, and probably more.

Our other infra is in the process of making this jump, or already has. This tests it out everywhere, across the various reference builds, to see if we have any issues.

This is a bit more aggressive than I had previously communicated, but n - 1 is going to be a better long term place than n - 2.

If we wanted to use `std::bit_cast` we would need one of:
1. GCC 11+ (~2.5 years old)
1. Clang 14 (~2.5 years old)
1. VS 16.11 (~2 years old)

For mobile this means:
1. NDK 26 (still in Beta 😭)
1. XCode 14.3.0 (~6 months old)

https://en.cppreference.com/w/cpp/compiler_support/20

That isn't quite doable yet, but we can start taking advantage of language features in the meantime. More of these will be supported in older toolchains.

Anyone needing support for older C++ versions can lag behind on more recent changes. E.g. Yoga 2.0 supports C++ 14.

bypass-github-export-checks

Changelog: [Internal]

Differential Revision: https://internalfb.com/D49261607

fbshipit-source-id: 660e510e884c89c0b12e5432dbb19bbb968928b4
NickGerleman added a commit to NickGerleman/yoga that referenced this pull request Sep 19, 2023
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

bypass-github-export-checks

Changelog:
[General][Breaking] - Require C++ 20 when including renderer headers

Differential Revision: https://internalfb.com/D49265967

fbshipit-source-id: 8cd943ca329d28d6b4336bf74734bda53916c1ea
Summary:
X-link: facebook/react-native#39485

Pull Request resolved: facebook#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

bypass-github-export-checks

Changelog:
[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: 7aba8d5c0c296fec571f2e29279648b93eacfbab
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D49265967

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in ea3869f.

facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Sep 19, 2023
Summary:
Pull Request resolved: #39485

X-link: facebook/yoga#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

bypass-github-export-checks

Changelog:
[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: 6ab935a866196df06e742c821f3af88eb4d18e1a
facebook-github-bot pushed a commit to facebook/litho that referenced this pull request Sep 19, 2023
Summary:
X-link: facebook/react-native#39485

X-link: facebook/yoga#1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

bypass-github-export-checks

Changelog:
[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: 6ab935a866196df06e742c821f3af88eb4d18e1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants