Repository navigation
Conversation
Summary: The vendored xxHash header in RocksDB used `std::unreachable()` whenever `__cplusplus` is newer than C++20, so building in C++23 mode against a standard library that lacks it (such as libstdc++ 11) fails with "no member named 'unreachable' in namespace 'std'". It now uses `std::unreachable()` only when `<utility>` defines `__cpp_lib_unreachable` (the check upstream xxHash documents), and otherwise keeps the existing `__builtin_unreachable()` fallback, so generated code is unchanged on every current build. `fbcode/rocksdb/src` gets this fix through the RocksDB release process. ___ landed-with-radar-review Differential Revision: D131078354
|
@r-barnes has exported this pull request. If you are a Meta employee, you can view the originating Diff in D131078354. |
✅ clang-tidy: No findings on changed linesCompleted in 0.0s. |
✅ Claude Code ReviewAuto-triggered after CI passed — reviewing commit 478989b SummaryThis is a correct and well-motivated fix. Checking High-severity findings (0): Full review (click to expand)Findings🟡 MEDIUMM1.
|
| Context | Affected? | Analysis |
|---|---|---|
| Normal compilation (C++20) | No | CMAKE_CXX_STANDARD defaults to 20; __cplusplus is not > 202002L, so neither the old nor new code path for std::unreachable() is reached. Falls through to __builtin_unreachable() or __assume(0). |
| C++23 mode with modern libstdc++/libc++ | Yes (safe) | __cpp_lib_unreachable is defined after #include <utility>, so std::unreachable() is used. Same behavior as before. |
| C++23 mode with old libstdc++ (e.g., 11) | Yes (fixed) | Previously failed to compile because std::unreachable() was selected but doesn't exist. Now correctly falls through to __builtin_unreachable(). |
| MSVC | No | MSVC uses __assume(0) via the _MSC_VER branch, which is earlier in the cascade. |
| xxhash.cc compilation | Yes | XXH_IMPLEMENTATION is defined, so the customization block is active. Same analysis as above applies. |
Positive Observations
- The fix is minimal and surgical — only the detection condition changes, preserving the fallback cascade.
- The change matches the C++ standard's recommended way to detect library features via feature-test macros.
- No behavioral change for any correctly-functioning build; only fixes broken builds.
- The PR description clearly explains the motivation and scope.
ℹ️ About this response
Generated by Claude Code.
Review methodology: claude_md/ci_review_prompt.md
Limitations:
- Claude may miss context from files not in the diff
- Large PRs may be truncated
- Always apply human judgment to AI suggestions
Commands:
/claude-review [context]— Request a code review/claude-query <question>— Ask about the PR or codebase
|
This pull request has been merged in 6c2e1c9. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
The vendored xxHash header in RocksDB used
std::unreachable()whenever__cplusplusis newer than C++20, so building in C++23 mode against a standard library that lacks it (such as libstdc++ 11) fails with "no member named 'unreachable' in namespace 'std'". It now usesstd::unreachable()only when<utility>defines__cpp_lib_unreachable(the check upstream xxHash documents), and otherwise keeps the existing__builtin_unreachable()fallback, so generated code is unchanged on every current build.fbcode/rocksdb/srcgets this fix through the RocksDB release process.landed-with-radar-review
Differential Revision: D131078354