Merge branch 'redundant_offsetof_macro' of https://github.com/edward-san/zdoom

This commit is contained in:
Christoph Oelckers 2014-07-26 10:17:25 +02:00
commit 5576892c01
1 changed files with 22 additions and 25 deletions

View File

@ -189,41 +189,38 @@ static const char *TerrainKeywords[] =
NULL NULL
}; };
// Alternate offsetof macro to shut GCC up
#define theoffsetof(type,field) ((size_t)&((type*)1)->field - 1)
static FGenericParse SplashParser[] = static FGenericParse SplashParser[] =
{ {
{ GEN_End, {0} }, { GEN_End, {0} },
{ GEN_Sound, {theoffsetof(FSplashDef, SmallSplashSound)} }, { GEN_Sound, {myoffsetof(FSplashDef, SmallSplashSound)} },
{ GEN_Fixed, {theoffsetof(FSplashDef, SmallSplashClip)} }, { GEN_Fixed, {myoffsetof(FSplashDef, SmallSplashClip)} },
{ GEN_Sound, {theoffsetof(FSplashDef, NormalSplashSound)} }, { GEN_Sound, {myoffsetof(FSplashDef, NormalSplashSound)} },
{ GEN_Class, {theoffsetof(FSplashDef, SmallSplash)} }, { GEN_Class, {myoffsetof(FSplashDef, SmallSplash)} },
{ GEN_Class, {theoffsetof(FSplashDef, SplashBase)} }, { GEN_Class, {myoffsetof(FSplashDef, SplashBase)} },
{ GEN_Class, {theoffsetof(FSplashDef, SplashChunk)} }, { GEN_Class, {myoffsetof(FSplashDef, SplashChunk)} },
{ GEN_Byte, {theoffsetof(FSplashDef, ChunkXVelShift)} }, { GEN_Byte, {myoffsetof(FSplashDef, ChunkXVelShift)} },
{ GEN_Byte, {theoffsetof(FSplashDef, ChunkYVelShift)} }, { GEN_Byte, {myoffsetof(FSplashDef, ChunkYVelShift)} },
{ GEN_Byte, {theoffsetof(FSplashDef, ChunkZVelShift)} }, { GEN_Byte, {myoffsetof(FSplashDef, ChunkZVelShift)} },
{ GEN_Fixed, {theoffsetof(FSplashDef, ChunkBaseZVel)} }, { GEN_Fixed, {myoffsetof(FSplashDef, ChunkBaseZVel)} },
{ GEN_Bool, {theoffsetof(FSplashDef, NoAlert)} } { GEN_Bool, {myoffsetof(FSplashDef, NoAlert)} }
}; };
static FGenericParse TerrainParser[] = static FGenericParse TerrainParser[] =
{ {
{ GEN_End, {0} }, { GEN_End, {0} },
{ GEN_Splash, {theoffsetof(FTerrainDef, Splash)} }, { GEN_Splash, {myoffsetof(FTerrainDef, Splash)} },
{ GEN_Int, {theoffsetof(FTerrainDef, DamageAmount)} }, { GEN_Int, {myoffsetof(FTerrainDef, DamageAmount)} },
{ GEN_Custom, {(size_t)ParseDamage} }, { GEN_Custom, {(size_t)ParseDamage} },
{ GEN_Int, {theoffsetof(FTerrainDef, DamageTimeMask)} }, { GEN_Int, {myoffsetof(FTerrainDef, DamageTimeMask)} },
{ GEN_Fixed, {theoffsetof(FTerrainDef, FootClip)} }, { GEN_Fixed, {myoffsetof(FTerrainDef, FootClip)} },
{ GEN_Float, {theoffsetof(FTerrainDef, StepVolume)} }, { GEN_Float, {myoffsetof(FTerrainDef, StepVolume)} },
{ GEN_Time, {theoffsetof(FTerrainDef, WalkStepTics)} }, { GEN_Time, {myoffsetof(FTerrainDef, WalkStepTics)} },
{ GEN_Time, {theoffsetof(FTerrainDef, RunStepTics)} }, { GEN_Time, {myoffsetof(FTerrainDef, RunStepTics)} },
{ GEN_Sound, {theoffsetof(FTerrainDef, LeftStepSound)} }, { GEN_Sound, {myoffsetof(FTerrainDef, LeftStepSound)} },
{ GEN_Sound, {theoffsetof(FTerrainDef, RightStepSound)} }, { GEN_Sound, {myoffsetof(FTerrainDef, RightStepSound)} },
{ GEN_Bool, {theoffsetof(FTerrainDef, IsLiquid)} }, { GEN_Bool, {myoffsetof(FTerrainDef, IsLiquid)} },
{ GEN_Custom, {(size_t)ParseFriction} }, { GEN_Custom, {(size_t)ParseFriction} },
{ GEN_Bool, {theoffsetof(FTerrainDef, AllowProtection)} }, { GEN_Bool, {myoffsetof(FTerrainDef, AllowProtection)} },
}; };