From b0393e4895164c2e2ea7e9e62198e07b98cb78bd Mon Sep 17 00:00:00 2001 From: Florian Reimold <11774314+FlorianReimold@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:58:21 +0100 Subject: [PATCH] Fixed many clang-tidy warnigns (#25) * cleaned includes * updated clang-tidy file --- .clang-tidy | 1 + tcp_pubsub/include/tcp_pubsub/callback_data.h | 2 +- tcp_pubsub/include/tcp_pubsub/executor.h | 5 +++-- tcp_pubsub/include/tcp_pubsub/publisher.h | 6 ++++-- tcp_pubsub/include/tcp_pubsub/subscriber.h | 6 ++++-- .../include/tcp_pubsub/subscriber_session.h | 4 ++-- .../include/tcp_pubsub/tcp_pubsub_logger.h | 2 +- tcp_pubsub/src/executor.cpp | 3 +++ tcp_pubsub/src/executor_impl.cpp | 7 +++++++ tcp_pubsub/src/executor_impl.h | 9 ++++----- tcp_pubsub/src/portable_endian.h | 16 +++++++-------- tcp_pubsub/src/publisher.cpp | 8 ++++++++ tcp_pubsub/src/publisher_impl.cpp | 16 +++++++++++++++ tcp_pubsub/src/publisher_impl.h | 12 +++++++---- tcp_pubsub/src/publisher_session.cpp | 13 ++++++++++++ tcp_pubsub/src/publisher_session.h | 9 +++++++-- tcp_pubsub/src/subscriber.cpp | 8 +++++++- tcp_pubsub/src/subscriber_impl.cpp | 20 +++++++++++++++++-- tcp_pubsub/src/subscriber_impl.h | 17 +++++++++------- tcp_pubsub/src/subscriber_session.cpp | 3 +++ tcp_pubsub/src/subscriber_session_impl.cpp | 14 +++++++++++++ tcp_pubsub/src/subscriber_session_impl.h | 15 +++++++------- .../src/tcp_pubsub_logger_abstraction.h | 2 -- 23 files changed, 150 insertions(+), 48 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 43f8989..47bd903 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -36,6 +36,7 @@ Checks: "-*, -cppcoreguidelines-pro-type-reinterpret-cast, misc-*, + -misc-include-cleaner, -misc-non-private-member-variables-in-classes, -misc-no-recursion, diff --git a/tcp_pubsub/include/tcp_pubsub/callback_data.h b/tcp_pubsub/include/tcp_pubsub/callback_data.h index ee2012c..a088b0e 100644 --- a/tcp_pubsub/include/tcp_pubsub/callback_data.h +++ b/tcp_pubsub/include/tcp_pubsub/callback_data.h @@ -8,7 +8,7 @@ #include #include -#include +#include // IWYU pragma: keep namespace tcp_pubsub { diff --git a/tcp_pubsub/include/tcp_pubsub/executor.h b/tcp_pubsub/include/tcp_pubsub/executor.h index fb2618b..9e88dfd 100644 --- a/tcp_pubsub/include/tcp_pubsub/executor.h +++ b/tcp_pubsub/include/tcp_pubsub/executor.h @@ -3,14 +3,15 @@ #pragma once -#include +#include #include +#include #include #include "tcp_pubsub_logger.h" -#include +#include // IWYU pragma: keep #include namespace tcp_pubsub diff --git a/tcp_pubsub/include/tcp_pubsub/publisher.h b/tcp_pubsub/include/tcp_pubsub/publisher.h index c2f3d94..3c337ea 100644 --- a/tcp_pubsub/include/tcp_pubsub/publisher.h +++ b/tcp_pubsub/include/tcp_pubsub/publisher.h @@ -3,16 +3,18 @@ #pragma once +#include #include +#include #include #include -#include +#include #include #include "executor.h" -#include +#include // IWYU pragma: keep #include namespace tcp_pubsub diff --git a/tcp_pubsub/include/tcp_pubsub/subscriber.h b/tcp_pubsub/include/tcp_pubsub/subscriber.h index afa8217..17f2521 100644 --- a/tcp_pubsub/include/tcp_pubsub/subscriber.h +++ b/tcp_pubsub/include/tcp_pubsub/subscriber.h @@ -5,16 +5,18 @@ #include -#include #include +#include +#include #include #include "executor.h" #include "subscriber_session.h" #include "callback_data.h" -#include #include +#include // IWYU pragma: keep +#include namespace tcp_pubsub { diff --git a/tcp_pubsub/include/tcp_pubsub/subscriber_session.h b/tcp_pubsub/include/tcp_pubsub/subscriber_session.h index d99d297..6b7089a 100644 --- a/tcp_pubsub/include/tcp_pubsub/subscriber_session.h +++ b/tcp_pubsub/include/tcp_pubsub/subscriber_session.h @@ -7,7 +7,7 @@ #include #include -#include +#include // IWYU pragma: keep #include namespace tcp_pubsub @@ -81,4 +81,4 @@ namespace tcp_pubsub private: std::shared_ptr subscriber_session_impl_; }; -} \ No newline at end of file +} diff --git a/tcp_pubsub/include/tcp_pubsub/tcp_pubsub_logger.h b/tcp_pubsub/include/tcp_pubsub/tcp_pubsub_logger.h index f5fba50..142a1ba 100644 --- a/tcp_pubsub/include/tcp_pubsub/tcp_pubsub_logger.h +++ b/tcp_pubsub/include/tcp_pubsub/tcp_pubsub_logger.h @@ -9,7 +9,7 @@ #include -#include +#include // IWYU pragma: keep namespace tcp_pubsub { diff --git a/tcp_pubsub/src/executor.cpp b/tcp_pubsub/src/executor.cpp index 7c27a9d..af78ad8 100644 --- a/tcp_pubsub/src/executor.cpp +++ b/tcp_pubsub/src/executor.cpp @@ -1,9 +1,12 @@ // Copyright (c) Continental. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for details. +#include +#include #include #include "executor_impl.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" namespace tcp_pubsub { diff --git a/tcp_pubsub/src/executor_impl.cpp b/tcp_pubsub/src/executor_impl.cpp index a64e3a0..50687ad 100644 --- a/tcp_pubsub/src/executor_impl.cpp +++ b/tcp_pubsub/src/executor_impl.cpp @@ -2,6 +2,13 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. #include "executor_impl.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" +#include "tcp_pubsub_logger_abstraction.h" +#include +#include +#include +#include +#include namespace tcp_pubsub { diff --git a/tcp_pubsub/src/executor_impl.h b/tcp_pubsub/src/executor_impl.h index 4ed7d65..ca8716d 100644 --- a/tcp_pubsub/src/executor_impl.h +++ b/tcp_pubsub/src/executor_impl.h @@ -3,15 +3,14 @@ #pragma once -#include +#include +#include #include -#include #include -#include -#include +#include // IWYU pragma: keep -#include "tcp_pubsub_logger_abstraction.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" namespace tcp_pubsub { diff --git a/tcp_pubsub/src/portable_endian.h b/tcp_pubsub/src/portable_endian.h index e6d238f..bc14541 100644 --- a/tcp_pubsub/src/portable_endian.h +++ b/tcp_pubsub/src/portable_endian.h @@ -19,11 +19,11 @@ #if defined(__linux__) || defined(__CYGWIN__) -# include +# include // IWYU pragma: export #elif defined(__APPLE__) -# include +# include // IWYU pragma: export # define htobe16(x) OSSwapHostToBigInt16(x) # define htole16(x) OSSwapHostToLittleInt16(x) @@ -47,7 +47,7 @@ #elif defined(__OpenBSD__) -# include +# include // IWYU pragma: export # define __BYTE_ORDER BYTE_ORDER # define __BIG_ENDIAN BIG_ENDIAN @@ -56,7 +56,7 @@ #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -# include +# include // IWYU pragma: export # define be16toh(x) betoh16(x) # define le16toh(x) letoh16(x) @@ -69,9 +69,9 @@ #elif defined(__WINDOWS__) -# include +# include // IWYU pragma: export # ifdef __GNUC__ -# include +# include // IWYU pragma: export # endif # if BYTE_ORDER == LITTLE_ENDIAN @@ -122,8 +122,8 @@ #elif defined(__QNXNTO__) -# include -# include +# include // IWYU pragma: export +# include // IWYU pragma: export #else diff --git a/tcp_pubsub/src/publisher.cpp b/tcp_pubsub/src/publisher.cpp index 902e400..d52eaef 100644 --- a/tcp_pubsub/src/publisher.cpp +++ b/tcp_pubsub/src/publisher.cpp @@ -1,7 +1,15 @@ // Copyright (c) Continental. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for details. +#include +#include +#include +#include +#include +#include + #include +#include #include "executor_impl.h" #include "publisher_impl.h" diff --git a/tcp_pubsub/src/publisher_impl.cpp b/tcp_pubsub/src/publisher_impl.cpp index 3910a23..6db4c24 100644 --- a/tcp_pubsub/src/publisher_impl.cpp +++ b/tcp_pubsub/src/publisher_impl.cpp @@ -4,9 +4,25 @@ #include "publisher_impl.h" #include "tcp_header.h" +#include "publisher_session.h" #include "portable_endian.h" #include "executor_impl.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" +#include "tcp_pubsub_logger_abstraction.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include namespace tcp_pubsub { diff --git a/tcp_pubsub/src/publisher_impl.h b/tcp_pubsub/src/publisher_impl.h index 6c04dd0..6e2e152 100644 --- a/tcp_pubsub/src/publisher_impl.h +++ b/tcp_pubsub/src/publisher_impl.h @@ -3,17 +3,21 @@ #pragma once +#include +#include +#include #include -#include #include -#include +#include +#include +#include #include #include -#include -#include "tcp_pubsub_logger_abstraction.h" #include "publisher_session.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" +#include namespace tcp_pubsub { diff --git a/tcp_pubsub/src/publisher_session.cpp b/tcp_pubsub/src/publisher_session.cpp index 769ac87..8492c87 100644 --- a/tcp_pubsub/src/publisher_session.cpp +++ b/tcp_pubsub/src/publisher_session.cpp @@ -3,12 +3,25 @@ #include "publisher_session.h" +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include #include "tcp_header.h" #include "portable_endian.h" #include "protocol_handshake_message.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" +#include "tcp_pubsub_logger_abstraction.h" namespace tcp_pubsub { diff --git a/tcp_pubsub/src/publisher_session.h b/tcp_pubsub/src/publisher_session.h index 0e86c71..62f5aa9 100644 --- a/tcp_pubsub/src/publisher_session.h +++ b/tcp_pubsub/src/publisher_session.h @@ -3,13 +3,18 @@ #pragma once +#include +#include #include -#include #include +#include +#include +#include +#include #include "tcp_header.h" -#include "tcp_pubsub_logger_abstraction.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" namespace tcp_pubsub { diff --git a/tcp_pubsub/src/subscriber.cpp b/tcp_pubsub/src/subscriber.cpp index 0781c19..dd5922d 100644 --- a/tcp_pubsub/src/subscriber.cpp +++ b/tcp_pubsub/src/subscriber.cpp @@ -1,12 +1,18 @@ // Copyright (c) Continental. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for details. +#include +#include +#include +#include #include #include +#include #include "subscriber_impl.h" -#include "executor_impl.h" +#include "tcp_pubsub/callback_data.h" +#include "tcp_pubsub/subscriber_session.h" namespace tcp_pubsub { diff --git a/tcp_pubsub/src/subscriber_impl.cpp b/tcp_pubsub/src/subscriber_impl.cpp index f7363a9..ef3acce 100644 --- a/tcp_pubsub/src/subscriber_impl.cpp +++ b/tcp_pubsub/src/subscriber_impl.cpp @@ -3,10 +3,26 @@ #include "subscriber_impl.h" -#include "tcp_header.h" +#include "executor_impl.h" #include "portable_endian.h" #include "subscriber_session_impl.h" -#include "executor_impl.h" +#include "tcp_header.h" +#include "tcp_pubsub/callback_data.h" +#include "tcp_pubsub/executor.h" +#include "tcp_pubsub/subscriber_session.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" +#include "tcp_pubsub_logger_abstraction.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace tcp_pubsub { diff --git a/tcp_pubsub/src/subscriber_impl.h b/tcp_pubsub/src/subscriber_impl.h index ed07d9e..e6c3992 100644 --- a/tcp_pubsub/src/subscriber_impl.h +++ b/tcp_pubsub/src/subscriber_impl.h @@ -3,11 +3,15 @@ #pragma once +#include +#include +#include +#include #include -#include #include +#include +#include #include -#include #include #include @@ -16,12 +20,11 @@ #include #include -#include "tcp_pubsub_logger_abstraction.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" -namespace tcp_pubsub +namespace tcp_pubsub { +class Subscriber_Impl : public std::enable_shared_from_this { - class Subscriber_Impl : public std::enable_shared_from_this - { //////////////////////////////////////////////// // Constructor & Destructor //////////////////////////////////////////////// @@ -90,4 +93,4 @@ namespace tcp_pubsub // Log function const tcp_pubsub::logger::logger_t log_; }; -} + } // namespace tcp_pubsub diff --git a/tcp_pubsub/src/subscriber_session.cpp b/tcp_pubsub/src/subscriber_session.cpp index 5c93d81..ba57d30 100644 --- a/tcp_pubsub/src/subscriber_session.cpp +++ b/tcp_pubsub/src/subscriber_session.cpp @@ -1,6 +1,9 @@ // Copyright (c) Continental. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for details. +#include +#include +#include #include #include "subscriber_session_impl.h" diff --git a/tcp_pubsub/src/subscriber_session_impl.cpp b/tcp_pubsub/src/subscriber_session_impl.cpp index 426a372..f88f765 100644 --- a/tcp_pubsub/src/subscriber_session_impl.cpp +++ b/tcp_pubsub/src/subscriber_session_impl.cpp @@ -6,6 +6,20 @@ #include "portable_endian.h" #include "protocol_handshake_message.h" +#include "tcp_header.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" +#include "tcp_pubsub_logger_abstraction.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace tcp_pubsub { diff --git a/tcp_pubsub/src/subscriber_session_impl.h b/tcp_pubsub/src/subscriber_session_impl.h index 486e0a8..c8c3ae3 100644 --- a/tcp_pubsub/src/subscriber_session_impl.h +++ b/tcp_pubsub/src/subscriber_session_impl.h @@ -3,20 +3,21 @@ #pragma once +#include +#include +#include +#include #include #include -#include -#include #include -#include "tcp_pubsub_logger_abstraction.h" #include "tcp_header.h" +#include "tcp_pubsub/tcp_pubsub_logger.h" -namespace tcp_pubsub +namespace tcp_pubsub { +class SubscriberSession_Impl : public std::enable_shared_from_this { - class SubscriberSession_Impl : public std::enable_shared_from_this - { ////////////////////////////////////////////// /// Constructor & Destructor ////////////////////////////////////////////// @@ -108,4 +109,4 @@ namespace tcp_pubsub // Logger const tcp_pubsub::logger::logger_t log_; }; -} + } // namespace tcp_pubsub diff --git a/tcp_pubsub/src/tcp_pubsub_logger_abstraction.h b/tcp_pubsub/src/tcp_pubsub_logger_abstraction.h index 0b7e99f..f88f5db 100644 --- a/tcp_pubsub/src/tcp_pubsub_logger_abstraction.h +++ b/tcp_pubsub/src/tcp_pubsub_logger_abstraction.h @@ -3,8 +3,6 @@ #pragma once -#include - // // If DEBUG_VERBOSE is not set by the user, we enable it when compiling in // Debug mode. The user can still omit those verbose messages by setting a