This is an automated email from the ASF dual-hosted git repository.

wasphin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 84286d2f Fix GCC 16 compile Error (#3583)
84286d2f is described below

commit 84286d2f1b7982ae8ba3d8e734685bdeb0685101
Author: pynj2026 <[email protected]>
AuthorDate: Tue Oct 6 15:54:43 2026 +0800

    Fix GCC 16 compile Error (#3583)
    
    * Fix GCC 16 compile Error:
    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
    
    * Fix GCC 16 compile Error:
    1. Remove __STRICT_ANSI__ definition instead of probing it
    
    ---------
    
    Co-authored-by: panyfx <[email protected]>
---
 CMakeLists.txt                         |  1 -
 src/brpc/policy/http2_rpc_protocol.cpp | 16 ++++++++++++++++
 src/brpc/policy/http2_rpc_protocol.h   | 16 ++--------------
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9e1aa8f..e98e0c4f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -191,7 +191,6 @@ list(APPEND BRPC_COMMON_DEFINITIONS
     __STDC_FORMAT_MACROS
     __STDC_LIMIT_MACROS
     __STDC_CONSTANT_MACROS
-    __STRICT_ANSI__
 )
 
 if(WITH_ASAN)
diff --git a/src/brpc/policy/http2_rpc_protocol.cpp 
b/src/brpc/policy/http2_rpc_protocol.cpp
index 6d9b2b87..060b25fa 100644
--- a/src/brpc/policy/http2_rpc_protocol.cpp
+++ b/src/brpc/policy/http2_rpc_protocol.cpp
@@ -1683,6 +1683,22 @@ bool H2Context::FlushPendingData(int stream_id) {
     return out.empty() || WriteAck(_socket, &out) == 0;
 }
 
+H2UnsentRequest::H2UnsentRequest(Controller* c)
+    : _nref(1)
+    , _size(0)
+    , _stream_id(0)
+    , _cntl(c) {
+#ifndef NDEBUG
+    get_h2_bvars()->h2_unsent_request_count << 1;
+#endif
+}
+
+H2UnsentRequest::~H2UnsentRequest() {
+#ifndef NDEBUG
+    get_h2_bvars()->h2_unsent_request_count << -1;
+#endif
+}
+
 H2UnsentRequest* H2UnsentRequest::New(Controller* c) {
     const HttpHeader& h = c->http_request();
     const CommonStrings* const common = get_common_strings();
diff --git a/src/brpc/policy/http2_rpc_protocol.h 
b/src/brpc/policy/http2_rpc_protocol.h
index 64c9864d..b82dd93f 100644
--- a/src/brpc/policy/http2_rpc_protocol.h
+++ b/src/brpc/policy/http2_rpc_protocol.h
@@ -165,20 +165,8 @@ private:
     void push(const std::string& name, const std::string& value)
     { new (&_list[_size++]) HPacker::Header(name, value); }
 
-    H2UnsentRequest(Controller* c)
-        : _nref(1)
-        , _size(0)
-        , _stream_id(0)
-        , _cntl(c) {
-#ifndef NDEBUG
-        get_h2_bvars()->h2_unsent_request_count << 1;
-#endif
-    }
-    ~H2UnsentRequest() {
-#ifndef NDEBUG
-        get_h2_bvars()->h2_unsent_request_count << -1;
-#endif
-    }
+    H2UnsentRequest(Controller* c);
+    ~H2UnsentRequest();
     H2UnsentRequest(const H2UnsentRequest&);
     void operator=(const H2UnsentRequest&);
     void Destroy();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to