From 749c2753e464f9628e68c8a2bca65acbdaa202d5 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 8 Aug 2019 22:19:22 -0400 Subject: [PATCH] Try to compile with AppVeyor's GCC 9.1.0 --- src/Makefile.cfg | 6 ++++++ src/d_clisrv.c | 2 +- src/dehacked.c | 8 ++++---- src/hu_stuff.c | 2 +- src/p_spec.c | 2 +- src/v_video.c | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 738b05330..d9fee7559 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -154,6 +154,9 @@ ifdef GCC43 endif endif WFLAGS+=-Wsign-compare +ifdef GCC91 + WFLAGS+=-Wno-error=address-of-packed-member +endif ifdef GCC45 WFLAGS+=-Wlogical-op endif @@ -238,6 +241,9 @@ ifdef GCC80 WFLAGS+=-Wno-error=format-overflow WFLAGS+=-Wno-error=stringop-truncation WFLAGS+=-Wno-error=stringop-overflow +ifdef GCC91 + WFLAGS+=-Werror=-Wstringop-overflow=2 +endif WFLAGS+=-Wno-format-overflow WFLAGS+=-Wno-stringop-truncation WFLAGS+=-Wno-stringop-overflow diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 274fe398a..6c5b56f81 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1242,7 +1242,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled(); netbuffer->u.serverinfo.isdedicated = (UINT8)dedicated; strncpy(netbuffer->u.serverinfo.servername, cv_servername.string, - MAXSERVERNAME); + MAXSERVERNAME-1); strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), 7); M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, 16); diff --git a/src/dehacked.c b/src/dehacked.c index bda0c38f7..d506ef910 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1186,9 +1186,9 @@ static void readlevelheader(MYFILE *f, INT32 num) { i = get_mus(word2, true); if (i && i <= 1035) - snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i)); + snprintf(mapheaderinfo[num-1]->musname, 6, "%sM", G_BuildMapName(i)); else if (i && i <= 1050) - strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7); + strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 6); else mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string mapheaderinfo[num-1]->musname[6] = 0; @@ -1213,7 +1213,7 @@ static void readlevelheader(MYFILE *f, INT32 num) else if (fastcmp(word, "SKYNUM")) mapheaderinfo[num-1]->skynum = (INT16)i; else if (fastcmp(word, "INTERSCREEN")) - strncpy(mapheaderinfo[num-1]->interscreen, word2, 8); + strncpy(mapheaderinfo[num-1]->interscreen, word2, 7); else if (fastcmp(word, "PRECUTSCENENUM")) mapheaderinfo[num-1]->precutscenenum = (UINT8)i; else if (fastcmp(word, "CUTSCENENUM")) @@ -3101,7 +3101,7 @@ static void readmaincfg(MYFILE *f) // Also save a time attack folder filenamelen = strlen(gamedatafilename)-4; // Strip off the extension - strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder))); + strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder)-1)); timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0'; strcpy(savegamename, timeattackfolder); diff --git a/src/hu_stuff.c b/src/hu_stuff.c index a9a2b7504..13272a748 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -3072,7 +3072,7 @@ void HU_DoCEcho(const char *msg) { I_OutputMsg("%s\n", msg); // print to log - strncpy(cechotext, msg, sizeof(cechotext)); + strncpy(cechotext, msg, sizeof(cechotext)-1); strncat(cechotext, "\\", sizeof(cechotext) - strlen(cechotext) - 1); cechotext[sizeof(cechotext) - 1] = '\0'; cechotimer = cechoduration; diff --git a/src/p_spec.c b/src/p_spec.c index f3be86ee1..9b46d4b3b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -469,7 +469,7 @@ void P_ParseAnimationDefintion(SINT8 istexture) // Increase the size to make room for the new animation definition maxanims++; animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL); - strncpy(animdefs[i].startname, animdefsToken, 9); + strncpy(animdefs[i].startname, animdefsToken, 8); } // animdefs[i].startname is now set to animdefsToken either way. diff --git a/src/v_video.c b/src/v_video.c index c3b29e157..5f16bd916 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -196,7 +196,7 @@ static void LoadPalette(const char *lumpname) const char *R_GetPalname(UINT16 num) { static char palname[9]; - char newpal[9] = "PLAYPAL"; + char newpal[9] = "PLAYPAL\0"; if (num > 0 && num <= 10000) snprintf(newpal, 8, "PAL%04u", num-1);