This is an automated email from the ASF dual-hosted git repository.
chenBright 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 359e8f57 fix(build): clean up redundant warning sources (#3385)
359e8f57 is described below
commit 359e8f57ecbe8cc6804a0bec342fdf11960ff415
Author: darion-yaphet <[email protected]>
AuthorDate: Thu Jul 16 17:10:43 2026 +0800
fix(build): clean up redundant warning sources (#3385)
* fix(build): clean up redundant warning sources
Remove redundant pthread linkage from protoc-gen-mcpack targets and quiet
compiler warnings from unused rpcz/couchbase code paths and non-x86 iobuf
builds.
* fix(couchbase): preserve C++11 warning suppression
Use brpc's existing ALLOW_UNUSED macro on Couchbase vbucket constants so
the declarations keep silencing platform-specific unused-constant warnings
without requiring C++17 attributes.
---
src/CMakeLists.txt | 4 ++--
src/brpc/builtin/rpcz_service.cpp | 15 ---------------
src/brpc/couchbase.cpp | 6 +++---
src/butil/iobuf.cpp | 2 --
4 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a9a4d11f..17fe2154 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -86,7 +86,7 @@ if(BUILD_SHARED_LIBS)
endif()
SET_TARGET_PROPERTIES(brpc-shared PROPERTIES OUTPUT_NAME brpc
CLEAN_DIRECT_OUTPUT 1)
- target_link_libraries(protoc-gen-mcpack PRIVATE brpc-shared ${DYNAMIC_LIB}
pthread)
+ target_link_libraries(protoc-gen-mcpack PRIVATE brpc-shared ${DYNAMIC_LIB})
install(TARGETS brpc-shared
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
@@ -94,7 +94,7 @@ if(BUILD_SHARED_LIBS)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else()
- target_link_libraries(protoc-gen-mcpack PRIVATE brpc-static ${DYNAMIC_LIB}
pthread)
+ target_link_libraries(protoc-gen-mcpack PRIVATE brpc-static ${DYNAMIC_LIB})
endif()
diff --git a/src/brpc/builtin/rpcz_service.cpp
b/src/brpc/builtin/rpcz_service.cpp
index e5111ac3..9afb651e 100644
--- a/src/brpc/builtin/rpcz_service.cpp
+++ b/src/brpc/builtin/rpcz_service.cpp
@@ -188,21 +188,6 @@ static void PrintAnnotations(
SpanInfoExtractor** extractors, int num_extr, const RpczSpan* span) {
int64_t anno_time;
std::string a;
- const char* span_type_str = "Span";
- if (span) {
- switch (span->type()) {
- case SPAN_TYPE_SERVER:
- span_type_str = "ServerSpan";
- break;
- case SPAN_TYPE_CLIENT:
- span_type_str = "ClientSpan";
- break;
- case SPAN_TYPE_BTHREAD:
- span_type_str = "BthreadSpan";
- break;
- }
- }
-
// TODO: Going through all extractors is not strictly correct because
// later extractors may have earlier annotations.
for (int i = 0; i < num_extr; ++i) {
diff --git a/src/brpc/couchbase.cpp b/src/brpc/couchbase.cpp
index 52e16dc9..a707d75a 100644
--- a/src/brpc/couchbase.cpp
+++ b/src/brpc/couchbase.cpp
@@ -45,8 +45,8 @@ namespace brpc {
// Couchbase protocol constants
namespace {
-[[maybe_unused]] constexpr uint32_t APPLE_VBUCKET_COUNT = 64;
-constexpr uint32_t DEFAULT_VBUCKET_COUNT = 1024;
+constexpr uint32_t APPLE_VBUCKET_COUNT ALLOW_UNUSED = 64;
+constexpr uint32_t DEFAULT_VBUCKET_COUNT ALLOW_UNUSED = 1024;
constexpr int CONNECTION_ID_SIZE = 33;
constexpr size_t RANDOM_ID_HEX_SIZE = 67; // 33 bytes * 2 + null terminator
} // namespace
@@ -2631,4 +2631,4 @@ bool CouchbaseOperations::clearPipeline() {
pipeline_active = false;
return true;
}
-} // namespace brpc
\ No newline at end of file
+} // namespace brpc
diff --git a/src/butil/iobuf.cpp b/src/butil/iobuf.cpp
index a743f792..be751d31 100644
--- a/src/butil/iobuf.cpp
+++ b/src/butil/iobuf.cpp
@@ -167,8 +167,6 @@ inline iov_function get_pwritev_func() {
#else // ARCH_CPU_X86_64
-#warning "We don't check if the kernel supports SYS_preadv or SYS_pwritev on
non-X86_64, use implementation on pread/pwrite directly."
-
inline iov_function get_preadv_func() {
return user_preadv;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]