Skip to content

Commit 620b7a6

Browse files
clalancetteBarry-Xu-2018
authored andcommitted
Fixes pointed out by the clang analyzer. (ros2#2339)
1. Remove the default Logger copy constructor without copy assignment (rule of three -> rule of zero). 2. Remove an unnecessary capture in a lambda. 3. Mark a variable unused. 4. Mark a method as override. Signed-off-by: Chris Lalancette <[email protected]>
1 parent 6007cde commit 620b7a6

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

rclcpp/include/rclcpp/logger.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ class Logger
126126
std::shared_ptr<std::pair<std::string, std::string>> logger_sublogger_pairname_ = nullptr;
127127

128128
public:
129-
RCLCPP_PUBLIC
130-
Logger(const Logger &) = default;
131-
132129
/// Get the name of this logger.
133130
/**
134131
* \return the full name of the logger including any prefixes, or

rclcpp/src/rclcpp/context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ template<Context::ShutdownType shutdown_type>
462462
std::vector<rclcpp::Context::ShutdownCallback>
463463
Context::get_shutdown_callback() const
464464
{
465-
const auto get_callback_vector = [this](auto & mutex, auto & callback_set) {
465+
const auto get_callback_vector = [](auto & mutex, auto & callback_set) {
466466
const std::lock_guard<std::mutex> lock(mutex);
467467
std::vector<rclcpp::Context::ShutdownCallback> callbacks;
468468
for (auto & callback : callback_set) {

rclcpp/test/rclcpp/executors/test_executors.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ TYPED_TEST(TestExecutors, testRaceConditionAddNode)
644644
break;
645645
}
646646
total += k * (i + 42);
647+
(void)total;
647648
}
648649
});
649650
}

rclcpp/test/rclcpp/test_intra_process_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ class SubscriptionIntraProcessBuffer : public SubscriptionIntraProcessBase
289289
}
290290

291291
bool
292-
use_take_shared_method() const
292+
use_take_shared_method() const override
293293
{
294294
return take_shared_method;
295295
}

0 commit comments

Comments
 (0)