Skip to content

Commit

Permalink
Fix clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMarechal25 committed Nov 17, 2023
1 parent e68838b commit ad94df2
Show file tree
Hide file tree
Showing 30 changed files with 58 additions and 55 deletions.
1 change: 0 additions & 1 deletion src/ext/yuni/src/yuni/core/logs/handler/file.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ void File<NextHandler>::internalDecoratorWriteWL(LoggerT& logger, const AnyStrin
{
if (pFile.opened())
{
typedef typename LoggerT::DecoratorsType DecoratorsType;
// Append the message to the file
logger.DecoratorsType::template internalDecoratorAddPrefix<File, VerbosityType>(pFile, s);

Expand Down
2 changes: 0 additions & 2 deletions src/ext/yuni/src/yuni/core/logs/handler/stdcout.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class YUNI_DECL StdCout : public NextHandler
template<class LoggerT, class VerbosityType>
void internalDecoratorWriteWL(LoggerT& logger, const AnyString& s) const
{
typedef typename LoggerT::DecoratorsType DecoratorsType;

// Write the message to the std::cout/cerr
if (VerbosityType::shouldUsesStdCerr)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ext/yuni/src/yuni/core/nullable/extension.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Extension
namespace CString
{
template<class CStringT, class T, class Alloc>
struct Append<CStringT, Yuni::Nullable<T, Alloc>> final
class Append<CStringT, Yuni::Nullable<T, Alloc>> final
{
static void Perform(CStringT& s, const Yuni::Nullable<T, Alloc>& rhs)
{
Expand Down
6 changes: 3 additions & 3 deletions src/ext/yuni/src/yuni/core/nullable/nullable.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,14 @@ inline void Nullable<T, Alloc>::print(S& out, const U& nullValue) const
}

template<class T, class Alloc>
inline typename Nullable<T, Alloc>::reference Nullable<T, Alloc>::operator[](size_type n)
inline typename Nullable<T, Alloc>::reference Nullable<T, Alloc>::operator[](size_type)
{
return pHolder.reference();
}

template<class T, class Alloc>
inline typename Nullable<T, Alloc>::const_reference Nullable<T, Alloc>::operator[](
size_type n) const
size_type) const
{
return pHolder.reference();
}
Expand Down Expand Up @@ -327,7 +327,7 @@ inline typename Nullable<T, Alloc>::const_reference Nullable<T, Alloc>::back() c
}

template<class T, class Alloc>
inline bool Nullable<T, Alloc>::operator<(const Nullable& rhs) const
inline bool Nullable<T, Alloc>::operator<(const Nullable&) const
{
return false;
}
Expand Down
6 changes: 1 addition & 5 deletions src/libs/antares/array/antares/array/matrix-to-buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ class I_mtx_to_buffer_dumper;
class matrix_to_buffer_dumper_factory
{
public:
matrix_to_buffer_dumper_factory(bool isDecimal, uint precision) :
any_decimal_(isDecimal and precision)
matrix_to_buffer_dumper_factory()
{
}

Expand All @@ -59,9 +58,6 @@ class matrix_to_buffer_dumper_factory
I_mtx_to_buffer_dumper<T, ReadWriteT, PredicateT>* get_dumper(const Matrix<T, ReadWriteT>* mtx,
std::string& data,
PredicateT& predicate);

private:
bool any_decimal_;
};

template<class T, class ReadWriteT, class PredicateT>
Expand Down
2 changes: 1 addition & 1 deletion src/libs/antares/array/antares/array/matrix.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ void Matrix<T, ReadWriteT>::saveToBuffer(std::string& data,
// Does nothing if the matrix only contains zero
return;

matrix_to_buffer_dumper_factory mtx_to_buffer_dumper_factory(isDecimal, precision);
matrix_to_buffer_dumper_factory mtx_to_buffer_dumper_factory;

I_mtx_to_buffer_dumper<T, ReadWriteT, PredicateT>* mtx_to_buffer_dpr
= mtx_to_buffer_dumper_factory.get_dumper<T, ReadWriteT, PredicateT>(this, data, predicate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ namespace Benchmarking
class IDurationCollector
{
public:
virtual ~IDurationCollector() = default;
virtual void addDuration(const std::string& name, int64_t duration) = 0;
};

class NullDurationCollector : public IDurationCollector
{
public:
NullDurationCollector() = default;
virtual ~NullDurationCollector() = default;
void addDuration(const std::string& /* name */, int64_t /* duration */) override
{ /* Do nothing */
}
Expand All @@ -29,6 +31,7 @@ class DurationCollector : public IDurationCollector
{
public:
DurationCollector() = default;
virtual ~DurationCollector() = default;

void toFileContent(FileContent& file_content);
void addDuration(const std::string& name, int64_t duration) override;
Expand Down
4 changes: 2 additions & 2 deletions src/libs/antares/object/intrusive-reference.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ inline IIntrusiveReference<ChildT, TP>::~IIntrusiveReference()

template<class ChildT, template<class> class TP>
inline IIntrusiveReference<ChildT, TP>::IIntrusiveReference(
const IIntrusiveReference<ChildT, TP>& rhs) :
[[maybe_unused]] const IIntrusiveReference<ChildT, TP>& rhs) :
pRefCount(0)
{
}

template<class ChildT, template<class> class TP>
inline IIntrusiveReference<ChildT, TP>& IIntrusiveReference<ChildT, TP>::operator=(
const IIntrusiveReference& rhs) const
[[maybe_unused]] const IIntrusiveReference& rhs) const
{
// Does nothing
return *this;
Expand Down
1 change: 0 additions & 1 deletion src/libs/antares/study/runtime/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ StudyRuntimeInfos::~StudyRuntimeInfos()
#ifndef NDEBUG
void StudyRangeLimits::checkIntegrity() const
{
assert(this != nullptr);
assert(hour[rangeBegin] <= hour[rangeEnd]);
assert(day[rangeBegin] <= day[rangeEnd]);
assert(hour[rangeBegin] < 9000); // arbitrary value
Expand Down
9 changes: 2 additions & 7 deletions src/libs/antares/study/scenario-builder/TSnumberData.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,12 @@ class TSNumberData : public dataInterface
void setTSnumber(uint index, uint year, uint value);
//@}

uint width() const;
uint height() const;
uint width() const override;
uint height() const override;

double get_value(uint x, uint y) const;
void set_value(uint x, uint y, uint value);

/*
** Give the study an access to TS numbers scenarii
*/
virtual bool apply(Study& study) = 0;

protected:
virtual CString<512, false> get_prefix() const = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class thermalTSNumberData : public TSNumberData
{
public:
thermalTSNumberData() = default;
virtual ~thermalTSNumberData() = default;

bool reset(const Study& study) override;
void saveToINIFile(const Study& study, Yuni::IO::File::Stream& file) const override;
Expand Down
2 changes: 1 addition & 1 deletion src/solver/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Antares::Solver
{
class Application : public Yuni::IEventObserver<Application, Yuni::Policy::SingleThreaded>
class Application final : public Yuni::IEventObserver<Application, Yuni::Policy::SingleThreaded>
{
public:
//! \name Constructor & Destructor
Expand Down
2 changes: 1 addition & 1 deletion src/solver/constraints-builder/grid.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ typename Grid<NodeT>::VectorEdgeP Grid<NodeT>::findShortestPath(NodeP node1, Nod
Grid::VectorEdgeP path;
Grid::NodeP currentNode = node2;

while (!prev[currentNode] == 0)
while (!(prev[currentNode] == 0))
{
path.push_back(adjency.at(currentNode).at(prev[currentNode]));
currentNode = prev[currentNode];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BindingConstraintsTimeSeriesNumbersWriter: public ITimeSeriesNumbersWriter

public:
explicit BindingConstraintsTimeSeriesNumbersWriter(IResultWriter& resultWriter);
BindingConstraintsTimeSeriesNumbersWriter() = default;
BindingConstraintsTimeSeriesNumbersWriter() = delete;
void write(const Data::BindingConstraintGroupRepository &bindingConstraintGroupRepository) override;

private:
Expand Down
1 change: 0 additions & 1 deletion src/solver/simulation/adequacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class Adequacy
uint pNbWeeks;
uint pStartTime;
uint pNbMaxPerformedYearsInParallel;
bool pPreproOnly;
std::vector<PROBLEME_HEBDO> pProblemesHebdo;
Matrix<> pRES;
IResultWriter& resultWriter;
Expand Down
1 change: 0 additions & 1 deletion src/solver/simulation/economy.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class Economy
uint pNbWeeks;
uint pStartTime;
uint pNbMaxPerformedYearsInParallel;
bool pPreproOnly;
std::vector<PROBLEME_HEBDO> pProblemesHebdo;
std::vector<std::unique_ptr<Antares::Solver::Optimization::WeeklyOptimization>> weeklyOptProblems_;
std::vector<std::unique_ptr<interfacePostProcessList>> postProcessesList_;
Expand Down
2 changes: 1 addition & 1 deletion src/solver/simulation/solver.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ void ISimulation<Impl>::computeAnnualCostsStatistics(
}
}

static void logPerformedYearsInAset(setOfParallelYears& set)
static inline void logPerformedYearsInAset(setOfParallelYears& set)
{
logs.info() << "parallel batch size : " << set.nbYears << " (" << set.nbPerformedYears
<< " perfomed)";
Expand Down
6 changes: 6 additions & 0 deletions src/solver/simulation/timeseries-numbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class areaNumberOfTSretriever
class loadAreaNumberOfTSretriever : public areaNumberOfTSretriever
{
public:
virtual ~loadAreaNumberOfTSretriever() = default;
loadAreaNumberOfTSretriever(Study& study) : areaNumberOfTSretriever(study)
{
}
Expand All @@ -143,6 +144,7 @@ class loadAreaNumberOfTSretriever : public areaNumberOfTSretriever
class hydroAreaNumberOfTSretriever : public areaNumberOfTSretriever
{
public:
virtual ~hydroAreaNumberOfTSretriever() = default;
hydroAreaNumberOfTSretriever(Study& study) : areaNumberOfTSretriever(study)
{
}
Expand All @@ -160,6 +162,7 @@ class hydroAreaNumberOfTSretriever : public areaNumberOfTSretriever
class windAreaNumberOfTSretriever : public areaNumberOfTSretriever
{
public:
virtual ~windAreaNumberOfTSretriever() = default;
windAreaNumberOfTSretriever(Study& study) : areaNumberOfTSretriever(study)
{
}
Expand All @@ -177,6 +180,7 @@ class windAreaNumberOfTSretriever : public areaNumberOfTSretriever
class solarAreaNumberOfTSretriever : public areaNumberOfTSretriever
{
public:
virtual ~solarAreaNumberOfTSretriever() = default;
solarAreaNumberOfTSretriever(Study& study) : areaNumberOfTSretriever(study)
{
}
Expand All @@ -194,6 +198,7 @@ class solarAreaNumberOfTSretriever : public areaNumberOfTSretriever
class thermalAreaNumberOfTSretriever : public areaNumberOfTSretriever
{
public:
virtual ~thermalAreaNumberOfTSretriever() = default;
thermalAreaNumberOfTSretriever(Study& study) : areaNumberOfTSretriever(study)
{
}
Expand All @@ -217,6 +222,7 @@ class thermalAreaNumberOfTSretriever : public areaNumberOfTSretriever
class renewClustersAreaNumberOfTSretriever : public areaNumberOfTSretriever
{
public:
virtual ~renewClustersAreaNumberOfTSretriever() = default;
renewClustersAreaNumberOfTSretriever(Study& study) : areaNumberOfTSretriever(study)
{
}
Expand Down
4 changes: 4 additions & 0 deletions src/solver/utils/mps_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class I_MPS_writer
{
}
I_MPS_writer() = default;
virtual ~I_MPS_writer() = default;
virtual void runIfNeeded(Solver::IResultWriter& writer, const std::string& filename) = 0;

protected:
Expand All @@ -46,6 +47,7 @@ class fullMPSwriter final : public I_MPS_writer
class fullOrToolsMPSwriter : public I_MPS_writer
{
public:
virtual ~fullOrToolsMPSwriter() = default;
fullOrToolsMPSwriter(MPSolver* solver, uint currentOptimNumber);
void runIfNeeded(Solver::IResultWriter& writer, const std::string& filename) override;

Expand All @@ -56,6 +58,7 @@ class fullOrToolsMPSwriter : public I_MPS_writer
class nullMPSwriter : public I_MPS_writer
{
public:
virtual ~nullMPSwriter() = default;
using I_MPS_writer::I_MPS_writer;
void runIfNeeded(Solver::IResultWriter& /*writer*/,
const std::string& /*filename*/) override
Expand All @@ -67,6 +70,7 @@ class nullMPSwriter : public I_MPS_writer
class mpsWriterFactory
{
public:
virtual ~mpsWriterFactory() = default;
mpsWriterFactory(Data::mpsExportStatus exportMPS,
bool exportMPSOnError,
const int current_optim_number,
Expand Down
7 changes: 7 additions & 0 deletions src/solver/utils/name_translator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,26 @@
class NameTranslator
{
public:
virtual ~NameTranslator() = default;
virtual char** translate(const std::vector<std::string>& src,
std::vector<char*>& pointerVec) = 0;
static std::unique_ptr<NameTranslator> create(bool useRealNames);
};

class RealName : public NameTranslator
{
public:
~RealName() override = default;
private:
char** translate(const std::vector<std::string>& src,
std::vector<char*>& pointerVec) override;
};

class NullName : public NameTranslator
{
public:
~NullName() override = default;
private:
char** translate(const std::vector<std::string>& src,
std::vector<char*>& pointerVec) override;
};
15 changes: 6 additions & 9 deletions src/solver/utils/named_problem.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#include "named_problem.h"
#include <algorithm>

namespace Antares
{
namespace Optimization
namespace Antares::Optimization
{

PROBLEME_SIMPLEXE_NOMME::PROBLEME_SIMPLEXE_NOMME(const std::vector<std::string>& NomDesVariables,
Expand All @@ -12,15 +10,15 @@ PROBLEME_SIMPLEXE_NOMME::PROBLEME_SIMPLEXE_NOMME(const std::vector<std::string>&
std::vector<int>& StatutDesVariables,
std::vector<int>& StatutDesContraintes,
bool UseNamedProblems,
bool SolverLogs) :
bool SolverLogs) : PROBLEME_SIMPLEXE(),

NomDesVariables(NomDesVariables),
NomDesContraintes(NomDesContraintes),
VariablesEntieres(VariablesEntieres),
useNamedProblems_(UseNamedProblems),
solverLogs_(SolverLogs),
StatutDesVariables(StatutDesVariables),
StatutDesContraintes(StatutDesContraintes),
useNamedProblems_(UseNamedProblems),
solverLogs_(SolverLogs)
VariablesEntieres(VariablesEntieres)
{
AffichageDesTraces = SolverLogs ? OUI_SPX : NON_SPX;
}
Expand All @@ -36,5 +34,4 @@ bool PROBLEME_SIMPLEXE_NOMME::basisExists() const
return !StatutDesVariables.empty() && !StatutDesContraintes.empty();
}

} // namespace Optimization
} // namespace Antares
} // namespace Antares::Optimization
12 changes: 6 additions & 6 deletions src/solver/variable/commons/spatial-aggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ struct MultipleCaptionProxy
template<class VCardT>
struct MultipleCaptionProxy<0, VCardT>
{
static std::string Caption(const uint indx)
static std::string Caption(const uint)
{
return "";
}

static std::string Unit(const uint indx)
static std::string Unit(const uint)
{
return "";
}
Expand All @@ -69,12 +69,12 @@ struct MultipleCaptionProxy<0, VCardT>
template<class VCardT>
struct MultipleCaptionProxy<1, VCardT>
{
static std::string Caption(const uint indx)
static std::string Caption(const uint)
{
return "";
}

static std::string Unit(const uint indx)
static std::string Unit(const uint)
{
return "";
}
Expand All @@ -83,12 +83,12 @@ struct MultipleCaptionProxy<1, VCardT>
template<class VCardT>
struct MultipleCaptionProxy<Category::dynamicColumns, VCardT>
{
static std::string Caption(const uint indx)
static std::string Caption(const uint)
{
return "";
}

static std::string Unit(const uint indx)
static std::string Unit(const uint)
{
return "";
}
Expand Down
Loading

0 comments on commit ad94df2

Please sign in to comment.