- fixed GCC warnings and errors

(Is there anyway to tone down GCC's warning level? It outputs too many false positives for potentially uninitialized variables in which the genuine errors get drowned.)
This commit is contained in:
Christoph Oelckers 2017-03-11 19:02:00 +01:00
parent 77a388e908
commit 921abc404d
21 changed files with 45 additions and 27 deletions

View file

@ -70,6 +70,7 @@
#include "a_keys.h"
#include "r_data/colormaps.h"
#include "g_levellocals.h"
#include "actorinlines.h"
//=============================================================================

View file

@ -21,6 +21,7 @@
#include "d_player.h"
#include "p_spec.h"
#include "p_checkposition.h"
#include "actorinlines.h"
#include "math/cmath.h"
static FRandom pr_botopendoor ("BotOpenDoor");

View file

@ -21,6 +21,7 @@
#include "d_event.h"
#include "d_player.h"
#include "vectors.h"
#include "actorinlines.h"
static FRandom pr_botmove ("BotMove");

View file

@ -183,7 +183,7 @@ void DThinker::SerializeThinkers(FSerializer &arc, bool hubLoad)
int size = arc.ArraySize();
for (int j = 0; j < size; j++)
{
DThinker *thinker;
DThinker *thinker = nullptr;
arc(nullptr, thinker);
if (thinker != nullptr)
{

View file

@ -91,6 +91,7 @@
#include "g_hub.h"
#include "g_levellocals.h"
#include "actorinlines.h"
#include <string.h>

View file

@ -41,6 +41,7 @@
#include "sbarinfo.h"
#include "templates.h"
#include "r_utility.h"
#include "actorinlines.h"
#define ST_RAMPAGEDELAY (2*TICRATE)
#define ST_MUCHPAIN 20

View file

@ -840,7 +840,7 @@ int FGLRenderer::PTM_BestColor (const uint32_t *pal_in, int r, int g, int b, int
static float trackpowtable = 0.;
double fbestdist, fdist;
int bestcolor;
int bestcolor = 0;
if (firstTime || trackpowtable != gl_paltonemap_powtable)
{

View file

@ -847,7 +847,7 @@ void GLLinePortal::PushState()
void GLLinePortal::PopState()
{
FStateVec4 &v = gl_RenderState.GetClipLine();
float e;
float e = 0;
planestack.Pop(e);
planestack.Pop(v.vec[3]);
planestack.Pop(v.vec[2]);

View file

@ -62,6 +62,7 @@
#include "menu/menu.h"
#include "g_levellocals.h"
#include "virtual.h"
#include "actorinlines.h"
// The conversations as they exist inside a SCRIPTxx lump.
struct Response

View file

@ -40,6 +40,7 @@
#include "p_blockmap.h"
#include "r_utility.h"
#include "actor.h"
#include "actorinlines.h"
// State.
#include "r_state.h"

View file

@ -143,10 +143,11 @@ DPSprite::DPSprite(player_t *owner, AActor *caller, int id)
Owner(owner),
Sprite(0),
ID(id),
processPending(true),
alpha(1),
RenderStyle(STYLE_Normal)
processPending(true)
{
alpha = 1;
RenderStyle = STYLE_Normal;
DPSprite *prev = nullptr;
DPSprite *next = Owner->psprites;
while (next != nullptr && next->ID < ID)

View file

@ -52,6 +52,7 @@
#include "math/cmath.h"
#include "actorptrselect.h"
#include "g_levellocals.h"
#include "actorinlines.h"
// Set of spawnable things for the Thing_Spawn and Thing_Projectile specials.
FClassMap SpawnableThings;

View file

@ -1813,7 +1813,7 @@ public:
vd->zCeiling = vd->zFloor = vd->flags = 0;
sc.MustGetToken('{');
double x, y;
double x = 0, y = 0;
while (!sc.CheckToken('}'))
{
FName key = ParseKey();

View file

@ -59,7 +59,7 @@ void RenderPolyWallSprite::Render(const TriMatrix &worldToClip, const Vec4f &cli
left.X = pos.X - x1 * angcos;
left.Y = pos.Y - x1 * angsin;
right.X = left.X + x2 * angcos;
right.Y = right.Y + x2 * angsin;
right.Y = left.Y + x2 * angsin;
//int scaled_to = tex->GetScaledTopOffset();
//int scaled_bo = scaled_to - tex->GetScaledHeight();

View file

@ -1064,7 +1064,7 @@ void FCanvasTextureInfo::Serialize(FSerializer &arc)
{
if (arc.BeginArray("canvastextures"))
{
AActor *viewpoint;
AActor *viewpoint = nullptr;
int fov;
FTextureID picnum;
while (arc.BeginObject(nullptr))

View file

@ -325,7 +325,7 @@ void AudioToolboxMIDIDevice::TimerCallback(CFRunLoopTimerRef timer, void* info)
#undef AT_MIDI_CHECK_ERROR
MIDIDevice *CreateAudioToolboxMIDTDevice()
MIDIDevice *CreateAudioToolboxMIDIDevice()
{
return new AudioToolboxMIDIDevice();
}

View file

@ -2057,7 +2057,7 @@ MIDIDevice* OpenALSoundRenderer::CreateMIDIDevice() const
extern unsigned mididevice;
return CreateWinMIDIDevice(mididevice);
#elif defined __APPLE__
return CreateAudioToolboxMIDIDevice;
return CreateAudioToolboxMIDIDevice();
#else
return new OPLMIDIDevice(nullptr);
#endif

View file

@ -231,7 +231,7 @@ namespace swrenderer
Thread->TranslucentPass->Render();
VisiblePlane *pl;
VisiblePlane *pl = nullptr; // quiet, GCC!
visplaneStack.Pop(pl);
if (pl->Alpha > 0 && pl->picnum != skyflatnum)
{

View file

@ -166,6 +166,10 @@ namespace swrenderer
// Get the top and bottom clipping arrays
switch (decal->RenderFlags & RF_CLIPMASK)
{
default:
// keep GCC quiet.
return;
case RF_CLIPFULL:
if (curline->backsector == NULL)
{

View file

@ -358,6 +358,11 @@ namespace swrenderer
neardepth = ds->sz2, fardepth = ds->sz1;
}
}
else
{
// GCC complained about this case, is there something missing here?
fardepth = neardepth = 0;
}
// Check if sprite is in front of draw seg:
if ((!spr->IsWallSprite() && neardepth > spr->depth) || ((spr->IsWallSprite() || fardepth > spr->depth) &&

View file

@ -50,29 +50,29 @@ namespace swrenderer
int TextureFracBits() const { return dc_wall_fracbits; }
FVector3 dc_normal;
FVector3 dc_viewpos;
FVector3 dc_viewpos_step;
FVector3 dc_normal = { 0,0,0 };
FVector3 dc_viewpos = { 0,0,0 };
FVector3 dc_viewpos_step = { 0,0,0 };
DrawerLight *dc_lights = nullptr;
int dc_num_lights = 0;
private:
uint8_t *dc_dest = nullptr;
int dc_dest_y = 0;
int dc_count;
int dc_count = 0;
fixed_t dc_iscale;
fixed_t dc_texturefrac;
uint32_t dc_texturefracx;
uint32_t dc_textureheight;
const uint8_t *dc_source;
const uint8_t *dc_source2;
int dc_wall_fracbits;
fixed_t dc_iscale = 0;
fixed_t dc_texturefrac = 0;
uint32_t dc_texturefracx = 0;
uint32_t dc_textureheight = 0;
const uint8_t *dc_source = nullptr;
const uint8_t *dc_source2 = nullptr;
int dc_wall_fracbits = 0;
uint32_t *dc_srcblend;
uint32_t *dc_destblend;
fixed_t dc_srcalpha;
fixed_t dc_destalpha;
uint32_t *dc_srcblend = nullptr;
uint32_t *dc_destblend = nullptr;
fixed_t dc_srcalpha = 0;
fixed_t dc_destalpha = 0;
typedef void(SWPixelFormatDrawers::*WallDrawerFunc)(const WallDrawerArgs &args);
WallDrawerFunc wallfunc = nullptr;