Skip to content

Commit d3241a6

Browse files
committed
Make CHECK_SDL a function
Check correct type and avoid clang-tidy trying to "simplify" the resulting boolean condition, i.e. > warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
1 parent ededb8a commit d3241a6

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

extras/videoDrivers/SDL2/VideoSDL2.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@
3232
# include <gl4esinit.h>
3333
#endif
3434

35+
namespace {
36+
3537
/// Check that the (SDL) call returns success or print the error
3638
/// Can be used in conditions: if(CHECK_SDL(SDL_Foo()))
37-
#define CHECK_SDL(call) ((call) >= 0 || (PrintError(), false))
38-
39-
namespace {
39+
bool CHECK_SDL(int sdlResult)
40+
{
41+
if(sdlResult >= 0)
42+
return true;
43+
VideoSDL2::PrintError();
44+
return false;
45+
}
4046

4147
template<typename T>
4248
struct SDLMemoryDeleter

extras/videoDrivers/SDL2/VideoSDL2.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ class VideoSDL2 final : public VideoDriver
5353
/// Get (device-dependent!) window pointer, HWND in Windows
5454
void* GetMapPointer() const override;
5555

56-
private:
5756
static void PrintError();
5857
static void PrintError(const std::string& msg);
58+
59+
private:
5960
void HandlePaste();
6061
void UpdateCurrentSizes();
6162
void MoveWindowToCenter();

0 commit comments

Comments
 (0)