From bb689ba3c990d32a4a171520abc91b3498462e3b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 25 Jun 2008 22:16:04 +0000 Subject: [PATCH] - Fixed all the new warnings tossed out by GCC 4.3. SVN r1047 (trunk) --- docs/rh-log.txt | 3 +++ snes_spc/Makefile | 5 ++++- src/farchive.cpp | 2 +- src/g_heretic/a_chicken.cpp | 2 +- src/info.h | 4 ++-- src/nodebuild.cpp | 4 ++-- src/p_acs.cpp | 2 +- src/p_conversation.cpp | 8 ++++---- src/p_map.cpp | 2 +- src/p_mobj.cpp | 4 ++-- src/p_sight.cpp | 6 +++--- src/r_plane.cpp | 2 +- src/r_polymost.cpp | 2 +- src/sound/music_cd.cpp | 2 +- src/thingdef/thingdef_codeptr.cpp | 8 ++++---- src/w_wad.cpp | 16 +++++++++++----- 16 files changed, 42 insertions(+), 30 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index d6be2494b..97d8208eb 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,6 @@ +June 25, 2008 +- Fixed all the new warnings tossed out by GCC 4.3. + June 23, 2008 - Fixed: PickNext/PrevWeapon() did not check for NULL player actors. - Fixed compilation issues with GCC. diff --git a/snes_spc/Makefile b/snes_spc/Makefile index f5c202d01..049e1332a 100644 --- a/snes_spc/Makefile +++ b/snes_spc/Makefile @@ -13,7 +13,10 @@ STATICLIB = libsnes_spc.a CCDV = @../ccdv CC = gcc -CFLAGS = $(LOC) -O3 -Wall -fomit-frame-pointer + +# SNES_SPC::cpu_write_high() contains an intentional write outside +# the RAM array, so don't warn about it. +CFLAGS = $(LOC) -O3 -Wall -Wno-array-bounds -fomit-frame-pointer LD = $(CC) LDFLAGS = $(LOC) -s diff --git a/src/farchive.cpp b/src/farchive.cpp index cbf2cd358..c7310169c 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -98,7 +98,7 @@ static inline void SWAP_DOUBLE(double &dst, double &src) } #else static inline WORD SWAP_WORD(WORD x) { return (((x)<<8) | ((x)>>8)); } -static inline DWORD SWAP_DWORD(DWORD x) { return x = (((x)>>24) | (((x)>>8)&0xff00) | ((x)<<8)&0xff0000 | ((x)<<24)); } +static inline DWORD SWAP_DWORD(DWORD x) { return x = (((x)>>24) | (((x)>>8)&0xff00) | (((x)<<8)&0xff0000) | ((x)<<24)); } static inline QWORD SWAP_QWORD(QWORD x) { union { QWORD q; DWORD d[2]; } t, u; diff --git a/src/g_heretic/a_chicken.cpp b/src/g_heretic/a_chicken.cpp index 475b19e98..db2fe529f 100644 --- a/src/g_heretic/a_chicken.cpp +++ b/src/g_heretic/a_chicken.cpp @@ -343,7 +343,7 @@ void A_Feathers (AActor *actor) mo->momx = pr_feathers.Random2() << 8; mo->momy = pr_feathers.Random2() << 8; mo->momz = FRACUNIT + (pr_feathers() << 9); - mo->SetState (&AFeather::States[S_FEATHER+pr_feathers()&7]); + mo->SetState (&AFeather::States[S_FEATHER+(pr_feathers()&7)]); } } diff --git a/src/info.h b/src/info.h index e938d9d0e..48cfc4605 100644 --- a/src/info.h +++ b/src/info.h @@ -181,13 +181,13 @@ FArchive &operator<< (FArchive &arc, FState *&state); #endif #define _S__FR_TIC_(spr,frm,tic,m1,m2,cmd,next) \ - _S__SPRITE_(spr), (tic+1)&255, m1|((tic+1)>>8), m2, (tic>254)?SF_BIGTIC|(frm):(frm), cmd, next } + _S__SPRITE_(spr), (tic+1)&255, (m1)|((tic+1)>>8), m2, (tic>254)?(SF_BIGTIC|(frm)):(frm), cmd, next } #define S_NORMAL2(spr,frm,tic,cmd,next,m1,m2) \ _S__FR_TIC_(spr, (frm) - 'A', tic, m1, m2, cmd, next) #define S_BRIGHT2(spr,frm,tic,cmd,next,m1,m2) \ - _S__FR_TIC_(spr, (frm) - 'A' | SF_FULLBRIGHT, tic, m1, m2, cmd, next) + _S__FR_TIC_(spr, ((frm) - 'A') | SF_FULLBRIGHT, tic, m1, m2, cmd, next) /* #defines its own, completely unrelated S_NORMAL. * Since winbase.h will only be included in Win32-specific files that diff --git a/src/nodebuild.cpp b/src/nodebuild.cpp index 37b45981d..303c28c02 100644 --- a/src/nodebuild.cpp +++ b/src/nodebuild.cpp @@ -106,8 +106,8 @@ int FNodeBuilder::CreateNode (DWORD set, fixed_t bbox[4]) if ((selstat = SelectSplitter (set, node, splitseg, skip, true)) > 0 || (skip > 0 && (selstat = SelectSplitter (set, node, splitseg, 1, true)) > 0) || - (selstat < 0 && (SelectSplitter (set, node, splitseg, skip, false) > 0) || - (skip > 0 && SelectSplitter (set, node, splitseg, 1, false))) || + (selstat < 0 && (SelectSplitter (set, node, splitseg, skip, false) > 0 || + (skip > 0 && SelectSplitter (set, node, splitseg, 1, false)))) || CheckSubsector (set, node, splitseg, count)) { // Create a normal node diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 96e4bbb9f..fde8cd859 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3754,7 +3754,7 @@ int DLevelScript::RunScript () case PCD_CASEGOTOSORTED: // The count and jump table are 4-byte aligned - pc = (int *)((BYTE *)pc + (4 - (((size_t)pc & 3)) & 3)); + pc = (int *)(((size_t)pc + 3) & ~3); { int numcases = NEXTWORD; int min = 0, max = numcases-1; diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index f41aa9679..e1b6d6c9b 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -323,16 +323,16 @@ static FStrifeDialogueNode *ReadRetailNode (FileReader *lump, DWORD &prevSpeaker node->Dialogue = ncopystring (speech.Dialogue); // The speaker's portrait, if any. - speech.Backdrop[8] = 0; + speech.Dialogue[0] = 0; //speech.Backdrop[8] = 0; node->Backdrop = TexMan.CheckForTexture (speech.Backdrop, FTexture::TEX_MiscPatch); // The speaker's voice for this node, if any. - speech.Sound[8] = 0; + speech.Backdrop[0] = 0; //speech.Sound[8] = 0; sprintf (fullsound, "svox/%s", speech.Sound); node->SpeakerVoice = fullsound; // The speaker's name, if any. - speech.Name[16] = 0; + speech.Sound[0] = 0; //speech.Name[16] = 0; node->SpeakerName = ncopystring (speech.Name); // The item the speaker should drop when killed. @@ -406,7 +406,7 @@ static FStrifeDialogueNode *ReadTeaserNode (FileReader *lump, DWORD &prevSpeaker } // The speaker's name, if any. - speech.Name[16] = 0; + speech.Dialogue[0] = 0; //speech.Name[16] = 0; node->SpeakerName = ncopystring (speech.Name); // The item the speaker should drop when killed. diff --git a/src/p_map.cpp b/src/p_map.cpp index b4421f604..43a219dc8 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -394,7 +394,7 @@ int P_GetFriction (const AActor *mo, int *frictionfactor) { friction = FRICTION_FLY; } - else if (!(mo->flags & MF_NOGRAVITY) && mo->waterlevel > 1 || + else if ((!(mo->flags & MF_NOGRAVITY) && mo->waterlevel > 1) || (mo->waterlevel == 1 && mo->z > mo->floorz + 6*FRACUNIT)) { friction = secfriction (mo->Sector); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index d44c6a97f..a1a4a62ee 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1353,7 +1353,7 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) // that large thrusts can't propel an actor through a wall, because wall // running depends on the player's original movement continuing even after // it gets blocked. - if (mo->player != NULL && (i_compatflags & COMPATF_WALLRUN) || (mo->waterlevel >= 1) || + if ((mo->player != NULL && (i_compatflags & COMPATF_WALLRUN)) || (mo->waterlevel >= 1) || (mo->player != NULL && mo->player->crouchfactor < FRACUNIT*3/4)) { // preserve the direction instead of clamping x and y independently. @@ -2650,7 +2650,7 @@ void AActor::Tick () } if (bglobal.botnum && consoleplayer == Net_Arbitrator && !demoplayback && - (flags & (MF_SPECIAL|MF_MISSILE)) || (flags3 & MF3_ISMONSTER)) + ((flags & (MF_SPECIAL|MF_MISSILE)) || (flags3 & MF3_ISMONSTER))) { clock (BotSupportCycles); bglobal.m_Thinking = true; diff --git a/src/p_sight.cpp b/src/p_sight.cpp index 1403754f1..27a867780 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -134,9 +134,9 @@ static bool P_SightCheckLine (line_t *ld) return false; } if (SeePastShootableLines && - !(ld->activation & SPAC_Impact) || - (ld->special != ACS_Execute && ld->special != ACS_ExecuteAlways) || - (ld->args[1] != 0 && ld->args[1] != level.levelnum)) + (!(ld->activation & SPAC_Impact) || + (ld->special != ACS_Execute && ld->special != ACS_ExecuteAlways) || + (ld->args[1] != 0 && ld->args[1] != level.levelnum))) { // Pretend the other side is invisible if this is not an impact line // or it does not run a script on the current map. Used to prevent diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 169b37cf0..eebfaa01e 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -996,7 +996,7 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool masked) basecolormap = pl->colormap; planeshade = LIGHT2SHADE(pl->lightlevel); - if (r_drawflat || (pl->height.a == 0 && pl->height.b == 0) && !tilt) + if (r_drawflat || ((pl->height.a == 0 && pl->height.b == 0) && !tilt)) { R_DrawNormalPlane (pl, alpha, masked); } diff --git a/src/r_polymost.cpp b/src/r_polymost.cpp index 012883f5e..c2a344bad 100644 --- a/src/r_polymost.cpp +++ b/src/r_polymost.cpp @@ -831,7 +831,7 @@ void Polymost_Responder (event_t *ev) } else if (ev->type == EV_KeyUp && ev->data1 == KEY_MOUSE1) { - if (pt == 1) if (px0 != px1) pt++; else pt--; + if (pt == 1) { if (px0 != px1) pt++; else pt--; } if (pt == 2) { numpoly = polypt = 0; diff --git a/src/sound/music_cd.cpp b/src/sound/music_cd.cpp index 342e236d3..c6d6401c8 100644 --- a/src/sound/music_cd.cpp +++ b/src/sound/music_cd.cpp @@ -59,7 +59,7 @@ CDSong::CDSong (int track, int id) success = CD_Init (); } - if (success && track == 0 || CD_CheckTrack (track)) + if (success && (track == 0 || CD_CheckTrack (track))) { m_Inited = true; m_Track = track; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d156abbb9..8bbb6d14d 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -529,7 +529,7 @@ void A_JumpIfHealthLower(AActor * self) //========================================================================== void A_JumpIfCloser(AActor * self) { - FState * CallingState; + FState * CallingState = NULL; int index = CheckIndex(2, &CallingState); AActor * target; @@ -967,7 +967,7 @@ void A_CustomComboAttack (AActor *self) //========================================================================== void A_JumpIfNoAmmo(AActor * self) { - FState * CallingState; + FState * CallingState = NULL; int index=CheckIndex(1, &CallingState); if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains! @@ -2015,7 +2015,7 @@ void A_Burst (AActor *actor) //=========================================================================== void A_CheckFloor (AActor *self) { - FState *CallingState; + FState *CallingState = NULL; int index = CheckIndex (1, &CallingState); if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains! @@ -2144,7 +2144,7 @@ void A_ClearTarget(AActor * self) void A_JumpIfTargetInLOS(AActor * self) { - FState * CallingState; + FState * CallingState = NULL; int index = CheckIndex(3, &CallingState); angle_t an; angle_t fov = angle_t(EvalExpressionF (StateParameters[index+1], self) * ANGLE_1); diff --git a/src/w_wad.cpp b/src/w_wad.cpp index d5a6e1a9a..f2bd9543d 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -54,8 +54,7 @@ struct rfflump_t BYTE IStillDontKnow[8]; BYTE Flags; char Extension[3]; - char Name[8]; - BYTE WhatIsThis[4]; + char Name[8+4]; // 4 bytes that I don't know what they are for }; struct grpinfo_t @@ -66,8 +65,15 @@ struct grpinfo_t struct grplump_t { - char Name[12]; - DWORD Size; + union + { + struct + { + char Name[12]; + DWORD Size; + }; + char NameWithZero[13]; + }; }; union MergedHeader @@ -491,7 +497,7 @@ void FWadCollection::AddFile (const char *filename, const char * data, int lengt lump_p->position = pos; lump_p->size = LittleLong(grp_p->Size); pos += lump_p->size; - grp_p->Name[12] = '\0'; // Be sure filename is null-terminated + grp_p->NameWithZero[12] = '\0'; // Be sure filename is null-terminated lump_p->fullname = copystring(grp_p->Name); uppercopy (lump_p->name, grp_p->Name); lump_p->name[8] = 0;