Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed many clang-tidy warnigns #25

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Checks: "-*,
-cppcoreguidelines-pro-type-reinterpret-cast,

misc-*,
-misc-include-cleaner,
-misc-non-private-member-variables-in-classes,
-misc-no-recursion,

Expand Down
2 changes: 1 addition & 1 deletion tcp_pubsub/include/tcp_pubsub/callback_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <memory>
#include <cstdint>

#include <tcp_pubsub/tcp_pubsub_version.h>
#include <tcp_pubsub/tcp_pubsub_version.h> // IWYU pragma: keep

namespace tcp_pubsub
{
Expand Down
5 changes: 3 additions & 2 deletions tcp_pubsub/include/tcp_pubsub/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

#pragma once

#include <string>
#include <cstddef>
#include <memory>
#include <string>

#include <cstdint>

#include "tcp_pubsub_logger.h"

#include <tcp_pubsub/tcp_pubsub_version.h>
#include <tcp_pubsub/tcp_pubsub_version.h> // IWYU pragma: keep
#include <tcp_pubsub/tcp_pubsub_export.h>

namespace tcp_pubsub
Expand Down
6 changes: 4 additions & 2 deletions tcp_pubsub/include/tcp_pubsub/publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@

#pragma once

#include <cstddef>
#include <cstdint>

#include <chrono>
#include <memory>
#include <string>
#include <chrono>
#include <utility>
#include <vector>

#include "executor.h"

#include <tcp_pubsub/tcp_pubsub_version.h>
#include <tcp_pubsub/tcp_pubsub_version.h> // IWYU pragma: keep
#include <tcp_pubsub/tcp_pubsub_export.h>

namespace tcp_pubsub
Expand Down
6 changes: 4 additions & 2 deletions tcp_pubsub/include/tcp_pubsub/subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@

#include <cstdint>

#include <memory>
#include <chrono>
#include <functional>
#include <memory>
#include <string>

#include "executor.h"
#include "subscriber_session.h"
#include "callback_data.h"

#include <tcp_pubsub/tcp_pubsub_version.h>
#include <tcp_pubsub/tcp_pubsub_export.h>
#include <tcp_pubsub/tcp_pubsub_version.h> // IWYU pragma: keep
#include <vector>

namespace tcp_pubsub
{
Expand Down
4 changes: 2 additions & 2 deletions tcp_pubsub/include/tcp_pubsub/subscriber_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <string>
#include <cstdint>

#include <tcp_pubsub/tcp_pubsub_version.h>
#include <tcp_pubsub/tcp_pubsub_version.h> // IWYU pragma: keep
#include <tcp_pubsub/tcp_pubsub_export.h>

namespace tcp_pubsub
Expand Down Expand Up @@ -81,4 +81,4 @@ namespace tcp_pubsub
private:
std::shared_ptr<SubscriberSession_Impl> subscriber_session_impl_;
};
}
}
2 changes: 1 addition & 1 deletion tcp_pubsub/include/tcp_pubsub/tcp_pubsub_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <cstdint>

#include <tcp_pubsub/tcp_pubsub_version.h>
#include <tcp_pubsub/tcp_pubsub_version.h> // IWYU pragma: keep

namespace tcp_pubsub
{
Expand Down
3 changes: 3 additions & 0 deletions tcp_pubsub/src/executor.cpp
Original file line number Diff line number Diff line change
@@ -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 <cstddef>
#include <memory>
#include <tcp_pubsub/executor.h>

#include "executor_impl.h"
#include "tcp_pubsub/tcp_pubsub_logger.h"

namespace tcp_pubsub
{
Expand Down
7 changes: 7 additions & 0 deletions tcp_pubsub/src/executor_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cstddef>
#include <memory>
#include <sstream>
#include <string>
#include <thread>

namespace tcp_pubsub
{
Expand Down
9 changes: 4 additions & 5 deletions tcp_pubsub/src/executor_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

#pragma once

#include <cstdint>
#include <cstddef>
#include <memory>
#include <thread>
#include <string>
#include <vector>
#include <memory>

#include <asio.hpp>
#include <asio.hpp> // IWYU pragma: keep

#include "tcp_pubsub_logger_abstraction.h"
#include "tcp_pubsub/tcp_pubsub_logger.h"

namespace tcp_pubsub
{
Expand Down
16 changes: 8 additions & 8 deletions tcp_pubsub/src/portable_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

#if defined(__linux__) || defined(__CYGWIN__)

# include <endian.h>
# include <endian.h> // IWYU pragma: export

#elif defined(__APPLE__)

# include <libkern/OSByteOrder.h>
# include <libkern/OSByteOrder.h> // IWYU pragma: export

# define htobe16(x) OSSwapHostToBigInt16(x)
# define htole16(x) OSSwapHostToLittleInt16(x)
Expand All @@ -47,7 +47,7 @@

#elif defined(__OpenBSD__)

# include <endian.h>
# include <endian.h> // IWYU pragma: export

# define __BYTE_ORDER BYTE_ORDER
# define __BIG_ENDIAN BIG_ENDIAN
Expand All @@ -56,7 +56,7 @@

#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)

# include <sys/endian.h>
# include <sys/endian.h> // IWYU pragma: export

# define be16toh(x) betoh16(x)
# define le16toh(x) letoh16(x)
Expand All @@ -69,9 +69,9 @@

#elif defined(__WINDOWS__)

# include <winsock2.h>
# include <winsock2.h> // IWYU pragma: export
# ifdef __GNUC__
# include <sys/param.h>
# include <sys/param.h> // IWYU pragma: export
# endif

# if BYTE_ORDER == LITTLE_ENDIAN
Expand Down Expand Up @@ -122,8 +122,8 @@

#elif defined(__QNXNTO__)

# include <gulliver.h>
# include <net/netbyte.h>
# include <gulliver.h> // IWYU pragma: export
# include <net/netbyte.h> // IWYU pragma: export

#else

Expand Down
8 changes: 8 additions & 0 deletions tcp_pubsub/src/publisher.cpp
Original file line number Diff line number Diff line change
@@ -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 <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include <tcp_pubsub/publisher.h>
#include <tcp_pubsub/executor.h>

#include "executor_impl.h"
#include "publisher_impl.h"
Expand Down
16 changes: 16 additions & 0 deletions tcp_pubsub/src/publisher_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cstdint>
#include <cstring>
#include <ios>
#include <tcp_pubsub/executor.h>

#include <cstddef>
#include <memory>
#include <mutex>
#include <sstream>
#include <string>
#include <thread>
#include <utility>
#include <vector>

namespace tcp_pubsub
{
Expand Down
12 changes: 8 additions & 4 deletions tcp_pubsub/src/publisher_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@

#pragma once

#include <atomic>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
#include <mutex>
#include <atomic>
#include <string>
#include <utility>
#include <vector>

#include <asio.hpp>
#include <recycle/shared_pool.hpp>

#include <tcp_pubsub/executor.h>
#include "tcp_pubsub_logger_abstraction.h"
#include "publisher_session.h"
#include "tcp_pubsub/tcp_pubsub_logger.h"
#include <tcp_pubsub/executor.h>

namespace tcp_pubsub
{
Expand Down
13 changes: 13 additions & 0 deletions tcp_pubsub/src/publisher_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@

#include "publisher_session.h"

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <functional>
#include <iostream>
#include <memory>
#include <mutex>
#include <sstream>
#include <string>
#include <thread>
#include <vector>

#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
{
Expand Down
9 changes: 7 additions & 2 deletions tcp_pubsub/src/publisher_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@

#pragma once

#include <atomic>
#include <cstdint>
#include <functional>
#include <deque>

#include <asio.hpp>
#include <memory>
#include <mutex>
#include <string>
#include <vector>

#include "tcp_header.h"
#include "tcp_pubsub_logger_abstraction.h"
#include "tcp_pubsub/tcp_pubsub_logger.h"

namespace tcp_pubsub
{
Expand Down
8 changes: 7 additions & 1 deletion tcp_pubsub/src/subscriber.cpp
Original file line number Diff line number Diff line change
@@ -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 <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <tcp_pubsub/subscriber.h>

#include <tcp_pubsub/executor.h>
#include <vector>

#include "subscriber_impl.h"
#include "executor_impl.h"
#include "tcp_pubsub/callback_data.h"
#include "tcp_pubsub/subscriber_session.h"

namespace tcp_pubsub
{
Expand Down
20 changes: 18 additions & 2 deletions tcp_pubsub/src/subscriber_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <algorithm>
#include <cstdint>
#include <functional>
#include <ios>
#include <memory>
#include <mutex>
#include <sstream>
#include <string>
#include <thread>
#include <utility>
#include <vector>

namespace tcp_pubsub
{
Expand Down
Loading