diff options
-rw-r--r-- | src/localconsts.h | 6 | ||||
-rw-r--r-- | src/resources/sdlimagehelper.cpp | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/localconsts.h b/src/localconsts.h index 63865afc8..dc7723ae3 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -300,6 +300,12 @@ #endif // ENABLE_CHECKS +#if __cpp_if_constexpr >= 201606 +#define ifconstexpr if constexpr +#else // __cpp_if_constexpr >= 201606 +#define ifconstexpr if +#endif // __cpp_if_constexpr >= 201606 + #ifdef USE_SDL2 PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wswitch-default") diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index 5459062f9..21bc75b0b 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -266,7 +266,7 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) } else { - if (SDL_ALPHA_OPAQUE != 255) + ifconstexpr (SDL_ALPHA_OPAQUE != 255) { hasAlpha = true; memset(alphaChannel, SDL_ALPHA_OPAQUE, sz); @@ -275,7 +275,7 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) } else { - if (SDL_ALPHA_OPAQUE != 255) + ifconstexpr (SDL_ALPHA_OPAQUE != 255) { hasAlpha = true; memset(alphaChannel, SDL_ALPHA_OPAQUE, sz); |