Skip to content

Commit 889bcea

Browse files
committed
force enum to uin32_t for all compilers via enum-base
Some clang versions seem to use int32 for enums unless explicitly overridden. Use `enum : uint32_t` will force the type in a compatible way, this also allows us to get rid of the dummy FORCE_UINT32 enum members
1 parent 7e0d2f8 commit 889bcea

4 files changed

Lines changed: 4 additions & 12 deletions

File tree

WickedEngine/wiAudio.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ namespace wi::audio
1515

1616
// SUBMIX_TYPE specifies the playback channel of sound instances
1717
// Do not change the order as this enum can be serialized!
18-
enum SUBMIX_TYPE
18+
enum SUBMIX_TYPE : uint32_t
1919
{
2020
SUBMIX_TYPE_SOUNDEFFECT,
2121
SUBMIX_TYPE_MUSIC,
2222
SUBMIX_TYPE_USER0,
2323
SUBMIX_TYPE_USER1,
2424
SUBMIX_TYPE_COUNT,
25-
26-
ENUM_FORCE_UINT32 = 0xFFFFFFFF, // submix type can be serialized
2725
};
2826

2927
// Sound is holding the sound data needed for playback, but it can't be played by itself.

WickedEngine/wiEmittedParticle.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ namespace wi
2121
public:
2222

2323
// This is serialized, order of enums shouldn't change!
24-
enum PARTICLESHADERTYPE
24+
enum PARTICLESHADERTYPE : uint32_t
2525
{
2626
SOFT,
2727
SOFT_DISTORTION,
2828
SIMPLE,
2929
SOFT_LIGHTING,
3030
PARTICLESHADERTYPE_COUNT,
31-
ENUM_FORCE_UINT32 = 0xFFFFFFFF,
3231
};
3332

3433
ParticleCounters statistics = {};

WickedEngine/wiPhysics_Jolt.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,9 +1930,6 @@ namespace wi::physics
19301930
}
19311931
break;
19321932

1933-
// make Clang happy
1934-
case wi::scene::RigidBodyPhysicsComponent::ENUM_FORCE_UINT32:
1935-
JPH_ASSERT(false);
19361933
}
19371934

19381935
if (!shape_result.IsValid())

WickedEngine/wiScene_Components.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ namespace wi::scene
407407
};
408408
uint32_t _flags = EMPTY;
409409

410-
enum CollisionShape
410+
enum CollisionShape : uint32_t
411411
{
412412
BOX,
413413
SPHERE,
@@ -416,7 +416,6 @@ namespace wi::scene
416416
TRIANGLE_MESH,
417417
CYLINDER,
418418
HEIGHTFIELD,
419-
ENUM_FORCE_UINT32 = 0xFFFFFFFF
420419
};
421420
CollisionShape shape = BOX;
422421
float mass = 1.0f; // Set to 0 to make body static
@@ -1317,14 +1316,13 @@ namespace wi::scene
13171316
};
13181317
uint32_t _flags = EMPTY;
13191318

1320-
enum LightType
1319+
enum LightType : uint32_t
13211320
{
13221321
DIRECTIONAL,
13231322
POINT,
13241323
SPOT,
13251324
RECTANGLE,
13261325
LIGHTTYPE_COUNT,
1327-
ENUM_FORCE_UINT32 = 0xFFFFFFFF,
13281326
};
13291327
LightType type = POINT;
13301328

0 commit comments

Comments
 (0)