libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
10.23k stars 1.87k forks source link

Broken preprocessor logic for SDL_LEAN_AND_MEAN (and possibly more?) #11344

Open AntTheAlchemist opened 1 month ago

AntTheAlchemist commented 1 month ago

Currently, SDL_LEAN_AND_MEAN doesn't do anything, due to this #ifdef logic (for example):

#ifndef SDL_LEAN_AND_MEAN
#define SDL_LEAN_AND_MEAN 0
#endif
// ...
#ifndef SDL_VIDEO_RENDER_SW
#define SDL_VIDEO_RENDER_SW !SDL_LEAN_AND_MEAN
#endif

SDL_VIDEO_RENDER_SW will always be defined (as either 0 or 1, or blank), so therefore:

#ifdef SDL_VIDEO_RENDER_SW
    &SW_RenderDriver,
#endif

This will always add the software renderer, no matter if SDL_LEAN_AND_MEAN is defined as 0, 1 or undefined. We should be using #undef SDL_VIDEO_RENDER_SW?

Commit 387774a seemed to break this, and it may affect much more than SDL_LEAN_AND_MEAN?

AntTheAlchemist commented 1 month ago

#undef won't work, because there are still places that use #if and expecting a 0 / 1.