-
Notifications
You must be signed in to change notification settings - Fork 38.1k
refactor: minor whitespace fixups, s/const/constexpr/ and remove template (followup to #19845) #20033
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
Conversation
|
cc @hebasto |
|
Concept ACK, obviously :) Thanks @vasild ! Mind also integrating #19845 (comment) as that change was unneeded? |
|
Well, I left it as is because template <typename E>
bool operator()(const E& e) const {is more generic than bool operator()(const std::runtime_error& e) const {both work now but the former would also work if the exception does not inherit |
|
I don't think the template function is required to make exception handling more generic for the following reasons:
|
|
Please describe the actual changes in the pr title/description? |
7db9bf3 to
b763174
Compare
|
Done! |
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.
ACK b763174
For the PR title, maybe s/style/net, test/ per CONTRIBUTING.md. Feel free to ignore.
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.
ACK b763174, I have reviewed the code and it looks OK, I agree it can be merged.
|
https://travis-ci.org/github/bitcoin/bitcoin/jobs/740417628#L2831 |
b763174 to
89836a8
Compare
|
Interesting. I compiled and ran the unit tests without warnings. |
|
re-ACK 89836a8 change since previous review is replacing std::runtime_error with std::exception, built/ran unit tests with gcc debian 10.2.0-15, then broke a few v3 net_tests involving Change per diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h
index 33c2ea0028..1812ce1666 100644
--- a/src/test/util/setup_common.h
+++ b/src/test/util/setup_common.h
@@ -163,7 +163,7 @@ class HasReason
{
public:
explicit HasReason(const std::string& reason) : m_reason(reason) {}
- bool operator()(const std::runtime_error& e) const
+ bool operator()(const std::exception& e) const
{
return std::string(e.what()).find(m_reason) != std::string::npos;
}; |
|
re-ACK 89836a8
CentOS build uses pretty old gcc. Nice that CI caught that issue. |
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.
ACK 89836a8
…expr/ and remove template (followup to bitcoin#19845) 89836a8 style: minor improvements as a followup to bitcoin#19845 (Vasil Dimov) Pull request description: Address suggestions: bitcoin#19845 (comment) bitcoin#19845 (comment) bitcoin#19845 (comment) ACKs for top commit: jonatack: re-ACK 89836a8 change since previous review is replacing std::runtime_error with std::exception, built/ran unit tests with gcc debian 10.2.0-15, then broke a few v3 net_tests involving `BOOST_CHECK_EXCEPTION`, rebuilt, ran `src/test/test_bitcoin -t net_tests -l all` and checked the error reporting. hebasto: re-ACK 89836a8 theStack: ACK 89836a8 Tree-SHA512: 36477fdccabe5a8ad91fbabb4655cc363a3a7ca237a98ae6dd4a9fae4a4113762040f864d4ca13a47d081f7d16e5bd487edbfb61ab50a37e4a0424e9bec30b24
…n class 03525ea [Refactor] Clang-tidy and fix compiler error in HasReason class (Fuzzbawls) Pull request description: Came across this compiler error when updating the [code coverage report](https://www.fuzzbawls.pw/pivx/regression-test-coverage/index.html). The server runs on CentOS 7 currently, which uses a fairly old (but still supported) version of gcc. Indeed, upstream also ran into this error (Ref: bitcoin#20033) Some older (but still supported) versions of gcc will throw an error when trying to convert from `std::ios_base::failure` to `std::runtime_error`. Use `std::exception` base type instead. Also apply clang-format to the class and remove the `cout`. ACKs for top commit: random-zebra: utACK 03525ea furszy: utACK 03525ea and merging.. Tree-SHA512: 46a92f96d30c5f0f29babc30841b0b8b694fabe9ee0e8a5ed79ebc1e405c8718515b718ef12384973b0b003adb907378b27c1fca7f00581e7c3a742d59e9f9ba
Summary: Minor follow-up to [[bitcoin/bitcoin#19845 | core#19845]] (D10720). The template was thought to be needed to handle both `std::ios_base::failure` and `std::runtime_error`, but they both inherit `std:eexception` so it is not necessary. This is a backport of [[bitcoin/bitcoin#20033 | core#20033]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10732
Address suggestions:
#19845 (comment)
#19845 (comment)
#19845 (comment)