Breaking: Use C++ 20 #1382

Closed
NickGerleman wants to merge 1 commits from export-D49261607 into main
NickGerleman commented 2023-09-13 20:42:09 -07:00 (Migrated from github.com)

Summary:
X-link: https://github.com/facebook/react-native/pull/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)
  2. Clang 14 (~2.5 years old)
  3. VS 16.11 (~2 years old)

For mobile this means:

  1. NDK 26 (still in Beta 😭)
  2. 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.
Differential Revision: D49261607

Summary: X-link: https://github.com/facebook/react-native/pull/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. Differential Revision: D49261607
facebook-github-bot commented 2023-09-13 20:42:16 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-13 21:51:02 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-15 14:31:41 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-15 21:16:37 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-17 20:13:02 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-17 20:49:07 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-17 20:54:18 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 00:32:21 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 00:41:55 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 18:00:02 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 18:07:01 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 18:12:52 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 18:18:20 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 18:28:28 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 18:33:45 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 18:45:34 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 18:52:09 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 20:10:59 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 20:46:03 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 20:52:33 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 21:00:05 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 21:20:44 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 21:41:29 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-18 21:47:41 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-19 00:31:38 -07:00 (Migrated from github.com)

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

This pull request was **exported** from Phabricator. Differential Revision: [D49261607](https://www.internalfb.com/diff/D49261607)
facebook-github-bot commented 2023-09-19 01:34:47 -07:00 (Migrated from github.com)

This pull request has been merged in facebook/yoga@557d2a76fe.

This pull request has been merged in facebook/yoga@557d2a76fe901b2bd544cdb1867781d1e1c77942.

Pull request closed

Sign in to join this conversation.
No description provided.