mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Address some longstanding warnings with printf when building with MinGW's GCC 6 and newer.
Building with said newer versions may fix the -Wodr warning when building for release. git-svn-id: https://svn.eduke32.com/eduke32@6140 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
914762513d
commit
f781f21ccd
7 changed files with 53 additions and 57 deletions
|
@ -356,7 +356,7 @@ int32_t scriptfile_getsymbolvalue(char const *name, int32_t *val)
|
|||
sscanf(name + 2, "%" PRIx64 "", &x);
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(x > UINT32_MAX))
|
||||
initprintf("warning: number 0x%" PRIx64 " truncated to 32 bits.\n", x);
|
||||
buildprint("warning: number 0x", hex(x), " truncated to 32 bits.\n");
|
||||
|
||||
*val = x;
|
||||
return 1;
|
||||
|
|
|
@ -1175,40 +1175,39 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
void G_DumpDebugInfo(void)
|
||||
{
|
||||
#if !defined LUNATIC
|
||||
static char const s_WEAPON[] = "WEAPON";
|
||||
int32_t i,j,x;
|
||||
// FILE * fp=fopen("condebug.log","w");
|
||||
|
||||
VM_ScriptInfo(insptr, 64);
|
||||
OSD_Printf("\n");
|
||||
|
||||
OSD_Printf("Current gamevar values:\n");
|
||||
buildprint("\nCurrent gamevar values:\n");
|
||||
|
||||
for (i=0; i<MAX_WEAPONS; i++)
|
||||
{
|
||||
for (j=0; j<numplayers; j++)
|
||||
{
|
||||
OSD_Printf("Player %d\n\n",j);
|
||||
OSD_Printf("WEAPON%d_CLIP %" PRIdPTR "\n", i, PWEAPON(j, i, Clip));
|
||||
OSD_Printf("WEAPON%d_RELOAD %" PRIdPTR "\n", i, PWEAPON(j, i, Reload));
|
||||
OSD_Printf("WEAPON%d_FIREDELAY %" PRIdPTR "\n", i, PWEAPON(j, i, FireDelay));
|
||||
OSD_Printf("WEAPON%d_TOTALTIME %" PRIdPTR "\n", i, PWEAPON(j, i, TotalTime));
|
||||
OSD_Printf("WEAPON%d_HOLDDELAY %" PRIdPTR "\n", i, PWEAPON(j, i, HoldDelay));
|
||||
OSD_Printf("WEAPON%d_FLAGS %" PRIdPTR "\n", i, PWEAPON(j, i, Flags));
|
||||
OSD_Printf("WEAPON%d_SHOOTS %" PRIdPTR "\n", i, PWEAPON(j, i, Shoots));
|
||||
OSD_Printf("WEAPON%d_SPAWNTIME %" PRIdPTR "\n", i, PWEAPON(j, i, SpawnTime));
|
||||
OSD_Printf("WEAPON%d_SPAWN %" PRIdPTR "\n", i, PWEAPON(j, i, Spawn));
|
||||
OSD_Printf("WEAPON%d_SHOTSPERBURST %" PRIdPTR "\n", i, PWEAPON(j, i, ShotsPerBurst));
|
||||
OSD_Printf("WEAPON%d_WORKSLIKE %" PRIdPTR "\n", i, PWEAPON(j, i, WorksLike));
|
||||
OSD_Printf("WEAPON%d_INITIALSOUND %" PRIdPTR "\n", i, PWEAPON(j, i, InitialSound));
|
||||
OSD_Printf("WEAPON%d_FIRESOUND %" PRIdPTR "\n", i, PWEAPON(j, i, FireSound));
|
||||
OSD_Printf("WEAPON%d_SOUND2TIME %" PRIdPTR "\n", i, PWEAPON(j, i, Sound2Time));
|
||||
OSD_Printf("WEAPON%d_SOUND2SOUND %" PRIdPTR "\n", i, PWEAPON(j, i, Sound2Sound));
|
||||
OSD_Printf("WEAPON%d_RELOADSOUND1 %" PRIdPTR "\n", i, PWEAPON(j, i, ReloadSound1));
|
||||
OSD_Printf("WEAPON%d_RELOADSOUND2 %" PRIdPTR "\n", i, PWEAPON(j, i, ReloadSound2));
|
||||
OSD_Printf("WEAPON%d_SELECTSOUND %" PRIdPTR "\n", i, PWEAPON(j, i, SelectSound));
|
||||
OSD_Printf("WEAPON%d_FLASHCOLOR %" PRIdPTR "\n", i, PWEAPON(j, i, FlashColor));
|
||||
buildprint("Player ", j, "\n\n");
|
||||
buildprint(s_WEAPON, i, "_CLIP ", PWEAPON(j, i, Clip), "\n");
|
||||
buildprint(s_WEAPON, i, "_RELOAD ", PWEAPON(j, i, Reload), "\n");
|
||||
buildprint(s_WEAPON, i, "_FIREDELAY ", PWEAPON(j, i, FireDelay), "\n");
|
||||
buildprint(s_WEAPON, i, "_TOTALTIME ", PWEAPON(j, i, TotalTime), "\n");
|
||||
buildprint(s_WEAPON, i, "_HOLDDELAY ", PWEAPON(j, i, HoldDelay), "\n");
|
||||
buildprint(s_WEAPON, i, "_FLAGS ", PWEAPON(j, i, Flags), "\n");
|
||||
buildprint(s_WEAPON, i, "_SHOOTS ", PWEAPON(j, i, Shoots), "\n");
|
||||
buildprint(s_WEAPON, i, "_SPAWNTIME ", PWEAPON(j, i, SpawnTime), "\n");
|
||||
buildprint(s_WEAPON, i, "_SPAWN ", PWEAPON(j, i, Spawn), "\n");
|
||||
buildprint(s_WEAPON, i, "_SHOTSPERBURST ", PWEAPON(j, i, ShotsPerBurst), "\n");
|
||||
buildprint(s_WEAPON, i, "_WORKSLIKE ", PWEAPON(j, i, WorksLike), "\n");
|
||||
buildprint(s_WEAPON, i, "_INITIALSOUND ", PWEAPON(j, i, InitialSound), "\n");
|
||||
buildprint(s_WEAPON, i, "_FIRESOUND ", PWEAPON(j, i, FireSound), "\n");
|
||||
buildprint(s_WEAPON, i, "_SOUND2TIME ", PWEAPON(j, i, Sound2Time), "\n");
|
||||
buildprint(s_WEAPON, i, "_SOUND2SOUND ", PWEAPON(j, i, Sound2Sound), "\n");
|
||||
buildprint(s_WEAPON, i, "_RELOADSOUND1 ", PWEAPON(j, i, ReloadSound1), "\n");
|
||||
buildprint(s_WEAPON, i, "_RELOADSOUND2 ", PWEAPON(j, i, ReloadSound2), "\n");
|
||||
buildprint(s_WEAPON, i, "_SELECTSOUND ", PWEAPON(j, i, SelectSound), "\n");
|
||||
buildprint(s_WEAPON, i, "_FLASHCOLOR ", PWEAPON(j, i, FlashColor), "\n");
|
||||
}
|
||||
OSD_Printf("\n");
|
||||
buildprint("\n");
|
||||
}
|
||||
|
||||
for (x=0; x<MAXSTATUS; x++)
|
||||
|
@ -1216,30 +1215,28 @@ void G_DumpDebugInfo(void)
|
|||
j = headspritestat[x];
|
||||
while (j >= 0)
|
||||
{
|
||||
OSD_Printf("Sprite %d (%d,%d,%d) (picnum: %d)\n",j,
|
||||
TrackerCast(sprite[j].x),TrackerCast(sprite[j].y),TrackerCast(sprite[j].z),TrackerCast(sprite[j].picnum));
|
||||
buildprint("Sprite ", j, " (", TrackerCast(sprite[j].x), ",", TrackerCast(sprite[j].y), ",", TrackerCast(sprite[j].z),
|
||||
") (picnum: ", TrackerCast(sprite[j].picnum), ")\n");
|
||||
for (i=0; i<g_gameVarCount; i++)
|
||||
{
|
||||
if (aGameVars[i].flags & (GAMEVAR_PERACTOR))
|
||||
{
|
||||
if (aGameVars[i].pValues[j] != aGameVars[i].defaultValue)
|
||||
{
|
||||
OSD_Printf("gamevar %s ",aGameVars[i].szLabel);
|
||||
OSD_Printf("%" PRIdPTR "",aGameVars[i].pValues[j]);
|
||||
OSD_Printf(" GAMEVAR_PERACTOR");
|
||||
buildprint("gamevar ", aGameVars[i].szLabel, " ", aGameVars[i].pValues[j], " GAMEVAR_PERACTOR");
|
||||
if (aGameVars[i].flags != GAMEVAR_PERACTOR)
|
||||
{
|
||||
OSD_Printf(" // ");
|
||||
buildprint(" // ");
|
||||
if (aGameVars[i].flags & (GAMEVAR_SYSTEM))
|
||||
{
|
||||
OSD_Printf(" (system)");
|
||||
buildprint(" (system)");
|
||||
}
|
||||
}
|
||||
OSD_Printf("\n");
|
||||
buildprint("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
OSD_Printf("\n");
|
||||
buildprint("\n");
|
||||
j = nextspritestat[j];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1338,7 +1338,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
|
|||
if (EDUKE32_PREDICT_FALSE((intptr_t)apScript[i] < (intptr_t)&apScript[0] || (intptr_t)apScript[i] >= (intptr_t)&apScript[g_scriptSize]))
|
||||
{
|
||||
g_errorCnt++;
|
||||
initprintf("Internal compiler error at %" PRIdPTR " (0x%" PRIxPTR ")\n",i,i);
|
||||
buildprint("Internal compiler error at ", i, " (0x", hex(i), ")\n");
|
||||
VM_ScriptInfo(&apScript[i], 16);
|
||||
}
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
|
|||
bitptr = newbitptr;
|
||||
if (apScript != newscript)
|
||||
{
|
||||
initprintf("Relocating compiled code from to 0x%" PRIxPTR " to 0x%" PRIxPTR "\n", (intptr_t)apScript, (intptr_t)newscript);
|
||||
buildprint("Relocating compiled code from to 0x", hex((intptr_t)apScript), " to 0x", hex((intptr_t)newscript), "\n");
|
||||
apScript = newscript;
|
||||
}
|
||||
|
||||
|
@ -1637,8 +1637,7 @@ static int32_t parse_hex_constant(const char *hexnum)
|
|||
|
||||
if (EDUKE32_PREDICT_FALSE(x > UINT32_MAX))
|
||||
{
|
||||
initprintf("%s:%d: warning: number 0x%" PRIx64 " truncated to 32 bits.\n",
|
||||
g_scriptFileName,g_lineNumber, x);
|
||||
initprintf(g_scriptFileName, ":", g_lineNumber, ": warning: number 0x", hex(x), " truncated to 32 bits.\n");
|
||||
g_warningCnt++;
|
||||
}
|
||||
|
||||
|
|
|
@ -1745,7 +1745,7 @@ skip_check:
|
|||
|
||||
case CON_DEBUG:
|
||||
insptr++;
|
||||
initprintf("%" PRIdPTR "\n",*insptr++);
|
||||
buildprint(*insptr++, "\n");
|
||||
continue;
|
||||
|
||||
case CON_ENDOFGAME:
|
||||
|
|
|
@ -327,40 +327,40 @@ void Gv_WriteSave(FILE *fil)
|
|||
|
||||
void Gv_DumpValues(void)
|
||||
{
|
||||
OSD_Printf("// Current Game Definitions\n\n");
|
||||
buildprint("// Current Game Definitions\n\n");
|
||||
|
||||
for (bssize_t i=0; i<g_gameVarCount; i++)
|
||||
{
|
||||
OSD_Printf("gamevar %s ",aGameVars[i].szLabel);
|
||||
buildprint("gamevar ", aGameVars[i].szLabel, " ");
|
||||
|
||||
if (aGameVars[i].flags & (GAMEVAR_INTPTR))
|
||||
OSD_Printf("%d",*((int32_t *)aGameVars[i].global));
|
||||
buildprint(*(int32_t *)aGameVars[i].global);
|
||||
else if (aGameVars[i].flags & (GAMEVAR_SHORTPTR))
|
||||
OSD_Printf("%d",*((int16_t *)aGameVars[i].global));
|
||||
buildprint(*(int16_t *)aGameVars[i].global);
|
||||
else if (aGameVars[i].flags & (GAMEVAR_CHARPTR))
|
||||
OSD_Printf("%d",*((char *)aGameVars[i].global));
|
||||
buildprint(*(int8_t *)aGameVars[i].global);
|
||||
else
|
||||
OSD_Printf("%" PRIdPTR "",aGameVars[i].global);
|
||||
buildprint(aGameVars[i].global);
|
||||
|
||||
if (aGameVars[i].flags & (GAMEVAR_PERPLAYER))
|
||||
OSD_Printf(" GAMEVAR_PERPLAYER");
|
||||
buildprint(" GAMEVAR_PERPLAYER");
|
||||
else if (aGameVars[i].flags & (GAMEVAR_PERACTOR))
|
||||
OSD_Printf(" GAMEVAR_PERACTOR");
|
||||
buildprint(" GAMEVAR_PERACTOR");
|
||||
else
|
||||
OSD_Printf(" %" PRIdPTR,aGameVars[i].flags/* & (GAMEVAR_USER_MASK)*/);
|
||||
buildprint(" ", aGameVars[i].flags/* & (GAMEVAR_USER_MASK)*/);
|
||||
|
||||
OSD_Printf(" // ");
|
||||
buildprint(" // ");
|
||||
if (aGameVars[i].flags & (GAMEVAR_SYSTEM))
|
||||
OSD_Printf(" (system)");
|
||||
buildprint(" (system)");
|
||||
if (aGameVars[i].flags & (GAMEVAR_PTR_MASK))
|
||||
OSD_Printf(" (pointer)");
|
||||
buildprint(" (pointer)");
|
||||
if (aGameVars[i].flags & (GAMEVAR_READONLY))
|
||||
OSD_Printf(" (read only)");
|
||||
buildprint(" (read only)");
|
||||
if (aGameVars[i].flags & (GAMEVAR_SPECIAL))
|
||||
OSD_Printf(" (special)");
|
||||
OSD_Printf("\n");
|
||||
buildprint(" (special)");
|
||||
buildprint("\n");
|
||||
}
|
||||
OSD_Printf("\n// end of game definitions\n");
|
||||
buildprint("\n// end of game definitions\n");
|
||||
}
|
||||
|
||||
// XXX: This function is very strange.
|
||||
|
|
|
@ -641,7 +641,7 @@ static int32_t C_SetScriptSize(int32_t size)
|
|||
|
||||
if (apScript != newscript)
|
||||
{
|
||||
initprintf("Relocating compiled code from to 0x%" PRIxPTR " to 0x%" PRIxPTR "\n", (intptr_t)apScript, (intptr_t)newscript);
|
||||
buildprint("Relocating compiled code from to 0x", hex((intptr_t)apScript), " to 0x", hex((intptr_t)newscript), "\n");
|
||||
apScript = newscript;
|
||||
}
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ void Net_HandleClientPackets(void)
|
|||
if (playeridx < 0 || playeridx >= MAXPLAYERS)
|
||||
{
|
||||
enet_peer_disconnect_later(event.peer, DISC_INVALID);
|
||||
initprintf("Invalid player id (%" PRIdPTR ") from client.\n", playeridx);
|
||||
buildprint("Invalid player id (", playeridx, ") from client.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue