Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Various clang tidy recommendations#227

Merged
hikinggrass merged 18 commits intomainfrom
feature/clang-tidy-recommendations
Jan 8, 2025
Merged

Various clang tidy recommendations#227
hikinggrass merged 18 commits intomainfrom
feature/clang-tidy-recommendations

Conversation

@hikinggrass
Copy link
Member

  • More const ref usage
  • fix narrowing and widening conversion warnings

Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
…imum length

Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
@hikinggrass hikinggrass requested a review from a-w50 January 7, 2025 11:57
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
lib/everest.cpp Outdated
if (this->module_manifest.contains("enable_global_errors") &&
this->module_manifest.at("enable_global_errors").get<bool>()) {
std::shared_ptr<error::ErrorDatabaseMap> global_error_database = std::make_shared<error::ErrorDatabaseMap>();
const std::shared_ptr<error::ErrorDatabaseMap>& global_error_database =
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be a reference, also auto can be used here.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

lib/everest.cpp Outdated
for (const std::string& impl : Config::keys(this->module_manifest.at("provides"))) {
// setup shared database
std::shared_ptr<error::ErrorDatabaseMap> error_database = std::make_shared<error::ErrorDatabaseMap>();
const std::shared_ptr<error::ErrorDatabaseMap> error_database = std::make_shared<error::ErrorDatabaseMap>();
Copy link
Contributor

Choose a reason for hiding this comment

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

auto

Copy link
Member Author

Choose a reason for hiding this comment

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

changed to auto

{
const std::lock_guard<std::mutex> handlers_lock(handler_list_mutex);
for (auto handler : this->handlers) {
for (const auto& handler : this->handlers) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use local_handlers = this->handlers

Copy link
Member Author

Choose a reason for hiding this comment

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

this->handlers is a unordered_set, so just a copy-assignment to the local_handlers vector doesn't work, that's probably why this is done this way

Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
@hikinggrass hikinggrass merged commit 78c1de0 into main Jan 8, 2025
4 checks passed
@hikinggrass hikinggrass deleted the feature/clang-tidy-recommendations branch January 8, 2025 07:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants