Fix -Wunused-parameter warnings in third_party/http2.
PiperOrigin-RevId: 387149206
diff --git a/http2/adapter/callback_visitor.cc b/http2/adapter/callback_visitor.cc
index 7e54b1f..c7087a8 100644
--- a/http2/adapter/callback_visitor.cc
+++ b/http2/adapter/callback_visitor.cc
@@ -145,7 +145,8 @@
}
Http2VisitorInterface::OnHeaderResult CallbackVisitor::OnHeaderForStream(
- Http2StreamId stream_id, absl::string_view name, absl::string_view value) {
+ Http2StreamId /*stream_id*/, absl::string_view name,
+ absl::string_view value) {
if (callbacks_->on_header_callback) {
const int result = callbacks_->on_header_callback(
nullptr, ¤t_frame_, ToUint8Ptr(name.data()), name.size(),
@@ -163,7 +164,7 @@
return HEADER_OK;
}
-void CallbackVisitor::OnEndHeadersForStream(Http2StreamId stream_id) {
+void CallbackVisitor::OnEndHeadersForStream(Http2StreamId /*stream_id*/) {
if (callbacks_->on_frame_recv_callback) {
const int result = callbacks_->on_frame_recv_callback(
nullptr, ¤t_frame_, user_data_);
@@ -171,7 +172,7 @@
}
}
-void CallbackVisitor::OnBeginDataForStream(Http2StreamId stream_id,
+void CallbackVisitor::OnBeginDataForStream(Http2StreamId /*stream_id*/,
size_t payload_length) {
// TODO(b/181586191): Interpret padding, subtract padding from
// |remaining_data_|.
@@ -194,9 +195,9 @@
}
}
-void CallbackVisitor::OnEndStream(Http2StreamId stream_id) {}
+void CallbackVisitor::OnEndStream(Http2StreamId /*stream_id*/) {}
-void CallbackVisitor::OnRstStream(Http2StreamId stream_id,
+void CallbackVisitor::OnRstStream(Http2StreamId /*stream_id*/,
Http2ErrorCode error_code) {
current_frame_.rst_stream.error_code = static_cast<uint32_t>(error_code);
if (callbacks_->on_frame_recv_callback) {
@@ -214,10 +215,9 @@
}
}
-void CallbackVisitor::OnPriorityForStream(Http2StreamId stream_id,
+void CallbackVisitor::OnPriorityForStream(Http2StreamId /*stream_id*/,
Http2StreamId parent_stream_id,
- int weight,
- bool exclusive) {
+ int weight, bool exclusive) {
current_frame_.priority.pri_spec.stream_id = parent_stream_id;
current_frame_.priority.pri_spec.weight = weight;
current_frame_.priority.pri_spec.exclusive = exclusive;
@@ -226,7 +226,7 @@
}
}
-void CallbackVisitor::OnPing(Http2PingId ping_id, bool is_ack) {
+void CallbackVisitor::OnPing(Http2PingId ping_id, bool /*is_ack*/) {
uint64_t network_order_opaque_data =
quiche::QuicheEndian::HostToNet64(ping_id);
std::memcpy(current_frame_.ping.opaque_data, &network_order_opaque_data,
@@ -236,8 +236,8 @@
}
}
-void CallbackVisitor::OnPushPromiseForStream(Http2StreamId stream_id,
- Http2StreamId promised_stream_id) {
+void CallbackVisitor::OnPushPromiseForStream(
+ Http2StreamId /*stream_id*/, Http2StreamId /*promised_stream_id*/) {
QUICHE_LOG(DFATAL) << "Not implemented";
}
@@ -253,7 +253,7 @@
}
}
-void CallbackVisitor::OnWindowUpdate(Http2StreamId stream_id,
+void CallbackVisitor::OnWindowUpdate(Http2StreamId /*stream_id*/,
int window_increment) {
current_frame_.window_update.window_size_increment = window_increment;
if (callbacks_->on_frame_recv_callback) {
@@ -331,11 +331,11 @@
return 0;
}
-void CallbackVisitor::OnReadyToSendDataForStream(Http2StreamId stream_id,
- char* destination_buffer,
- size_t length,
- ssize_t* written,
- bool* end_stream) {
+void CallbackVisitor::OnReadyToSendDataForStream(Http2StreamId /*stream_id*/,
+ char* /*destination_buffer*/,
+ size_t /*length*/,
+ ssize_t* /*written*/,
+ bool* /*end_stream*/) {
QUICHE_LOG(DFATAL) << "Not implemented";
}
diff --git a/http2/adapter/callback_visitor_test.cc b/http2/adapter/callback_visitor_test.cc
index 3b171cf..ddf1f93 100644
--- a/http2/adapter/callback_visitor_test.cc
+++ b/http2/adapter/callback_visitor_test.cc
@@ -167,8 +167,8 @@
Field(&nghttp2_frame::hd,
HasFrameHeaderRef(7, kMetadataFrameType, _))))
.WillOnce(testing::Invoke(
- [kExampleFrame](uint8_t* buf, size_t len,
- const nghttp2_frame* frame) -> ssize_t {
+ [kExampleFrame](uint8_t* buf, size_t /*len*/,
+ const nghttp2_frame* /*frame*/) -> ssize_t {
std::memcpy(buf, kExampleFrame.data(), kExampleFrame.size());
return kExampleFrame.size();
}));
@@ -288,8 +288,8 @@
Field(&nghttp2_frame::hd,
HasFrameHeaderRef(5, kMetadataFrameType, _))))
.WillOnce(testing::Invoke(
- [kExampleFrame](uint8_t* buf, size_t len,
- const nghttp2_frame* frame) -> ssize_t {
+ [kExampleFrame](uint8_t* buf, size_t /*len*/,
+ const nghttp2_frame* /*frame*/) -> ssize_t {
std::memcpy(buf, kExampleFrame.data(), kExampleFrame.size());
return kExampleFrame.size();
}));
diff --git a/http2/adapter/http2_visitor_interface.h b/http2/adapter/http2_visitor_interface.h
index 2a74ff5..c5e749f 100644
--- a/http2/adapter/http2_visitor_interface.h
+++ b/http2/adapter/http2_visitor_interface.h
@@ -60,10 +60,8 @@
virtual void OnConnectionError() = 0;
// Called when the header for a frame is received.
- virtual void OnFrameHeader(Http2StreamId stream_id,
- size_t length,
- uint8_t type,
- uint8_t flags) {}
+ virtual void OnFrameHeader(Http2StreamId /*stream_id*/, size_t /*length*/,
+ uint8_t /*type*/, uint8_t /*flags*/) {}
// Called when a non-ack SETTINGS frame is received.
virtual void OnSettingsStart() = 0;
diff --git a/http2/adapter/mock_nghttp2_callbacks.cc b/http2/adapter/mock_nghttp2_callbacks.cc
index b3486b7..4243347 100644
--- a/http2/adapter/mock_nghttp2_callbacks.cc
+++ b/http2/adapter/mock_nghttp2_callbacks.cc
@@ -109,7 +109,7 @@
nghttp2_session_callbacks_set_error_callback2(
callbacks,
- [](nghttp2_session* session, int lib_error_code, const char* msg,
+ [](nghttp2_session* /*session*/, int lib_error_code, const char* msg,
size_t len, void* user_data) -> int {
return static_cast<MockNghttp2Callbacks*>(user_data)->OnErrorCallback2(
lib_error_code, msg, len);
diff --git a/http2/adapter/nghttp2_adapter.cc b/http2/adapter/nghttp2_adapter.cc
index 580009e..7eb57f8 100644
--- a/http2/adapter/nghttp2_adapter.cc
+++ b/http2/adapter/nghttp2_adapter.cc
@@ -90,8 +90,8 @@
stream_id, window_increment);
}
-void NgHttp2Adapter::SubmitMetadata(Http2StreamId stream_id,
- bool end_metadata) {
+void NgHttp2Adapter::SubmitMetadata(Http2StreamId /*stream_id*/,
+ bool /*end_metadata*/) {
QUICHE_LOG(DFATAL) << "Not implemented";
}
diff --git a/http2/adapter/nghttp2_adapter_test.cc b/http2/adapter/nghttp2_adapter_test.cc
index 34ecebe..b9d9c1d 100644
--- a/http2/adapter/nghttp2_adapter_test.cc
+++ b/http2/adapter/nghttp2_adapter_test.cc
@@ -27,12 +27,9 @@
// This send callback assumes |source|'s pointer is a TestDataSource, and
// |user_data| is a Http2VisitorInterface.
-int TestSendCallback(nghttp2_session*,
- nghttp2_frame* frame,
- const uint8_t* framehd,
- size_t length,
- nghttp2_data_source* source,
- void* user_data) {
+int TestSendCallback(nghttp2_session*, nghttp2_frame* /*frame*/,
+ const uint8_t* framehd, size_t length,
+ nghttp2_data_source* source, void* user_data) {
auto* visitor = static_cast<Http2VisitorInterface*>(user_data);
// Send the frame header via the visitor.
ssize_t result = visitor->OnReadyToSend(ToStringView(framehd, 9));
diff --git a/http2/adapter/nghttp2_callbacks.cc b/http2/adapter/nghttp2_callbacks.cc
index 43fb886..5c62cae 100644
--- a/http2/adapter/nghttp2_callbacks.cc
+++ b/http2/adapter/nghttp2_callbacks.cc
@@ -17,11 +17,8 @@
namespace adapter {
namespace callbacks {
-ssize_t OnReadyToSend(nghttp2_session* /* session */,
- const uint8_t* data,
- size_t length,
- int flags,
- void* user_data) {
+ssize_t OnReadyToSend(nghttp2_session* /* session */, const uint8_t* data,
+ size_t length, int /*flags*/, void* user_data) {
QUICHE_CHECK_NE(user_data, nullptr);
auto* visitor = static_cast<Http2VisitorInterface*>(user_data);
const ssize_t result = visitor->OnReadyToSend(ToStringView(data, length));
@@ -153,11 +150,8 @@
return 0;
}
-int OnHeader(nghttp2_session* /* session */,
- const nghttp2_frame* frame,
- nghttp2_rcbuf* name,
- nghttp2_rcbuf* value,
- uint8_t flags,
+int OnHeader(nghttp2_session* /* session */, const nghttp2_frame* frame,
+ nghttp2_rcbuf* name, nghttp2_rcbuf* value, uint8_t /*flags*/,
void* user_data) {
QUICHE_CHECK_NE(user_data, nullptr);
auto* visitor = static_cast<Http2VisitorInterface*>(user_data);
@@ -207,11 +201,8 @@
return result ? 0 : NGHTTP2_ERR_CALLBACK_FAILURE;
}
-int OnDataChunk(nghttp2_session* /* session */,
- uint8_t flags,
- Http2StreamId stream_id,
- const uint8_t* data,
- size_t len,
+int OnDataChunk(nghttp2_session* /* session */, uint8_t /*flags*/,
+ Http2StreamId stream_id, const uint8_t* data, size_t len,
void* user_data) {
QUICHE_CHECK_NE(user_data, nullptr);
auto* visitor = static_cast<Http2VisitorInterface*>(user_data);
@@ -230,7 +221,7 @@
return 0;
}
-int OnExtensionChunkReceived(nghttp2_session* session,
+int OnExtensionChunkReceived(nghttp2_session* /*session*/,
const nghttp2_frame_hd* hd, const uint8_t* data,
size_t len, void* user_data) {
QUICHE_CHECK_NE(user_data, nullptr);
@@ -244,7 +235,7 @@
return 0;
}
-int OnUnpackExtensionCallback(nghttp2_session* session, void** payload,
+int OnUnpackExtensionCallback(nghttp2_session* /*session*/, void** /*payload*/,
const nghttp2_frame_hd* hd, void* user_data) {
QUICHE_CHECK_NE(user_data, nullptr);
auto* visitor = static_cast<Http2VisitorInterface*>(user_data);
@@ -257,7 +248,7 @@
return 0;
}
-ssize_t OnPackExtensionCallback(nghttp2_session* session, uint8_t* buf,
+ssize_t OnPackExtensionCallback(nghttp2_session* /*session*/, uint8_t* buf,
size_t len, const nghttp2_frame* frame,
void* user_data) {
QUICHE_CHECK_NE(user_data, nullptr);
@@ -268,8 +259,8 @@
return written;
}
-int OnError(nghttp2_session* session, int lib_error_code, const char* msg,
- size_t len, void* user_data) {
+int OnError(nghttp2_session* /*session*/, int /*lib_error_code*/,
+ const char* msg, size_t len, void* user_data) {
QUICHE_CHECK_NE(user_data, nullptr);
auto* visitor = static_cast<Http2VisitorInterface*>(user_data);
visitor->OnErrorDebug(absl::string_view(msg, len));
diff --git a/http2/adapter/nghttp2_test.cc b/http2/adapter/nghttp2_test.cc
index 9623487..0b977dc 100644
--- a/http2/adapter/nghttp2_test.cc
+++ b/http2/adapter/nghttp2_test.cc
@@ -61,14 +61,15 @@
// Sets up the Send() callback to append to |serialized_|.
EXPECT_CALL(mock_callbacks_, Send(_, _, _))
- .WillRepeatedly([this](const uint8_t* data, size_t length, int flags) {
- absl::StrAppend(&serialized_, ToStringView(data, length));
- return length;
- });
+ .WillRepeatedly(
+ [this](const uint8_t* data, size_t length, int /*flags*/) {
+ absl::StrAppend(&serialized_, ToStringView(data, length));
+ return length;
+ });
// Sets up the SendData() callback to fetch and append data from a
// TestDataSource.
EXPECT_CALL(mock_callbacks_, SendData(_, _, _, _))
- .WillRepeatedly([this](nghttp2_frame* frame, const uint8_t* framehd,
+ .WillRepeatedly([this](nghttp2_frame* /*frame*/, const uint8_t* framehd,
size_t length, nghttp2_data_source* source) {
QUICHE_LOG(INFO) << "Appending frame header and " << length
<< " bytes of data";
diff --git a/http2/adapter/nghttp2_util_test.cc b/http2/adapter/nghttp2_util_test.cc
index fda0063..1ec00ba 100644
--- a/http2/adapter/nghttp2_util_test.cc
+++ b/http2/adapter/nghttp2_util_test.cc
@@ -11,12 +11,9 @@
// This send callback assumes |source|'s pointer is a TestDataSource, and
// |user_data| is a std::string.
-int FakeSendCallback(nghttp2_session*,
- nghttp2_frame* frame,
- const uint8_t* framehd,
- size_t length,
- nghttp2_data_source* source,
- void* user_data) {
+int FakeSendCallback(nghttp2_session*, nghttp2_frame* /*frame*/,
+ const uint8_t* framehd, size_t length,
+ nghttp2_data_source* source, void* user_data) {
auto* dest = static_cast<std::string*>(user_data);
// Appends the frame header to the string.
absl::StrAppend(dest, ToStringView(framehd, 9));
diff --git a/http2/adapter/oghttp2_adapter.cc b/http2/adapter/oghttp2_adapter.cc
index 47270dd..f695696 100644
--- a/http2/adapter/oghttp2_adapter.cc
+++ b/http2/adapter/oghttp2_adapter.cc
@@ -75,7 +75,7 @@
absl::make_unique<SpdyWindowUpdateIR>(stream_id, window_increment));
}
-void OgHttp2Adapter::SubmitMetadata(Http2StreamId stream_id, bool fin) {
+void OgHttp2Adapter::SubmitMetadata(Http2StreamId /*stream_id*/, bool /*fin*/) {
QUICHE_BUG(oghttp2_submit_metadata) << "Not implemented";
}
diff --git a/http2/adapter/oghttp2_session.cc b/http2/adapter/oghttp2_session.cc
index a503c1e..1dac781 100644
--- a/http2/adapter/oghttp2_session.cc
+++ b/http2/adapter/oghttp2_session.cc
@@ -78,10 +78,10 @@
flags_ = continuation.end_headers() ? 0x4 : 0;
length_ = continuation.size() - spdy::kFrameHeaderSize;
}
- void VisitAltSvc(const spdy::SpdyAltSvcIR& altsvc) override {}
+ void VisitAltSvc(const spdy::SpdyAltSvcIR& /*altsvc*/) override {}
void VisitPriorityUpdate(
- const spdy::SpdyPriorityUpdateIR& priority_update) override {}
- void VisitAcceptCh(const spdy::SpdyAcceptChIR& accept_ch) override {}
+ const spdy::SpdyPriorityUpdateIR& /*priority_update*/) override {}
+ void VisitAcceptCh(const spdy::SpdyAcceptChIR& /*accept_ch*/) override {}
uint32_t stream_id() { return stream_id_; }
uint32_t length() { return length_; }
@@ -531,8 +531,7 @@
}
void OgHttp2Session::OnDataFrameHeader(spdy::SpdyStreamId stream_id,
- size_t length,
- bool fin) {
+ size_t length, bool /*fin*/) {
visitor_.OnBeginDataForStream(stream_id, length);
}
@@ -563,7 +562,8 @@
// TODO(181586191): Pass padding to the visitor?
}
-void OgHttp2Session::OnStreamPadding(spdy::SpdyStreamId stream_id, size_t len) {
+void OgHttp2Session::OnStreamPadding(spdy::SpdyStreamId /*stream_id*/, size_t
+ /*len*/) {
// Flow control was accounted for in OnStreamPadLength().
// TODO(181586191): Pass padding to the visitor?
}
@@ -574,7 +574,7 @@
return &headers_handler_;
}
-void OgHttp2Session::OnHeaderFrameEnd(spdy::SpdyStreamId stream_id) {
+void OgHttp2Session::OnHeaderFrameEnd(spdy::SpdyStreamId /*stream_id*/) {
headers_handler_.set_stream_id(0);
}
@@ -622,18 +622,16 @@
"");
}
-bool OgHttp2Session::OnGoAwayFrameData(const char* goaway_data, size_t len) {
+bool OgHttp2Session::OnGoAwayFrameData(const char* /*goaway_data*/, size_t
+ /*len*/) {
// Opaque data is currently ignored.
return true;
}
void OgHttp2Session::OnHeaders(spdy::SpdyStreamId stream_id,
- bool has_priority,
- int weight,
- spdy::SpdyStreamId parent_stream_id,
- bool exclusive,
- bool fin,
- bool end) {
+ bool /*has_priority*/, int /*weight*/,
+ spdy::SpdyStreamId /*parent_stream_id*/,
+ bool /*exclusive*/, bool /*fin*/, bool /*end*/) {
if (options_.perspective == Perspective::kServer) {
WindowManager::WindowUpdateListener listener =
[this, stream_id](size_t window_update_delta) {
@@ -668,11 +666,12 @@
visitor_.OnWindowUpdate(stream_id, delta_window_size);
}
-void OgHttp2Session::OnPushPromise(spdy::SpdyStreamId stream_id,
- spdy::SpdyStreamId promised_stream_id,
- bool end) {}
+void OgHttp2Session::OnPushPromise(spdy::SpdyStreamId /*stream_id*/,
+ spdy::SpdyStreamId /*promised_stream_id*/,
+ bool /*end*/) {}
-void OgHttp2Session::OnContinuation(spdy::SpdyStreamId stream_id, bool end) {}
+void OgHttp2Session::OnContinuation(spdy::SpdyStreamId /*stream_id*/, bool
+ /*end*/) {}
void OgHttp2Session::OnAltSvc(spdy::SpdyStreamId /*stream_id*/,
absl::string_view /*origin*/,
@@ -680,16 +679,16 @@
AlternativeServiceVector& /*altsvc_vector*/) {
}
-void OgHttp2Session::OnPriority(spdy::SpdyStreamId stream_id,
- spdy::SpdyStreamId parent_stream_id,
- int weight,
- bool exclusive) {}
+void OgHttp2Session::OnPriority(spdy::SpdyStreamId /*stream_id*/,
+ spdy::SpdyStreamId /*parent_stream_id*/,
+ int /*weight*/, bool /*exclusive*/) {}
-void OgHttp2Session::OnPriorityUpdate(spdy::SpdyStreamId prioritized_stream_id,
- absl::string_view priority_field_value) {}
+void OgHttp2Session::OnPriorityUpdate(
+ spdy::SpdyStreamId /*prioritized_stream_id*/,
+ absl::string_view /*priority_field_value*/) {}
-bool OgHttp2Session::OnUnknownFrame(spdy::SpdyStreamId stream_id,
- uint8_t frame_type) {
+bool OgHttp2Session::OnUnknownFrame(spdy::SpdyStreamId /*stream_id*/,
+ uint8_t /*frame_type*/) {
return true;
}
diff --git a/http2/adapter/recording_http2_visitor.cc b/http2/adapter/recording_http2_visitor.cc
index cf81ee1..0706c5e 100644
--- a/http2/adapter/recording_http2_visitor.cc
+++ b/http2/adapter/recording_http2_visitor.cc
@@ -140,11 +140,9 @@
return true;
}
-void RecordingHttp2Visitor::OnReadyToSendDataForStream(Http2StreamId stream_id,
- char* destination_buffer,
- size_t length,
- ssize_t* written,
- bool* end_stream) {
+void RecordingHttp2Visitor::OnReadyToSendDataForStream(
+ Http2StreamId stream_id, char* /*destination_buffer*/, size_t length,
+ ssize_t* /*written*/, bool* /*end_stream*/) {
// TODO(b/181586191): Revisit this. The visitor is expected to write to the
// |destination_buffer| and set the other pointer values appropriately.
events_.push_back(
@@ -152,10 +150,8 @@
}
void RecordingHttp2Visitor::OnReadyToSendMetadataForStream(
- Http2StreamId stream_id,
- char* buffer,
- size_t length,
- ssize_t* written) {
+ Http2StreamId stream_id, char* /*buffer*/, size_t length,
+ ssize_t* /*written*/) {
// TODO(b/181586191): Revisit this. The visitor is expected to write to the
// |buffer| and set *written appropriately.
events_.push_back(absl::StrFormat("OnReadyToSendMetadataForStream %d %d",
diff --git a/http2/test_tools/frame_parts.cc b/http2/test_tools/frame_parts.cc
index a053beb..4713523 100644
--- a/http2/test_tools/frame_parts.cc
+++ b/http2/test_tools/frame_parts.cc
@@ -126,7 +126,7 @@
opt_altsvc_value_length_ = value.size();
}
-bool FrameParts::OnFrameHeader(const Http2FrameHeader& header) {
+bool FrameParts::OnFrameHeader(const Http2FrameHeader& /*header*/) {
ADD_FAILURE() << "OnFrameHeader: " << *this;
return true;
}