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

Fix compilation in Clang C23 mode. #18632

Merged
merged 1 commit into from
Oct 7, 2024
Merged

Fix compilation in Clang C23 mode. #18632

merged 1 commit into from
Oct 7, 2024

Conversation

copybara-service[bot]
Copy link

Fix compilation in Clang C23 mode.

In C23, false is now of type bool, not int. This turned a couple places where false was returned instead of NULL into errors.

The workaround in upb for Windows's broken NAN macro causes an error in Clang under C23, cannot compile this static initializer yet, I believe because 0.0 / 0.0 is not valid in constant-evaluation. This seems like it's probably a legitimate result of C23 standardizing constexpr, although it could be a clang bug. In any case, refine the workaround a bit, to avoid this problem.

I've also reverted the kUpb_FltInfinity/kUpb_Infinity back to their former definitions, as INFINITY wasn't broken by the windows header, only NAN.

@copybara-service copybara-service bot force-pushed the test_682723511 branch 2 times, most recently from 86bddb9 to 2d5d304 Compare October 7, 2024 12:50
In C23, `false` is now of type `bool`, not `int`. This turned a couple places where `false` was returned instead of `NULL` into errors.

The workaround in upb for Windows's broken NAN macro causes an error in Clang under C23, `cannot compile this static initializer yet`, I believe because `0.0 / 0.0` is not valid in constant-evaluation. This seems like it's probably a legitimate result of C23 standardizing constexpr, although it _could_ be a clang bug. In any case, refine the workaround a bit, to avoid this problem.

I've also reverted the kUpb_FltInfinity/kUpb_Infinity back to their former definitions, as INFINITY wasn't broken by the windows header, only NAN.

PiperOrigin-RevId: 683152452
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant