Repository navigation
Fix GCC 16 compile Error - #3583
Conversation
1.The -D__STRICT_ANSI__ in CMakeLists.txt conflicts with libstdc++ 16's
__int128 specialization
2. H2StreamContext is incomplete, so sizeof throws an error, causing
unique_ptr to fail
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
GCC 16 build compatibility remains unverified and needs target-toolchain validation before approval.
Review effort: Balanced
Findings: None
What changed in this PR
Addresses GCC 16 compilation issues in bRPC’s CMake configuration and HTTP/2 request handling.
Changes:
- Adds a compile probe before defining
__STRICT_ANSI__. - Moves
H2UnsentRequestconstruction and destruction out of the header to resolve incomplete-type errors.
| File | Description |
|---|---|
| src/brpc/policy/http2_rpc_protocol.h | Replaces inline constructor and destructor definitions with declarations. |
| src/brpc/policy/http2_rpc_protocol.cpp | Defines the constructor and destructor where the stream type is complete. |
| CMakeLists.txt | Conditionally enables __STRICT_ANSI__ based on compilation support. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
LGTM |
|
Could we simply remove the explicit We should let the compiler define this macro according to the selected language mode. Neither the Make nor Bazel build explicitly defines it; their I traced the CMake definition to commit 9b6b004 (2017), whose main change was to avoid compiling sources twice. It did not document a specific requirement for this macro, and I found no brpc source code checking it directly. Removing the manual definition would avoid the reported libstdc++ 16 conflict without introducing another configuration check. If strict ISO mode is intended, it should be selected through CMake language-mode settings rather than by forcing the macro. |
1. Remove __STRICT_ANSI__ definition instead of probing it
What problem does this PR solve?
Issue Number: No
Problem Summary:
What is changed and the side effects?
Changed:
The -D__STRICT_ANSI__ in CMakeLists.txt conflicts with libstdc++ 16's __int128 specialization
H2StreamContext is incomplete, so sizeof throws an error, causing unique_ptr to fail
Side effects:
No
No
Check List: