SW: Activate ASSERT macro with RELEASE=0 builds

git-svn-id: https://svn.eduke32.com/eduke32@8349 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-12-03 09:44:56 +00:00 committed by Christoph Oelckers
parent 823e47f3e8
commit 863d35d7c2
6 changed files with 24 additions and 27 deletions

View file

@ -60,19 +60,23 @@ extern char isShareware;
#define ERR_STD_ARG __FILE__, __LINE__ #define ERR_STD_ARG __FILE__, __LINE__
void _Assert(const char *expr, const char *strFile, unsigned uLine);
#define PRODUCTION_ASSERT(f) \
do { \
if (!(f)) \
_Assert(#f,ERR_STD_ARG); \
} while (0)
#if DEBUG || defined DEBUGGINGAIDS
#define ASSERT(f) PRODUCTION_ASSERT(f)
#else
#define ASSERT(f) do { } while (0)
#endif
#if DEBUG #if DEBUG
void HeapCheck(char *, int); void HeapCheck(char *, int);
#define HEAP_CHECK() HeapCheck(__FILE__, __LINE__) #define HEAP_CHECK() HeapCheck(__FILE__, __LINE__)
void _Assert(const char *expr, const char *strFile, unsigned uLine);
#define ASSERT(f) \
if (f) \
do { } while(0); \
else \
_Assert(#f,ERR_STD_ARG);
#define PRODUCTION_ASSERT(f) ASSERT(f)
void dsprintf(char *, char *, ...); void dsprintf(char *, char *, ...);
#define DSPRINTF dsprintf #define DSPRINTF dsprintf
@ -90,16 +94,8 @@ extern int DispMono;
#define RANDOM_DEBUG 1 // Set this to 1 for network testing. #define RANDOM_DEBUG 1 // Set this to 1 for network testing.
#else #else
#define ASSERT(f) do { } while(0)
#define MONO_PRINT(str) #define MONO_PRINT(str)
void _Assert(const char *expr, const char *strFile, unsigned uLine);
#define PRODUCTION_ASSERT(f) \
if (f) \
do { } while(0); \
else \
_Assert(#f,ERR_STD_ARG);
void dsprintf_null(char *str, const char *format, ...); void dsprintf_null(char *str, const char *format, ...);
#define DSPRINTF dsprintf_null #define DSPRINTF dsprintf_null
//#define DSPRINTF() //#define DSPRINTF()
@ -1164,7 +1160,7 @@ struct PLAYERstruct
short DiveDamageTics; short DiveDamageTics;
// Death stuff // Death stuff
short DeathType; uint16_t DeathType;
short Kills; short Kills;
short Killer; //who killed me short Killer; //who killed me
short KilledPlayer[MAX_SW_PLAYERS_REG]; short KilledPlayer[MAX_SW_PLAYERS_REG];

View file

@ -7671,7 +7671,7 @@ pSpriteControl(PLAYERp pp)
// RULE: Sprites can only kill themselves // RULE: Sprites can only kill themselves
PRODUCTION_ASSERT(psp); PRODUCTION_ASSERT(psp);
ASSERT(ValidPtr(psp)); ASSERT(ValidPtr(psp));
ASSERT((uint32_t) psp->Next != 0xCCCCCCCC); // ASSERT((uint32_t) psp->Next != 0xCCCCCCCC);
if (psp->State) if (psp->State)
pStateControl(psp); pStateControl(psp);

View file

@ -486,7 +486,7 @@ SectorSetup(void)
{ {
SINE_WAVE_FLOOR *swf; SINE_WAVE_FLOOR *swf;
short near_sect = i, base_sect = i; short near_sect = i, base_sect = i;
short swf_ndx = 0; uint16_t swf_ndx = 0;
short cnt = 0, sector_cnt; short cnt = 0, sector_cnt;
int range; int range;
int range_diff = 0; int range_diff = 0;

View file

@ -6812,11 +6812,11 @@ SpriteControl(void)
u = User[i]; u = User[i];
sp = User[i]->SpriteP; sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics) STATE_CONTROL(i, sp, u, StateTics)
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); // ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE);
#else #else
ASSERT(User[i]); ASSERT(User[i]);
StateControl(i); StateControl(i);
ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); // ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE);
#endif #endif
} }

View file

@ -726,7 +726,7 @@ void
SectorObjectSetupBounds(SECTOR_OBJECTp sop) SectorObjectSetupBounds(SECTOR_OBJECTp sop)
{ {
int xlow, ylow, xhigh, yhigh; int xlow, ylow, xhigh, yhigh;
short sp_num, next_sp_num, sn, startwall, endwall; short sp_num, next_sp_num, startwall, endwall;
int i, k, j; int i, k, j;
SPRITEp BoundSprite; SPRITEp BoundSprite;
SWBOOL FoundOutsideLoop = FALSE, FoundSector = FALSE; SWBOOL FoundOutsideLoop = FALSE, FoundSector = FALSE;
@ -846,7 +846,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
sop->num_sectors++; sop->num_sectors++;
} }
ASSERT(sop->num_sectors < SIZ(SectorObject[0].sector)); ASSERT((uint16_t)sop->num_sectors < SIZ(SectorObject[0].sector));
} }
// //
@ -967,6 +967,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
// sector // sector
// place all sprites on list // place all sprites on list
uint16_t sn;
for (sn = 0; sn < (int)SIZ(sop->sp_num); sn++) for (sn = 0; sn < (int)SIZ(sop->sp_num); sn++)
{ {
if (sop->sp_num[sn] == -1) if (sop->sp_num[sn] == -1)
@ -1498,7 +1499,7 @@ PlaceSectorObjectsOnTracks(void)
} }
} }
ASSERT(sop->num_walls < SIZ(sop->xorig)); ASSERT((uint16_t)sop->num_walls < SIZ(sop->xorig));
if (sop->track <= -1) if (sop->track <= -1)
continue; continue;

View file

@ -7748,7 +7748,7 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in
{ {
sect = sectlist[sectlistplc++]; sect = sectlist[sectlistplc++];
ASSERT(sectlistplc < SIZ(sectlist)); ASSERT((uint16_t)sectlistplc < SIZ(sectlist));
startwall = sector[sect].wallptr; startwall = sector[sect].wallptr;
endwall = startwall + sector[sect].wallnum; endwall = startwall + sector[sect].wallnum;
@ -7798,7 +7798,7 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in
if (k < 0) if (k < 0)
{ {
sectlist[sectlistend++] = nextsector; sectlist[sectlistend++] = nextsector;
ASSERT(sectlistend < SIZ(sectlist)); ASSERT((uint16_t)sectlistend < SIZ(sectlist));
} }
} }