diff options
author | fanquake <fanquake@gmail.com> | 2020-12-02 20:22:42 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-12-02 20:52:19 +0800 |
commit | 0a13d15c143906bb6fd5d30c25df03ce5e20418d (patch) | |
tree | d59aa8258a48fefe8535b56a23219103324f8a94 /src/test | |
parent | 3693fccc3acd25dad29879605bfa1fa5d55a7c3a (diff) | |
parent | 1e62350ca20898189904a88dfef9ea11ddcd8626 (diff) | |
download | bitcoin-0a13d15c143906bb6fd5d30c25df03ce5e20418d.tar.xz |
Merge #20530: lint, refactor: Update cppcheck linter to c++17 and improve explicit usage
1e62350ca20898189904a88dfef9ea11ddcd8626 refactor: Improve use of explicit keyword (Fabian Jahr)
c502a6dbfb854ca827a5a3925394f9e09d29b898 lint: Use c++17 std in cppcheck linter (Fabian Jahr)
Pull request description:
I found the `extended-lint-cppcheck` linter still uses `std=c++11` when reviewing #20471. The only difference in the output after this change is one line is missing:
```
src/script/descriptor.cpp:159:5: warning: Struct 'PubkeyProvider' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
```
After some digging, I am still not sure why this one is ignored with c++17 when 40 other`noExplicitConstructor` warnings were still appearing.
In the second commit, I fix these warnings, adding `explicit` where appropriate and adding fixes to ignore otherwise.
ACKs for top commit:
practicalswift:
cr ACK 1e62350ca20898189904a88dfef9ea11ddcd8626: patch looks correct!
MarcoFalke:
review ACK 1e62350ca20898189904a88dfef9ea11ddcd8626
Tree-SHA512: dff7b324429a57160e217cf38d9ddbb6e70c6cb3d3e3e0bd4013d88e07afc2292c3df94d0acf7122e9d486322821682ecf15c8f2724a78667764c05d47f89a12
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/signature_checker.cpp | 2 | ||||
-rw-r--r-- | src/test/util/logging.h | 2 | ||||
-rw-r--r-- | src/test/util_tests.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/test/fuzz/signature_checker.cpp b/src/test/fuzz/signature_checker.cpp index e121c89665..970452dbcc 100644 --- a/src/test/fuzz/signature_checker.cpp +++ b/src/test/fuzz/signature_checker.cpp @@ -24,7 +24,7 @@ class FuzzedSignatureChecker : public BaseSignatureChecker FuzzedDataProvider& m_fuzzed_data_provider; public: - FuzzedSignatureChecker(FuzzedDataProvider& fuzzed_data_provider) : m_fuzzed_data_provider(fuzzed_data_provider) + explicit FuzzedSignatureChecker(FuzzedDataProvider& fuzzed_data_provider) : m_fuzzed_data_provider(fuzzed_data_provider) { } diff --git a/src/test/util/logging.h b/src/test/util/logging.h index 1fcf7ca305..a49f9a7292 100644 --- a/src/test/util/logging.h +++ b/src/test/util/logging.h @@ -32,7 +32,7 @@ class DebugLogHelper void check_found(); public: - DebugLogHelper(std::string message, MatchFn match = [](const std::string*){ return true; }); + explicit DebugLogHelper(std::string message, MatchFn match = [](const std::string*){ return true; }); ~DebugLogHelper() { check_found(); } }; diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 36fa1a0299..131508f5f8 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -231,7 +231,7 @@ public: Optional<std::vector<std::string>> list_value; const char* error = nullptr; - Expect(util::SettingsValue s) : setting(std::move(s)) {} + explicit Expect(util::SettingsValue s) : setting(std::move(s)) {} Expect& DefaultString() { default_string = true; return *this; } Expect& DefaultInt() { default_int = true; return *this; } Expect& DefaultBool() { default_bool = true; return *this; } |