Skip to content
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

clang-tidy: clang-analyzer-core.DivideZero #7765

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ WarningsAsErrors: 'abseil-duration-*,
bugprone-assert-side-effect,
bugprone-unused-raii,
bugprone-use-after-move,
clang-analyzer-core.DivideZero,
modernize-deprecated-headers,
modernize-make-shared,
modernize-make-unique,
Expand Down
3 changes: 2 additions & 1 deletion source/common/common/backoff_strategy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ uint64_t JitteredBackOffStrategy::nextBackOffMs() {
if (base_backoff <= max_interval_) {
current_retry_++;
}
ASSERT(base_backoff > 0);
return std::min(random_.random() % base_backoff, max_interval_);
}

void JitteredBackOffStrategy::reset() { current_retry_ = 1; }

} // namespace Envoy
} // namespace Envoy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an incidental change picked up by my vim settings, but leaving it in since we probably want all files to end with newline.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to make the formatter deal with this...