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

Commits on Oct 7, 2024

  1. 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.
    
    PiperOrigin-RevId: 683152452
    protobuf-github-bot authored and copybara-github committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    8cc5f6b View commit details
    Browse the repository at this point in the history