Skip to content

Commit ec58eaa

Browse files
committed
Revert "Let the compiler assume that VERIFY expressions are true in release builds (#1492)"
Fixes #1759, reverts c76215a and #1492. Using XR_ASSUME makes the compiler to refuse some checks where they are crucial. We can't always assume and VERIFY wasn't made for that.
1 parent 18a546f commit ec58eaa

21 files changed

+10
-121
lines changed

src/xrAICore/Navigation/PatrolPath/patrol_point_inline.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,27 @@ inline bool CPatrolPoint::operator==(const CPatrolPoint& rhs) const
1616

1717
IC const Fvector& CPatrolPoint::position() const
1818
{
19-
#ifdef DEBUG
2019
VERIFY(m_initialized);
21-
#endif
2220
return (m_position);
2321
}
2422

2523
IC const u32& CPatrolPoint::flags() const
2624
{
27-
#ifdef DEBUG
2825
VERIFY(m_initialized);
29-
#endif
3026
return (m_flags);
3127
}
3228

3329
IC const shared_str& CPatrolPoint::name() const
3430
{
35-
#ifdef DEBUG
3631
VERIFY(m_initialized);
37-
#endif
3832
return (m_name);
3933
}
4034

4135
IC const u32& CPatrolPoint::level_vertex_id(
4236
const CLevelGraph* level_graph, const CGameLevelCrossTable* cross, const CGameGraph* game_graph) const
4337
{
44-
#ifdef DEBUG
4538
VERIFY(m_initialized);
39+
#ifdef DEBUG
4640
verify_vertex_id(level_graph, cross, game_graph);
4741
#endif
4842
return (m_level_vertex_id);
@@ -51,8 +45,8 @@ IC const u32& CPatrolPoint::level_vertex_id(
5145
IC const GameGraph::_GRAPH_ID& CPatrolPoint::game_vertex_id(
5246
const CLevelGraph* level_graph, const CGameLevelCrossTable* cross, const CGameGraph* game_graph) const
5347
{
54-
#ifdef DEBUG
5548
VERIFY(m_initialized);
49+
#ifdef DEBUG
5650
verify_vertex_id(level_graph, cross, game_graph);
5751
#endif
5852
return (m_game_vertex_id);

src/xrCore/xrDebug_macros.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@
196196
} while (false)
197197

198198
#define NODEFAULT XR_ASSUME(0)
199-
#define VERIFY(expr) XR_ASSUME(expr)
200-
#define VERIFY2(expr, desc) XR_ASSUME(expr)
201-
#define VERIFY3(expr, desc, arg1) XR_ASSUME(expr)
202-
#define VERIFY4(expr, desc, arg1, arg2) XR_ASSUME(expr)
199+
#define VERIFY(expr) do {} while (false)
200+
#define VERIFY2(expr, desc) do {} while (false)
201+
#define VERIFY3(expr, desc, arg1) do {} while (false)
202+
#define VERIFY4(expr, desc, arg1, arg2) do {} while (false)
203203
#define CHK_DX(expr) expr
204204
#define CHK_GL(expr) expr
205205
#endif // DEBUG

src/xrEngine/xr_collide_form.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,8 @@ void CCF_Skeleton::BuildState()
130130
Fmatrix ME, T, TW;
131131
const Fmatrix& Mbone = K->LL_GetTransform(I->elem_id);
132132

133-
#ifdef DEBUG
134133
VERIFY2(DET(Mbone) > EPS,
135134
(make_string("0 scale bone matrix, %d \n", I->elem_id) + dbg_object_full_dump_string(owner)).c_str());
136-
#endif
137135

138136
switch (I->type)
139137
{

src/xrEngine/xr_object_list.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ void CObjectList::SingleUpdate(IGameObject* O)
143143

144144
O->UpdateCL();
145145

146-
#ifdef DEBUG
147146
VERIFY3(O->GetDbgUpdateFrame() == Device.dwFrame, "Broken sequence of calls to 'UpdateCL'", *O->cName());
148-
#endif
149147
#if 0 // ndef DEBUG
150148
__try
151149
{
@@ -587,10 +585,7 @@ bool CObjectList::dump_all_objects()
587585

588586
void CObjectList::register_object_to_destroy(IGameObject* object_to_destroy)
589587
{
590-
#ifdef DEBUG
591588
VERIFY(!registered_object_to_destroy(object_to_destroy));
592-
#endif
593-
594589
// Msg("CObjectList::register_object_to_destroy [%x]", object_to_destroy);
595590
destroy_queue.push_back(object_to_destroy);
596591

src/xrGame/Actor_Network.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,7 @@ void CActor::net_Import_Physic(NET_Packet& P)
513513
}
514514
else
515515
{
516-
#ifdef DEBUG
517516
VERIFY(valid_pos(N_A.State.position, ph_boundaries()));
518-
#endif
519517
NET_A.push_back(N_A);
520518
if (NET_A.size() > 5)
521519
NET_A.pop_front();

src/xrGame/Car.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ void CCar::reload(LPCSTR section)
125125

126126
void CCar::cb_Steer(CBoneInstance* B)
127127
{
128-
#ifdef DEBUG
129128
VERIFY2(fsimilar(DET(B->mTransform), 1.f, DET_CHECK_EPS), "Bones receive returns 0 matrix");
130-
#endif
131129
CCar* C = static_cast<CCar*>(B->callback_param());
132130
Fmatrix m;
133131

src/xrGame/CarCameras.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
bool CCar::HUDView() const { return active_camera->tag == ectFirst; }
1919
void CCar::cam_Update(float dt, float fov)
2020
{
21-
#ifdef DEBUG
2221
VERIFY(!physics_world()->Processing());
23-
#endif
2422
Fvector P, Da;
2523
Da.set(0, 0, 0);
2624
// bool owner = !!Owner();

src/xrGame/DestroyablePhysicsObject.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ void CDestroyablePhysicsObject::Hit(SHit* pHDS)
8989
}
9090
void CDestroyablePhysicsObject::Destroy()
9191
{
92-
#ifdef DEBUG
9392
VERIFY(!physics_world()->Processing());
94-
#endif
95-
9693
const CGameObject* who_object = smart_cast<const CGameObject*>(FatalHit().initiator());
9794
callback(GameObject::eDeath)(lua_game_object(), who_object ? who_object->lua_game_object() : 0);
9895
CPHDestroyable::Destroy(ID(), "physic_destroyable_object");

src/xrGame/GameObject.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,10 +1039,8 @@ void CGameObject::setDestroy(bool _destroy)
10391039
Msg("cl setDestroy [%d][%d]", ID(), Device.dwFrame);
10401040
#endif //#ifdef MP_LOGGING
10411041
}
1042-
#ifdef DEBUG
10431042
else
10441043
VERIFY(!g_pGameLevel->Objects.registered_object_to_destroy(this));
1045-
#endif
10461044
}
10471045

10481046
Fvector CGameObject::get_new_local_point_on_mesh(u16& bone_id) const

src/xrGame/Level_Bullet_Manager.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,7 @@ void CBulletManager::AddBullet(const Fvector& position, const Fvector& direction
185185
// Always called in Primary thread
186186
// Uncomment below if you will change the behaviour
187187
// if (!g_mt_config.test(mtBullets))
188-
#ifdef DEBUG
189188
VERIFY(m_thread_id == std::this_thread::get_id());
190-
#endif
191189

192190
VERIFY(u16(-1) != cartridge.bullet_material_idx);
193191
// u32 CurID = Level().CurrentControlEntity()->ID();
@@ -207,9 +205,7 @@ void CBulletManager::UpdateWorkload()
207205
{
208206
ZoneScoped;
209207

210-
#ifdef DEBUG
211208
VERIFY(g_mt_config.test(mtBullets) || m_thread_id == std::this_thread::get_id());
212-
#endif
213209

214210
rq_storage.r_clear();
215211

0 commit comments

Comments
 (0)