diff --git a/src/Etterna/Globals/global.h b/src/Etterna/Globals/global.h index a5a31f2c15..7101632956 100644 --- a/src/Etterna/Globals/global.h +++ b/src/Etterna/Globals/global.h @@ -130,32 +130,6 @@ ShowWarningOrTrace(const char* file, #define SM_UNIQUE_NAME2(x, line) SM_UNIQUE_NAME3(x, line) #define SM_UNIQUE_NAME(x) SM_UNIQUE_NAME2(x, __LINE__) -template -struct CompileAssert; -template<> -struct CompileAssert -{ -}; -template -struct CompileAssertDecl -{ -}; - -// Ignore "unused-local-typedef" warnings for COMPILE_ASSERT -#if defined(__clang__) -#define COMPILE_ASSERT_PRE \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wunused-local-typedef\"") -#define COMPILE_ASSERT_POST _Pragma("clang diagnostic pop") -#else -#define COMPILE_ASSERT_PRE -#define COMPILE_ASSERT_POST -#endif -#define COMPILE_ASSERT(COND) \ - COMPILE_ASSERT_PRE \ - typedef CompileAssertDecl)> \ - CompileAssertInst COMPILE_ASSERT_POST - #include "RageUtil/Misc/RageException.h" /* Don't include our own headers here, since they tend to change often. */ diff --git a/src/Etterna/Models/Misc/EnumHelper.h b/src/Etterna/Models/Misc/EnumHelper.h index 1795d8ce2f..1c60d1206a 100644 --- a/src/Etterna/Models/Misc/EnumHelper.h +++ b/src/Etterna/Models/Misc/EnumHelper.h @@ -47,7 +47,7 @@ EnumToString(int iVal, \ const std::string& X##ToString(X x); \ \ - COMPILE_ASSERT(NUM_##X == ARRAYLEN(X##Names)); \ +static_assert(NUM_##X == ARRAYLEN(X##Names), "Size mismatch between "#X" enum and "#X"Names (Did you forget to add a string for a new enum entry?)"); \ \ const std::string& X##ToString(X x) \ \ diff --git a/src/Etterna/Models/Misc/Game.cpp b/src/Etterna/Models/Misc/Game.cpp index e21dbcabd4..83d45c36b8 100644 --- a/src/Etterna/Models/Misc/Game.cpp +++ b/src/Etterna/Models/Misc/Game.cpp @@ -1,4 +1,4 @@ -#include "Etterna/Globals/global.h" +#include "Etterna/Globals/global.h" #include "Game.h" TapNoteScore @@ -38,7 +38,7 @@ static const Game::PerButtonInfo g_CommonButtonInfo[] = { const Game::PerButtonInfo* Game::GetPerButtonInfo(GameButton gb) const { - COMPILE_ASSERT(GAME_BUTTON_NEXT == ARRAYLEN(g_CommonButtonInfo)); + static_assert(GAME_BUTTON_NEXT == ARRAYLEN(g_CommonButtonInfo)); if (gb < GAME_BUTTON_NEXT) return &g_CommonButtonInfo[gb]; diff --git a/src/Etterna/Singletons/InputMapper.cpp b/src/Etterna/Singletons/InputMapper.cpp index bb31decb10..6be4a3942d 100644 --- a/src/Etterna/Singletons/InputMapper.cpp +++ b/src/Etterna/Singletons/InputMapper.cpp @@ -1270,7 +1270,7 @@ static const InputScheme::GameButtonInfo g_CommonGameButtonInfo[] = { const InputScheme::GameButtonInfo* InputScheme::GetGameButtonInfo(GameButton gb) const { - COMPILE_ASSERT(GAME_BUTTON_NEXT == ARRAYLEN(g_CommonGameButtonInfo)); + static_assert(GAME_BUTTON_NEXT == ARRAYLEN(g_CommonGameButtonInfo)); if (gb < GAME_BUTTON_NEXT) return &g_CommonGameButtonInfo[gb]; diff --git a/src/arch/MovieTexture/MovieTexture_Generic.cpp b/src/arch/MovieTexture/MovieTexture_Generic.cpp index 9651187599..7488ee8074 100644 --- a/src/arch/MovieTexture/MovieTexture_Generic.cpp +++ b/src/arch/MovieTexture/MovieTexture_Generic.cpp @@ -498,7 +498,7 @@ MovieTexture_Generic::UpdateFrame() static EffectMode EffectModes[] = { EffectMode_YUYV422, }; -COMPILE_ASSERT(ARRAYLEN(EffectModes) == NUM_PixelFormatYCbCr); +static_assert(ARRAYLEN(EffectModes) == NUM_PixelFormatYCbCr); EffectMode MovieTexture_Generic::GetEffectMode(MovieDecoderPixelFormatYCbCr fmt)