mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Add clang-tidy bugprone-*
checks
This commit is contained in:
parent
9269edcccc
commit
82b9821a8a
14
.clang-tidy
14
.clang-tidy
@ -1,11 +1,25 @@
|
|||||||
Checks: >
|
Checks: >
|
||||||
-*,
|
-*,
|
||||||
|
bugprone-*,
|
||||||
clang-analyzer-*,
|
clang-analyzer-*,
|
||||||
misc-*,
|
misc-*,
|
||||||
modernize-*,
|
modernize-*,
|
||||||
performance-*,
|
performance-*,
|
||||||
portability-*,
|
portability-*,
|
||||||
readability-*,
|
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-nullability.NullablePassedToNonnull,
|
||||||
-clang-analyzer-optin.cplusplus.VirtualCall,
|
-clang-analyzer-optin.cplusplus.VirtualCall,
|
||||||
-clang-analyzer-optin.osx.*,
|
-clang-analyzer-optin.osx.*,
|
||||||
|
@ -32,9 +32,6 @@
|
|||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
|
|
||||||
class Context;
|
|
||||||
|
|
||||||
using ContextDestroyCallback = void (*)(void*);
|
using ContextDestroyCallback = void (*)(void*);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
// Windows' HWND is a type alias for struct HWND__*
|
// Windows' HWND is a type alias for struct HWND__*
|
||||||
#if defined(SFML_SYSTEM_WINDOWS)
|
#if defined(SFML_SYSTEM_WINDOWS)
|
||||||
struct HWND__;
|
struct HWND__; // NOLINT(bugprone-reserved-identifier)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32_WINDOWS
|
#ifndef _WIN32_WINDOWS
|
||||||
#define _WIN32_WINDOWS 0x0501
|
#define _WIN32_WINDOWS 0x0501 // NOLINT(bugprone-reserved-identifier)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32_WINNT
|
#ifndef _WIN32_WINNT
|
||||||
@ -49,7 +49,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
#define _UNICODE 1
|
#define _UNICODE 1 // NOLINT(bugprone-reserved-identifier)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -93,10 +93,10 @@ void uninitFileDescriptors()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
|
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
|
||||||
#define NBITS(x) (((x - 1) / BITS_PER_LONG) + 1)
|
#define NBITS(x) ((((x)-1) / BITS_PER_LONG) + 1)
|
||||||
#define OFF(x) (x % BITS_PER_LONG)
|
#define OFF(x) ((x) % BITS_PER_LONG)
|
||||||
#define LONG(x) (x / BITS_PER_LONG)
|
#define LONG(x) ((x) / BITS_PER_LONG)
|
||||||
#define TEST_BIT(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
|
#define TEST_BIT(bit, array) (((array)[LONG(bit)] >> OFF(bit)) & 1)
|
||||||
|
|
||||||
// Only keep fileDescriptors that we think are a keyboard, mouse or touchpad/touchscreen
|
// Only keep fileDescriptors that we think are a keyboard, mouse or touchpad/touchscreen
|
||||||
// Joysticks are handled in /src/SFML/Window/Unix/JoystickImpl.cpp
|
// Joysticks are handled in /src/SFML/Window/Unix/JoystickImpl.cpp
|
||||||
|
@ -15,7 +15,7 @@ static_assert(std::is_nothrow_move_assignable_v<sf::Packet>);
|
|||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
sf::Packet packet; \
|
sf::Packet packet; \
|
||||||
packet << expected; \
|
packet << (expected); \
|
||||||
CHECK(packet.getReadPosition() == 0); \
|
CHECK(packet.getReadPosition() == 0); \
|
||||||
CHECK(packet.getData() != nullptr); \
|
CHECK(packet.getData() != nullptr); \
|
||||||
CHECK(packet.getDataSize() == sizeof(expected)); \
|
CHECK(packet.getDataSize() == sizeof(expected)); \
|
||||||
@ -29,7 +29,7 @@ static_assert(std::is_nothrow_move_assignable_v<sf::Packet>);
|
|||||||
CHECK(packet.getDataSize() == sizeof(expected)); \
|
CHECK(packet.getDataSize() == sizeof(expected)); \
|
||||||
CHECK(packet.endOfPacket()); \
|
CHECK(packet.endOfPacket()); \
|
||||||
CHECK(static_cast<bool>(packet)); \
|
CHECK(static_cast<bool>(packet)); \
|
||||||
CHECK(expected == received); \
|
CHECK((expected) == received); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
TEST_CASE("[Network] sf::Packet")
|
TEST_CASE("[Network] sf::Packet")
|
||||||
|
Loading…
Reference in New Issue
Block a user