Skip to content

Commit

Permalink
[#555] Fix clang-tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
elfenpiff committed Dec 20, 2024
1 parent 6d76c5f commit f8c372a
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 21 deletions.
1 change: 1 addition & 0 deletions examples/c/discovery/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <stdio.h>

iox2_callback_progression_e list_callback(const iox2_static_config_t* static_details, void* callback_context) {
(void) callback_context;
printf("Found Service: %s, ServiceID: %s\n", static_details->name, static_details->id);
return iox2_callback_progression_e_CONTINUE;
}
Expand Down
1 change: 1 addition & 0 deletions examples/c/domains/src/discovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <stdio.h>

iox2_callback_progression_e list_callback(const iox2_static_config_t* static_details, void* callback_context) {
(void) callback_context;
printf("Found Service: %s, ServiceID: %s\n", static_details->name, static_details->id);
return iox2_callback_progression_e_CONTINUE;
}
Expand Down
3 changes: 0 additions & 3 deletions examples/c/domains/src/subscriber.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,8 @@ int main(int argc, char** argv) {
goto drop_service;
}

uint64_t counter = 0;
printf("subscribed to: [domain: \"%s\", service: \"%s\"]\n", argv[1], argv[2]);
while (iox2_node_wait(&node_handle, 1, 0) == IOX2_OK) {
counter += 1;

// receive sample
iox2_sample_h sample = NULL;
if (iox2_subscriber_receive(&subscriber, NULL, &sample) != IOX2_OK) {
Expand Down
2 changes: 1 addition & 1 deletion examples/c/event_multiplexing/src/notifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char** argv) {
iox2_port_factory_event_h service = NULL;
if (iox2_service_builder_event_open_or_create(service_builder_event, NULL, &service) != IOX2_OK) {
printf("Unable to create service!\n");
goto drop_node;
goto drop_service_name;
}

// create notifier
Expand Down
3 changes: 0 additions & 3 deletions examples/c/publish_subscribe/src/subscriber.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ int main(void) {
goto drop_service;
}

uint64_t counter = 0;
while (iox2_node_wait(&node_handle, 1, 0) == IOX2_OK) {
counter += 1;

// receive sample
iox2_sample_h sample = NULL;
if (iox2_subscriber_receive(&subscriber, NULL, &sample) != IOX2_OK) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ int main(void) {
goto drop_service;
}

uint64_t counter = 0;
while (iox2_node_wait(&node_handle, 1, 0) == IOX2_OK) {
counter += 1;

// receive sample
iox2_sample_h sample = NULL;
if (iox2_subscriber_receive(&subscriber, NULL, &sample) != IOX2_OK) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enum class PubSubEvent : uint8_t {
SentSample = 4,
ReceivedSample = 5,
SentHistory = 6,
Unknown
Unknown = 7
};

namespace iox {
Expand Down
6 changes: 5 additions & 1 deletion examples/cxx/health_monitoring/src/central_daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ using namespace iox2;

constexpr iox::units::Duration CYCLE_TIME = iox::units::Duration::fromMilliseconds(100);

namespace {
void find_and_cleanup_dead_nodes();
}

auto main() -> int {
auto service_name_1 = ServiceName::create("service_1").expect("");
Expand Down Expand Up @@ -93,14 +95,16 @@ auto main() -> int {
return 0;
}

namespace {
void find_and_cleanup_dead_nodes() {
Node<ServiceType::Ipc>::list(Config::global_config(), [](auto node_state) {
node_state.dead([](auto view) {
std::cout << "detected dead node: ";
view.details().and_then([](auto details) { std::cout << details.name().to_string().c_str(); });
view.details().and_then([](const auto& details) { std::cout << details.name().to_string().c_str(); });
std::cout << std::endl;
view.remove_stale_resources().expect("");
});
return CallbackProgression::Continue;
}).expect("");
}
} // namespace
6 changes: 5 additions & 1 deletion examples/cxx/health_monitoring/src/subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ constexpr iox::units::Duration REACTION_BUFFER = iox::units::Duration::fromMilli
constexpr iox::units::Duration CYCLE_TIME_1 = iox::units::Duration::fromMilliseconds(1000) + REACTION_BUFFER;
constexpr iox::units::Duration CYCLE_TIME_2 = iox::units::Duration::fromMilliseconds(1500) + REACTION_BUFFER;

namespace {
void find_and_cleanup_dead_nodes();
void handle_incoming_events(Listener<ServiceType::Ipc>& listener,
const Subscriber<ServiceType::Ipc, uint64_t, void>& subscriber,
const ServiceName& service_name);
} // namespace

auto main() -> int {
auto service_name_1 = ServiceName::create("service_1").expect("");
Expand Down Expand Up @@ -94,6 +96,7 @@ auto main() -> int {
return 0;
}

namespace {
void handle_incoming_events(Listener<ServiceType::Ipc>& listener,
const Subscriber<ServiceType::Ipc, uint64_t, void>& subscriber,
const ServiceName& service_name) {
Expand All @@ -119,10 +122,11 @@ void find_and_cleanup_dead_nodes() {
Node<ServiceType::Ipc>::list(Config::global_config(), [](auto node_state) {
node_state.dead([](auto view) {
std::cout << "detected dead node: ";
view.details().and_then([](auto details) { std::cout << details.name().to_string().c_str(); });
view.details().and_then([](const auto& details) { std::cout << details.name().to_string().c_str(); });
std::cout << std::endl;
view.remove_stale_resources().expect("");
});
return CallbackProgression::Continue;
}).expect("");
}
} // namespace
3 changes: 1 addition & 2 deletions iceoryx2-ffi/cxx/src/port_factory_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ auto PortFactoryEvent<S>::dynamic_config() const -> const DynamicConfigEvent& {
}

template <ServiceType S>
auto PortFactoryEvent<S>::nodes(const iox::function<CallbackProgression(NodeState<S>)>& callback) const
auto PortFactoryEvent<S>::nodes([[maybe_unused]] const iox::function<CallbackProgression(NodeState<S>)>& callback) const
-> iox::expected<void, NodeListFailure> {
static_cast<void>(callback);
IOX_TODO();
}

Expand Down
9 changes: 3 additions & 6 deletions iceoryx2-ffi/cxx/src/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,10 @@ auto Service<S>::does_exist(const ServiceName& service_name,
}

template <ServiceType S>
auto Service<S>::details(const ServiceName& service_name,
const ConfigView config,
const MessagingPattern messaging_pattern)
auto Service<S>::details([[maybe_unused]] const ServiceName& service_name,
[[maybe_unused]] const ConfigView config,
[[maybe_unused]] const MessagingPattern messaging_pattern)
-> iox::expected<iox::optional<ServiceDetails<S>>, ServiceDetailsError> {
static_cast<void>(service_name);
static_cast<void>(config);
static_cast<void>(messaging_pattern);
IOX_TODO();
}

Expand Down
2 changes: 2 additions & 0 deletions iceoryx2-ffi/cxx/tests/src/waitset_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ TYPED_TEST(WaitSetTest, triggering_everything_works) {

std::vector<Listener<TestFixture::TYPE>> listeners;
std::vector<WaitSetGuard<TestFixture::TYPE>> guards;
guards.reserve(NUMBER_OF_INTERVALS + NUMBER_OF_NOTIFICATIONS + NUMBER_OF_DEADLINES);
listeners.reserve(NUMBER_OF_NOTIFICATIONS + NUMBER_OF_DEADLINES);

for (uint64_t idx = 0; idx < NUMBER_OF_INTERVALS; ++idx) {
guards.emplace_back(sut.attach_interval(Duration::fromNanoseconds(1)).expect(""));
Expand Down

0 comments on commit f8c372a

Please sign in to comment.