Skip to content

Commit 392ee43

Browse files
committed
Replace STATIC_CHECK macro with static_assert
1 parent 13c2eab commit 392ee43

16 files changed

+35
-36
lines changed

src/Common/object_loader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct CLoader
1818
template <bool a>
1919
IC static void load_data(T& data, M& stream, const P& p)
2020
{
21-
STATIC_CHECK(!std::is_polymorphic<T>::value, Cannot_load_polymorphic_classes_as_binary_data);
21+
static_assert(!std::is_polymorphic<T>::value, "Cannot load polymorphic classes as binary data.");
2222
stream.r(&data, sizeof(T));
2323
}
2424

src/Common/object_saver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct CSaver
1818
template <bool a>
1919
IC static void save_data(const T& data, M& stream, const P& p)
2020
{
21-
STATIC_CHECK(!std::is_polymorphic<T>::value, Cannot_save_polymorphic_classes_as_binary_data);
21+
static_assert(!std::is_polymorphic<T>::value, "Cannot save polymorphic classes as binary data.");
2222
stream.w(&data, sizeof(T));
2323
}
2424

src/utils/xrAI/guid_generator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ xrGUID generate_guid()
2020
{
2121
xrGUID result;
2222
#ifdef WINVER
23-
STATIC_CHECK(sizeof(xrGUID) == sizeof(GUID), Different_GUID_types);
23+
static_assert(sizeof(xrGUID) == sizeof(GUID), "Different GUID types.");
2424
GUID _result;
2525
RPC_STATUS gen_result = UuidCreate(&_result);
2626
memcpy(&result, &_result, sizeof(_result));
@@ -32,7 +32,7 @@ xrGUID generate_guid()
3232
default: break;
3333
}
3434
#endif
35-
STATIC_CHECK(sizeof(result) >= sizeof(u64), GUID_must_have_size_greater_or_equal_to_the_long_long);
35+
static_assert(sizeof(result) >= sizeof(u64), "GUID must have size greater or equal to the long long.");
3636
ZeroMemory(&result, sizeof(result));
3737
u64 temp = CPU::GetCLK();
3838
memcpy(&result, &temp, sizeof(temp));
@@ -42,7 +42,7 @@ xrGUID generate_guid()
4242
LPCSTR generate_guid(const xrGUID& guid, LPSTR buffer, const u32& buffer_size)
4343
{
4444
#ifdef WINVER
45-
STATIC_CHECK(sizeof(xrGUID) == sizeof(GUID), Different_GUID_types);
45+
static_assert(sizeof(xrGUID) == sizeof(GUID), "Different GUID types.");
4646
GUID temp;
4747
memcpy(&temp, &guid, sizeof(guid));
4848
RPC_CSTR temp2;

src/xrAICore/Components/problem_solver_inline.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ IC bool CProblemSolverAbstract::is_goal_reached(const _index_type& vertex_index)
246246
TEMPLATE_SPECIALIZATION
247247
IC bool CProblemSolverAbstract::is_goal_reached_impl(const _index_type& vertex_index) const
248248
{
249-
STATIC_CHECK(!reverse_search, This_function_cannot_be_used_in_the_REVERSE_search);
249+
static_assert(!reverse_search, "This function cannot be used in the REVERSE search.");
250250
xr_vector<COperatorCondition>::const_iterator I = vertex_index.conditions().begin();
251251
xr_vector<COperatorCondition>::const_iterator E = vertex_index.conditions().end();
252252
xr_vector<COperatorCondition>::const_iterator i = target_state().conditions().begin();
@@ -309,7 +309,7 @@ IC bool CProblemSolverAbstract::is_goal_reached_impl(const _index_type& vertex_i
309309
TEMPLATE_SPECIALIZATION
310310
IC bool CProblemSolverAbstract::is_goal_reached_impl(const _index_type& vertex_index, bool) const
311311
{
312-
STATIC_CHECK(reverse_search, This_function_cannot_be_used_in_the_STRAIGHT_search);
312+
static_assert(reverse_search, "This function cannot be used in the STRAIGHT search.");
313313
xr_vector<COperatorCondition>::const_iterator I = m_current_state.conditions().begin();
314314
xr_vector<COperatorCondition>::const_iterator E = m_current_state.conditions().end();
315315
xr_vector<COperatorCondition>::const_iterator i = vertex_index.conditions().begin();
@@ -377,7 +377,7 @@ TEMPLATE_SPECIALIZATION
377377
IC typename CProblemSolverAbstract::_edge_value_type CProblemSolverAbstract::estimate_edge_weight_impl(
378378
const _index_type& condition) const
379379
{
380-
STATIC_CHECK(!reverse_search, This_function_cannot_be_used_in_the_REVERSE_search);
380+
static_assert(!reverse_search, "This function cannot be used in the REVERSE search.");
381381
_edge_value_type result = 0;
382382
xr_vector<COperatorCondition>::const_iterator I = target_state().conditions().begin();
383383
xr_vector<COperatorCondition>::const_iterator E = target_state().conditions().end();
@@ -405,7 +405,7 @@ TEMPLATE_SPECIALIZATION
405405
IC typename CProblemSolverAbstract::_edge_value_type CProblemSolverAbstract::estimate_edge_weight_impl(
406406
const _index_type& condition, bool) const
407407
{
408-
STATIC_CHECK(reverse_search, This_function_cannot_be_used_in_the_STRAIGHT_search);
408+
static_assert(reverse_search, "This function cannot be used in the STRAIGHT search.");
409409
_edge_value_type result = 0;
410410
xr_vector<COperatorCondition>::const_iterator I = current_state().conditions().begin();
411411
xr_vector<COperatorCondition>::const_iterator E = current_state().conditions().end();

src/xrCore/Crypto/xr_dsa_signer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ xr_dsa_signer::xr_dsa_signer(u8 const p_number[crypto::xr_dsa::public_key_length
66
u8 const q_number[crypto::xr_dsa::private_key_length], u8 const g_number[crypto::xr_dsa::public_key_length])
77
: m_dsa(p_number, q_number, g_number)
88
{
9-
STATIC_CHECK(crypto::xr_dsa::private_key_length == crypto::xr_sha256::digest_length,
10-
private_key_size_must_be_equal_to_digest_value_size);
9+
static_assert(crypto::xr_dsa::private_key_length == crypto::xr_sha256::digest_length,
10+
"Private key size must be equal to digest value size.");
1111
}
1212

1313
xr_dsa_signer::~xr_dsa_signer() {}

src/xrCore/Crypto/xr_dsa_verifyer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ xr_dsa_verifyer::xr_dsa_verifyer(u8 const p_number[crypto::xr_dsa::public_key_le
66
u8 const public_key[crypto::xr_dsa::public_key_length])
77
: m_dsa(p_number, q_number, g_number)
88
{
9-
STATIC_CHECK(sizeof(m_public_key.m_value) == crypto::xr_dsa::public_key_length, public_key_sizes_not_equal);
9+
static_assert(sizeof(m_public_key.m_value) == crypto::xr_dsa::public_key_length, "Public key sizes not equal.");
1010
CopyMemory(m_public_key.m_value, public_key, sizeof(m_public_key.m_value));
1111
}
1212

src/xrCore/Crypto/xr_sha.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ bool xr_sha256::continue_calculate()
2424

2525
if (!m_data_size)
2626
{
27-
STATIC_CHECK(digest_length == CryptoPP::SHA1::DIGESTSIZE, digest_length_must_be_equal_to_digest_size);
27+
static_assert(digest_length == CryptoPP::SHA1::DIGESTSIZE, "Digest length must be equal to digest size.");
2828
m_sha_ctx.Final(m_result);
2929
return true;
3030
}

src/xrCore/intrusive_ptr_inline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ IC intrusive_ptr<object_type, base_type>::intrusive_ptr(self_type const& rhs)
3131
template <typename object_type, typename base_type>
3232
IC intrusive_ptr<object_type, base_type>::~intrusive_ptr()
3333
{
34-
STATIC_CHECK(result, Class_MUST_Be_Derived_From_The_Base);
34+
static_assert(result, "Class MUST be derived from the base.");
3535
dec();
3636
}
3737

src/xrCore/string_concatenations_inline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class XRCORE_API string_tupples
115115
template <typename T>
116116
static inline void add_string(string_tupples& self, T p)
117117
{
118-
STATIC_CHECK(index < max_item_count, Error_invalid_string_index_specified);
118+
static_assert(index < max_item_count, "Error invalid string index specified.");
119119

120120
LPCSTR cstr = string(p);
121121
VERIFY(cstr);

src/xrGame/aimers_base_inline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ template <u32 bone_count0, u32 bone_count1>
1313
inline void aimers::base::fill_bones(u32 const (&bones)[bone_count0], u16 const (&bones_ids)[bone_count1],
1414
Fmatrix (&local_bones)[bone_count1], Fmatrix (&global_bones)[bone_count1])
1515
{
16-
STATIC_CHECK(bone_count0 <= bone_count1, invalid_arrays_passed);
16+
static_assert(bone_count0 <= bone_count1, "Invalid arrays passed.");
1717

1818
u16 const root_bone_id = m_kinematics.LL_GetBoneRoot();
1919
CBoneInstance& root_bone = m_kinematics.LL_GetBoneInstance(root_bone_id);

0 commit comments

Comments
 (0)