From d262190faf147fd3d3ff11aa196fd7827087fee8 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 7 May 2022 07:23:26 -0400 Subject: [PATCH] Fix compiling with da strict settings Moved from gnu99 to gnu11 because I think unnamed union is reasonable, and will also cause a lot of problems down the road if we ever need changes!! --- src/Makefile.d/versions.mk | 3 +++ src/d_main.c | 23 ----------------------- src/hardware/hw_main.c | 4 ++-- src/lua_hudlib.c | 4 ++-- src/lua_hudlib_drawlist.c | 15 +++++++++++---- src/lua_hudlib_drawlist.h | 6 +++--- src/m_perfstats.c | 2 +- 7 files changed, 22 insertions(+), 35 deletions(-) diff --git a/src/Makefile.d/versions.mk b/src/Makefile.d/versions.mk index 240e6d31b..78ae649dd 100644 --- a/src/Makefile.d/versions.mk +++ b/src/Makefile.d/versions.mk @@ -45,6 +45,9 @@ endif ifdef GCC45 #WFLAGS+=-Wc++-compat WFLAGS+=-std=gnu99 +endif +ifdef GCC47 + WFLAGS+=-std=gnu11 endif WFLAGS+=-Wcast-qual ifndef NOCASTALIGNWARN diff --git a/src/d_main.c b/src/d_main.c index d6996b5a8..2d6af058f 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -683,29 +683,6 @@ static void D_Display(void) } } -static boolean D_CheckFrameCap(void) -{ - static boolean init = false; - static precise_t startCap = 0; - precise_t endCap = 0; - - endCap = I_GetPreciseTime(); - - if (init == false) - { - startCap = endCap; - init = true; - } - else if (I_CheckFrameCap(startCap, endCap)) - { - // Framerate should be capped. - return true; - } - - startCap = endCap; - return false; -} - // ========================================================================= // D_SRB2Loop // ========================================================================= diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 1fabe6068..2f625505d 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5388,7 +5388,7 @@ static void HWR_ProjectSprite(mobj_t *thing) if (thing->renderflags & RF_SHADOWEFFECTS) { mobj_t *caster = thing->target; - interpmobjstate_t casterinterp = {}; + interpmobjstate_t casterinterp = {0}; if (R_UsingFrameInterpolation() && !paused) { @@ -5481,7 +5481,7 @@ static void HWR_ProjectSprite(mobj_t *thing) if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer) { - interpmobjstate_t tracer_interp = {}; + interpmobjstate_t tracer_interp = {0}; if (! R_ThingVisible(thing->tracer)) return; diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index b39a507ec..765b20894 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -672,7 +672,7 @@ static int libd_drawOnMinimap(lua_State *L) { fixed_t x, y, scale; // coordinates of the object patch_t *patch; // patch we want to draw - const UINT8 *colormap = NULL; // do we want to colormap this patch? + UINT8 *colormap = NULL; // do we want to colormap this patch? boolean centered; // the patch is centered and doesn't need readjusting on x/y coordinates. huddrawlist_h list; @@ -898,7 +898,7 @@ static int libd_drawPaddedNum(lua_State *L) static int libd_drawPingNum(lua_State *L) { INT32 x, y, flags, num; - const UINT8 *colormap = NULL; + UINT8 *colormap = NULL; huddrawlist_h list; HUDONLY x = luaL_checkinteger(L, 1); diff --git a/src/lua_hudlib_drawlist.c b/src/lua_hudlib_drawlist.c index 2bda6fbcd..9b318ee91 100644 --- a/src/lua_hudlib_drawlist.c +++ b/src/lua_hudlib_drawlist.c @@ -279,10 +279,17 @@ void LUA_HUD_AddDrawPingNum( INT32 y, INT32 flags, INT32 num, - const UINT8 *colormap + UINT8 *colormap ) { - *(int*)(NULL + 1); + size_t i = AllocateDrawItem(list); + drawitem_t *item = &list->items[i]; + item->type = DI_DrawPingNum; + item->x = x; + item->y = y; + item->flags = flags; + item->num = num; + item->colormap = colormap; } void LUA_HUD_AddDrawFill( @@ -363,8 +370,8 @@ void LUA_HUD_AddDrawKartString( huddrawlist_h list, fixed_t x, fixed_t y, - INT32 flags, - const char *str + const char *str, + INT32 flags ) { size_t i = AllocateDrawItem(list); diff --git a/src/lua_hudlib_drawlist.h b/src/lua_hudlib_drawlist.h index 44a332460..398293602 100644 --- a/src/lua_hudlib_drawlist.h +++ b/src/lua_hudlib_drawlist.h @@ -82,7 +82,7 @@ void LUA_HUD_AddDrawPingNum( INT32 y, INT32 flags, INT32 num, - const UINT8 *colormap + UINT8 *colormap ); void LUA_HUD_AddDrawFill( huddrawlist_h list, @@ -119,8 +119,8 @@ void LUA_HUD_AddDrawKartString( huddrawlist_h list, fixed_t x, fixed_t y, - INT32 flags, - const char *str + const char *str, + INT32 flags ); // Draws the given draw list diff --git a/src/m_perfstats.c b/src/m_perfstats.c index d1a211367..2b5ced7a8 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -566,7 +566,7 @@ void M_DrawPerfStats(void) len = (int)strlen(str); if (len > 20) str += len - 20; - snprintf(s, sizeof s - 1, "%20s: %lld", str, (thinkframe_hooks[i].time_taken) / (I_GetPrecisePrecision() / 1000000)); + snprintf(s, sizeof s - 1, "%20s: %ld", str, (long)((thinkframe_hooks[i].time_taken) / (I_GetPrecisePrecision() / 1000000))); V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | text_color, s); y += 4; // repeated code! if (y > 192)