From e52fd83626dd5ee3d6007a6531e790748fbfbe9e Mon Sep 17 00:00:00 2001 From: Steven Hahn <hahnse@ornl.gov> Date: Mon, 12 Mar 2018 18:00:17 -0400 Subject: [PATCH] Fix or suppress warnings from clang 6.0 --- Framework/API/inc/MantidAPI/IMaskWorkspace.h | 1 + Framework/Algorithms/src/PolarizationEfficiencyCor.cpp | 4 ++-- .../Crystal/inc/MantidCrystal/FindSXPeaksHelper.h | 4 ++++ .../src/FuncMinimizers/FABADAMinimizer.cpp | 4 ++-- .../Geometry/inc/MantidGeometry/Crystal/HKLGenerator.h | 2 +- .../Geometry/inc/MantidGeometry/Objects/IObject.h | 1 + Framework/Geometry/src/Crystal/HKLGenerator.cpp | 10 +++++----- Framework/Geometry/src/Math/BnId.cpp | 4 ---- Framework/Kernel/src/MaterialXMLParser.cpp | 1 + .../LiveData/inc/MantidLiveData/Kafka/IKafkaBroker.h | 2 +- Framework/Parallel/inc/MantidParallel/Status.h | 9 ++++++--- Framework/Parallel/test/EventParserTest.h | 2 +- .../mantid/kernel/src/Converters/CloneToNumpy.cpp | 1 + .../mantid/kernel/src/Converters/DateAndTime.cpp | 7 +++++++ .../mantid/kernel/src/Converters/NDArrayToVector.cpp | 8 ++++++++ .../lib/3rdparty/qtcolorpicker/src/qtcolorpicker.cpp | 5 +---- .../IEnggDiffMultiRunFittingWidgetAdder.h | 1 + 17 files changed, 43 insertions(+), 23 deletions(-) diff --git a/Framework/API/inc/MantidAPI/IMaskWorkspace.h b/Framework/API/inc/MantidAPI/IMaskWorkspace.h index cd51c350aaf..b1a9dddd6d8 100644 --- a/Framework/API/inc/MantidAPI/IMaskWorkspace.h +++ b/Framework/API/inc/MantidAPI/IMaskWorkspace.h @@ -38,6 +38,7 @@ class DLLExport IMaskWorkspace { public: IMaskWorkspace() = default; IMaskWorkspace &operator=(const IMaskWorkspace &) = delete; + virtual ~IMaskWorkspace() = default; /// Return the workspace typeID virtual const std::string id() const { return "IMaskWorkspace"; } /// Total number of masked pixels diff --git a/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp b/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp index 553dcd3ab95..3d30c504028 100644 --- a/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp +++ b/Framework/Algorithms/src/PolarizationEfficiencyCor.cpp @@ -557,8 +557,8 @@ void PolarizationEfficiencyCor::checkConsistentX( const auto &P2x = efficiencies.P2->x(); checkX(P2x, "P2"); // A local helper function to check an input workspace against F1. - auto checkWS = [&F1x, &checkX](const API::MatrixWorkspace_sptr &ws, - const std::string &tag) { + auto checkWS = [&checkX](const API::MatrixWorkspace_sptr &ws, + const std::string &tag) { const auto nHist = ws->getNumberHistograms(); for (size_t i = 0; i != nHist; ++i) { checkX(ws->x(i), tag); diff --git a/Framework/Crystal/inc/MantidCrystal/FindSXPeaksHelper.h b/Framework/Crystal/inc/MantidCrystal/FindSXPeaksHelper.h index 83c03c8fc5f..e021920f5c8 100644 --- a/Framework/Crystal/inc/MantidCrystal/FindSXPeaksHelper.h +++ b/Framework/Crystal/inc/MantidCrystal/FindSXPeaksHelper.h @@ -122,6 +122,7 @@ private: * ------------------------------------------------------------------------------------------ */ struct DLLExport BackgroundStrategy { + virtual ~BackgroundStrategy() = default; virtual bool isBelowBackground(const double intensity, const HistogramData::HistogramY &y) const = 0; }; @@ -155,6 +156,7 @@ public: const double minValue = EMPTY_DBL(), const double maxValue = EMPTY_DBL(), const XAxisUnit units = XAxisUnit::TOF); + virtual ~PeakFindingStrategy() = default; PeakList findSXPeaks(const HistogramData::HistogramX &x, const HistogramData::HistogramY &y, const int workspaceIndex) const; @@ -219,6 +221,7 @@ private: */ class DLLExport CompareStrategy { public: + virtual ~CompareStrategy() = default; virtual bool compare(const SXPeak &lhs, const SXPeak &rhs) const = 0; }; @@ -253,6 +256,7 @@ private: class DLLExport ReducePeakListStrategy { public: ReducePeakListStrategy(const CompareStrategy *compareStrategy); + virtual ~ReducePeakListStrategy() = default; virtual std::vector<SXPeak> reduce(const std::vector<SXPeak> &peaks, Mantid::Kernel::ProgressBase &progress) const = 0; diff --git a/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp index 98ecd9628f8..fa2ce0ddb6a 100644 --- a/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/FABADAMinimizer.cpp @@ -959,12 +959,12 @@ void FABADAMinimizer::calculateConvChainAndBestParameters( auto posBestPar = std::find(reducedChain[j].begin(), reducedChain[j].end(), bestParameters[j]); double varLeft = 0, varRight = 0; - for (auto k = reducedChain[j].begin(); k < reducedChain[j].end(); k++) { + for (auto k = reducedChain[j].begin(); k < reducedChain[j].end(); + k += 2) { if (k < posBestPar) varLeft += (*k - bestParameters[j]) * (*k - bestParameters[j]); else if (k > posBestPar) varRight += (*k - bestParameters[j]) * (*k - bestParameters[j]); - ++k; } if (posBestPar != reducedChain[j].begin()) varLeft /= double(posBestPar - reducedChain[j].begin()); diff --git a/Framework/Geometry/inc/MantidGeometry/Crystal/HKLGenerator.h b/Framework/Geometry/inc/MantidGeometry/Crystal/HKLGenerator.h index b20d11ccf2f..b3467fdf709 100644 --- a/Framework/Geometry/inc/MantidGeometry/Crystal/HKLGenerator.h +++ b/Framework/Geometry/inc/MantidGeometry/Crystal/HKLGenerator.h @@ -143,7 +143,7 @@ public: int m_h, m_k, m_l; Kernel::V3D m_hkl; - int m_hMin, m_hMax; + int m_hMax; int m_kMin, m_kMax; int m_lMin, m_lMax; }; diff --git a/Framework/Geometry/inc/MantidGeometry/Objects/IObject.h b/Framework/Geometry/inc/MantidGeometry/Objects/IObject.h index 24331e80752..6b186d0b7ac 100644 --- a/Framework/Geometry/inc/MantidGeometry/Objects/IObject.h +++ b/Framework/Geometry/inc/MantidGeometry/Objects/IObject.h @@ -54,6 +54,7 @@ class vtkGeometryCacheWriter; */ class MANTID_GEOMETRY_DLL IObject { public: + virtual ~IObject() = default; virtual bool isValid(const Kernel::V3D &) const = 0; virtual bool isOnSide(const Kernel::V3D &) const = 0; virtual int calcValidType(const Kernel::V3D &Pt, diff --git a/Framework/Geometry/src/Crystal/HKLGenerator.cpp b/Framework/Geometry/src/Crystal/HKLGenerator.cpp index 9d56c3a2f5d..0979b69dff5 100644 --- a/Framework/Geometry/src/Crystal/HKLGenerator.cpp +++ b/Framework/Geometry/src/Crystal/HKLGenerator.cpp @@ -62,20 +62,20 @@ V3D HKLGenerator::getEndHKL() const { /// Default constructor, requirement from boost::iterator_facade HKLGenerator::const_iterator::const_iterator() - : m_h(0), m_k(0), m_l(0), m_hkl(V3D(0, 0, 0)), m_hMin(0), m_hMax(0), - m_kMin(0), m_kMax(0), m_lMin(0), m_lMax(0) {} + : m_h(0), m_k(0), m_l(0), m_hkl(V3D(0, 0, 0)), m_hMax(0), m_kMin(0), + m_kMax(0), m_lMin(0), m_lMax(0) {} /// Return an iterator with min = max = current. HKLGenerator::const_iterator::const_iterator(const V3D ¤t) : m_h(static_cast<int>(current.X())), m_k(static_cast<int>(current.Y())), - m_l(static_cast<int>(current.Z())), m_hkl(current), m_hMin(m_h), - m_hMax(m_h), m_kMin(m_k), m_kMax(m_k), m_lMin(m_l), m_lMax(m_l) {} + m_l(static_cast<int>(current.Z())), m_hkl(current), m_hMax(m_h), + m_kMin(m_k), m_kMax(m_k), m_lMin(m_l), m_lMax(m_l) {} /// Return an iterator that can move from min to max, with current = min HKLGenerator::const_iterator::const_iterator(const V3D &hklMin, const V3D &hklMax) : m_h(static_cast<int>(hklMin.X())), m_k(static_cast<int>(hklMin.Y())), - m_l(static_cast<int>(hklMin.Z())), m_hkl(hklMin), m_hMin(m_h), + m_l(static_cast<int>(hklMin.Z())), m_hkl(hklMin), m_hMax(static_cast<int>(hklMax.X())), m_kMin(m_k), m_kMax(static_cast<int>(hklMax.Y())), m_lMin(m_l), m_lMax(static_cast<int>(hklMax.Z())) {} diff --git a/Framework/Geometry/src/Math/BnId.cpp b/Framework/Geometry/src/Math/BnId.cpp index 84088af0014..7fb6b3b33b7 100644 --- a/Framework/Geometry/src/Math/BnId.cpp +++ b/Framework/Geometry/src/Math/BnId.cpp @@ -110,8 +110,6 @@ int BnId::operator<(const BnId &A) const { if (A.size != size) return size < A.size; - std::pair<int, int> cntA(0, 0); // count for A - std::pair<int, int> cntT(0, 0); // count for this if (Znum != A.Znum) return (Znum < A.Znum) ? 1 : 0; @@ -282,8 +280,6 @@ std::pair<int, BnId> BnId::makeCombination(const BnId &A) const return std::pair<int, BnId>(0, BnId()); int flag(0); // numb of diff - std::pair<int, int> Tcnt(0, 0); // this counter - std::pair<int, int> Acnt(0, 0); // A counter auto avc = A.Tval.cbegin(); std::vector<int>::const_iterator chpt; // change point for (auto tvc = Tval.cbegin(); tvc != Tval.cend(); ++tvc, ++avc) { diff --git a/Framework/Kernel/src/MaterialXMLParser.cpp b/Framework/Kernel/src/MaterialXMLParser.cpp index 1e110f55d4e..51425438731 100644 --- a/Framework/Kernel/src/MaterialXMLParser.cpp +++ b/Framework/Kernel/src/MaterialXMLParser.cpp @@ -51,6 +51,7 @@ const char *ABSORB_ATT = "absorptionxsec"; // Base type to put in a hash struct BuilderHandle { + virtual ~BuilderHandle() = default; virtual void operator()(MaterialBuilder &builder, const std::string &value) const = 0; }; diff --git a/Framework/LiveData/inc/MantidLiveData/Kafka/IKafkaBroker.h b/Framework/LiveData/inc/MantidLiveData/Kafka/IKafkaBroker.h index 0b83329afb8..6104a95cd48 100644 --- a/Framework/LiveData/inc/MantidLiveData/Kafka/IKafkaBroker.h +++ b/Framework/LiveData/inc/MantidLiveData/Kafka/IKafkaBroker.h @@ -35,7 +35,7 @@ namespace LiveData { */ class DLLExport IKafkaBroker { public: - ~IKafkaBroker() = default; + virtual ~IKafkaBroker() = default; virtual std::unique_ptr<IKafkaStreamSubscriber> subscribe(std::vector<std::string> topics, diff --git a/Framework/Parallel/inc/MantidParallel/Status.h b/Framework/Parallel/inc/MantidParallel/Status.h index adbb5c852be..965a117cf8c 100644 --- a/Framework/Parallel/inc/MantidParallel/Status.h +++ b/Framework/Parallel/inc/MantidParallel/Status.h @@ -44,7 +44,8 @@ class ThreadingBackend; class MANTID_PARALLEL_DLL Status { public: #ifdef MPI_EXPERIMENTAL - Status(const boost::mpi::status &status) : m_status(status) {} + Status(const boost::mpi::status &status) + : m_status(status), m_threadingBackend{false} {} #endif template <typename T> boost::optional<int> count() const { @@ -56,12 +57,14 @@ public: } private: - Status(const size_t size) : m_size(size), m_threadingBackend(true) {} + Status(const size_t size) : m_size(size) {} #ifdef MPI_EXPERIMENTAL boost::mpi::status m_status; #endif const size_t m_size{0}; - const bool m_threadingBackend{false}; +#ifdef MPI_EXPERIMENTAL + bool m_threadingBackend{true}; +#endif // For accessing constructor based on size. friend class detail::ThreadingBackend; }; diff --git a/Framework/Parallel/test/EventParserTest.h b/Framework/Parallel/test/EventParserTest.h index 0dce40044bd..2de672e236a 100644 --- a/Framework/Parallel/test/EventParserTest.h +++ b/Framework/Parallel/test/EventParserTest.h @@ -97,7 +97,7 @@ private: static_cast<IndexType>(m_bank_offsets[bank] + absolutePixel)); std::transform(list.cbegin() + prev_end, list.cend(), std::back_inserter(m_event_time_offsets[bank]), - [this](const TofEvent &event) { + [](const TofEvent &event) { return static_cast<TimeOffsetType>(event.tof()); }); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Converters/CloneToNumpy.cpp b/Framework/PythonInterface/mantid/kernel/src/Converters/CloneToNumpy.cpp index bf501e26a4b..fb49c9d5934 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Converters/CloneToNumpy.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Converters/CloneToNumpy.cpp @@ -22,6 +22,7 @@ extern template int NDArrayTypeIndex<unsigned long>::typenum; extern template int NDArrayTypeIndex<unsigned long long>::typenum; extern template int NDArrayTypeIndex<float>::typenum; extern template int NDArrayTypeIndex<double>::typenum; +extern template int NDArrayTypeIndex<Mantid::Types::Core::DateAndTime>::typenum; namespace Impl { /** diff --git a/Framework/PythonInterface/mantid/kernel/src/Converters/DateAndTime.cpp b/Framework/PythonInterface/mantid/kernel/src/Converters/DateAndTime.cpp index 17e46c70885..539d41c26a2 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Converters/DateAndTime.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Converters/DateAndTime.cpp @@ -42,7 +42,14 @@ PyArray_Descr *descr_ns() { return func_PyArray_Descr("M8[ns]"); } // internal function that handles raw pointer boost::shared_ptr<Types::Core::DateAndTime> to_dateandtime(const PyObject *datetime) { +#if __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-qual" +#endif if (!PyArray_IsScalar(datetime, Datetime)) { +#if __clang__ +#pragma clang diagnostic pop +#endif throw std::runtime_error("Expected datetime64"); } diff --git a/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayToVector.cpp b/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayToVector.cpp index 94668f5a1d3..93f0a100d4c 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayToVector.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Converters/NDArrayToVector.cpp @@ -27,6 +27,14 @@ extern template int NDArrayTypeIndex<unsigned long>::typenum; extern template int NDArrayTypeIndex<unsigned long long>::typenum; extern template int NDArrayTypeIndex<float>::typenum; extern template int NDArrayTypeIndex<double>::typenum; +extern template int NDArrayTypeIndex<bool>::typecode; +extern template int NDArrayTypeIndex<int>::typecode; +extern template int NDArrayTypeIndex<long>::typecode; +extern template int NDArrayTypeIndex<long long>::typecode; +extern template int NDArrayTypeIndex<unsigned int>::typecode; +extern template int NDArrayTypeIndex<unsigned long>::typecode; +extern template int NDArrayTypeIndex<unsigned long long>::typecode; +extern template int NDArrayTypeIndex<double>::typecode; } namespace { diff --git a/MantidPlot/src/lib/3rdparty/qtcolorpicker/src/qtcolorpicker.cpp b/MantidPlot/src/lib/3rdparty/qtcolorpicker/src/qtcolorpicker.cpp index 0ebcec2d711..c599b26d407 100644 --- a/MantidPlot/src/lib/3rdparty/qtcolorpicker/src/qtcolorpicker.cpp +++ b/MantidPlot/src/lib/3rdparty/qtcolorpicker/src/qtcolorpicker.cpp @@ -605,10 +605,7 @@ void ColorPickerPopup::insertColor(const QColor &col, const QString &text, QColor ColorPickerPopup::color(int index) const { if (index < 0 || index > (int)items.count() - 1) return QColor(); - - // cppcheck-suppress cstyleCast - ColorPickerPopup *that = (ColorPickerPopup *)this; - return that->items.at(index)->color(); + return this->items.at(index)->color(); } /*! \internal diff --git a/qt/scientific_interfaces/EnggDiffraction/IEnggDiffMultiRunFittingWidgetAdder.h b/qt/scientific_interfaces/EnggDiffraction/IEnggDiffMultiRunFittingWidgetAdder.h index 55657b8990b..03c3c3e8e20 100644 --- a/qt/scientific_interfaces/EnggDiffraction/IEnggDiffMultiRunFittingWidgetAdder.h +++ b/qt/scientific_interfaces/EnggDiffraction/IEnggDiffMultiRunFittingWidgetAdder.h @@ -9,6 +9,7 @@ namespace CustomInterfaces { class IEnggDiffMultiRunFittingWidgetAdder { public: + virtual ~IEnggDiffMultiRunFittingWidgetAdder() = default; virtual void operator()(IEnggDiffMultiRunFittingWidgetOwner &owner) = 0; }; -- GitLab