From e1ceb9f96a49517a206012ae983444c39716f2d3 Mon Sep 17 00:00:00 2001 From: Rex Schilasky <49162693+rex-schilasky@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:38:57 +0100 Subject: [PATCH] [core] common warning fixes (#1837) * eCAL_Finalize(eCAL_Init_All) -> eCAL_Finalize() * class WriterImpl -> struct WriterImpl * minor sample warning fixes * JsonOptions (deprecated) -> JsonPrintOptions * some more warning fixes --- app/meas_cutter/src/config_file_parser.h | 4 ++-- app/meas_cutter/src/utils.h | 4 ++-- .../hdf5/include/ecal/measurement/hdf5/writer.h | 2 +- ecal/core/CMakeLists.txt | 13 +++++++++++-- .../ecal/msg/protobuf/dynamic_json_subscriber.h | 2 +- .../c/pubsub/string/minimal_rec/src/minimal_rec.c | 4 ++-- .../string/minimal_rec_cb/src/minimal_rec_cb.c | 4 ++-- .../c/pubsub/string/minimal_snd/src/minimal_snd.c | 4 ++-- .../minimal_client_c/src/minimal_client_c.c | 4 ++-- .../minimal_server_c/src/minimal_server_c.c | 4 ++-- .../massive_pub_sub/src/massive_pub_sub.cpp | 2 +- .../pubsub_throughput/src/pubsub_throughput.cpp | 2 ++ .../person_loopback/src/person_loopback.cpp | 2 +- .../cpp/pubsub_test/src/pubsub_connection_test.cpp | 2 -- ecal/tests/cpp/pubsub_test/src/pubsub_test.cpp | 4 ++-- 15 files changed, 33 insertions(+), 24 deletions(-) diff --git a/app/meas_cutter/src/config_file_parser.h b/app/meas_cutter/src/config_file_parser.h index 4efa8e3583..e545b80c86 100644 --- a/app/meas_cutter/src/config_file_parser.h +++ b/app/meas_cutter/src/config_file_parser.h @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ #include #include -#define YAML_CPP_STATIC_DEFINE +//#define YAML_CPP_STATIC_DEFINE // set by CMake #include #include "utils.h" diff --git a/app/meas_cutter/src/utils.h b/app/meas_cutter/src/utils.h index 48736c8f9b..0523391c10 100644 --- a/app/meas_cutter/src/utils.h +++ b/app/meas_cutter/src/utils.h @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ #include #include -#define YAML_CPP_STATIC_DEFINE +//#define YAML_CPP_STATIC_DEFINE // set by CMake #include "yaml-cpp/yaml.h" #include diff --git a/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h b/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h index 8e20c2036d..3d11703a47 100644 --- a/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h +++ b/contrib/measurement/hdf5/include/ecal/measurement/hdf5/writer.h @@ -39,7 +39,7 @@ namespace eCAL { namespace hdf5 { - class WriterImpl; + struct WriterImpl; /** * @brief Hdf5 based Writer implementation diff --git a/ecal/core/CMakeLists.txt b/ecal/core/CMakeLists.txt index 83621a14e6..dc415386ff 100644 --- a/ecal/core/CMakeLists.txt +++ b/ecal/core/CMakeLists.txt @@ -502,11 +502,19 @@ endif() # public header ###################################### set(ecal_header_cmn - include/ecal/types/logging.h - include/ecal/types/monitoring.h + include/ecal/config/application.h include/ecal/config/configuration.h + include/ecal/config/logging.h + include/ecal/config/monitoring.h include/ecal/config/publisher.h + include/ecal/config/registration.h + include/ecal/config/service.h include/ecal/config/subscriber.h + include/ecal/config/time.h + include/ecal/config/transport_layer.h + include/ecal/config/user_arguments.h + include/ecal/types/logging.h + include/ecal/types/monitoring.h include/ecal/ecal.h include/ecal/ecal_callback.h include/ecal/ecal_config.h @@ -555,6 +563,7 @@ set(ecal_header_cimpl set(ecal_header_msg include/ecal/msg/protobuf/client.h + include/ecal/msg/protobuf/dynamic_json_subscriber.h include/ecal/msg/protobuf/dynamic_publisher.h include/ecal/msg/protobuf/dynamic_subscriber.h include/ecal/msg/protobuf/publisher.h diff --git a/ecal/core/include/ecal/msg/protobuf/dynamic_json_subscriber.h b/ecal/core/include/ecal/msg/protobuf/dynamic_json_subscriber.h index aa0d236983..fca3ba4632 100644 --- a/ecal/core/include/ecal/msg/protobuf/dynamic_json_subscriber.h +++ b/ecal/core/include/ecal/msg/protobuf/dynamic_json_subscriber.h @@ -63,7 +63,7 @@ namespace eCAL public: std::string Deserialize(const void* buffer_, size_t size_, const SDataTypeInformation& datatype_info_) { - google::protobuf::util::JsonOptions options; + google::protobuf::util::JsonPrintOptions options; #if GOOGLE_PROTOBUF_VERSION >= 5026000 options.always_print_fields_with_no_presence = true; #else diff --git a/ecal/samples/c/pubsub/string/minimal_rec/src/minimal_rec.c b/ecal/samples/c/pubsub/string/minimal_rec/src/minimal_rec.c index ed528a9c05..cd0a2320c4 100644 --- a/ecal/samples/c/pubsub/string/minimal_rec/src/minimal_rec.c +++ b/ecal/samples/c/pubsub/string/minimal_rec/src/minimal_rec.c @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ int main(int argc, char **argv) eCAL_Sub_Destroy(sub); // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/c/pubsub/string/minimal_rec_cb/src/minimal_rec_cb.c b/ecal/samples/c/pubsub/string/minimal_rec_cb/src/minimal_rec_cb.c index fcadd04ab7..42eaf829fc 100644 --- a/ecal/samples/c/pubsub/string/minimal_rec_cb/src/minimal_rec_cb.c +++ b/ecal/samples/c/pubsub/string/minimal_rec_cb/src/minimal_rec_cb.c @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ int main(int argc, char **argv) eCAL_Sub_Destroy(sub); // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/c/pubsub/string/minimal_snd/src/minimal_snd.c b/ecal/samples/c/pubsub/string/minimal_snd/src/minimal_snd.c index 3b2d5cae43..cb3698b18c 100644 --- a/ecal/samples/c/pubsub/string/minimal_snd/src/minimal_snd.c +++ b/ecal/samples/c/pubsub/string/minimal_snd/src/minimal_snd.c @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ int main(int argc, char **argv) } // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/c/services/minimal_client_c/src/minimal_client_c.c b/ecal/samples/c/services/minimal_client_c/src/minimal_client_c.c index 25d98a9cac..44d08b869a 100644 --- a/ecal/samples/c/services/minimal_client_c/src/minimal_client_c.c +++ b/ecal/samples/c/services/minimal_client_c/src/minimal_client_c.c @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ int main(int argc, char **argv) eCAL_Client_Destroy(hclient); // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/c/services/minimal_server_c/src/minimal_server_c.c b/ecal/samples/c/services/minimal_server_c/src/minimal_server_c.c index 26a07c6bc5..8884127f00 100644 --- a/ecal/samples/c/services/minimal_server_c/src/minimal_server_c.c +++ b/ecal/samples/c/services/minimal_server_c/src/minimal_server_c.c @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2024 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ int main(int argc, char **argv) eCAL_Server_Destroy(hserver); // finalize eCAL API - eCAL_Finalize(eCAL_Init_All); + eCAL_Finalize(); return(0); } diff --git a/ecal/samples/cpp/benchmarks/massive_pub_sub/src/massive_pub_sub.cpp b/ecal/samples/cpp/benchmarks/massive_pub_sub/src/massive_pub_sub.cpp index dc2b46e6e4..c46543aafa 100644 --- a/ecal/samples/cpp/benchmarks/massive_pub_sub/src/massive_pub_sub.cpp +++ b/ecal/samples/cpp/benchmarks/massive_pub_sub/src/massive_pub_sub.cpp @@ -54,7 +54,7 @@ std::string GenerateSizedString(const std::string& name, size_t totalSize) return result; } -int main(int argc, char** argv) +int main(int /*argc*/, char** /*argv*/) { // set eCAL configuration eCAL::Configuration configuration; diff --git a/ecal/samples/cpp/benchmarks/pubsub_throughput/src/pubsub_throughput.cpp b/ecal/samples/cpp/benchmarks/pubsub_throughput/src/pubsub_throughput.cpp index a2f346c17e..d8ede8f303 100644 --- a/ecal/samples/cpp/benchmarks/pubsub_throughput/src/pubsub_throughput.cpp +++ b/ecal/samples/cpp/benchmarks/pubsub_throughput/src/pubsub_throughput.cpp @@ -51,6 +51,8 @@ void throughput_test(int snd_size, int snd_loops, eCAL::TLayer::eTransportLayer case eCAL::TLayer::tlayer_tcp: pub_config.layer.tcp.enable = true; break; + default: + break; } // enable zero copy mode diff --git a/ecal/samples/cpp/pubsub/protobuf/person_loopback/src/person_loopback.cpp b/ecal/samples/cpp/pubsub/protobuf/person_loopback/src/person_loopback.cpp index 039f4fe925..ff3351933e 100644 --- a/ecal/samples/cpp/pubsub/protobuf/person_loopback/src/person_loopback.cpp +++ b/ecal/samples/cpp/pubsub/protobuf/person_loopback/src/person_loopback.cpp @@ -40,7 +40,7 @@ int main(int argc, char **argv) pb::People::Person person; eCAL::protobuf::CSubscriber sub("person"); - auto receive_lambda = [&sub](const char* /*topic_name_*/, const pb::People::Person& person_, const long long /*time_*/, const long long /*clock_*/, const long long /*id_*/){ + auto receive_lambda = [](const char* /*topic_name_*/, const pb::People::Person& person_, const long long /*time_*/, const long long /*clock_*/, const long long /*id_*/){ std::cout << "------------------------------------------" << std::endl; std::cout << " RECEIVED " << std::endl; std::cout << "------------------------------------------" << std::endl; diff --git a/ecal/tests/cpp/pubsub_test/src/pubsub_connection_test.cpp b/ecal/tests/cpp/pubsub_test/src/pubsub_connection_test.cpp index 5bc061ee0b..0521d7770c 100644 --- a/ecal/tests/cpp/pubsub_test/src/pubsub_connection_test.cpp +++ b/ecal/tests/cpp/pubsub_test/src/pubsub_connection_test.cpp @@ -71,7 +71,6 @@ TEST(core_cpp_pubsub, TestSubscriberIsPublishedTiming) std::string first_received_sample; auto subscriber_function = [&do_start_publication, &publication_finished, &publisher_seen_at_subscription_start, &first_received_sample]() { eCAL::CSubscriber sub("blob"); - bool received(false); const auto max_sub_count(10); auto sub_count(0); auto receive_lambda = [&max_sub_count, &sub_count, &publisher_seen_at_subscription_start, &first_received_sample, &sub](const char* /*topic_name_*/, const struct eCAL::SReceiveCallbackData* data_) { @@ -171,7 +170,6 @@ TEST(core_cpp_pubsub, TestPublisherIsSubscribedTiming) std::string first_received_sample; auto subscriber_function = [&publication_finished, &publisher_seen_at_subscription_start, &first_received_sample]() { eCAL::CSubscriber sub("blob"); - bool received(false); const auto max_sub_count(10); auto sub_count(0); auto receive_lambda = [&max_sub_count, &sub_count, &publisher_seen_at_subscription_start, &first_received_sample, &sub](const char* /*topic_name_*/, const struct eCAL::SReceiveCallbackData* data_) { diff --git a/ecal/tests/cpp/pubsub_test/src/pubsub_test.cpp b/ecal/tests/cpp/pubsub_test/src/pubsub_test.cpp index 0fa73c8a60..28b7c75503 100644 --- a/ecal/tests/cpp/pubsub_test/src/pubsub_test.cpp +++ b/ecal/tests/cpp/pubsub_test/src/pubsub_test.cpp @@ -588,7 +588,7 @@ TEST(core_cpp_pubsub, SubscriberReconnection) size_t callback_received_count(0); eCAL::string::CSubscriber sub_foo("foo"); - auto receive_lambda = [&sub_foo, &callback_received_count](const char* /*topic_*/, const std::string& /*msg*/, long long /*time_*/, long long /*clock_*/, long long /*id_*/) { + auto receive_lambda = [&callback_received_count](const char* /*topic_*/, const std::string& /*msg*/, long long /*time_*/, long long /*clock_*/, long long /*id_*/) { std::cout << "Receiving in scope 1" << std::endl; callback_received_count++; }; @@ -605,7 +605,7 @@ TEST(core_cpp_pubsub, SubscriberReconnection) size_t callback_received_count(0); eCAL::string::CSubscriber sub_foo("foo"); - auto receive_lambda = [&sub_foo, &callback_received_count](const char* /*topic_*/, const std::string& /*msg*/, long long /*time_*/, long long /*clock_*/, long long /*id_*/) { + auto receive_lambda = [&callback_received_count](const char* /*topic_*/, const std::string& /*msg*/, long long /*time_*/, long long /*clock_*/, long long /*id_*/) { std::cout << "Receiving in scope 2" << std::endl; callback_received_count++; };