-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matching format specifies type to argument type to eliminate compile … #521
Conversation
src/raft_server.cxx
Outdated
@@ -1151,7 +1151,7 @@ void raft_server::check_leadership_transfer() { | |||
if (peer_elem->get_matched_idx() + params->stale_log_gap_ < | |||
cur_commit_idx) { | |||
// This peer is lagging behind. | |||
p_tr("peer %d is lagging behind, %lu < %lu", | |||
p_tr("peer %d is lagging behind, %llu < %llu", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use PRIu64
. This symbol is different according to the platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many %lu, %llu, %d use case across the whole repo, but I am only fixing this line because it has warning during compile.
I fixed it to use PRIu64.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%d
probably be ok, but 64-bit integers should be replaced. The whole project was re-visited a couple of years ago, but if there are still missing ones, we need to fix them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~ grep -rn "%l" .
./fix_format.hxx:20: replace_all(format_string, "%ld", "%" PRId64); \
./fix_format.hxx:21: replace_all(format_string, "%lu", "%" PRIu64); \
./asio_service.cxx:336: "due to error %d, %s, ref count %ld",
We don't need to care about ./fix_format.hxx, the %ld in ./asio_service.cxx is correct, I think that is all the case.
src/raft_server.cxx
Outdated
@@ -1160,7 +1160,7 @@ void raft_server::check_leadership_transfer() { | |||
uint64_t last_resp_ms = peer_elem->get_resp_timer_us() / 1000; | |||
if (last_resp_ms > election_lower) { | |||
// This replica is not responding. | |||
p_tr("peer %d is not responding, %lu ms ago", | |||
p_tr("peer %d is not responding, %llu ms ago", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace this one too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
…warnings
format specifies type 'unsigned long' but the argument has type 'ulong' (aka 'unsigned long long').