Fix some gcc 8 and gcc 9 compiler warnings that were thrown 4500 times.

Refs #5294
Differential Revision: https://code.wildfiregames.com/D2055
Reviewed By: Vladislav
This was SVN commit r22443.
This commit is contained in:
elexis
2019-07-09 00:18:48 +00:00
parent 7cf6244110
commit 8a32b0b3d4
12 changed files with 51 additions and 17 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2014 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@@ -364,7 +364,7 @@ size_t CLOSTexture::GetBitmapSize(size_t w, size_t h, size_t* pitch)
return *pitch * (h + g_BlurSize - 1); return *pitch * (h + g_BlurSize - 1);
} }
void CLOSTexture::GenerateBitmap(ICmpRangeManager::CLosQuerier los, u8* losData, size_t w, size_t h, size_t pitch) void CLOSTexture::GenerateBitmap(const ICmpRangeManager::CLosQuerier& los, u8* losData, size_t w, size_t h, size_t pitch)
{ {
u8 *dataPtr = losData; u8 *dataPtr = losData;
+2 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2014 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@@ -83,7 +83,7 @@ private:
void RecomputeTexture(int unit); void RecomputeTexture(int unit);
size_t GetBitmapSize(size_t w, size_t h, size_t* pitch); size_t GetBitmapSize(size_t w, size_t h, size_t* pitch);
void GenerateBitmap(ICmpRangeManager::CLosQuerier los, u8* losData, size_t w, size_t h, size_t pitch); void GenerateBitmap(const ICmpRangeManager::CLosQuerier& los, u8* losData, size_t w, size_t h, size_t pitch);
CSimulation2& m_Simulation; CSimulation2& m_Simulation;
+6 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@@ -71,6 +71,11 @@ CGUISpriteInstance::CGUISpriteInstance(const CGUISpriteInstance& Sprite)
{ {
} }
CGUISpriteInstance& CGUISpriteInstance::operator=(const CGUISpriteInstance& Sprite)
{
return this->operator=(Sprite.m_SpriteName);
}
CGUISpriteInstance& CGUISpriteInstance::operator=(const CStr& SpriteName) CGUISpriteInstance& CGUISpriteInstance::operator=(const CStr& SpriteName)
{ {
m_SpriteName = SpriteName; m_SpriteName = SpriteName;
+2 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@@ -161,6 +161,7 @@ public:
CGUISpriteInstance(); CGUISpriteInstance();
CGUISpriteInstance(const CStr& SpriteName); CGUISpriteInstance(const CStr& SpriteName);
CGUISpriteInstance(const CGUISpriteInstance& Sprite); CGUISpriteInstance(const CGUISpriteInstance& Sprite);
CGUISpriteInstance& operator=(const CGUISpriteInstance&);
CGUISpriteInstance& operator=(const CStr& SpriteName); CGUISpriteInstance& operator=(const CStr& SpriteName);
void Draw(CRect Size, int CellID, std::map<CStr, CGUISprite*>& Sprites, float Z) const; void Draw(CRect Size, int CellID, std::map<CStr, CGUISprite*>& Sprites, float Z) const;
void Invalidate(); void Invalidate();
+7 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
@@ -84,6 +84,12 @@ public:
DetectSeparator(); DetectSeparator();
} }
Path(const Path& p)
: path(p.path)
{
DetectSeparator();
}
Path(const char* p) Path(const char* p)
: path((const unsigned char*)p, (const unsigned char*)p+strlen(p)) : path((const unsigned char*)p, (const unsigned char*)p+strlen(p))
// interpret bytes as unsigned; makes no difference for ASCII, // interpret bytes as unsigned; makes no difference for ASCII,
+13
View File
@@ -24,6 +24,11 @@ CRect::CRect() :
{ {
} }
CRect::CRect(const CRect& rect) :
left(rect.left), top(rect.top), right(rect.right), bottom(rect.bottom)
{
}
CRect::CRect(const CPos &pos) : CRect::CRect(const CPos &pos) :
left(pos.x), top(pos.y), right(pos.x), bottom(pos.y) left(pos.x), top(pos.y), right(pos.x), bottom(pos.y)
{ {
@@ -218,6 +223,10 @@ CPos::CPos() : x(0.f), y(0.f)
{ {
} }
CPos::CPos(const CPos& pos) : x(pos.x), y(pos.y)
{
}
CPos::CPos(const CSize& s) : x(s.cx), y(s.cy) CPos::CPos(const CSize& s) : x(s.cx), y(s.cy)
{ {
} }
@@ -303,6 +312,10 @@ CSize::CSize() : cx(0.f), cy(0.f)
{ {
} }
CSize::CSize(const CSize& size) : cx(size.cx), cy(size.cy)
{
}
CSize::CSize(const CRect &rect) : cx(rect.GetWidth()), cy(rect.GetHeight()) CSize::CSize(const CRect &rect) : cx(rect.GetWidth()), cy(rect.GetHeight())
{ {
} }
+3
View File
@@ -43,6 +43,7 @@ public:
CRect(const CPos &upperleft, const CPos &bottomright); CRect(const CPos &upperleft, const CPos &bottomright);
CRect(const CPos &pos, const CSize &size); CRect(const CPos &pos, const CSize &size);
CRect(const float l, const float t, const float r, const float b); CRect(const float l, const float t, const float r, const float b);
CRect(const CRect&);
CRect& operator=(const CRect& a); CRect& operator=(const CRect& a);
bool operator==(const CRect& a) const; bool operator==(const CRect& a) const;
@@ -133,6 +134,7 @@ class CPos
{ {
public: public:
CPos(); CPos();
CPos(const CPos& pos);
CPos(const CSize &pos); CPos(const CSize &pos);
CPos(const float px, const float py); CPos(const float px, const float py);
@@ -172,6 +174,7 @@ public:
CSize(); CSize();
CSize(const CRect &rect); CSize(const CRect &rect);
CSize(const CPos &pos); CSize(const CPos &pos);
CSize(const CSize& size);
CSize(const float sx, const float sy); CSize(const float sx, const float sy);
CSize& operator=(const CSize& a); CSize& operator=(const CSize& a);
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@@ -114,7 +114,7 @@ public:
virtual void RemoveProjectile(uint32_t); virtual void RemoveProjectile(uint32_t);
void RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, const CFrustum& frustum, bool culling, void RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, const CFrustum& frustum, bool culling,
ICmpRangeManager::CLosQuerier los, bool losRevealAll) const; const ICmpRangeManager::CLosQuerier& los, bool losRevealAll) const;
private: private:
struct Projectile struct Projectile
@@ -358,7 +358,7 @@ void CCmpProjectileManager::RemoveProjectile(uint32_t id)
} }
void CCmpProjectileManager::RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, void CCmpProjectileManager::RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector,
const CFrustum& frustum, bool culling, ICmpRangeManager::CLosQuerier los, bool losRevealAll) const const CFrustum& frustum, bool culling, const ICmpRangeManager::CLosQuerier& los, bool losRevealAll) const
{ {
// Don't display objects outside the visible area // Don't display objects outside the visible area
ssize_t posi = (ssize_t)(0.5f + position.X / TERRAIN_TILE_SIZE); ssize_t posi = (ssize_t)(0.5f + position.X / TERRAIN_TILE_SIZE);
+4 -4
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@@ -283,8 +283,8 @@ public:
CDebugSerializer serialize(script, stream); CDebugSerializer serialize(script, stream);
serialize.NumberI32("x", 16, -16, 16); serialize.NumberI32("x", 16, -16, 16);
serialize.NumberI32("x", -16, -16, 16); serialize.NumberI32("x", -16, -16, 16);
TS_ASSERT_THROWS(serialize.NumberI32("x", 17, -16, 16), PSERROR_Serialize_OutOfBounds); TS_ASSERT_THROWS(serialize.NumberI32("x", 99, -16, 16), const PSERROR_Serialize_OutOfBounds&);
TS_ASSERT_THROWS(serialize.NumberI32("x", -17, -16, 16), PSERROR_Serialize_OutOfBounds); TS_ASSERT_THROWS(serialize.NumberI32("x", -17, -16, 16), const PSERROR_Serialize_OutOfBounds&);
} }
// TODO: test exceptions more thoroughly // TODO: test exceptions more thoroughly
@@ -766,7 +766,7 @@ public:
TestLogger logger; TestLogger logger;
TS_ASSERT(script.Eval("([1, 2, function () { }])", &obj)); TS_ASSERT(script.Eval("([1, 2, function () { }])", &obj));
TS_ASSERT_THROWS(serialize.ScriptVal("script", &obj), PSERROR_Serialize_InvalidScriptValue); TS_ASSERT_THROWS(serialize.ScriptVal("script", &obj), const PSERROR_Serialize_InvalidScriptValue&);
} }
void test_script_splice() void test_script_splice()
@@ -131,6 +131,11 @@ class AtObj
public: public:
AtObj() {} AtObj() {}
AtObj(const AtObj& r) : m_Node(r.m_Node) {} AtObj(const AtObj& r) : m_Node(r.m_Node) {}
AtObj& operator=(const AtObj& r)
{
m_Node = r.m_Node;
return *this;
}
// Return an iterator to the children matching 'key' // Return an iterator to the children matching 'key'
const AtIter operator[] (const char* key) const; const AtIter operator[] (const char* key) const;
@@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games. /* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@@ -175,8 +175,9 @@ QUERYHANDLER(GetTerrainTexturePreview)
} }
else else
{ {
sTerrainTexturePreview noPreview; sTerrainTexturePreview noPreview{};
noPreview.name = std::wstring(); noPreview.name = std::wstring();
noPreview.loaded = false;
noPreview.imageHeight = 0; noPreview.imageHeight = 0;
noPreview.imageWidth = 0; noPreview.imageWidth = 0;
msg->preview = noPreview; msg->preview = noPreview;
@@ -91,7 +91,7 @@ const bool NOMERGE = false;
#define COMMANDDATASTRUCT(t) \ #define COMMANDDATASTRUCT(t) \
struct d##t { \ struct d##t { \
private: \ private: \
const d##t& operator=(const d##t&); \ d##t& operator=(const d##t&) = delete; \
public: public:
#define COMMANDSTRUCT(t, merge) \ #define COMMANDSTRUCT(t, merge) \