- Fixed all the new warnings tossed out by GCC 4.3.

SVN r1047 (trunk)
This commit is contained in:
Randy Heit 2008-06-25 22:16:04 +00:00
parent 9c6e40e192
commit bb689ba3c9
16 changed files with 42 additions and 30 deletions

View file

@ -1,3 +1,6 @@
June 25, 2008
- Fixed all the new warnings tossed out by GCC 4.3.
June 23, 2008 June 23, 2008
- Fixed: PickNext/PrevWeapon() did not check for NULL player actors. - Fixed: PickNext/PrevWeapon() did not check for NULL player actors.
- Fixed compilation issues with GCC. - Fixed compilation issues with GCC.

View file

@ -13,7 +13,10 @@ STATICLIB = libsnes_spc.a
CCDV = @../ccdv CCDV = @../ccdv
CC = gcc 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) LD = $(CC)
LDFLAGS = $(LOC) -s LDFLAGS = $(LOC) -s

View file

@ -98,7 +98,7 @@ static inline void SWAP_DOUBLE(double &dst, double &src)
} }
#else #else
static inline WORD SWAP_WORD(WORD x) { return (((x)<<8) | ((x)>>8)); } 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) static inline QWORD SWAP_QWORD(QWORD x)
{ {
union { QWORD q; DWORD d[2]; } t, u; union { QWORD q; DWORD d[2]; } t, u;

View file

@ -343,7 +343,7 @@ void A_Feathers (AActor *actor)
mo->momx = pr_feathers.Random2() << 8; mo->momx = pr_feathers.Random2() << 8;
mo->momy = pr_feathers.Random2() << 8; mo->momy = pr_feathers.Random2() << 8;
mo->momz = FRACUNIT + (pr_feathers() << 9); mo->momz = FRACUNIT + (pr_feathers() << 9);
mo->SetState (&AFeather::States[S_FEATHER+pr_feathers()&7]); mo->SetState (&AFeather::States[S_FEATHER+(pr_feathers()&7)]);
} }
} }

View file

@ -181,13 +181,13 @@ FArchive &operator<< (FArchive &arc, FState *&state);
#endif #endif
#define _S__FR_TIC_(spr,frm,tic,m1,m2,cmd,next) \ #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) \ #define S_NORMAL2(spr,frm,tic,cmd,next,m1,m2) \
_S__FR_TIC_(spr, (frm) - 'A', tic, m1, m2, cmd, next) _S__FR_TIC_(spr, (frm) - 'A', tic, m1, m2, cmd, next)
#define S_BRIGHT2(spr,frm,tic,cmd,next,m1,m2) \ #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)
/* <winbase.h> #defines its own, completely unrelated S_NORMAL. /* <winbase.h> #defines its own, completely unrelated S_NORMAL.
* Since winbase.h will only be included in Win32-specific files that * Since winbase.h will only be included in Win32-specific files that

View file

@ -106,8 +106,8 @@ int FNodeBuilder::CreateNode (DWORD set, fixed_t bbox[4])
if ((selstat = SelectSplitter (set, node, splitseg, skip, true)) > 0 || if ((selstat = SelectSplitter (set, node, splitseg, skip, true)) > 0 ||
(skip > 0 && (selstat = SelectSplitter (set, node, splitseg, 1, true)) > 0) || (skip > 0 && (selstat = SelectSplitter (set, node, splitseg, 1, true)) > 0) ||
(selstat < 0 && (SelectSplitter (set, node, splitseg, skip, false) > 0) || (selstat < 0 && (SelectSplitter (set, node, splitseg, skip, false) > 0 ||
(skip > 0 && SelectSplitter (set, node, splitseg, 1, false))) || (skip > 0 && SelectSplitter (set, node, splitseg, 1, false)))) ||
CheckSubsector (set, node, splitseg, count)) CheckSubsector (set, node, splitseg, count))
{ {
// Create a normal node // Create a normal node

View file

@ -3754,7 +3754,7 @@ int DLevelScript::RunScript ()
case PCD_CASEGOTOSORTED: case PCD_CASEGOTOSORTED:
// The count and jump table are 4-byte aligned // 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 numcases = NEXTWORD;
int min = 0, max = numcases-1; int min = 0, max = numcases-1;

View file

@ -323,16 +323,16 @@ static FStrifeDialogueNode *ReadRetailNode (FileReader *lump, DWORD &prevSpeaker
node->Dialogue = ncopystring (speech.Dialogue); node->Dialogue = ncopystring (speech.Dialogue);
// The speaker's portrait, if any. // 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); node->Backdrop = TexMan.CheckForTexture (speech.Backdrop, FTexture::TEX_MiscPatch);
// The speaker's voice for this node, if any. // 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); sprintf (fullsound, "svox/%s", speech.Sound);
node->SpeakerVoice = fullsound; node->SpeakerVoice = fullsound;
// The speaker's name, if any. // The speaker's name, if any.
speech.Name[16] = 0; speech.Sound[0] = 0; //speech.Name[16] = 0;
node->SpeakerName = ncopystring (speech.Name); node->SpeakerName = ncopystring (speech.Name);
// The item the speaker should drop when killed. // 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. // The speaker's name, if any.
speech.Name[16] = 0; speech.Dialogue[0] = 0; //speech.Name[16] = 0;
node->SpeakerName = ncopystring (speech.Name); node->SpeakerName = ncopystring (speech.Name);
// The item the speaker should drop when killed. // The item the speaker should drop when killed.

View file

@ -394,7 +394,7 @@ int P_GetFriction (const AActor *mo, int *frictionfactor)
{ {
friction = FRICTION_FLY; 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)) (mo->waterlevel == 1 && mo->z > mo->floorz + 6*FRACUNIT))
{ {
friction = secfriction (mo->Sector); friction = secfriction (mo->Sector);

View file

@ -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 // that large thrusts can't propel an actor through a wall, because wall
// running depends on the player's original movement continuing even after // running depends on the player's original movement continuing even after
// it gets blocked. // 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)) (mo->player != NULL && mo->player->crouchfactor < FRACUNIT*3/4))
{ {
// preserve the direction instead of clamping x and y independently. // preserve the direction instead of clamping x and y independently.
@ -2650,7 +2650,7 @@ void AActor::Tick ()
} }
if (bglobal.botnum && consoleplayer == Net_Arbitrator && !demoplayback && 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); clock (BotSupportCycles);
bglobal.m_Thinking = true; bglobal.m_Thinking = true;

View file

@ -134,9 +134,9 @@ static bool P_SightCheckLine (line_t *ld)
return false; return false;
} }
if (SeePastShootableLines && if (SeePastShootableLines &&
!(ld->activation & SPAC_Impact) || (!(ld->activation & SPAC_Impact) ||
(ld->special != ACS_Execute && ld->special != ACS_ExecuteAlways) || (ld->special != ACS_Execute && ld->special != ACS_ExecuteAlways) ||
(ld->args[1] != 0 && ld->args[1] != level.levelnum)) (ld->args[1] != 0 && ld->args[1] != level.levelnum)))
{ {
// Pretend the other side is invisible if this is not an impact line // 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 // or it does not run a script on the current map. Used to prevent

View file

@ -996,7 +996,7 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool masked)
basecolormap = pl->colormap; basecolormap = pl->colormap;
planeshade = LIGHT2SHADE(pl->lightlevel); 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); R_DrawNormalPlane (pl, alpha, masked);
} }

View file

@ -831,7 +831,7 @@ void Polymost_Responder (event_t *ev)
} }
else if (ev->type == EV_KeyUp && ev->data1 == KEY_MOUSE1) 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) if (pt == 2)
{ {
numpoly = polypt = 0; numpoly = polypt = 0;

View file

@ -59,7 +59,7 @@ CDSong::CDSong (int track, int id)
success = CD_Init (); success = CD_Init ();
} }
if (success && track == 0 || CD_CheckTrack (track)) if (success && (track == 0 || CD_CheckTrack (track)))
{ {
m_Inited = true; m_Inited = true;
m_Track = track; m_Track = track;

View file

@ -529,7 +529,7 @@ void A_JumpIfHealthLower(AActor * self)
//========================================================================== //==========================================================================
void A_JumpIfCloser(AActor * self) void A_JumpIfCloser(AActor * self)
{ {
FState * CallingState; FState * CallingState = NULL;
int index = CheckIndex(2, &CallingState); int index = CheckIndex(2, &CallingState);
AActor * target; AActor * target;
@ -967,7 +967,7 @@ void A_CustomComboAttack (AActor *self)
//========================================================================== //==========================================================================
void A_JumpIfNoAmmo(AActor * self) void A_JumpIfNoAmmo(AActor * self)
{ {
FState * CallingState; FState * CallingState = NULL;
int index=CheckIndex(1, &CallingState); int index=CheckIndex(1, &CallingState);
if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains! 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) void A_CheckFloor (AActor *self)
{ {
FState *CallingState; FState *CallingState = NULL;
int index = CheckIndex (1, &CallingState); int index = CheckIndex (1, &CallingState);
if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains! 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) void A_JumpIfTargetInLOS(AActor * self)
{ {
FState * CallingState; FState * CallingState = NULL;
int index = CheckIndex(3, &CallingState); int index = CheckIndex(3, &CallingState);
angle_t an; angle_t an;
angle_t fov = angle_t(EvalExpressionF (StateParameters[index+1], self) * ANGLE_1); angle_t fov = angle_t(EvalExpressionF (StateParameters[index+1], self) * ANGLE_1);

View file

@ -54,8 +54,7 @@ struct rfflump_t
BYTE IStillDontKnow[8]; BYTE IStillDontKnow[8];
BYTE Flags; BYTE Flags;
char Extension[3]; char Extension[3];
char Name[8]; char Name[8+4]; // 4 bytes that I don't know what they are for
BYTE WhatIsThis[4];
}; };
struct grpinfo_t struct grpinfo_t
@ -66,8 +65,15 @@ struct grpinfo_t
struct grplump_t struct grplump_t
{ {
union
{
struct
{
char Name[12]; char Name[12];
DWORD Size; DWORD Size;
};
char NameWithZero[13];
};
}; };
union MergedHeader union MergedHeader
@ -491,7 +497,7 @@ void FWadCollection::AddFile (const char *filename, const char * data, int lengt
lump_p->position = pos; lump_p->position = pos;
lump_p->size = LittleLong(grp_p->Size); lump_p->size = LittleLong(grp_p->Size);
pos += lump_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); lump_p->fullname = copystring(grp_p->Name);
uppercopy (lump_p->name, grp_p->Name); uppercopy (lump_p->name, grp_p->Name);
lump_p->name[8] = 0; lump_p->name[8] = 0;