Commit d288632c authored by Laurențiu Nicola's avatar Laurențiu Nicola
Browse files

Merge branch 'fix-warnings' into 'develop'

COMP: Fix some compiler warnings

See merge request !786
parents 27cb6cba 6ae99fbe
Pipeline #7399 failed with stages
in 68 minutes and 16 seconds
......@@ -30,6 +30,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
......@@ -309,7 +310,7 @@ ImageKeywordlist ReadGeometryFromImage(const std::string& filename, bool checkRp
ImageKeywordlist ReadGeometryFromGEOMFile(const std::string& filename)
{
ossimKeywordlist geom_kwl;
// ossimKeywordlist geom_kwl;
ImageKeywordlist otb_kwl;
ossimFilename ossimGeomFile = ossimFilename(filename);
......@@ -332,11 +333,17 @@ ImageKeywordlist ReadGeometryFromGEOMFile(const std::string& filename)
// {
// geom_kwl = kwl;
// }
geom_kwl = kwl;
otb_kwl.SetKeywordlist(kwl);
}
else
{
otb_kwl.SetKeywordlist(ossimKeywordlist());
}
}
otb_kwl.SetKeywordlist(geom_kwl);
else
{
otb_kwl.SetKeywordlist(ossimKeywordlist());
}
return otb_kwl;
}
......@@ -456,7 +463,7 @@ void WriteGeometry(const ImageKeywordlist& otb_kwl, const std::string& filename)
}
}
bool ImageKeywordlist::ReadGeometry(const std::string & path)
bool ImageKeywordlist::ReadGeometry(const std::string & /*path*/)
{
// The geom files used in OTB are simpler than what OSSIM actually supports
// It is basically a list of 'key: value' lines
......@@ -467,7 +474,7 @@ bool ImageKeywordlist::ReadGeometry(const std::string & path)
return false;
}
void ImageKeywordlist::WriteGeometry(const std::string& filename) const
void ImageKeywordlist::WriteGeometry(const std::string& /*filename*/) const
{
// Write the image keyword list if any (without using ossimKeywordlist)
// values in the keywordlist matching the regex '\n|\r| $|^ ' must be
......
......@@ -27,6 +27,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
......
......@@ -27,6 +27,8 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
......
......@@ -26,6 +26,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
......
......@@ -27,6 +27,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
......
......@@ -25,6 +25,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
......
......@@ -27,7 +27,7 @@ string_view lstrip(string_view const& v, string_view const& c )
{
string_view::const_iterator pos = std::find_if(
v.cbegin(), v.cend(),
[&v, &c](char in) -> bool {return std::find(c.cbegin(),c.cend(),in) == c.cend();});
[&c](char in) -> bool {return std::find(c.cbegin(),c.cend(),in) == c.cend();});
// Beware: returned string_view may be empty
return string_view(pos, v.cend());
......@@ -37,7 +37,7 @@ string_view rstrip(string_view const& v, string_view const& c )
{
string_view::const_reverse_iterator pos = std::find_if(
v.crbegin(), v.crend(),
[&v, &c](char in) -> bool {return std::find(c.cbegin(),c.cend(),in) == c.cend();});
[&c](char in) -> bool {return std::find(c.cbegin(),c.cend(),in) == c.cend();});
// Beware: returned string_view may be empty
return string_view(v.cbegin(), &*pos - &(*v.cbegin()) + 1);
......
......@@ -158,7 +158,7 @@ public:
* There values a computed by 6S. */
WavelengthSpectralBandVectorType GetSpectralSensitivity() const override;
void Parse(const MetadataSupplierInterface & mds);
void Parse(const MetadataSupplierInterface & mds) override;
protected:
SpotImageMetadataInterface() = default;
......
......@@ -36,7 +36,7 @@ GeomMetadataSupplier::GeomMetadataSupplier(std::string const& fileName)
this->ReadGeomFile();
}
std::string GeomMetadataSupplier::GetMetadataValue(std::string const& path, bool& hasValue, int band) const
std::string GeomMetadataSupplier::GetMetadataValue(std::string const& path, bool& hasValue, int /*band*/) const
{
auto value = this->m_MetadataDic.find(path);
if(value != this->m_MetadataDic.end())
......@@ -48,7 +48,7 @@ std::string GeomMetadataSupplier::GetMetadataValue(std::string const& path, bool
return "";
}
std::string GeomMetadataSupplier::GetResourceFile(std::string const& s) const
std::string GeomMetadataSupplier::GetResourceFile(std::string const& /*s*/) const
{
return this->m_FileName;
}
......
......@@ -36,7 +36,7 @@ XMLMetadataSupplier::XMLMetadataSupplier(const std::string & fileName)
CPLDestroyXMLNode(psNode);
}
std::string XMLMetadataSupplier::GetMetadataValue(std::string const& path, bool& hasValue, int band) const
std::string XMLMetadataSupplier::GetMetadataValue(std::string const& path, bool& hasValue, int /*band*/) const
{
const char * ret = CSLFetchNameValue(m_MetadataDic, path.c_str());
if (ret)
......@@ -83,7 +83,7 @@ std::string XMLMetadataSupplier::GetFirstMetadataValue(std::string const& path,
}
}
std::string XMLMetadataSupplier::GetResourceFile(std::string const& s) const
std::string XMLMetadataSupplier::GetResourceFile(std::string const& /*s*/) const
{
return m_FileName;
}
......
......@@ -28,6 +28,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
......
......@@ -45,6 +45,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
......
......@@ -51,7 +51,7 @@ int otbRPCTransformTest(int itkNotUsed(argc), char* argv[])
std::string rpcFile(argv[1]);
std::string gcpFileName(argv[2]);
double geoTol(atof(argv[3]));
double imgTol(atof(argv[4]));
// double imgTol(atof(argv[4]));
// Tools
auto imgDistance = DistanceType::New();
......
......@@ -34,8 +34,6 @@ int otbImageToGenericRSOutputParameters(int itkNotUsed(argc), char* argv[])
const char* infname = argv[1];
const char* outfname = argv[2];
typedef ImageType::SizeType SizeType;
typedef ImageType::SpacingType SpacingType;
typedef otb::ImageFileReader<ImageType> ReaderType;
// Reader
......
......@@ -47,6 +47,8 @@ typedef otb::GeographicalDistance<ImageType::PointType> Geographi
int produceGCP(char* outputgcpfilename, const otb::ImageMetadata& imd, bool useForwardSensorModel = true, double z = 16.19688987731934)
{
(void)useForwardSensorModel;
itk::Point<double, 2> imagePoint;
itk::Point<double, 2> geoPoint;
......
......@@ -430,7 +430,7 @@ void VectorDataExtractROI<TVectorData>::ProjectRegionToInputVectorProjection()
genericTransform->SetInputProjectionRef(m_ROI.GetRegionProjection());
//TODO: genericTransform->SetInputImageMetadata(m_ROI.GetImageMetadata());
genericTransform->SetOutputProjectionRef(this->GetInput()->GetProjectionRef());
const itk::MetaDataDictionary& inputDict = this->GetInput()->GetMetaDataDictionary();
//TODO: const itk::MetaDataDictionary& inputDict = this->GetInput()->GetMetaDataDictionary();
//TODO: genericTransform->SetOutputImageMetadata(this->GetInput()->GetImageMetadata());
genericTransform->SetOutputOrigin(this->GetInput()->GetOrigin());
genericTransform->SetOutputSpacing(this->GetInput()->GetSpacing());
......
......@@ -24,8 +24,12 @@
#include "otbMachineLearningModel.h"
#include <string>
// Quiet a deprecation warning
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
......@@ -70,10 +74,10 @@ template <class TInputValue, class NeuronType>
class ITK_EXPORT AutoencoderModel : public MachineLearningModel<itk::VariableLengthVector<TInputValue>, itk::VariableLengthVector<TInputValue>>
{
public:
typedef AutoencoderModel Self;
typedef AutoencoderModel Self;
typedef MachineLearningModel<itk::VariableLengthVector<TInputValue>, itk::VariableLengthVector<TInputValue>> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef typename Superclass::InputValueType InputValueType;
typedef typename Superclass::InputSampleType InputSampleType;
......@@ -91,7 +95,7 @@ public:
typedef typename Superclass::ProbaSampleType ProbaSampleType;
typedef typename Superclass::ProbaListSampleType ProbaListSampleType;
/// Neural network related typedefs
typedef shark::ConcatenatedModel<shark::RealVector> ModelType;
typedef shark::ConcatenatedModel<shark::RealVector> ModelType;
typedef shark::LinearModel<shark::RealVector, NeuronType> LayerType;
typedef shark::LinearModel<shark::RealVector, shark::LinearNeuron> OutLayerType;
......
......@@ -27,6 +27,7 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
......@@ -145,7 +146,7 @@ void AutoencoderModel<TInputValue, NeuronType>::TrainOneLayer(shark::AbstractSto
shark::Data<shark::RealVector>& samples, std::ostream& File)
{
typedef shark::AbstractModel<shark::RealVector, shark::RealVector> BaseModelType;
ModelType net;
ModelType net;
net.add(&(m_InLayers[layer_index]), true);
net.add((layer_index ? (BaseModelType*)&(m_InLayers[m_NumberOfHiddenNeurons.Size() * 2 - 1 - layer_index]) : (BaseModelType*)&m_OutLayer), true);
......@@ -156,7 +157,7 @@ void AutoencoderModel<TInputValue, NeuronType>::TrainOneLayer(shark::AbstractSto
//~ shark::ImpulseNoiseModel noise(inputs,m_Noise[layer_index],1.0); //set an input pixel with probability m_Noise to 0
//~ shark::ConcatenatedModel<shark::RealVector,shark::RealVector> model = noise>> net;
shark::LabeledData<shark::RealVector, shark::RealVector> trainSet(samples, samples); // labels identical to inputs
shark::SquaredLoss<shark::RealVector> loss;
shark::SquaredLoss<shark::RealVector> loss;
//~ shark::ErrorFunction error(trainSet, &model, &loss);
shark::ErrorFunction<> error(trainSet, &net, &loss);
......@@ -194,7 +195,7 @@ void AutoencoderModel<TInputValue, NeuronType>::TrainOneSparseLayer(shark::Abstr
shark::Data<shark::RealVector>& samples, std::ostream& File)
{
typedef shark::AbstractModel<shark::RealVector, shark::RealVector> BaseModelType;
ModelType net;
ModelType net;
net.add(&(m_InLayers[layer_index]), true);
net.add((layer_index ? (BaseModelType*)&(m_InLayers[m_NumberOfHiddenNeurons.Size() * 2 - 1 - layer_index]) : (BaseModelType*)&m_OutLayer), true);
......@@ -204,7 +205,7 @@ void AutoencoderModel<TInputValue, NeuronType>::TrainOneSparseLayer(shark::Abstr
// Idea : set the initials value for the output weights higher than the input weights
shark::LabeledData<shark::RealVector, shark::RealVector> trainSet(samples, samples); // labels identical to inputs
shark::SquaredLoss<shark::RealVector> loss;
shark::SquaredLoss<shark::RealVector> loss;
//~ shark::SparseAutoencoderError error(trainSet,&net, &loss, m_Rho[layer_index], m_Beta[layer_index]);
// SparseAutoencoderError doesn't exist anymore, for now use a plain ErrorFunction
shark::ErrorFunction<> error(trainSet, &net, &loss);
......@@ -249,7 +250,7 @@ void AutoencoderModel<TInputValue, NeuronType>::TrainNetwork(shark::AbstractStop
// labels identical to inputs
shark::LabeledData<shark::RealVector, shark::RealVector> trainSet(samples, samples);
shark::SquaredLoss<shark::RealVector> loss;
shark::SquaredLoss<shark::RealVector> loss;
shark::ErrorFunction<> error(trainSet, &net, &loss);
shark::TwoNormRegularizer<> regularizer(error.numberOfVariables());
......
......@@ -23,8 +23,12 @@
#include "otbMachineLearningModelTraits.h"
#include "otbMachineLearningModel.h"
// Quiet a deprecation warning
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
......@@ -65,10 +69,10 @@ template <class TInputValue>
class ITK_EXPORT PCAModel : public MachineLearningModel<itk::VariableLengthVector<TInputValue>, itk::VariableLengthVector<TInputValue>>
{
public:
typedef PCAModel Self;
typedef PCAModel Self;
typedef MachineLearningModel<itk::VariableLengthVector<TInputValue>, itk::VariableLengthVector<TInputValue>> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef typename Superclass::InputValueType InputValueType;
typedef typename Superclass::InputSampleType InputSampleType;
......
......@@ -26,6 +26,7 @@
#include "itkMacro.h"
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment