Codechange: Replace assert_compile macro with static_assert

This commit is contained in:
Charles Pigott
2020-12-27 10:44:22 +00:00
parent 395a5d9991
commit 860c270c73
77 changed files with 133 additions and 135 deletions

View File

@@ -2182,7 +2182,7 @@ bool AfterLoadGame()
for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
/* There are always as many CargoPayments as Vehicles. We need to make the
* assert() in Pool::GetNew() happy by calling CanAllocateItem(). */
assert_compile(CargoPaymentPool::MAX_SIZE == VehiclePool::MAX_SIZE);
static_assert(CargoPaymentPool::MAX_SIZE == VehiclePool::MAX_SIZE);
assert(CargoPayment::CanAllocateItem());
Vehicle *v = *iter;
if (v->cargo_payment == nullptr) v->cargo_payment = new CargoPayment(v);

View File

@@ -100,7 +100,7 @@ static const SaveLoad * const _glog_desc[] = {
_glog_emergency_desc,
};
assert_compile(lengthof(_glog_desc) == GLCT_END);
static_assert(lengthof(_glog_desc) == GLCT_END);
static void Load_GLOG_common(LoggedAction *&gamelog_action, uint &gamelog_actions)
{

View File

@@ -243,7 +243,7 @@ static inline bool CheckOldSavegameType(FILE *f, char *temp, const char *last, u
static SavegameType DetermineOldSavegameType(FILE *f, char *title, const char *last)
{
assert_compile(TTD_HEADER_SIZE >= TTO_HEADER_SIZE);
static_assert(TTD_HEADER_SIZE >= TTO_HEADER_SIZE);
char temp[TTD_HEADER_SIZE] = "Unknown";
SavegameType type = SGT_TTO;

View File

@@ -93,7 +93,7 @@ struct OldChunks {
};
/* If it fails, check lines above.. */
assert_compile(sizeof(TileIndex) == 4);
static_assert(sizeof(TileIndex) == 4);
extern uint _bump_assert_value;
byte ReadByte(LoadgameState *ls);

View File

@@ -1142,7 +1142,7 @@ static size_t ReferenceToInt(const void *obj, SLRefType rt)
*/
static void *IntToReference(size_t index, SLRefType rt)
{
assert_compile(sizeof(size_t) <= sizeof(void *));
static_assert(sizeof(size_t) <= sizeof(void *));
assert(_sl.action == SLA_PTRS);