mirror of https://github.com/bjornbytes/lovr.git
Add lovrUnreachable macro;
This commit is contained in:
parent
d2110af83a
commit
65b0f95ca9
|
@ -371,7 +371,7 @@ static int l_lovrModelDataGetMeshIndex(lua_State* L) {
|
|||
switch (mesh->indices->type) {
|
||||
case U16: lua_pushinteger(L, data.u16[index]); return 1;
|
||||
case U32: lua_pushinteger(L, data.u32[index]); return 1;
|
||||
default: lovrThrow("Unreachable");
|
||||
default: lovrUnreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1943,7 +1943,7 @@ static int l_lovrMat4__mul(lua_State* L) {
|
|||
memcpy(out, n, 4 * sizeof(float));
|
||||
mat4_mulVec4(m, out);
|
||||
} else {
|
||||
lovrThrow("Unreachable");
|
||||
lovrUnreachable();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ void luax_pushjoint(lua_State* L, Joint* joint) {
|
|||
case JOINT_DISTANCE: luax_pushtype(L, DistanceJoint, joint); break;
|
||||
case JOINT_HINGE: luax_pushtype(L, HingeJoint, joint); break;
|
||||
case JOINT_SLIDER: luax_pushtype(L, SliderJoint, joint); break;
|
||||
default: lovrThrow("Unreachable");
|
||||
default: lovrUnreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ void luax_pushshape(lua_State* L, Shape* shape) {
|
|||
case SHAPE_CAPSULE: luax_pushtype(L, CapsuleShape, shape); break;
|
||||
case SHAPE_CYLINDER: luax_pushtype(L, CylinderShape, shape); break;
|
||||
case SHAPE_MESH: luax_pushtype(L, MeshShape, shape); break;
|
||||
default: lovrThrow("Unreachable");
|
||||
default: lovrUnreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ static size_t measure(uint32_t w, uint32_t h, TextureFormat format) {
|
|||
case FORMAT_ASTC_10x10: return ((w + 9) / 10) * ((h + 9) / 10) * 16;
|
||||
case FORMAT_ASTC_12x10: return ((w + 11) / 12) * ((h + 9) / 10) * 16;
|
||||
case FORMAT_ASTC_12x12: return ((w + 11) / 12) * ((h + 11) / 12) * 16;
|
||||
default: lovrThrow("Unreachable");
|
||||
default: lovrUnreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ typedef void errorFn(void*, const char*, va_list);
|
|||
void lovrSetErrorCallback(errorFn* callback, void* userdata);
|
||||
_Noreturn void lovrThrow(const char* format, ...);
|
||||
#define lovrAssert(c, ...) if (!(c)) { lovrThrow(__VA_ARGS__); }
|
||||
#define lovrUnreachable() lovrThrow("Unreachable")
|
||||
|
||||
#ifdef LOVR_UNCHECKED
|
||||
#define lovrCheck(c, ...) ((void) 0)
|
||||
|
|
Loading…
Reference in New Issue