diff --git a/include/SFML/Audio/Sound.hpp b/include/SFML/Audio/Sound.hpp index 55c47a63d..9ce9402cc 100644 --- a/include/SFML/Audio/Sound.hpp +++ b/include/SFML/Audio/Sound.hpp @@ -31,8 +31,6 @@ #include -#include - namespace sf { diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp index b95bbe194..0a0be9c4e 100644 --- a/include/SFML/Audio/SoundBuffer.hpp +++ b/include/SFML/Audio/SoundBuffer.hpp @@ -34,10 +34,11 @@ #include #include -#include #include #include +#include + namespace sf { diff --git a/include/SFML/Audio/SoundFileFactory.hpp b/include/SFML/Audio/SoundFileFactory.hpp index 8049e6e11..8942ca6ad 100644 --- a/include/SFML/Audio/SoundFileFactory.hpp +++ b/include/SFML/Audio/SoundFileFactory.hpp @@ -29,11 +29,12 @@ //////////////////////////////////////////////////////////// #include -#include #include #include #include +#include + namespace sf { diff --git a/include/SFML/Audio/SoundFileFactory.inl b/include/SFML/Audio/SoundFileFactory.inl index b36163237..3e565bbbe 100644 --- a/include/SFML/Audio/SoundFileFactory.inl +++ b/include/SFML/Audio/SoundFileFactory.inl @@ -25,6 +25,9 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) + +#include namespace sf diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp index 155a35aef..869a25097 100644 --- a/include/SFML/Graphics/Color.hpp +++ b/include/SFML/Graphics/Color.hpp @@ -226,10 +226,10 @@ constexpr Color& operator-=(Color& left, const Color& right); //////////////////////////////////////////////////////////// constexpr Color& operator*=(Color& left, const Color& right); -#include - } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \class sf::Color diff --git a/include/SFML/Graphics/Color.inl b/include/SFML/Graphics/Color.inl index 9b7bfc2d2..c47dc5e88 100644 --- a/include/SFML/Graphics/Color.inl +++ b/include/SFML/Graphics/Color.inl @@ -22,7 +22,14 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) + +namespace sf +{ //////////////////////////////////////////////////////////// constexpr Color::Color() = default; @@ -149,3 +156,5 @@ inline constexpr Color Color::Yellow(255, 255, 0); inline constexpr Color Color::Magenta(255, 0, 255); inline constexpr Color Color::Cyan(0, 255, 255); inline constexpr Color Color::Transparent(0, 0, 0, 0); + +} // namespace sf diff --git a/include/SFML/Graphics/Glsl.hpp b/include/SFML/Graphics/Glsl.hpp index ae920b543..ea8753176 100644 --- a/include/SFML/Graphics/Glsl.hpp +++ b/include/SFML/Graphics/Glsl.hpp @@ -47,8 +47,6 @@ struct Matrix; template struct Vector4; -#include - } // namespace priv @@ -195,6 +193,8 @@ using Mat4 = priv::Matrix<4, 4>; } // namespace Glsl } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \namespace sf::Glsl diff --git a/include/SFML/Graphics/Glsl.inl b/include/SFML/Graphics/Glsl.inl index d1300f639..8fac15c20 100644 --- a/include/SFML/Graphics/Glsl.inl +++ b/include/SFML/Graphics/Glsl.inl @@ -22,7 +22,14 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) + +namespace sf::priv +{ //////////////////////////////////////////////////////////// /// \brief Helper functions to copy sf::Transform to sf::Glsl::Mat3/4 /// @@ -149,3 +156,5 @@ struct Vector4 T z{}; //!< 3rd component (Z) of the 4D vector T w{}; //!< 4th component (W) of the 4D vector }; + +} // namespace sf::priv diff --git a/include/SFML/Graphics/Rect.hpp b/include/SFML/Graphics/Rect.hpp index f6519ed83..be2dd2811 100644 --- a/include/SFML/Graphics/Rect.hpp +++ b/include/SFML/Graphics/Rect.hpp @@ -173,14 +173,14 @@ template template [[nodiscard]] constexpr bool operator!=(const Rect& left, const Rect& right); -#include - // Create type aliases for the most common types using IntRect = Rect; using FloatRect = Rect; } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \class sf::Rect diff --git a/include/SFML/Graphics/Rect.inl b/include/SFML/Graphics/Rect.inl index e138d80f2..df9ede64f 100644 --- a/include/SFML/Graphics/Rect.inl +++ b/include/SFML/Graphics/Rect.inl @@ -22,7 +22,14 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) + +namespace sf +{ //////////////////////////////////////////////////////////// template constexpr Rect::Rect() = default; @@ -150,3 +157,5 @@ constexpr bool operator!=(const Rect& left, const Rect& right) { return !(left == right); } + +} // namespace sf diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index 25c9e56c8..120771b82 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -35,8 +35,7 @@ #include #include - -#include +#include namespace sf diff --git a/include/SFML/Graphics/Transform.hpp b/include/SFML/Graphics/Transform.hpp index 245ad4b38..8ccf091fe 100644 --- a/include/SFML/Graphics/Transform.hpp +++ b/include/SFML/Graphics/Transform.hpp @@ -33,8 +33,6 @@ #include -#include - namespace sf { @@ -347,10 +345,10 @@ constexpr Vector2f operator*(const Transform& left, const Vector2f& right); //////////////////////////////////////////////////////////// [[nodiscard]] constexpr bool operator!=(const Transform& left, const Transform& right); -#include - } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \class sf::Transform diff --git a/include/SFML/Graphics/Transform.inl b/include/SFML/Graphics/Transform.inl index 6a2a5817a..c3cff93d0 100644 --- a/include/SFML/Graphics/Transform.inl +++ b/include/SFML/Graphics/Transform.inl @@ -22,7 +22,16 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) +#include + + +namespace sf +{ //////////////////////////////////////////////////////////// constexpr Transform::Transform() = default; @@ -229,3 +238,5 @@ constexpr bool operator!=(const Transform& left, const Transform& right) // Note: the 'inline' keyword here is technically not required, but VS2019 fails // to compile with a bogus "multiple definition" error if not explicitly used. inline constexpr Transform Transform::Identity; + +} // namespace sf diff --git a/include/SFML/Graphics/Vertex.hpp b/include/SFML/Graphics/Vertex.hpp index 6649c0b81..43879750b 100644 --- a/include/SFML/Graphics/Vertex.hpp +++ b/include/SFML/Graphics/Vertex.hpp @@ -97,10 +97,10 @@ public: Vector2f texCoords; //!< Coordinates of the texture's pixel to map to the vertex }; -#include - } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \class sf::Vertex diff --git a/include/SFML/Graphics/Vertex.inl b/include/SFML/Graphics/Vertex.inl index 8807afa25..baac4beca 100644 --- a/include/SFML/Graphics/Vertex.inl +++ b/include/SFML/Graphics/Vertex.inl @@ -22,7 +22,14 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) + +namespace sf +{ //////////////////////////////////////////////////////////// constexpr Vertex::Vertex() = default; @@ -54,3 +61,5 @@ color(theColor), texCoords(theTexCoords) { } + +} // namespace sf diff --git a/include/SFML/Network/Socket.hpp b/include/SFML/Network/Socket.hpp index f524b7c52..f6f97ac11 100644 --- a/include/SFML/Network/Socket.hpp +++ b/include/SFML/Network/Socket.hpp @@ -31,8 +31,6 @@ #include -#include - namespace sf { diff --git a/include/SFML/Network/TcpSocket.hpp b/include/SFML/Network/TcpSocket.hpp index 44f43e73d..d13e1dc14 100644 --- a/include/SFML/Network/TcpSocket.hpp +++ b/include/SFML/Network/TcpSocket.hpp @@ -34,6 +34,7 @@ #include #include +#include #include diff --git a/include/SFML/System/Angle.hpp b/include/SFML/System/Angle.hpp index dd833c720..2af146632 100644 --- a/include/SFML/System/Angle.hpp +++ b/include/SFML/System/Angle.hpp @@ -29,8 +29,6 @@ //////////////////////////////////////////////////////////// #include -#include - namespace sf { @@ -471,11 +469,10 @@ namespace Literals [[nodiscard]] constexpr Angle operator""_rad(unsigned long long int angle); } // namespace Literals +} // namespace sf #include -} // namespace sf - //////////////////////////////////////////////////////////// /// \class sf::Angle diff --git a/include/SFML/System/Angle.inl b/include/SFML/System/Angle.inl index 7d59999ba..53b41d526 100644 --- a/include/SFML/System/Angle.inl +++ b/include/SFML/System/Angle.inl @@ -22,6 +22,16 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) + +#include + + +namespace sf +{ namespace priv { constexpr float pi = 3.141592654f; @@ -267,3 +277,5 @@ constexpr Angle operator""_rad(unsigned long long angle) // Note: the 'inline' keyword here is technically not required, but VS2019 fails // to compile with a bogus "multiple definition" error if not explicitly used. inline constexpr Angle Angle::Zero; + +} // namespace sf diff --git a/include/SFML/System/String.hpp b/include/SFML/System/String.hpp index 345b663d3..9ce333a2b 100644 --- a/include/SFML/System/String.hpp +++ b/include/SFML/System/String.hpp @@ -636,10 +636,10 @@ SFML_SYSTEM_API bool operator>=(const String& left, const String& right); //////////////////////////////////////////////////////////// SFML_SYSTEM_API String operator+(const String& left, const String& right); -#include - } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \class sf::String diff --git a/include/SFML/System/String.inl b/include/SFML/System/String.inl index 4ff7763af..c7af24acc 100644 --- a/include/SFML/System/String.inl +++ b/include/SFML/System/String.inl @@ -22,7 +22,14 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) + +namespace sf +{ //////////////////////////////////////////////////////////// template String String::fromUtf8(T begin, T end) @@ -51,3 +58,5 @@ String String::fromUtf32(T begin, T end) string.m_string.assign(begin, end); return string; } + +} // namespace sf diff --git a/include/SFML/System/Time.hpp b/include/SFML/System/Time.hpp index 6d1cbc42a..9b637dc28 100644 --- a/include/SFML/System/Time.hpp +++ b/include/SFML/System/Time.hpp @@ -30,9 +30,7 @@ #include #include -#include -#include #include @@ -450,10 +448,10 @@ constexpr Time& operator/=(Time& left, std::int64_t right); //////////////////////////////////////////////////////////// constexpr Time& operator%=(Time& left, Time right); -#include - } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \class sf::Time diff --git a/include/SFML/System/Time.inl b/include/SFML/System/Time.inl index c506fae84..ac838f3ec 100644 --- a/include/SFML/System/Time.inl +++ b/include/SFML/System/Time.inl @@ -22,7 +22,18 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) +#include + +#include + + +namespace sf +{ //////////////////////////////////////////////////////////// constexpr Time::Time() = default; @@ -273,3 +284,5 @@ constexpr Time& operator%=(Time& left, Time right) // Note: the 'inline' keyword here is technically not required, but VS2019 fails // to compile with a bogus "multiple definition" error if not explicitly used. inline constexpr Time Time::Zero; + +} // namespace sf diff --git a/include/SFML/System/Utf.hpp b/include/SFML/System/Utf.hpp index 2079e1e1f..f0759f2ec 100644 --- a/include/SFML/System/Utf.hpp +++ b/include/SFML/System/Utf.hpp @@ -731,8 +731,6 @@ public: static Out encodeWide(std::uint32_t codepoint, Out output, wchar_t replacement = 0); }; -#include - // Make type aliases to get rid of the template syntax using Utf8 = Utf<8>; using Utf16 = Utf<16>; @@ -740,6 +738,8 @@ using Utf32 = Utf<32>; } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \class sf::Utf diff --git a/include/SFML/System/Utf.inl b/include/SFML/System/Utf.inl index 00f741acc..b409f1643 100644 --- a/include/SFML/System/Utf.inl +++ b/include/SFML/System/Utf.inl @@ -22,6 +22,11 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) + //////////////////////////////////////////////////////////// // References: @@ -34,6 +39,8 @@ //////////////////////////////////////////////////////////// +namespace sf +{ //////////////////////////////////////////////////////////// template OutputIt priv::copy(InputIt first, InputIt last, OutputIt dFirst) @@ -727,3 +734,5 @@ Out Utf<32>::encodeWide(std::uint32_t codepoint, Out output, wchar_t replacement return output; } + +} // namespace sf diff --git a/include/SFML/System/Vector2.hpp b/include/SFML/System/Vector2.hpp index 565d824d2..66fa1cc26 100644 --- a/include/SFML/System/Vector2.hpp +++ b/include/SFML/System/Vector2.hpp @@ -28,8 +28,6 @@ #include -#include - namespace sf { @@ -398,10 +396,10 @@ template template [[nodiscard]] constexpr bool operator!=(const Vector2& left, const Vector2& right); -#include - } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \class sf::Vector2 diff --git a/include/SFML/System/Vector2.inl b/include/SFML/System/Vector2.inl index cd1b6996e..dae219807 100644 --- a/include/SFML/System/Vector2.inl +++ b/include/SFML/System/Vector2.inl @@ -22,7 +22,16 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) +#include + + +namespace sf +{ //////////////////////////////////////////////////////////// template constexpr Vector2::Vector2() = default; @@ -219,3 +228,5 @@ const Vector2 Vector2::UnitX(static_cast(1), static_cast(0)); template const Vector2 Vector2::UnitY(static_cast(0), static_cast(1)); + +} // namespace sf diff --git a/include/SFML/System/Vector3.hpp b/include/SFML/System/Vector3.hpp index 207315872..5b8ddb5db 100644 --- a/include/SFML/System/Vector3.hpp +++ b/include/SFML/System/Vector3.hpp @@ -26,7 +26,6 @@ #include -#include namespace sf { @@ -309,14 +308,14 @@ template template [[nodiscard]] constexpr bool operator!=(const Vector3& left, const Vector3& right); -#include - // Define the most common types using Vector3i = Vector3; using Vector3f = Vector3; } // namespace sf +#include + //////////////////////////////////////////////////////////// /// \class sf::Vector3 diff --git a/include/SFML/System/Vector3.inl b/include/SFML/System/Vector3.inl index be42c5a93..5a5ad2e2d 100644 --- a/include/SFML/System/Vector3.inl +++ b/include/SFML/System/Vector3.inl @@ -22,7 +22,16 @@ // //////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include // NOLINT(misc-header-include-cycle) +#include + + +namespace sf +{ //////////////////////////////////////////////////////////// template constexpr Vector3::Vector3() = default; @@ -208,3 +217,5 @@ constexpr bool operator!=(const Vector3& left, const Vector3& right) { return (left.x != right.x) || (left.y != right.y) || (left.z != right.z); } + +} // namespace sf diff --git a/src/SFML/Network/SocketImpl.hpp b/src/SFML/Network/SocketImpl.hpp index 6a7ff642f..6c9565f9d 100644 --- a/src/SFML/Network/SocketImpl.hpp +++ b/src/SFML/Network/SocketImpl.hpp @@ -46,6 +46,8 @@ #include #include +#include + #endif #include diff --git a/test/Graphics/Font.test.cpp b/test/Graphics/Font.test.cpp index b7bd1a207..ff72f6e85 100644 --- a/test/Graphics/Font.test.cpp +++ b/test/Graphics/Font.test.cpp @@ -73,8 +73,8 @@ TEST_CASE("[Graphics] sf::Font", runDisplayTests()) SECTION("Invalid data and size") { CHECK(!font.loadFromMemory(nullptr, 1)); - const std::byte byte{0xCD}; - CHECK(!font.loadFromMemory(&byte, 0)); + const std::byte testByte{0xCD}; + CHECK(!font.loadFromMemory(&testByte, 0)); } SECTION("Successful load") diff --git a/test/Graphics/Image.test.cpp b/test/Graphics/Image.test.cpp index cde8db13e..0dfd63689 100644 --- a/test/Graphics/Image.test.cpp +++ b/test/Graphics/Image.test.cpp @@ -155,8 +155,8 @@ TEST_CASE("[Graphics] sf::Image") SECTION("Invalid size") { - const std::byte byte{0xAB}; - CHECK(!image.loadFromMemory(&byte, 0)); + const std::byte testByte{0xAB}; + CHECK(!image.loadFromMemory(&testByte, 0)); } SECTION("Failed load")