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

Fix some warnings/bugs found by clang-tidy #8812

Merged
merged 4 commits into from
Aug 19, 2023
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
3 changes: 2 additions & 1 deletion src/libmain/progress-bar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class ProgressBar : public Logger
stop();
}

void stop() override
/* Called by destructor, can't be overridden */
void stop() override final
{
{
auto state(state_.lock());
Expand Down
4 changes: 3 additions & 1 deletion src/libstore/build/local-derivation-goal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/libstore/build/substitution-goal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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; };
};
Expand Down
2 changes: 2 additions & 0 deletions src/libstore/filetransfer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/libutil/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/libutil/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class SimpleLogger : public Logger
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 + ">";
Expand Down
Loading