From dad337add81f7eb35c4610b69370a75cc0994546 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 18 Jul 2017 20:53:41 +0000 Subject: [PATCH] Fix gcc 7.1.0 warnings git-svn-id: https://svn.eduke32.com/eduke32@6370 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/audiolib/src/multivoc.cpp | 8 +++++-- source/build/include/compat.h | 8 +++---- source/build/src/build.cpp | 2 ++ source/build/src/defs.cpp | 1 + source/build/src/engine.cpp | 6 +++++ source/build/src/miniz.c | 5 +++-- source/build/src/osd.cpp | 2 ++ source/build/src/polymost.cpp | 2 +- source/duke3d/Dependencies.mak | 2 +- source/duke3d/src/actors.cpp | 10 ++++++--- source/duke3d/src/astub.cpp | 12 ++++++++-- source/duke3d/src/game.cpp | 38 ++++++++++++++++++++++++++++---- source/duke3d/src/gamedef.cpp | 12 +++++++++- source/duke3d/src/gameexec.cpp | 3 +++ source/duke3d/src/m32def.cpp | 3 +++ source/duke3d/src/m32exec.cpp | 3 +++ source/duke3d/src/m32vars.cpp | 9 +++++++- source/duke3d/src/menus.cpp | 18 +++++++++++++++ source/duke3d/src/osdcmds.cpp | 4 ++++ source/duke3d/src/player.cpp | 6 ++++- source/duke3d/src/premap.cpp | 2 +- source/duke3d/src/screens.cpp | 1 + source/duke3d/src/screentext.cpp | 1 + source/duke3d/src/sector.cpp | 4 +++- source/mact/src/scriplib.cpp | 3 +++ 25 files changed, 141 insertions(+), 24 deletions(-) diff --git a/source/audiolib/src/multivoc.cpp b/source/audiolib/src/multivoc.cpp index a20157425..31fb2366a 100644 --- a/source/audiolib/src/multivoc.cpp +++ b/source/audiolib/src/multivoc.cpp @@ -619,11 +619,15 @@ void MV_SetVoiceMixMode(VoiceNode *voice) switch (type) { - case T_16BITSOURCE | T_LEFTQUIET: MV_LeftVolume = MV_RightVolume; + case T_16BITSOURCE | T_LEFTQUIET: + MV_LeftVolume = MV_RightVolume; + fallthrough__; case T_16BITSOURCE | T_MONO: case T_16BITSOURCE | T_RIGHTQUIET: voice->mix = MV_Mix16BitMono16; break; - case T_LEFTQUIET: MV_LeftVolume = MV_RightVolume; + case T_LEFTQUIET: + MV_LeftVolume = MV_RightVolume; + fallthrough__; case T_MONO: case T_RIGHTQUIET: voice->mix = MV_Mix16BitMono; break; diff --git a/source/build/include/compat.h b/source/build/include/compat.h index 01e2876c6..157bf2994 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -227,13 +227,13 @@ #endif #if __has_cpp_attribute(fallthrough) -# define FALLTHROUGH [[fallthrough]] +# define fallthrough__ [[fallthrough]] #elif __has_cpp_attribute(clang::fallthrough) -# define FALLTHROUGH [[clang::fallthrough]] +# define fallthrough__ [[clang::fallthrough]] #elif __has_cpp_attribute(gnu::fallthrough) -# define FALLTHROUGH [[gnu::fallthrough]] +# define fallthrough__ [[gnu::fallthrough]] #else -# define FALLTHROUGH +# define fallthrough__ #endif diff --git a/source/build/src/build.cpp b/source/build/src/build.cpp index 40d25a281..9d5b24ce8 100644 --- a/source/build/src/build.cpp +++ b/source/build/src/build.cpp @@ -304,11 +304,13 @@ static int32_t osdcmd_vidmode(osdfuncparm_t const * const parm) break; case 4: // fs, res, bpp switch newfullscreen = (Batol(parm->parms[3]) != 0); + fallthrough__; case 3: // res & bpp switch tmp = Batol(parm->parms[2]); if (!(tmp==8 || tmp==16 || tmp==32)) return OSDCMD_SHOWHELP; newbpp = tmp; + fallthrough__; #endif case 2: // res switch newx = Batol(parm->parms[0]); diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 73008c55f..8e234b2a2 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -3524,6 +3524,7 @@ static int32_t defsparser(scriptfile *script) glb->def[0].alpha = (float)(value2-a) * finv2value; glb->def[1].alpha = (float)a * finv2value; } + fallthrough__; #endif case 0: numalphatabs = value; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 6b0ecf559..56c1f0f74 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -9379,8 +9379,10 @@ int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_ { case 5: convertv5sectv6(&v5sect,&v6sect); + fallthrough__; case 6: convertv6sectv7(&v6sect,§or[i]); + break; } } @@ -9426,8 +9428,10 @@ int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_ { case 5: convertv5wallv6(&v5wall,&v6wall,i); + fallthrough__; case 6: convertv6wallv7(&v6wall,&wall[i]); + break; } } @@ -9478,8 +9482,10 @@ int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_ { case 5: convertv5sprv6(&v5spr,&v6spr); + fallthrough__; case 6: convertv6sprv7(&v6spr,&sprite[i]); + break; } check_sprite(i); diff --git a/source/build/src/miniz.c b/source/build/src/miniz.c index 723bb1296..a301d33bc 100644 --- a/source/build/src/miniz.c +++ b/source/build/src/miniz.c @@ -2084,7 +2084,7 @@ void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int for (y = 0; y < h; ++y) { tdefl_compress_buffer(pComp, &z, 1, TDEFL_NO_FLUSH); - tdefl_compress_buffer(pComp, (mz_uint8 *)pImage + (flip ? (h - 1 - y) : y) * bpl, bpl, TDEFL_NO_FLUSH); + tdefl_compress_buffer(pComp, (mz_uint8 const *)pImage + (flip ? (h - 1 - y) : y) * bpl, bpl, TDEFL_NO_FLUSH); } if (tdefl_compress_buffer(pComp, NULL, 0, TDEFL_FINISH) != TDEFL_STATUS_DONE) { @@ -3176,6 +3176,7 @@ struct mz_zip_internal_state_tag #if defined(DEBUG) || defined(_DEBUG) || defined(NDEBUG) static MZ_FORCEINLINE mz_uint mz_zip_array_range_check(const mz_zip_array *pArray, mz_uint index) { + pArray = pArray; MZ_ASSERT(index < pArray->m_size); return index; } @@ -4805,7 +4806,7 @@ mz_zip_reader_extract_iter_state* mz_zip_reader_extract_iter_new(mz_zip_archive if (!((flags & MZ_ZIP_FLAG_COMPRESSED_DATA) || (!pState->file_stat.m_method))) { /* Decompression required, therefore intermediate read buffer required */ - pState->read_buf_size = MZ_MIN(pState->file_stat.m_comp_size, MZ_ZIP_MAX_IO_BUF_SIZE); + pState->read_buf_size = MZ_MIN(pState->file_stat.m_comp_size, (mz_uint64)MZ_ZIP_MAX_IO_BUF_SIZE); if (NULL == (pState->pRead_buf = pZip->m_pAlloc(pZip->m_pAlloc_opaque, 1, (size_t)pState->read_buf_size))) { mz_zip_set_error(pZip, MZ_ZIP_ALLOC_FAILED); diff --git a/source/build/src/osd.cpp b/source/build/src/osd.cpp index 12c5b1036..6504e0e4b 100644 --- a/source/build/src/osd.cpp +++ b/source/build/src/osd.cpp @@ -957,6 +957,7 @@ int32_t OSD_HandleChar(char ch) if (--editor.pos < editor.start) editor.start--, editor.end--; + fallthrough__; #ifndef __APPLE__ case 127: // handled in OSD_HandleScanCode (delete) #endif @@ -2125,6 +2126,7 @@ int32_t osdcmd_cvar_set(osdfuncparm_t const * const parm) break; case CVAR_INVALIDATEALL: gltexinvalidatetype(INVALIDATE_ALL); + fallthrough__; case CVAR_INVALIDATEART: gltexinvalidatetype(INVALIDATE_ART); #ifdef POLYMER diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 77fa6196c..34339421c 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -1812,7 +1812,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 } else { - float const al = waloff[globalpicnum] ? alphahackarray[globalpicnum] * (1.f/255.f) ? alphahackarray[globalpicnum] * (1.f/255.f): + float const al = waloff[globalpicnum] ? alphahackarray[globalpicnum] != 0 ? alphahackarray[globalpicnum] * (1.f/255.f): (pth && pth->hicr && pth->hicr->alphacut >= 0.f ? pth->hicr->alphacut : 0.f) : 0.f; bglAlphaFunc(GL_GREATER, al); diff --git a/source/duke3d/Dependencies.mak b/source/duke3d/Dependencies.mak index 404c6c345..453ba0797 100644 --- a/source/duke3d/Dependencies.mak +++ b/source/duke3d/Dependencies.mak @@ -46,7 +46,7 @@ $(DUKE3D_OBJ)/gamedef.$o: $(DUKE3D_SRC)/gamedef.cpp $(duke3d_h) $(gamedef_h) $(D $(DUKE3D_OBJ)/gameexec.$o: $(DUKE3D_SRC)/gameexec.cpp $(DUKE3D_SRC)/gamestructures.cpp $(duke3d_h) $(gamedef_h) $(DUKE3D_OBJ)/gamestructures.$o: $(DUKE3D_SRC)/gamestructures.cpp $(duke3d_h) $(gamedef_h) $(DUKE3D_OBJ)/gamevars.$o: $(DUKE3D_SRC)/gamevars.cpp $(DUKE3D_SRC)/gamestructures.cpp $(duke3d_h) $(gamedef_h) $(DUKE3D_SRC)/savegame.h -$(DUKE3D_OBJ)/global.$o: $(DUKE3D_SRC)/*.cpp $(DUKE3D_SRC)/global.cpp $(duke3d_h) +$(DUKE3D_OBJ)/global.$o: $(DUKE3D_SRC)/global.cpp $(duke3d_h) $(DUKE3D_OBJ)/input.$o: $(DUKE3D_SRC)/input.cpp $(duke3d_h) $(DUKE3D_SRC)/input.h $(DUKE3D_OBJ)/mdump.$o: $(DUKE3D_SRC)/mdump.cpp $(DUKE3D_SRC)/mdump.h $(DUKE3D_OBJ)/menus.$o: $(DUKE3D_SRC)/menus.cpp $(duke3d_h) $(DUKE3D_SRC)/input.h $(MACT_INC)/mouse.h $(DUKE3D_SRC)/menus.h diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 1359fdcd6..03c06eba2 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -2973,6 +2973,7 @@ ACTOR_STATIC void G_MoveWeapons(void) sprite[newSprite].yrepeat = 32; DELETE_SPRITE_AND_CONTINUE(spriteNum); } + fallthrough__; case SHRINKSPARK__STATIC: case RPG__STATIC: case FIRELASER__STATIC: @@ -3448,6 +3449,7 @@ ACTOR_STATIC void G_MoveTransports(void) case STAT_ACTOR: if (sprite[sectSprite].extra > 0 && A_CheckNonTeleporting(sectSprite)) goto JBOLT; + fallthrough__; case STAT_MISC: case STAT_FALLER: case STAT_DUMMYPLAYER: @@ -5077,9 +5079,10 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 if (pData[1] == 5) A_DeleteSprite(spriteNum); goto next_sprite; - + fallthrough__; case FRAMEEFFECT1_13__STATIC: if (PLUTOPAK) goto next_sprite; // JBF: ideally this should never happen... + fallthrough__; case FRAMEEFFECT1__STATIC: if (pSprite->owner >= 0) @@ -5109,7 +5112,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 sprite[g_player[playerNum].ps->i].extra -= 4; } } - + fallthrough__; case FIRELASER__STATIC: if (pSprite->extra != 5) pSprite->extra = 5; @@ -5843,7 +5846,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 } } x = 0; // XXX: This assignment is dead? - + fallthrough__; case SE_14_SUBWAY_CAR: if (pSprite->owner==-1) @@ -6499,6 +6502,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 case ST_26_SPLITTING_ST_DOOR: if (GetAnimationGoal(§or[pSprite->sectnum].ceilingz) >= 0) break; + fallthrough__; default: G_ActivateBySector(pSprite->sectnum,spriteNum); pData[0] = 0; diff --git a/source/duke3d/src/astub.cpp b/source/duke3d/src/astub.cpp index 50eb22785..1cf548785 100644 --- a/source/duke3d/src/astub.cpp +++ b/source/duke3d/src/astub.cpp @@ -10307,6 +10307,7 @@ void ExtPreCheckKeys(void) // just before drawrooms // 5-frame walk case 1550 : // Shark frames=5; + fallthrough__; // 2-frame walk case 1445 : // duke kick case LIZTROOPDUCKING : @@ -10318,7 +10319,7 @@ void ExtPreCheckKeys(void) // just before drawrooms case BOSS1LOB : case LIZTROOPSHOOT : if (frames==0) frames=2; - + fallthrough__; // 4-frame walk case 1491 : // duke crawl case LIZTROOP : @@ -10331,15 +10332,18 @@ void ExtPreCheckKeys(void) // just before drawrooms case BOSS4 : case NEWBEAST: if (frames==0) frames=4; + fallthrough__; case LIZTROOPJETPACK : case DRONE : case COMMANDER : case TANK : case RECON : if (frames==0) frames = 10; + fallthrough__; case CAMERA1: case APLAYER : if (frames==0) frames=1; + fallthrough__; case GREENSLIME : case EGG : case PIGCOPSTAYPUT : @@ -10525,6 +10529,7 @@ void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr // 5-frame walk case 1550 : // Shark frames=5; + fallthrough__; // 2-frame walk case 1445 : // duke kick case LIZTROOPDUCKING : @@ -10536,7 +10541,7 @@ void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr case BOSS1LOB : case LIZTROOPSHOOT : if (frames==0) frames=2; - + fallthrough__; // 4-frame walk case 1491 : // duke crawl case LIZTROOP : @@ -10549,16 +10554,19 @@ void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr case BOSS4 : case NEWBEAST: if (frames==0) frames=4; + fallthrough__; case LIZTROOPJETPACK : case DRONE : case COMMANDER : case TANK : case RECON : if (frames==0) frames = 10; + fallthrough__; case ROTATEGUN : case CAMERA1: case APLAYER : if (frames==0) frames=1; + fallthrough__; case GREENSLIME : case PIGCOPSTAYPUT : case LIZMANSTAYPUT: diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 77d23a61d..16168eab5 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -1594,9 +1594,11 @@ int A_Spawn(int spriteNum, int tileNum) if (sector[sectNum].floorpicnum == FLOORSLIME || sector[sectNum].ceilingpicnum == FLOORSLIME) pSprite->pal = 7; + fallthrough__; case DOMELITE__STATIC: if (pSprite->picnum == DOMELITE) pSprite->cstat |= 257; + fallthrough__; case NEON1__STATIC: case NEON2__STATIC: case NEON3__STATIC: @@ -1605,6 +1607,7 @@ int A_Spawn(int spriteNum, int tileNum) case NEON6__STATIC: if (pSprite->picnum != WATERSPLASH2) pSprite->cstat |= 257; + fallthrough__; case NUKEBUTTON__STATIC: case JIBS1__STATIC: case JIBS2__STATIC: @@ -1669,6 +1672,7 @@ int A_Spawn(int spriteNum, int tileNum) case FRAMEEFFECT1_13__STATIC: if (PLUTOPAK) break; + fallthrough__; case FRAMEEFFECT1__STATIC: if (spriteNum >= 0) { @@ -1782,6 +1786,7 @@ int A_Spawn(int spriteNum, int tileNum) pSprite->shade = 127; } pSprite->cstat |= 32; + fallthrough__; } case FECES__STATIC: if (spriteNum >= 0) @@ -1901,6 +1906,7 @@ int A_Spawn(int spriteNum, int tileNum) case PIPE6__STATIC: pSprite->clipdist = 32; pSprite->cstat |= 257; + fallthrough__; case OCEANSPRITE4__STATIC: changespritestat(newSprite, STAT_DEFAULT); break; @@ -1999,6 +2005,7 @@ int A_Spawn(int spriteNum, int tileNum) case PODFEM1__STATIC: pSprite->extra <<= 1; + fallthrough__; case FEM1__STATIC: case FEM2__STATIC: case FEM3__STATIC: @@ -2014,6 +2021,7 @@ int A_Spawn(int spriteNum, int tileNum) case TOUGHGAL__STATIC: pSprite->yvel = pSprite->hitag; pSprite->hitag = -1; + fallthrough__; case BLOODYPOLE__STATIC: pSprite->cstat |= 257; pSprite->clipdist = 32; @@ -2035,6 +2043,7 @@ int A_Spawn(int spriteNum, int tileNum) pSprite->shade = sprite[spriteNum].shade; pSprite->pal = g_player[P_Get(spriteNum)].ps->palookup; } + fallthrough__; case DUKECAR__STATIC: case HELECOPT__STATIC: // if(sp->picnum == HELECOPT || sp->picnum == DUKECAR) sp->xvel = 1024; @@ -2042,6 +2051,7 @@ int A_Spawn(int spriteNum, int tileNum) pSprite->extra = 1; pSprite->xvel = 292; pSprite->zvel = 360; + fallthrough__; case BLIMP__STATIC: pSprite->cstat |= 257; pSprite->clipdist = 128; @@ -2148,6 +2158,7 @@ int A_Spawn(int spriteNum, int tileNum) case RESPAWN__STATIC: pSprite->extra = 66-13; + fallthrough__; case MUSICANDSFX__STATIC: if ((!g_netServer && ud.multimode < 2) && pSprite->pal == 1) { @@ -2166,6 +2177,7 @@ int A_Spawn(int spriteNum, int tileNum) G_AddGameLight(0, newSprite, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 32768, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); actor[newSprite].lightcount = 2; } + fallthrough__; #endif case EXPLOSION2BOT__STATIC: case BURNING__STATIC: @@ -2319,6 +2331,7 @@ int A_Spawn(int spriteNum, int tileNum) T1(newSprite) = pSprite->z; T2(newSprite) = krand()&127; } + fallthrough__; case WATERDRIPSPLASH__STATIC: pSprite->xrepeat = pSprite->yrepeat = 24; changespritestat(newSprite, STAT_STANDABLE); @@ -2341,7 +2354,7 @@ int A_Spawn(int spriteNum, int tileNum) changespritestat(newSprite, STAT_MISC); break; } - // touchplate falls through + fallthrough__; case WATERBUBBLEMAKER__STATIC: if (EDUKE32_PREDICT_FALSE(pSprite->hitag && pSprite->picnum == WATERBUBBLEMAKER)) { @@ -2378,6 +2391,7 @@ int A_Spawn(int spriteNum, int tileNum) case COMMANDERSTAYPUT__STATIC: case BOSS4STAYPUT__STATIC: actor[newSprite].actorstayput = pSprite->sectnum; + fallthrough__; case BOSS1__STATIC: case BOSS2__STATIC: case BOSS3__STATIC: @@ -2386,6 +2400,7 @@ int A_Spawn(int spriteNum, int tileNum) case GREENSLIME__STATIC: if (pSprite->picnum == GREENSLIME) pSprite->extra = 1; + fallthrough__; case DRONE__STATIC: case LIZTROOPONTOILET__STATIC: case LIZTROOPJUSTSIT__STATIC: @@ -2666,7 +2681,7 @@ int A_Spawn(int spriteNum, int tileNum) } pSprite->pal = 0; - + fallthrough__; case ACCESSCARD__STATIC: if (pSprite->picnum == ATOMICHEALTH) @@ -2697,7 +2712,7 @@ int A_Spawn(int spriteNum, int tileNum) case WATERFOUNTAIN__STATIC: SLT(newSprite) = 1; - + fallthrough__; case TREE1__STATIC: case TREE2__STATIC: case TIRE__STATIC: @@ -2731,6 +2746,7 @@ int A_Spawn(int spriteNum, int tileNum) pSprite->xvel = -8; A_SetSprite(newSprite,CLIPMASK0); } + fallthrough__; case CEILINGSTEAM__STATIC: changespritestat(newSprite, STAT_STANDABLE); break; @@ -2760,6 +2776,7 @@ int A_Spawn(int spriteNum, int tileNum) case 46: ror_protectedsectors[pSprite->sectnum] = 1; /* XXX: fall-through intended? */ + fallthrough__; #endif case SE_49_POINT_LIGHT: case SE_50_SPOT_LIGHT: @@ -3102,6 +3119,7 @@ int A_Spawn(int spriteNum, int tileNum) if (sector[sectNum].lotag && labs(sector[sectNum].ceilingz-pSprite->z) > 1024) sector[sectNum].lotag |= 32768; //If its open + fallthrough__; case SE_8_UP_OPEN_DOOR_LIGHTS: //First, get the ceiling-floor shade { @@ -3279,9 +3297,11 @@ int A_Spawn(int spriteNum, int tileNum) if (spriteNum == -1) spriteNum = SUBWAY; actor[newSprite].lastv.x = spriteNum; + fallthrough__; case SE_30_TWO_WAY_TRAIN: if (g_netServer || numplayers > 1) break; + fallthrough__; case SE_0_ROTATING_SECTOR: case SE_1_PIVOT: case SE_5: @@ -3356,6 +3376,7 @@ int A_Spawn(int spriteNum, int tileNum) case CANWITHSOMETHING4__STATIC: case RUBBERCAN__STATIC: pSprite->extra = 0; + fallthrough__; case EXPLODINGBARREL__STATIC: case HORSEONSIDE__STATIC: case FIREBARREL__STATIC: @@ -3371,6 +3392,7 @@ int A_Spawn(int spriteNum, int tileNum) if (spriteNum >= 0) pSprite->owner = spriteNum; else pSprite->owner = newSprite; + fallthrough__; case EGG__STATIC: if (ud.monsters_off == 1 && pSprite->picnum == EGG) { @@ -3613,6 +3635,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo t->shade = -127; continue; } + fallthrough__; case BULLETHOLE__STATIC: case CRACK1__STATIC: case CRACK2__STATIC: @@ -3731,6 +3754,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo case FOOTPRINTS4__STATIC: if (t->pal == 6) t->shade = -127; + fallthrough__; case PUKE__STATIC: case MONEY__STATIC: //case MONEY+1__STATIC: @@ -4047,7 +4071,7 @@ PALONLY: } if (t->pal == 6) t->shade = -120; - /* fall-through */ + fallthrough__; case SCRAP1__STATIC: case SCRAP2__STATIC: case SCRAP3__STATIC: @@ -4067,6 +4091,7 @@ PALONLY: t->pal = 7; break; } + fallthrough__; default: G_MaybeTakeOnFloorPal(t, sect); break; @@ -4246,6 +4271,7 @@ skip: t->z = sprite[pSprite->owner].z-(3<<8); if (g_tripbombLaserMode == 2 && g_player[screenpeek].ps->heat_on == 0) t->yrepeat = 0; + fallthrough__; case EXPLOSION2__STATIC: case EXPLOSION2BOT__STATIC: case FREEZEBLAST__STATIC: @@ -4268,11 +4294,13 @@ skip: case FIRE__STATIC: case FIRE2__STATIC: t->cstat |= 128; + fallthrough__; case BURNING__STATIC: case BURNING2__STATIC: if (sprite[pSprite->owner].picnum != TREE1 && sprite[pSprite->owner].picnum != TREE2) t->z = actor[t->owner].floorz; t->shade = -127; + fallthrough__; case SMALLSMOKE__STATIC: t->cstat |= 8192+1024; break; @@ -4303,6 +4331,7 @@ skip: break; case SHELL__STATIC: t->picnum = pSprite->picnum+(T1(i)&1); + fallthrough__; case SHOTGUNSHELL__STATIC: t->cstat |= 12; if (T1(i) > 2) t->cstat &= ~16; @@ -4310,6 +4339,7 @@ skip: break; case FRAMEEFFECT1_13__STATIC: if (PLUTOPAK) break; + fallthrough__; case FRAMEEFFECT1__STATIC: if (pSprite->owner >= 0 && sprite[pSprite->owner].statnum < MAXSTATUS) { diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 3f404c4aa..7b3e8ddd0 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -1435,6 +1435,7 @@ static int32_t C_SkipComments(void) { case '\n': g_lineNumber++; + fallthrough__; case ' ': case '\t': case '\r': @@ -1491,6 +1492,7 @@ static int32_t C_SkipComments(void) textptr++; continue; } + fallthrough__; case 0: // EOF return ((g_scriptPtr-apScript) > (g_scriptSize-32)) ? C_SetScriptSize(g_scriptSize<<1) : 0; } @@ -3654,6 +3656,7 @@ DO_DEFSTATE: C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE); + fallthrough__; case CON_ADDAMMO: case CON_ADDWEAPON: case CON_SIZETO: @@ -3662,6 +3665,7 @@ DO_DEFSTATE: case CON_ADDINVENTORY: case CON_GUTS: C_GetNextValue(LABEL_DEFINE); + fallthrough__; case CON_ESPAWN: case CON_ESHOOT: case CON_QSPAWN: @@ -4059,6 +4063,7 @@ DO_DEFSTATE: case CON_NEXTSPRITESECT: case CON_SECTOROFWALL: C_GetNextVarType(GAMEVAR_READONLY); + fallthrough__; case CON_ADDLOGVAR: case CON_ESHOOTVAR: case CON_ESPAWNVAR: @@ -4103,6 +4108,7 @@ DO_DEFSTATE: case CON_SQRT: C_GetNextVar(); + fallthrough__; case CON_FINDPLAYER: case CON_FINDOTHERPLAYER: case CON_DISPLAYRAND: @@ -4284,6 +4290,7 @@ DO_DEFSTATE: return 1; } textptr++; + fallthrough__; case CON_SETARRAY: C_GetNextLabelName(); i=GetADefID(label+(g_labelCnt<<6)); @@ -4793,12 +4800,15 @@ DO_DEFSTATE: { case CON_SCREENTEXT: C_GetManyVars(8); + fallthrough__; case CON_GAMETEXTZ: case CON_DIGITALNUMBERZ: C_GetManyVars(1); + fallthrough__; case CON_GAMETEXT: case CON_DIGITALNUMBER: C_GetManyVars(6); + fallthrough__; default: C_GetManyVars(5); break; @@ -6282,7 +6292,7 @@ static void C_AddDefaultDefinitions(void) { "GAMEARRAY_BOOLEAN", GAMEARRAY_BITMAP }, }; - for (int i = 0; i < ARRAY_SIZE(predefined); i++) + for (unsigned i = 0; i < ARRAY_SIZE(predefined); i++) C_AddDefinition(predefined[i].token, predefined[i].val, LABEL_DEFINE); C_AddDefinition("NO", 0, LABEL_DEFINE | LABEL_ACTION | LABEL_AI | LABEL_MOVE); diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index f7e589f4c..99ff26ee5 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -2662,6 +2662,7 @@ nullquote: case CON_EQSPAWNVAR: if (spriteNum != -1) A_AddToDeleteQueue(spriteNum); + fallthrough__; case CON_ESPAWNVAR: aGameVars[g_returnVarID].global = spriteNum; break; @@ -2693,6 +2694,7 @@ nullquote: case CON_EQSPAWN: if (spriteNum != -1) A_AddToDeleteQueue(spriteNum); + fallthrough__; case CON_ESPAWN: aGameVars[g_returnVarID].global = spriteNum; break; @@ -3851,6 +3853,7 @@ nullquote: break; } inputPos++; + fallthrough__; case 'd': { if (argIdx >= numArgs) diff --git a/source/duke3d/src/m32def.cpp b/source/duke3d/src/m32def.cpp index 7dcd278b8..486d8f4ea 100644 --- a/source/duke3d/src/m32def.cpp +++ b/source/duke3d/src/m32def.cpp @@ -3030,6 +3030,7 @@ repeatcase: C_ReportError(WARNING_OUTSIDEDRAWSPRITE); g_numCompilerWarnings++; } + fallthrough__; case CON_RESETKEY: case CON_SETKEY: case CON_INSERTSPRITE: @@ -3180,6 +3181,7 @@ repeatcase: C_CUSTOMERROR("Can define quotes only at top level."); return 1; } + fallthrough__; case CON_REDEFINEQUOTE: if (tw == CON_DEFINEQUOTE) g_scriptPtr--; @@ -3935,6 +3937,7 @@ void C_ReportError(int32_t iError) case WARNING_NAMEMATCHESVAR: initprintf("%s:%d: warning: symbol `%s' already used for game variable.\n", g_szScriptFileName, g_lineNumber, tlabel); + break; case WARNING_OUTSIDEDRAWSPRITE: initprintf("%s:%d: warning: found `%s' outside of EVENT_ANALYZESPRITES\n", g_szScriptFileName,g_lineNumber,tempbuf); diff --git a/source/duke3d/src/m32exec.cpp b/source/duke3d/src/m32exec.cpp index 8982a20dd..61d40ebf4 100644 --- a/source/duke3d/src/m32exec.cpp +++ b/source/duke3d/src/m32exec.cpp @@ -369,6 +369,7 @@ skip_check: case CON_BREAK: vm.flags |= VMFLAG_BREAK; // XXX: may not be cleared subsequently? + fallthrough__; case CON_ENDS: return 1; @@ -379,6 +380,7 @@ skip_check: case CON_ENDSWITCH: vm.flags &= ~VMFLAG_BREAK; + fallthrough__; case CON_ENDEVENT: insptr++; return 1; @@ -2644,6 +2646,7 @@ badindex: break; } k++; + fallthrough__; case 'd': { char buf[16]; diff --git a/source/duke3d/src/m32vars.cpp b/source/duke3d/src/m32vars.cpp index e895c50b8..e9e65f1d4 100644 --- a/source/duke3d/src/m32vars.cpp +++ b/source/duke3d/src/m32vars.cpp @@ -109,7 +109,7 @@ void Gv_NewArray(const char *pszLabel, void *arrayptr, intptr_t asize, uint32_t { // the dummy array with index 0 sets the size to 0 so that accidental accesses as array // will complain. - C_CUSTOMERROR("invalid array size %d. Must be between 1 and 65536", asize); + C_CUSTOMERROR("invalid array size %d. Must be between 1 and 65536", (int)asize); return; } @@ -335,6 +335,9 @@ int32_t __fastcall Gv_GetVarX(int32_t id) return (VM_AccessWall(0, index, memberid, 0) ^ -negateResult) + negateResult; case M32_TSPRITE_VAR_ID: return (VM_AccessTsprite(0, index, memberid, 0) ^ -negateResult) + negateResult; + default: + M32_ERROR("Gv_GetVarX(): WTF??"); + return -1; } } case M32_FLAG_VAR: @@ -445,6 +448,9 @@ void __fastcall Gv_SetVarX(int32_t id, int32_t lValue) case M32_TSPRITE_VAR_ID: VM_AccessTsprite(1, index, memberid, lValue); return; + default: + M32_ERROR("Gv_SetVarX(): WTF??"); + return; } } case M32_FLAG_VAR: @@ -469,6 +475,7 @@ void __fastcall Gv_SetVarX(int32_t id, int32_t lValue) return; } } + fallthrough__; case GAMEVAR_INTPTR: *((int32_t *)aGameVars[id].val.lValue)=(int32_t)lValue; return; diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index f01d4664a..ba1a81bb9 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -1723,6 +1723,7 @@ static void Menu_Pre(MenuID_t cm) case MENU_MAIN_INGAME: MenuEntry_DisableOnCondition(&ME_MAIN_SAVEGAME, ud.recstat == 2); MenuEntry_DisableOnCondition(&ME_MAIN_QUITTOTITLE, g_netServer || numplayers > 1); + fallthrough__; case MENU_MAIN: if ((g_netServer || ud.multimode > 1) && ud.recstat != 2) { @@ -1945,6 +1946,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin) { case MENU_MAIN_INGAME: l += 4; + fallthrough__; case MENU_MAIN: rotatesprite_fs(origin.x + (MENU_MARGIN_CENTER<<16), origin.y + ((28+l)<<16), 65536L,0,INGAMEDUKETHREEDEE,0,0,10); if (PLUTOPAK) // JBF 20030804 @@ -2823,6 +2825,7 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption) { case 2: ud.weaponswitch |= 4; + fallthrough__; case 1: ud.weaponswitch |= 1; break; @@ -3405,6 +3408,7 @@ static void Menu_FileSelect(int32_t input) case MENU_NETUSERMAP: if ((g_netServer || ud.multimode > 1)) Net_SendUserMapName(); + fallthrough__; case MENU_USERMAP: if (input) { @@ -5165,6 +5169,7 @@ static MenuEntry_t *Menu_RunInput_Menu_Movement(MenuMenu_t *menu, MenuMovement_t { case MM_End: menu->currentEntry = menu->numEntries; + fallthrough__; case MM_Up: do { @@ -5177,6 +5182,7 @@ static MenuEntry_t *Menu_RunInput_Menu_Movement(MenuMenu_t *menu, MenuMovement_t case MM_Home: menu->currentEntry = -1; + fallthrough__; case MM_Down: do { @@ -5229,6 +5235,7 @@ static void Menu_RunInput_EntryOptionList_Movement(MenuOption_t *object, MenuMov --object->options->currentEntry; if (object->options->currentEntry >= 0) break; + fallthrough__; case MM_End: object->options->currentEntry = object->options->numOptions-1; break; @@ -5237,6 +5244,7 @@ static void Menu_RunInput_EntryOptionList_Movement(MenuOption_t *object, MenuMov ++object->options->currentEntry; if (object->options->currentEntry < object->options->numOptions) break; + fallthrough__; case MM_Home: object->options->currentEntry = 0; break; @@ -5276,6 +5284,7 @@ static int32_t Menu_RunInput_EntryOption_Movement(MenuEntry_t *entry, MenuOption --newValueIndex; if (newValueIndex >= 0) break; + fallthrough__; case MM_AllTheWayRight: newValueIndex = object->options->numOptions-1; break; @@ -5284,6 +5293,7 @@ static int32_t Menu_RunInput_EntryOption_Movement(MenuEntry_t *entry, MenuOption ++newValueIndex; if (newValueIndex < object->options->numOptions) break; + fallthrough__; case MM_AllTheWayLeft: newValueIndex = 0; break; @@ -5362,6 +5372,7 @@ static void Menu_RunInput_EntryRangeInt32_Movement(MenuEntry_t *entry, MenuRange --newValueIndex; if (newValueIndex >= 0) break; + fallthrough__; case MM_AllTheWayLeft: newValueIndex = 0; break; @@ -5371,6 +5382,7 @@ static void Menu_RunInput_EntryRangeInt32_Movement(MenuEntry_t *entry, MenuRange ++newValueIndex; if (newValueIndex < object->steps) break; + fallthrough__; case MM_AllTheWayRight: newValueIndex = object->steps-1; break; @@ -5418,6 +5430,7 @@ static void Menu_RunInput_EntryRangeFloat_Movement(MenuEntry_t *entry, MenuRange --newValueIndex; if (newValueIndex >= 0) break; + fallthrough__; case MM_AllTheWayLeft: newValueIndex = 0; break; @@ -5427,6 +5440,7 @@ static void Menu_RunInput_EntryRangeFloat_Movement(MenuEntry_t *entry, MenuRange ++newValueIndex; if (newValueIndex < object->steps) break; + fallthrough__; case MM_AllTheWayRight: newValueIndex = object->steps-1; break; @@ -5471,6 +5485,7 @@ static void Menu_RunInput_EntryRangeDouble_Movement(/*MenuEntry_t *entry, */Menu --newValueIndex; if (newValueIndex >= 0) break; + fallthrough__; case MM_AllTheWayLeft: newValueIndex = 0; break; @@ -5480,6 +5495,7 @@ static void Menu_RunInput_EntryRangeDouble_Movement(/*MenuEntry_t *entry, */Menu ++newValueIndex; if (newValueIndex < object->steps) break; + fallthrough__; case MM_AllTheWayRight: newValueIndex = object->steps-1; break; @@ -5548,6 +5564,7 @@ static void Menu_RunInput_FileSelect_Movement(MenuFileSelect_t *object, MenuMove object->findhigh[object->currentList] = object->findhigh[object->currentList]->prev; break; } + fallthrough__; case MM_End: object->findhigh[object->currentList] = object->findhigh[object->currentList]->userb; break; @@ -5560,6 +5577,7 @@ static void Menu_RunInput_FileSelect_Movement(MenuFileSelect_t *object, MenuMove object->findhigh[object->currentList] = object->findhigh[object->currentList]->next; break; } + fallthrough__; case MM_Home: object->findhigh[object->currentList] = object->findhigh[object->currentList]->usera; break; diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index 3d8bcb808..d23cab55d 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -513,15 +513,19 @@ static int32_t osdcmd_spawn(osdfuncparm_t const * const parm) vect.y = Batol(parm->parms[5]); vect.z = Batol(parm->parms[6]); set |= 8; + fallthrough__; case 4: // ang ang = Batol(parm->parms[3]) & 2047; set |= 4; + fallthrough__; case 3: // cstat cstat = (uint16_t)Batol(parm->parms[2]); set |= 2; + fallthrough__; case 2: // pal pal = (uint8_t)Batol(parm->parms[1]); set |= 1; + fallthrough__; case 1: // tile number if (isdigit(parm->parms[0][0])) { diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 953f39229..f348b7b62 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -1287,7 +1287,9 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec return returnSprite; } - case FREEZEBLAST__STATIC: startPos.z += (3 << 8); + case FREEZEBLAST__STATIC: + startPos.z += (3 << 8); + fallthrough__; case RPG__STATIC: { // XXX: "CODEDUP" @@ -2282,6 +2284,7 @@ void P_DisplayWeapon(void) case 2: G_DrawWeaponTileWithID(currentWeapon << 1, weaponX + 168 - halfLookAng, weaponY + 201 - weaponYOffset, SHOTGUN + 2, -128, weaponBits, weaponPal, 0); + fallthrough__; case 0: case 6: case 7: @@ -2297,6 +2300,7 @@ void P_DisplayWeapon(void) G_DrawWeaponTileWithID(currentWeapon << 1, weaponX + 178 - halfLookAng, weaponY + 194 - weaponYOffset, SHOTGUN + 1 + ((*(weaponFrame)-1) >> 1), -128, weaponBits, weaponPal, 0); + fallthrough__; case 5: case 9: case 10: diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index 8808ce772..968794c36 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -1246,7 +1246,7 @@ static void prelevel(char g) if (pWall->lotag && pWall->nextwall >= 0) wall[pWall->nextwall].lotag = pWall->lotag; - + fallthrough__; case BIGFORCE__STATIC: animwall[g_animWallCnt].wallnum = i; g_animWallCnt++; diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index b27c2ecf5..d02bff632 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -2262,6 +2262,7 @@ void G_BonusScreen(int32_t bonusonly) break; } } + fallthrough__; case 1: case 4: case 5: diff --git a/source/duke3d/src/screentext.cpp b/source/duke3d/src/screentext.cpp index 39a0c7563..80902c21c 100644 --- a/source/duke3d/src/screentext.cpp +++ b/source/duke3d/src/screentext.cpp @@ -127,6 +127,7 @@ int32_t G_GetStringTile(int32_t font, char *t, int32_t f) break; default: // unknown character *t = ' '; // whitespace-ize + fallthrough__; case '\n': return font; break; diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 080827f7b..9c6046863 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -1255,7 +1255,7 @@ int P_ActivateSwitch(int playerNum, int wallOrSprite, int switchType) return 0; } - /* fall-through (XXX: intended?) */ + fallthrough__; case MULTISWITCH__STATIC: case REST_SWITCH_CASES: if (G_CheckActivatorMotion(lotag)) @@ -2614,6 +2614,7 @@ CHECKINV1: case HANDREMOTE_WEAPON: i = currentWeapon = HANDBOMB_WEAPON; + fallthrough__; default: currentWeapon += weaponNum; break; @@ -2703,6 +2704,7 @@ CHECKINV1: pPlayer->last_full_weapon = pPlayer->curr_weapon; pPlayer->show_empty_weapon = 32; } + fallthrough__; case KNEE_WEAPON: case HANDREMOTE_WEAPON: P_AddWeapon(pPlayer, weaponNum, 1); diff --git a/source/mact/src/scriplib.cpp b/source/mact/src/scriplib.cpp index efaf8ad04..25ef295bf 100644 --- a/source/mact/src/scriplib.cpp +++ b/source/mact/src/scriplib.cpp @@ -326,6 +326,7 @@ int32_t SCRIPT_ParseBuffer(int32_t scripthandle, char *data, int32_t length) case ParsingSectionBegin: currentsection = dp = sp; state = ParsingSectionName; + fallthrough__; case ParsingSectionName: LETTER(); switch (ch) @@ -360,6 +361,7 @@ int32_t SCRIPT_ParseBuffer(int32_t scripthandle, char *data, int32_t length) EATLINE(sp); printf("Unexpected comment on line %d.\n", linenum); SETRV(-1); + fallthrough__; case '\n': case '\r': // Unexpected newline @@ -385,6 +387,7 @@ int32_t SCRIPT_ParseBuffer(int32_t scripthandle, char *data, int32_t length) case ParsingValueBegin: currentvalue = dp = sp; state = ParsingValue; + fallthrough__; case ParsingValue: LETTER(); switch (ch)