diff --git a/.clang-tidy b/.clang-tidy index 06c3cdf3e..584d7ee1f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,11 +1,25 @@ Checks: > -*, + bugprone-*, clang-analyzer-*, misc-*, modernize-*, performance-*, portability-*, readability-*, + -bugprone-assignment-in-if-condition, + -bugprone-branch-clone, + -bugprone-easily-swappable-parameters, + -bugprone-exception-escape, + -bugprone-implicit-widening-of-multiplication-result, + -bugprone-incorrect-roundings, + -bugprone-integer-division, + -bugprone-misplaced-widening-cast, + -bugprone-narrowing-conversions, + -bugprone-signed-char-misuse, + -bugprone-string-integer-assignment, + -bugprone-suspicious-include, + -bugprone-unchecked-optional-access, -clang-analyzer-nullability.NullablePassedToNonnull, -clang-analyzer-optin.cplusplus.VirtualCall, -clang-analyzer-optin.osx.*, diff --git a/include/SFML/Window/GlResource.hpp b/include/SFML/Window/GlResource.hpp index cf5c7213c..cc432925f 100644 --- a/include/SFML/Window/GlResource.hpp +++ b/include/SFML/Window/GlResource.hpp @@ -32,9 +32,6 @@ namespace sf { - -class Context; - using ContextDestroyCallback = void (*)(void*); //////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/WindowHandle.hpp b/include/SFML/Window/WindowHandle.hpp index 854a7d016..6f5e7d801 100644 --- a/include/SFML/Window/WindowHandle.hpp +++ b/include/SFML/Window/WindowHandle.hpp @@ -31,7 +31,7 @@ // Windows' HWND is a type alias for struct HWND__* #if defined(SFML_SYSTEM_WINDOWS) -struct HWND__; +struct HWND__; // NOLINT(bugprone-reserved-identifier) #endif namespace sf diff --git a/src/SFML/System/Win32/WindowsHeader.hpp b/src/SFML/System/Win32/WindowsHeader.hpp index 9e07d374b..bfeab7a27 100644 --- a/src/SFML/System/Win32/WindowsHeader.hpp +++ b/src/SFML/System/Win32/WindowsHeader.hpp @@ -33,7 +33,7 @@ #endif #ifndef _WIN32_WINDOWS -#define _WIN32_WINDOWS 0x0501 +#define _WIN32_WINDOWS 0x0501 // NOLINT(bugprone-reserved-identifier) #endif #ifndef _WIN32_WINNT @@ -49,7 +49,7 @@ #endif #ifndef _UNICODE -#define _UNICODE 1 +#define _UNICODE 1 // NOLINT(bugprone-reserved-identifier) #endif #include diff --git a/src/SFML/Window/DRM/InputImplUDev.cpp b/src/SFML/Window/DRM/InputImplUDev.cpp index 52f1cc201..af7df8bdd 100644 --- a/src/SFML/Window/DRM/InputImplUDev.cpp +++ b/src/SFML/Window/DRM/InputImplUDev.cpp @@ -93,10 +93,10 @@ void uninitFileDescriptors() } #define BITS_PER_LONG (sizeof(unsigned long) * 8) -#define NBITS(x) (((x - 1) / BITS_PER_LONG) + 1) -#define OFF(x) (x % BITS_PER_LONG) -#define LONG(x) (x / BITS_PER_LONG) -#define TEST_BIT(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) +#define NBITS(x) ((((x)-1) / BITS_PER_LONG) + 1) +#define OFF(x) ((x) % BITS_PER_LONG) +#define LONG(x) ((x) / BITS_PER_LONG) +#define TEST_BIT(bit, array) (((array)[LONG(bit)] >> OFF(bit)) & 1) // Only keep fileDescriptors that we think are a keyboard, mouse or touchpad/touchscreen // Joysticks are handled in /src/SFML/Window/Unix/JoystickImpl.cpp diff --git a/test/Network/Packet.test.cpp b/test/Network/Packet.test.cpp index 4f603cdd1..758993015 100644 --- a/test/Network/Packet.test.cpp +++ b/test/Network/Packet.test.cpp @@ -15,7 +15,7 @@ static_assert(std::is_nothrow_move_assignable_v); do \ { \ sf::Packet packet; \ - packet << expected; \ + packet << (expected); \ CHECK(packet.getReadPosition() == 0); \ CHECK(packet.getData() != nullptr); \ CHECK(packet.getDataSize() == sizeof(expected)); \ @@ -29,7 +29,7 @@ static_assert(std::is_nothrow_move_assignable_v); CHECK(packet.getDataSize() == sizeof(expected)); \ CHECK(packet.endOfPacket()); \ CHECK(static_cast(packet)); \ - CHECK(expected == received); \ + CHECK((expected) == received); \ } while (false) TEST_CASE("[Network] sf::Packet")