From f781f21ccda018f819810d74c9bf93eada82c400 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 5 Jun 2017 10:05:12 +0000 Subject: [PATCH] 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 --- source/build/src/scriptfile.cpp | 2 +- source/duke3d/src/game.cpp | 63 ++++++++++++++++----------------- source/duke3d/src/gamedef.cpp | 7 ++-- source/duke3d/src/gameexec.cpp | 2 +- source/duke3d/src/gamevars.cpp | 32 ++++++++--------- source/duke3d/src/m32def.cpp | 2 +- source/duke3d/src/net.cpp | 2 +- 7 files changed, 53 insertions(+), 57 deletions(-) diff --git a/source/build/src/scriptfile.cpp b/source/build/src/scriptfile.cpp index a7783d3a2..1ac2d7ac4 100644 --- a/source/build/src/scriptfile.cpp +++ b/source/build/src/scriptfile.cpp @@ -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; diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index b969fe72d..ed0eb3763 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -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= 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= (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++; } diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 962fde797..26a0d4572 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1745,7 +1745,7 @@ skip_check: case CON_DEBUG: insptr++; - initprintf("%" PRIdPTR "\n",*insptr++); + buildprint(*insptr++, "\n"); continue; case CON_ENDOFGAME: diff --git a/source/duke3d/src/gamevars.cpp b/source/duke3d/src/gamevars.cpp index f83369add..9e0e1354b 100644 --- a/source/duke3d/src/gamevars.cpp +++ b/source/duke3d/src/gamevars.cpp @@ -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= 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; }