Skip to content

Commit

Permalink
Fix some compilation warning issues
Browse files Browse the repository at this point in the history
  • Loading branch information
chenBright committed Jan 15, 2025
1 parent 47c1228 commit 101730b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: ./.github/actions/install-essential-dependences
- uses: ./.github/actions/init-make-config
with:
options: --cc=gcc --cxx=g++
options: --cc=gcc --cxx=g++ --werror
- name: compile
run: |
make -j ${{env.proc_num}}
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
- uses: ./.github/actions/install-all-dependences
- uses: ./.github/actions/init-make-config
with:
options: --cc=gcc --cxx=g++ --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer
options: --cc=gcc --cxx=g++ --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer --werror
- name: compile
run: |
make -j ${{env.proc_num}}
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- uses: ./.github/actions/install-essential-dependences
- uses: ./.github/actions/init-make-config
with:
options: --cc=clang --cxx=clang++
options: --cc=clang --cxx=clang++ --werror
- name: compile
run: |
make -j ${{env.proc_num}}
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
- uses: ./.github/actions/install-all-dependences
- uses: ./.github/actions/init-make-config
with:
options: --cc=clang --cxx=clang++ --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer
options: --cc=clang --cxx=clang++ --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer --werror
- name: compile
run: |
make -j ${{env.proc_num}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: |
GETOPT_PATH=$(brew --prefix gnu-getopt)/bin
export PATH=$GETOPT_PATH:$PATH
./config_brpc.sh --header="$(brew --prefix)/include" --libs="$(brew --prefix)/lib"
./config_brpc.sh --header="$(brew --prefix)/include" --libs="$(brew --prefix)/lib" --werror
- name: compile
run: |
Expand Down
7 changes: 6 additions & 1 deletion config_brpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ else
LDD=ldd
fi

TEMP=`getopt -o v: --long headers:,libs:,cc:,cxx:,with-glog,with-thrift,with-rdma,with-mesalink,with-bthread-tracer,with-debug-bthread-sche-safety,with-debug-lock,nodebugsymbols -n 'config_brpc' -- "$@"`
TEMP=`getopt -o v: --long headers:,libs:,cc:,cxx:,with-glog,with-thrift,with-rdma,with-mesalink,with-bthread-tracer,with-debug-bthread-sche-safety,with-debug-lock,nodebugsymbols,werror -n 'config_brpc' -- "$@"`
WITH_GLOG=0
WITH_THRIFT=0
WITH_RDMA=0
WITH_MESALINK=0
WITH_BTHREAD_TRACER=0
BRPC_DEBUG_BTHREAD_SCHE_SAFETY=0
DEBUGSYMBOLS=-g
WERROR=
BRPC_DEBUG_LOCK=0

if [ $? != 0 ] ; then >&2 $ECHO "Terminating..."; exit 1 ; fi
Expand Down Expand Up @@ -74,6 +75,7 @@ while true; do
--with-debug-bthread-sche-safety ) BRPC_DEBUG_BTHREAD_SCHE_SAFETY=1; shift 1 ;;
--with-debug-lock ) BRPC_DEBUG_LOCK=1; shift 1 ;;
--nodebugsymbols ) DEBUGSYMBOLS=; shift 1 ;;
--werror ) WERROR=-Werror; shift 1 ;;
-- ) shift; break ;;
* ) break ;;
esac
Expand Down Expand Up @@ -441,6 +443,9 @@ CPPFLAGS="${CPPFLAGS} -D__const__=__unused__"
if [ ! -z "$DEBUGSYMBOLS" ]; then
CPPFLAGS="${CPPFLAGS} $DEBUGSYMBOLS"
fi
if [ ! -z "$WERROR" ]; then
CPPFLAGS="${CPPFLAGS} $WERROR"
fi
if [ "$SYSTEM" = "Darwin" ]; then
CPPFLAGS="${CPPFLAGS} -Wno-deprecated-declarations -Wno-inconsistent-missing-override"
version=`sw_vers -productVersion | awk -F '.' '{print $1 "." $2}'`
Expand Down
2 changes: 1 addition & 1 deletion src/brpc/memcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class MemcacheResponse : public NonreflectableMessage<MemcacheResponse> {
void Clear() override;
bool IsInitialized() const PB_527_OVERRIDE;

size_t ByteSizeLong() const;
size_t ByteSizeLong() const override;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) PB_310_OVERRIDE;
void SerializeWithCachedSizes(
Expand Down
8 changes: 6 additions & 2 deletions src/brpc/policy/http2_rpc_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,13 @@ H2ParseResult H2StreamContext::OnData(
}
}

const int64_t acc = _deferred_window_update.fetch_add(frag_size, butil::memory_order_relaxed) + frag_size;
int64_t acc = frag_size +
_deferred_window_update.fetch_add(frag_size, butil::memory_order_relaxed);
int64_t quota = static_cast<int64_t>(
_conn_ctx->local_settings().stream_window_size /
(_conn_ctx->VolatilePendingStreamSize() + 1));
// Allocate the quota of the window to each stream.
if (acc >= static_cast<int64_t>(_conn_ctx->local_settings().stream_window_size) / (_conn_ctx->VolatilePendingStreamSize() + 1)) {
if (acc >= quota) {
if (acc > _conn_ctx->local_settings().stream_window_size) {
LOG(ERROR) << "Fail to satisfy the stream-level flow control policy";
return MakeH2Error(H2_FLOW_CONTROL_ERROR, frame_head.stream_id);
Expand Down
2 changes: 1 addition & 1 deletion src/bthread/task_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ void print_task(std::ostream& os, bthread_t tid) {
bthread_attr_t attr = BTHREAD_ATTR_NORMAL;
bool has_tls = false;
int64_t cpuwide_start_ns = 0;
TaskStatistics stat = {0, 0};
TaskStatistics stat = {0, 0, 0};
TaskStatus status = TASK_STATUS_UNKNOWN;
bool traced = false;
pid_t worker_tid = 0;
Expand Down

0 comments on commit 101730b

Please sign in to comment.