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

FloatOptional GCC build fix and more constexpr #1411

Closed
wants to merge 22 commits into from

Conversation

NickGerleman
Copy link
Contributor

@NickGerleman NickGerleman commented Oct 3, 2023

GCC flags that is is not declared constexpr but that unwrapOrDefault() is. std::isnan is not constexpr until C++ 23 (because we cannot have nice things), so I made yoga::isUndefined() constexpr, using the same code std::isnan() boils down to. I then made FloatOptional depend on Comparison.h (instead of the other way around), so we can use it.

I have no idea how Clang is okay with`unwrapOrDefault()` here.
@NickGerleman NickGerleman changed the title Fix FloatOptional GCC Build FloatOptional GCC build fix and more constexpr Oct 4, 2023
@facebook-github-bot
Copy link
Contributor

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Oct 5, 2023
Summary:
X-link: facebook/yoga#1411

Pull Request resolved: facebook#39796

X-link: facebook/yoga#1414

GCC flags that `isUndefined()` is not declared `constexpr` but that `unwrapOrDefault()` is. `std::isnan` is not constexpr until C++ 23 (because we cannot have nice things), so I made `yoga::isUndefined()` constexpr, using the same code `std::isnan()` boils down to. I then made `FloatOptional` depend on `Comparison.h` (instead of the other way around), so we can use it.

Note that the use of the `std::floating_point` concept here requires the libc++ bump in the previous diff in the stack.

Reviewed By: yungsters

Differential Revision: D49896837

fbshipit-source-id: 7eb01752afc41ef64a561f8a7ada01a644608ceb
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Oct 5, 2023
Summary:
X-link: facebook/yoga#1411


X-link: facebook/yoga#1414

GCC flags that `isUndefined()` is not declared `constexpr` but that `unwrapOrDefault()` is. `std::isnan` is not constexpr until C++ 23 (because we cannot have nice things), so I made `yoga::isUndefined()` constexpr, using the same code `std::isnan()` boils down to. I then made `FloatOptional` depend on `Comparison.h` (instead of the other way around), so we can use it.

Note that the use of the `std::floating_point` concept here requires the libc++ bump in the previous diff in the stack.

Reviewed By: yungsters

Differential Revision: D49896837
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Oct 5, 2023
Summary:
X-link: facebook/yoga#1411


X-link: facebook/yoga#1414

GCC flags that `isUndefined()` is not declared `constexpr` but that `unwrapOrDefault()` is. `std::isnan` is not constexpr until C++ 23 (because we cannot have nice things), so I made `yoga::isUndefined()` constexpr, using the same code `std::isnan()` boils down to. I then made `FloatOptional` depend on `Comparison.h` (instead of the other way around), so we can use it.

Note that the use of the `std::floating_point` concept here requires the libc++ bump in the previous diff in the stack.

Reviewed By: yungsters

Differential Revision: D49896837
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Oct 6, 2023
Summary:
X-link: facebook/yoga#1411


X-link: facebook/yoga#1414

GCC flags that `isUndefined()` is not declared `constexpr` but that `unwrapOrDefault()` is. `std::isnan` is not constexpr until C++ 23 (because we cannot have nice things), so I made `yoga::isUndefined()` constexpr, using the same code `std::isnan()` boils down to. I then made `FloatOptional` depend on `Comparison.h` (instead of the other way around), so we can use it.

Note that the use of the `std::floating_point` concept here requires the libc++ bump in the previous diff in the stack.

Reviewed By: yungsters

Differential Revision: D49896837
facebook-github-bot pushed a commit to facebook/litho that referenced this pull request Oct 6, 2023
Summary:
X-link: facebook/yoga#1411

X-link: facebook/react-native#39796

X-link: facebook/yoga#1414

GCC flags that `isUndefined()` is not declared `constexpr` but that `unwrapOrDefault()` is. `std::isnan` is not constexpr until C++ 23 (because we cannot have nice things), so I made `yoga::isUndefined()` constexpr, using the same code `std::isnan()` boils down to. I then made `FloatOptional` depend on `Comparison.h` (instead of the other way around), so we can use it.

Note that the use of the `std::floating_point` concept here requires the libc++ bump in the previous diff in the stack.

Reviewed By: yungsters

Differential Revision: D49896837

fbshipit-source-id: 61e2bbbfedecffd007a12d42d998e43d3cf5119c
facebook-github-bot pushed a commit that referenced this pull request Oct 6, 2023
Summary:
Pull Request resolved: #1411

X-link: facebook/react-native#39796

Pull Request resolved: #1414

GCC flags that `isUndefined()` is not declared `constexpr` but that `unwrapOrDefault()` is. `std::isnan` is not constexpr until C++ 23 (because we cannot have nice things), so I made `yoga::isUndefined()` constexpr, using the same code `std::isnan()` boils down to. I then made `FloatOptional` depend on `Comparison.h` (instead of the other way around), so we can use it.

Note that the use of the `std::floating_point` concept here requires the libc++ bump in the previous diff in the stack.

Reviewed By: yungsters

Differential Revision: D49896837

fbshipit-source-id: 61e2bbbfedecffd007a12d42d998e43d3cf5119c
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Oct 6, 2023
Summary:
X-link: facebook/yoga#1411

Pull Request resolved: #39796

X-link: facebook/yoga#1414

GCC flags that `isUndefined()` is not declared `constexpr` but that `unwrapOrDefault()` is. `std::isnan` is not constexpr until C++ 23 (because we cannot have nice things), so I made `yoga::isUndefined()` constexpr, using the same code `std::isnan()` boils down to. I then made `FloatOptional` depend on `Comparison.h` (instead of the other way around), so we can use it.

Note that the use of the `std::floating_point` concept here requires the libc++ bump in the previous diff in the stack.

Reviewed By: yungsters

Differential Revision: D49896837

fbshipit-source-id: 61e2bbbfedecffd007a12d42d998e43d3cf5119c
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