diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2023-08-19 16:00:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-19 16:00:12 +0200 |
commit | 10afcf06aa2607bf088f7f08989f42c1fa2689a2 (patch) | |
tree | b14be6ec72f8c284059c90b4ab8b23ca6d8e1c5e /src | |
parent | 665ad4f7c506d3274db564d6c3c20526dca218e0 (diff) | |
parent | e78e9a6bd1c5f26684a9da0d94ede7d960788e0e (diff) |
Merge pull request #8812 from tweag/fix-clang-tidy
Fix some warnings/bugs found by clang-tidy
Diffstat (limited to 'src')
-rw-r--r-- | src/libmain/progress-bar.cc | 3 | ||||
-rw-r--r-- | src/libstore/build/local-derivation-goal.hh | 4 | ||||
-rw-r--r-- | src/libstore/build/substitution-goal.hh | 3 | ||||
-rw-r--r-- | src/libstore/filetransfer.cc | 2 | ||||
-rw-r--r-- | src/libutil/args.cc | 2 | ||||
-rw-r--r-- | src/libutil/logging.cc | 2 |
6 files changed, 11 insertions, 5 deletions
diff --git a/src/libmain/progress-bar.cc b/src/libmain/progress-bar.cc index 6600ec177..45b1fdfd1 100644 --- a/src/libmain/progress-bar.cc +++ b/src/libmain/progress-bar.cc @@ -108,7 +108,8 @@ public: stop(); } - void stop() override + /* Called by destructor, can't be overridden */ + void stop() override final { { auto state(state_.lock()); diff --git a/src/libstore/build/local-derivation-goal.hh b/src/libstore/build/local-derivation-goal.hh index 9acd7593d..8827bfca3 100644 --- a/src/libstore/build/local-derivation-goal.hh +++ b/src/libstore/build/local-derivation-goal.hh @@ -272,8 +272,10 @@ struct LocalDerivationGoal : public DerivationGoal /** * Forcibly kill the child process, if any. + * + * Called by destructor, can't be overridden */ - void killChild() override; + void killChild() override final; /** * Kill any processes running under the build user UID or in the diff --git a/src/libstore/build/substitution-goal.hh b/src/libstore/build/substitution-goal.hh index 9fc041920..1b693baa1 100644 --- a/src/libstore/build/substitution-goal.hh +++ b/src/libstore/build/substitution-goal.hh @@ -114,7 +114,8 @@ public: void handleChildOutput(int fd, std::string_view data) override; void handleEOF(int fd) override; - void cleanup() override; + /* Called by destructor, can't be overridden */ + void cleanup() override final; JobCategory jobCategory() override { return JobCategory::Substitution; }; }; diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index 38b691279..a283af5a2 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -863,6 +863,8 @@ void FileTransfer::download(FileTransferRequest && request, Sink & sink) } chunk = std::move(state->data); + /* Reset state->data after the move, since we check data.empty() */ + state->data = ""; state->request.notify_one(); } diff --git a/src/libutil/args.cc b/src/libutil/args.cc index 3cf3ed9ca..00281ce6f 100644 --- a/src/libutil/args.cc +++ b/src/libutil/args.cc @@ -410,8 +410,8 @@ nlohmann::json MultiCommand::toJSON() auto cat = nlohmann::json::object(); cat["id"] = command->category(); cat["description"] = trim(categories[command->category()]); - j["category"] = std::move(cat); cat["experimental-feature"] = command->experimentalFeature(); + j["category"] = std::move(cat); cmds[name] = std::move(j); } diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc index 5a2dd99af..54702e4ea 100644 --- a/src/libutil/logging.cc +++ b/src/libutil/logging.cc @@ -67,7 +67,7 @@ public: case lvlWarn: c = '4'; break; case lvlNotice: case lvlInfo: c = '5'; break; case lvlTalkative: case lvlChatty: c = '6'; break; - case lvlDebug: case lvlVomit: c = '7'; + case lvlDebug: case lvlVomit: c = '7'; break; default: c = '7'; break; // should not happen, and missing enum case is reported by -Werror=switch-enum } prefix = std::string("<") + c + ">"; |