Commit 01d7ea87 authored by Ozaq's avatar Ozaq Committed by Mohcine Chraibi

Fix trivially fixable warnings (#411)

3/2 more serious warnigns on gcc/clang remain.

A bunch of -Wdeprecated-copy warnings have been fixed
E.g. class Point had explicit Copy C-tor which forces an implicit copy
asignment operator. -Wdeprecated-copy complains about this. See rule of
five.

Several signed/unsigned comparisons could be removed by changing loop
variables to size_t instead of int or unsigned int.

Missing return statements added several functions.

Several variable shadowing warnings have been fixed by renaming the
shadowing variable.

Unused parameters have been omited from function signatures so that no
UNUSED macro is neccesary anymore. Also the macro has been removed since
the lambda capture trick now triggers a warning on clang for an unused
cpature. Since now all unused vars are gone I simply removed the macro.

Some unneccesary const casts have been removed.
parent ea1fbaf7
...@@ -119,7 +119,7 @@ string TrajectoriesJPSV04::WritePed(Pedestrian* ped) ...@@ -119,7 +119,7 @@ string TrajectoriesJPSV04::WritePed(Pedestrian* ped)
return string(tmp); return string(tmp);
} }
void TrajectoriesJPSV04::WriteHeader(long nPeds, double fps, Building* building, int seed, int count) void TrajectoriesJPSV04::WriteHeader(long nPeds, double fps, Building* building, int seed, int /*count*/)
{ {
building->GetCaption(); building->GetCaption();
string tmp; string tmp;
...@@ -356,6 +356,7 @@ std::string getSourceFileName(const std::string & GetProjectFile) ...@@ -356,6 +356,7 @@ std::string getSourceFileName(const std::string & GetProjectFile)
} }
return ret; return ret;
} }
return ret;
} }
std::string getEventFileName(const std::string & GetProjectFile) std::string getEventFileName(const std::string & GetProjectFile)
...@@ -552,19 +553,19 @@ void TrajectoriesFLAT::WriteFooter() ...@@ -552,19 +553,19 @@ void TrajectoriesFLAT::WriteFooter()
{ {
} }
void TrajectoriesFLAT::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources) void TrajectoriesFLAT::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > /*sources*/)
{ {
} }
void TrajectoriesVTK::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources) void TrajectoriesVTK::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > /*sources*/)
{ {
} }
void TrajectoriesJPSV06::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources) void TrajectoriesJPSV06::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > /*sources*/)
{ {
} }
void TrajectoriesXML_MESH::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources) void TrajectoriesXML_MESH::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > /*sources*/)
{ {
} }
...@@ -648,7 +649,7 @@ void TrajectoriesVTK::WriteFooter() ...@@ -648,7 +649,7 @@ void TrajectoriesVTK::WriteFooter()
} }
void TrajectoriesJPSV06::WriteHeader(long nPeds, double fps, Building* building, int seed, int count) void TrajectoriesJPSV06::WriteHeader(long nPeds, double fps, Building* building, int seed, int /*count*/)
{ {
building->GetCaption(); building->GetCaption();
string tmp; string tmp;
...@@ -804,7 +805,7 @@ void TrajectoriesXML_MESH::WriteGeometry(Building* building) ...@@ -804,7 +805,7 @@ void TrajectoriesXML_MESH::WriteGeometry(Building* building)
} }
void TrajectoriesJPSV05::WriteHeader(long nPeds, double fps, Building* building, int seed, int count) void TrajectoriesJPSV05::WriteHeader(long nPeds, double fps, Building* building, int seed, int /*count*/)
{ {
building->GetCaption(); building->GetCaption();
string tmp; string tmp;
......
...@@ -361,7 +361,7 @@ void Simulation::UpdateRoutesAndLocations() ...@@ -361,7 +361,7 @@ void Simulation::UpdateRoutesAndLocations()
// } // }
#pragma omp parallel for shared(pedsToRemove, allRooms) #pragma omp parallel for shared(pedsToRemove, allRooms)
for (signed int p = 0; p < allPeds.size(); ++p) { for (size_t p = 0; p < allPeds.size(); ++p) {
auto ped = allPeds[p]; auto ped = allPeds[p];
Room* room = _building->GetRoom(ped->GetRoomID()); Room* room = _building->GetRoom(ped->GetRoomID());
SubRoom* sub0 = room->GetSubRoom(ped->GetSubRoomID()); SubRoom* sub0 = room->GetSubRoom(ped->GetSubRoomID());
......
...@@ -25,7 +25,7 @@ int Event::GetId() const ...@@ -25,7 +25,7 @@ int Event::GetId() const
return _id; return _id;
} }
const DoorState Event::GetState() const const DoorState& Event::GetState() const
{ {
return _state; return _state;
} }
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
/** /**
* @return the state (open, close) of the event * @return the state (open, close) of the event
*/ */
const DoorState GetState() const; const DoorState& GetState() const;
/** /**
* @return the time at which the event was recorded * @return the time at which the event was recorded
......
...@@ -726,6 +726,7 @@ Router * EventManager::CreateRouter(const RoutingStrategy& strategy) ...@@ -726,6 +726,7 @@ Router * EventManager::CreateRouter(const RoutingStrategy& strategy)
case ROUTING_FF_QUICKEST: case ROUTING_FF_QUICKEST:
rout = new FFRouter(ROUTING_FF_QUICKEST, ROUTING_FF_QUICKEST, _building->GetConfig()->get_has_specific_goals(), _building->GetConfig()); rout = new FFRouter(ROUTING_FF_QUICKEST, ROUTING_FF_QUICKEST, _building->GetConfig()->get_has_specific_goals(), _building->GetConfig());
break;
default: default:
Log->Write("ERROR: \twrong value for routing strategy [%d]!!!\n", strategy ); Log->Write("ERROR: \twrong value for routing strategy [%d]!!!\n", strategy );
......
...@@ -687,7 +687,7 @@ bool Building::resetGeometry(std::shared_ptr<TrainTimeTable> tab) ...@@ -687,7 +687,7 @@ bool Building::resetGeometry(std::shared_ptr<TrainTimeTable> tab)
// std::cout << "temp Added Doors: " <<TempAddedDoors[tab->id].size() << "\n"; // std::cout << "temp Added Doors: " <<TempAddedDoors[tab->id].size() << "\n";
return true; return true;
} }
bool Building::InitPlatforms() void Building::InitPlatforms()
{ {
int num_platform = -1; int num_platform = -1;
for (auto& roomItr : _rooms) for (auto& roomItr : _rooms)
......
...@@ -318,7 +318,7 @@ public: ...@@ -318,7 +318,7 @@ public:
private: private:
bool InitInsideGoals(); bool InitInsideGoals();
bool InitPlatforms(); void InitPlatforms();
void StringExplode(std::string str, std::string separator, std::vector<std::string>* results); void StringExplode(std::string str, std::string separator, std::vector<std::string>* results);
/** @defgroup auto-correct-geometry /** @defgroup auto-correct-geometry
* functions used to auto-correct the geometry. * functions used to auto-correct the geometry.
......
...@@ -242,8 +242,8 @@ bool Goal::ConvertLineToPoly() ...@@ -242,8 +242,8 @@ bool Goal::ConvertLineToPoly()
_crossing->SetPoint2(point2); _crossing->SetPoint2(point2);
}else{ }else{
_crossing->SetPoint1(_poly[0]); _crossing->SetPoint1(_poly[0]);
Line line(_poly[_poly.size()/2], _poly[(_poly.size()/2)+1], 0); Line tmp_line(_poly[_poly.size()/2], _poly[(_poly.size()/2)+1], 0);
_crossing->SetPoint2(line.GetCentre()); _crossing->SetPoint2(tmp_line.GetCentre());
} }
...@@ -352,9 +352,9 @@ int Goal::GetRoomID() const ...@@ -352,9 +352,9 @@ int Goal::GetRoomID() const
return _roomID; return _roomID;
} }
void Goal::SetRoomID(int _roomID) void Goal::SetRoomID(int roomID)
{ {
Goal::_roomID = _roomID; _roomID = roomID;
} }
int Goal::GetSubRoomID() const int Goal::GetSubRoomID() const
...@@ -362,7 +362,7 @@ int Goal::GetSubRoomID() const ...@@ -362,7 +362,7 @@ int Goal::GetSubRoomID() const
return _subRoomID; return _subRoomID;
} }
void Goal::SetSubRoomID(int _subRoomID) void Goal::SetSubRoomID(int subRoomID)
{ {
Goal::_subRoomID = _subRoomID; _subRoomID = subRoomID;
} }
...@@ -86,7 +86,7 @@ bool GoalManager::CheckInsideWaitingArea(Pedestrian* ped, int goalID) ...@@ -86,7 +86,7 @@ bool GoalManager::CheckInsideWaitingArea(Pedestrian* ped, int goalID)
Goal* goal = _allGoals[goalID]; Goal* goal = _allGoals[goalID];
if (goal!=nullptr){ if (goal!=nullptr){
if (WaitingArea* wa = dynamic_cast<WaitingArea*>(goal)) { if (dynamic_cast<WaitingArea*>(goal)) {
return goal->IsInsideGoal(ped->GetPos()); return goal->IsInsideGoal(ped->GetPos());
} }
} }
......
...@@ -67,14 +67,6 @@ int Line::GetUniqueID() const ...@@ -67,14 +67,6 @@ int Line::GetUniqueID() const
return _uid; return _uid;
} }
Line::Line(const Line& orig):
_point1(orig.GetPoint1()), _point2(orig.GetPoint2()), _centre(orig.GetCentre()), _length(orig.GetLength()), _uid(orig.GetUniqueID())
{
}
Line::~Line()
{
}
/************************************************************* /*************************************************************
Setter-Funktionen Setter-Funktionen
......
...@@ -60,9 +60,7 @@ public: ...@@ -60,9 +60,7 @@ public:
Line(const Point& p1, const Point& p2); Line(const Point& p1, const Point& p2);
Line(const Line& orig); virtual ~Line() = default;
virtual ~Line();
/** /**
* All Line elements (also derived class) have a unique ID * All Line elements (also derived class) have a unique ID
......
...@@ -32,16 +32,6 @@ ...@@ -32,16 +32,6 @@
/************************************************************ /************************************************************
Konstruktoren Konstruktoren
************************************************************/ ************************************************************/
Point::Point(const Point& orig)
{
// std::cout << "Point: " << toString() << std::endl;
// std::cout << "orig: " << toString() << std::endl;
_x = orig._x;
_y = orig._y;
}
std::string Point::toString() const std::string Point::toString() const
{ {
std::stringstream tmp; std::stringstream tmp;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* *
* *
**/ **/
#ifndef _POINT_H #ifndef _POINT_H
#define _POINT_H #define _POINT_H
...@@ -53,13 +53,6 @@ public: ...@@ -53,13 +53,6 @@ public:
*/ */
Point(double x = 0, double y = 0) : _x(x), _y(y) {}; Point(double x = 0, double y = 0) : _x(x), _y(y) {};
/**
* **Copy-Ctor**
* Constructs a new point as copy of the original point.
* @param [in] orig: original point which shall be copied
*/
Point(const Point& orig);
/// Norm /// Norm
double Norm() const; double Norm() const;
......
...@@ -10,9 +10,9 @@ int WaitingArea::getMaxNumPed() const ...@@ -10,9 +10,9 @@ int WaitingArea::getMaxNumPed() const
return maxNumPed; return maxNumPed;
} }
void WaitingArea::setMaxNumPed(int maxNumPed) void WaitingArea::setMaxNumPed(int newMaxNumPed)
{ {
WaitingArea::maxNumPed = maxNumPed; maxNumPed = newMaxNumPed;
} }
int WaitingArea::getMinNumPed() const int WaitingArea::getMinNumPed() const
...@@ -20,9 +20,9 @@ int WaitingArea::getMinNumPed() const ...@@ -20,9 +20,9 @@ int WaitingArea::getMinNumPed() const
return minNumPed; return minNumPed;
} }
void WaitingArea::setMinNumPed(int minNumPed) void WaitingArea::setMinNumPed(int newMinNumPed)
{ {
WaitingArea::minNumPed = minNumPed; minNumPed = newMinNumPed;
} }
bool WaitingArea::isOpen() const bool WaitingArea::isOpen() const
...@@ -30,9 +30,9 @@ bool WaitingArea::isOpen() const ...@@ -30,9 +30,9 @@ bool WaitingArea::isOpen() const
return open; return open;
} }
void WaitingArea::setOpen(bool open) void WaitingArea::setOpen(bool newOpenState)
{ {
WaitingArea::open = open; open = newOpenState;
} }
bool WaitingArea::isGlobalTimer() const bool WaitingArea::isGlobalTimer() const
...@@ -51,9 +51,9 @@ const std::map<int, double>& WaitingArea::getNextGoals() const ...@@ -51,9 +51,9 @@ const std::map<int, double>& WaitingArea::getNextGoals() const
return nextGoals; return nextGoals;
} }
bool WaitingArea::setNextGoals(const std::map<int, double>& nextGoals) bool WaitingArea::setNextGoals(const std::map<int, double>& newNextGoals)
{ {
WaitingArea::nextGoals = nextGoals; nextGoals = newNextGoals;
nextGoalsOpen.clear(); nextGoalsOpen.clear();
...@@ -122,9 +122,9 @@ double WaitingArea::getWaitingTime() const ...@@ -122,9 +122,9 @@ double WaitingArea::getWaitingTime() const
return waitingTime; return waitingTime;
} }
void WaitingArea::setWaitingTime(double waitingTime) void WaitingArea::setWaitingTime(double newWaitingTime)
{ {
WaitingArea::waitingTime = waitingTime; waitingTime = newWaitingTime;
} }
int WaitingArea::GetNextGoal() int WaitingArea::GetNextGoal()
...@@ -158,9 +158,6 @@ void WaitingArea::removePed(int ped) ...@@ -158,9 +158,6 @@ void WaitingArea::removePed(int ped)
if (pedInside.size() < minNumPed){ if (pedInside.size() < minNumPed){
startTime = -1.; startTime = -1.;
} }
} }
void WaitingArea::startTimer(double time) void WaitingArea::startTimer(double time)
...@@ -180,7 +177,7 @@ bool WaitingArea::isWaiting(double time, const Building* building) ...@@ -180,7 +177,7 @@ bool WaitingArea::isWaiting(double time, const Building* building)
startTimer(time); startTimer(time);
} }
if ((trans == nullptr) ){ if (trans == nullptr){
if (globalTimer){ if (globalTimer){
if (time > waitingTime){ if (time > waitingTime){
return false; return false;
...@@ -210,7 +207,7 @@ int WaitingArea::getTransitionID() const ...@@ -210,7 +207,7 @@ int WaitingArea::getTransitionID() const
return transitionID; return transitionID;
} }
void WaitingArea::setTransitionID(int transitionID) void WaitingArea::setTransitionID(int newTransitionID)
{ {
WaitingArea::transitionID = transitionID; transitionID = newTransitionID;
} }
...@@ -42,11 +42,6 @@ Wall::Wall(const Point& p1, const Point& p2, const std::string& type) : Line(p1, ...@@ -42,11 +42,6 @@ Wall::Wall(const Point& p1, const Point& p2, const std::string& type) : Line(p1,
{ {
} }
Wall::Wall(const Wall& orig) : Line(orig)
{
_type=orig.GetType();
}
void Wall::WriteToErrorLog() const void Wall::WriteToErrorLog() const
{ {
char tmp[CLENGTH]; char tmp[CLENGTH];
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* *
* *
**/ **/
#ifndef _WALL_H #ifndef _WALL_H
#define _WALL_H #define _WALL_H
...@@ -45,9 +45,9 @@ public: ...@@ -45,9 +45,9 @@ public:
Wall(const Point& p1, const Point& p2, const std::string& type="internal"); Wall(const Point& p1, const Point& p2, const std::string& type="internal");
/** /**
* Constructor * Destructor
*/ */
Wall(const Wall& orig); ~Wall() override = default;
/** /**
* set/get the wall type. Values are external and internal * set/get the wall type. Values are external and internal
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
/** /**
* @return a nicely formated string of the object * @return a nicely formated string of the object
*/ */
virtual std::string Write() const; std::string Write() const override;
private: private:
std::string _type; std::string _type;
......
...@@ -120,9 +120,10 @@ bool GradientModel::Init (Building* building) ...@@ -120,9 +120,10 @@ bool GradientModel::Init (Building* building)
pedsToRemove.clear(); pedsToRemove.clear();
bool error_occurred = false; bool error_occurred = false;
#pragma omp parallel for #pragma omp parallel for
for(signed int p=0;p<allPeds.size();p++) { for(size_t p=0;p<allPeds.size();p++) {
Pedestrian* ped = allPeds[p]; Pedestrian* ped = allPeds[p];
double cosPhi, sinPhi; double cosPhi = 0;
double sinPhi = 0;
//a destination could not be found for that pedestrian //a destination could not be found for that pedestrian
if (ped->FindRoute() == -1) { if (ped->FindRoute() == -1) {
Log->Write( Log->Write(
......
...@@ -202,7 +202,6 @@ void VelocityModel::ComputeNextTimeStep(double current, double deltaT, Building* ...@@ -202,7 +202,6 @@ void VelocityModel::ComputeNextTimeStep(double current, double deltaT, Building*
vector<Pedestrian*> neighbours; vector<Pedestrian*> neighbours;
building->GetGrid()->GetNeighbourhood(ped,neighbours); building->GetGrid()->GetNeighbourhood(ped,neighbours);
double time = Pedestrian::GetGlobalTime();
int size = (int) neighbours.size(); int size = (int) neighbours.size();
//// if (ped->GetID() == 71) { //// if (ped->GetID() == 71) {
//// std::cout << "------------------------------------" << std::endl; //// std::cout << "------------------------------------" << std::endl;
......
...@@ -252,8 +252,8 @@ void LCGrid::GetNeighbourhood(const Pedestrian* ped, vector<Pedestrian*>& neighb ...@@ -252,8 +252,8 @@ void LCGrid::GetNeighbourhood(const Pedestrian* ped, vector<Pedestrian*>& neighb
if ((myID == 70) && (fmod(Pedestrian::GetGlobalTime() , 45.) == 0) ){ if ((myID == 70) && (fmod(Pedestrian::GetGlobalTime() , 45.) == 0) ){
std::cout << Pedestrian::GetGlobalTime() << ":\t\tNeighborhood of 71 " << neighbourhood.size() << std::endl; std::cout << Pedestrian::GetGlobalTime() << ":\t\tNeighborhood of 71 " << neighbourhood.size() << std::endl;
for (auto& ped : neighbourhood){ for (auto& neighbour : neighbourhood){
std::cout << "Neighbor added: " << ped->GetID() << " at " << ped->GetPos().toString() << std::endl; std::cout << "Neighbor added: " << neighbour->GetID() << " at " << neighbour->GetPos().toString() << std::endl;
} }
std::cout << "---------------------------" << std::endl; std::cout << "---------------------------" << std::endl;
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "AgentsQueue.h" #include "AgentsQueue.h"
#include "../voronoi-boost/VoronoiPositionGenerator.h" #include "../voronoi-boost/VoronoiPositionGenerator.h"
#define UNUSED(x) [&x]{}() // c++11 silence warnings
using namespace std; using namespace std;
......
...@@ -55,21 +55,6 @@ JEllipse::JEllipse() ...@@ -55,21 +55,6 @@ JEllipse::JEllipse()
_vel0 = 0; // desired speed _vel0 = 0; // desired speed
} }
JEllipse::JEllipse(const JEllipse& orig)
{
_vel = orig.GetV(); // velocity vector
_center = orig.GetCenter();
_cosPhi = orig.GetCosPhi();
_sinPhi = orig.GetSinPhi();
_Xp = orig.GetXp(); //x Ellipse-coord of the centre (Center in (xc,yc) )
_Amin = orig.GetAmin(); // Semi-axis in direction of motion: pAmin + V * pAv
_Av = orig.GetAv();
_Bmin = orig.GetBmin(); // Semi-axis in direction of shoulders: pBmax - V *[(pBmax - pBmin) / V0]
_Bmax = orig.GetBmax();
_do_stretch = orig.DoesStretch();
_vel0 = orig.GetV0(); // desired speed
}
/************************************************************* /*************************************************************
Setter-Funktionen Setter-Funktionen
...@@ -239,9 +224,9 @@ double JEllipse::GetEB() const ...@@ -239,9 +224,9 @@ double JEllipse::GetEB() const
// return (v<v_min)? 0.5*b_shoulder: 0.5*(b_shoulder + a * exp(b*v)); // return (v<v_min)? 0.5*b_shoulder: 0.5*(b_shoulder + a * exp(b*v));
// todo: we dont have the possiblity to choose between ellipses and circles. // todo: we dont have the possiblity to choose between ellipses and circles.
// for the moment we can control this only with the parameter values in the following formula // for the moment we can control this only with the parameter values in the following formula
//double x; //double x;
//if(_vel0 > 0.001) //if(_vel0 > 0.001)
// x = (_Bmax - _Bmin) / _vel0; // x = (_Bmax - _Bmin) / _vel0;
//else //else
// x = 0; // x = 0;
......
...@@ -50,9 +50,7 @@ private: ...@@ -50,9 +50,7 @@ private:
public: public:
JEllipse(); JEllipse();
JEllipse(const JEllipse& orig);
void SetV(const Point& v); void SetV(const Point& v);
......
...@@ -40,8 +40,6 @@ ...@@ -40,8 +40,6 @@
//#include <ctime> //#include <ctime>