Replace COMPILE_ASSERT() with standard static_assert()

This commit is contained in:
Martin Natano
2023-04-20 11:21:29 +02:00
parent 78fb2e9fc3
commit 0b0787f344
6 changed files with 11 additions and 16 deletions
+3 -3
View File
@@ -80,7 +80,7 @@ const RString &EnumToString( int iVal, int iMax, const char **szNameArray, std::
#define XToString(X) \
const RString& X##ToString(X x); \
COMPILE_ASSERT( NUM_##X == ARRAYLEN(X##Names) ); \
static_assert( NUM_##X == ARRAYLEN(X##Names) ); \
const RString& X##ToString( X x ) \
{ \
static std::unique_ptr<RString> as_##X##Name[NUM_##X+2]; \
@@ -186,7 +186,7 @@ namespace LuaHelpers \
* @author Chris Danford, Glenn Maynard (c) 2004-2006
* @section LICENSE
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -196,7 +196,7 @@ namespace LuaHelpers \
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+5 -5
View File
@@ -32,7 +32,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];
else
@@ -44,7 +44,7 @@ TapNoteScore Game::GetMapJudgmentTo( TapNoteScore tns ) const
switch(tns)
{
case TNS_W1: return m_mapW1To;
case TNS_W2: return m_mapW2To;
case TNS_W2: return m_mapW2To;
case TNS_W3: return m_mapW3To;
case TNS_W4: return m_mapW4To;
case TNS_W5: return m_mapW5To;
@@ -55,7 +55,7 @@ TapNoteScore Game::GetMapJudgmentTo( TapNoteScore tns ) const
// lua start
#include "LuaBinding.h"
/** @brief Allow Lua to have access to the Game. */
/** @brief Allow Lua to have access to the Game. */
class LunaGame: public Luna<Game>
{
public:
@@ -79,7 +79,7 @@ LUA_REGISTER_CLASS( Game )
/*
* (c) 2001-2002 Chris Danford
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -89,7 +89,7 @@ LUA_REGISTER_CLASS( Game )
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+1 -1
View File
@@ -1214,7 +1214,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];
else
+1 -1
View File
@@ -37,7 +37,7 @@ static const float g_fTimeMeterSecondsChangeInit[] =
-4.0f, // SE_LetGo
-0.0f, // SE_Missed
};
COMPILE_ASSERT( ARRAYLEN(g_fTimeMeterSecondsChangeInit) == NUM_ScoreEvent );
static_assert( ARRAYLEN(g_fTimeMeterSecondsChangeInit) == NUM_ScoreEvent );
static void TimeMeterSecondsChangeInit( std::size_t /*ScoreEvent*/ i, RString &sNameOut, float &defaultValueOut )
{
@@ -493,7 +493,7 @@ static EffectMode EffectModes[] =
{
EffectMode_YUYV422,
};
COMPILE_ASSERT( ARRAYLEN(EffectModes) == NUM_PixelFormatYCbCr );
static_assert( ARRAYLEN(EffectModes) == NUM_PixelFormatYCbCr );
EffectMode MovieTexture_Generic::GetEffectMode( MovieDecoderPixelFormatYCbCr fmt )
{
-5
View File
@@ -112,11 +112,6 @@ void ShowWarningOrTrace( const char *file, int line, const char *message, bool b
#define SM_UNIQUE_NAME2(x,line) SM_UNIQUE_NAME3(x, line)
#define SM_UNIQUE_NAME(x) SM_UNIQUE_NAME2(x, __LINE__)
template <bool> struct CompileAssert;
template <> struct CompileAssert<true> { };
template<int> struct CompileAssertDecl { };
#define COMPILE_ASSERT(COND) typedef CompileAssertDecl< sizeof(CompileAssert<!!(COND)>) > CompileAssertInst
#include "StdString.h"
/** @brief Use RStrings throughout the program. */
typedef StdString::CStdString RString;