Commit a2faeda2 authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Update all clang & gcc warnings to macros

parent 6aeec190
...@@ -443,9 +443,9 @@ private: ...@@ -443,9 +443,9 @@ private:
class MockTestableFunctionParameterDecorator class MockTestableFunctionParameterDecorator
: public TestableFunctionParameterDecorator { : public TestableFunctionParameterDecorator {
public: public:
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_METHOD1(beforeDecoratedFunctionSet, void(const IFunction_sptr &)); MOCK_METHOD1(beforeDecoratedFunctionSet, void(const IFunction_sptr &));
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
}; };
}; };
......
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
private: private:
std::vector<V3D> getTestHKLs() { return {{1, 1, 0}}; } std::vector<V3D> getTestHKLs() { return {{1, 1, 0}}; }
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
// Mock function to check whether the correct methods are called // Mock function to check whether the correct methods are called
class MockLatticeFunction : public ILatticeFunction { class MockLatticeFunction : public ILatticeFunction {
public: public:
...@@ -104,6 +104,6 @@ private: ...@@ -104,6 +104,6 @@ private:
}; };
}; };
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
#endif /* MANTID_API_ILATTICEFUNCTIONTEST_H_ */ #endif /* MANTID_API_ILATTICEFUNCTIONTEST_H_ */
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
class ImplicitFunctionFactoryTest : public CxxTest::TestSuite { class ImplicitFunctionFactoryTest : public CxxTest::TestSuite {
private: private:
...@@ -107,7 +107,7 @@ private: ...@@ -107,7 +107,7 @@ private:
MOCK_METHOD1(setSuccessorParser, MOCK_METHOD1(setSuccessorParser,
void(Mantid::API::ImplicitFunctionParameterParser *successor)); void(Mantid::API::ImplicitFunctionParameterParser *successor));
}; };
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
class MockImplicitFunctionBuilderA class MockImplicitFunctionBuilderA
: public Mantid::API::ImplicitFunctionBuilder { : public Mantid::API::ImplicitFunctionBuilder {
......
...@@ -17,11 +17,11 @@ private: ...@@ -17,11 +17,11 @@ private:
class MockImplicitFunctionParameter class MockImplicitFunctionParameter
: public Mantid::API::ImplicitFunctionParameter { : public Mantid::API::ImplicitFunctionParameter {
public: public:
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_CONST_METHOD0(getName, std::string()); MOCK_CONST_METHOD0(getName, std::string());
MOCK_CONST_METHOD0(isValid, bool()); MOCK_CONST_METHOD0(isValid, bool());
MOCK_CONST_METHOD0(toXMLString, std::string()); MOCK_CONST_METHOD0(toXMLString, std::string());
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
protected: protected:
ImplicitFunctionParameter *clone() const override { ImplicitFunctionParameter *clone() const override {
return new MockImplicitFunctionParameter; return new MockImplicitFunctionParameter;
......
...@@ -14,7 +14,7 @@ public: ...@@ -14,7 +14,7 @@ public:
// Set this flag to true for testing // Set this flag to true for testing
m_dataReset = true; m_dataReset = true;
} }
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_CONST_METHOD0(name, std::string()); MOCK_CONST_METHOD0(name, std::string());
MOCK_CONST_METHOD0(supportsHistory, bool()); MOCK_CONST_METHOD0(supportsHistory, bool());
MOCK_CONST_METHOD0(buffersEvents, bool()); MOCK_CONST_METHOD0(buffersEvents, bool());
...@@ -25,7 +25,7 @@ public: ...@@ -25,7 +25,7 @@ public:
MOCK_METHOD0(runStatus, RunStatus()); MOCK_METHOD0(runStatus, RunStatus());
MOCK_CONST_METHOD0(runNumber, int()); MOCK_CONST_METHOD0(runNumber, int());
MOCK_METHOD1(setAlgorithm, void(const Mantid::API::IAlgorithm &)); MOCK_METHOD1(setAlgorithm, void(const Mantid::API::IAlgorithm &));
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
}; };
class LiveListenerTest : public CxxTest::TestSuite { class LiveListenerTest : public CxxTest::TestSuite {
......
...@@ -13,13 +13,13 @@ public: ...@@ -13,13 +13,13 @@ public:
boost::shared_ptr<ModeratorModel> clone() const override { boost::shared_ptr<ModeratorModel> clone() const override {
return boost::shared_ptr<MockModerator>(); return boost::shared_ptr<MockModerator>();
} }
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_CONST_METHOD0(emissionTimeMean, double()); MOCK_CONST_METHOD0(emissionTimeMean, double());
MOCK_CONST_METHOD0(emissionTimeVariance, double()); MOCK_CONST_METHOD0(emissionTimeVariance, double());
MOCK_CONST_METHOD1(sampleTimeDistribution, double(const double)); MOCK_CONST_METHOD1(sampleTimeDistribution, double(const double));
MOCK_METHOD2(setParameterValue, MOCK_METHOD2(setParameterValue,
void(const std::string &, const std::string &)); void(const std::string &, const std::string &));
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
}; };
class ModeratorModelTest : public CxxTest::TestSuite { class ModeratorModelTest : public CxxTest::TestSuite {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "MantidAPI/Sample.h" #include "MantidAPI/Sample.h"
#include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/WorkspaceFactory.h"
#include "MantidKernel/ConfigService.h" #include "MantidKernel/ConfigService.h"
#include "MantidKernel/WarningSuppressions.h"
#include "MantidTestHelpers/FakeObjects.h" #include "MantidTestHelpers/FakeObjects.h"
using Mantid::MantidVec; using Mantid::MantidVec;
...@@ -55,15 +56,13 @@ public: ...@@ -55,15 +56,13 @@ public:
MatrixWorkspace_sptr space; MatrixWorkspace_sptr space;
TS_ASSERT_THROWS_NOTHING( TS_ASSERT_THROWS_NOTHING(
space = WorkspaceFactory::Instance().create("work", 1, 1, 1)); space = WorkspaceFactory::Instance().create("work", 1, 1, 1));
// AppleClang gives warning if the result is unused. // clang-format off
#if __clang__ DIAG_OFF(unused-value)
#pragma clang diagnostic push // clang-format on
#pragma clang diagnostic ignored "-Wunused-value"
#endif
TS_ASSERT_THROWS_NOTHING(dynamic_cast<WorkspaceTester *>(space.get())); TS_ASSERT_THROWS_NOTHING(dynamic_cast<WorkspaceTester *>(space.get()));
#if __clang__ // clang-format off
#pragma clang diagnostic pop DIAG_ON(unused-value)
#endif // clang-format on
} }
/** Make a parent, have the child be created with the same sizes */ /** Make a parent, have the child be created with the same sizes */
......
...@@ -58,13 +58,13 @@ private: ...@@ -58,13 +58,13 @@ private:
// Helper type, representing some concrete workspace type. // Helper type, representing some concrete workspace type.
class MockWorkspace : public Mantid::API::Workspace { class MockWorkspace : public Mantid::API::Workspace {
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_CONST_METHOD0(id, const std::string()); MOCK_CONST_METHOD0(id, const std::string());
MOCK_CONST_METHOD0(name, const std::string()); MOCK_CONST_METHOD0(name, const std::string());
MOCK_CONST_METHOD0(threadSafe, bool()); MOCK_CONST_METHOD0(threadSafe, bool());
MOCK_CONST_METHOD0(toString, const std::string()); MOCK_CONST_METHOD0(toString, const std::string());
MOCK_CONST_METHOD0(getMemorySize, size_t()); MOCK_CONST_METHOD0(getMemorySize, size_t());
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
private: private:
MockWorkspace *doClone() const override { MockWorkspace *doClone() const override {
throw std::runtime_error("Cloning of MockWorkspace is not implemented."); throw std::runtime_error("Cloning of MockWorkspace is not implemented.");
......
...@@ -87,7 +87,7 @@ private: ...@@ -87,7 +87,7 @@ private:
class MockBeamProfile final : public Mantid::Algorithms::IBeamProfile { class MockBeamProfile final : public Mantid::Algorithms::IBeamProfile {
public: public:
using Mantid::Algorithms::IBeamProfile::Ray; using Mantid::Algorithms::IBeamProfile::Ray;
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_CONST_METHOD1(generatePoint, MOCK_CONST_METHOD1(generatePoint,
Ray(Mantid::Kernel::PseudoRandomNumberGenerator &)); Ray(Mantid::Kernel::PseudoRandomNumberGenerator &));
MOCK_CONST_METHOD2(generatePoint, MOCK_CONST_METHOD2(generatePoint,
...@@ -95,7 +95,7 @@ private: ...@@ -95,7 +95,7 @@ private:
const Mantid::Geometry::BoundingBox &)); const Mantid::Geometry::BoundingBox &));
MOCK_CONST_METHOD1(defineActiveRegion, Mantid::Geometry::BoundingBox( MOCK_CONST_METHOD1(defineActiveRegion, Mantid::Geometry::BoundingBox(
const Mantid::API::Sample &)); const Mantid::API::Sample &));
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
}; };
}; };
......
...@@ -13,7 +13,7 @@ using namespace Mantid::Algorithms; ...@@ -13,7 +13,7 @@ using namespace Mantid::Algorithms;
using namespace testing; using namespace testing;
class MockEntropy : public MaxentEntropy { class MockEntropy : public MaxentEntropy {
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
public: public:
MOCK_METHOD2(derivative, MOCK_METHOD2(derivative,
std::vector<double>(const std::vector<double> &, double)); std::vector<double>(const std::vector<double> &, double));
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
MOCK_METHOD1(imageToData, std::vector<double>(const std::vector<double> &)); MOCK_METHOD1(imageToData, std::vector<double>(const std::vector<double> &));
MOCK_METHOD1(dataToImage, std::vector<double>(const std::vector<double> &)); MOCK_METHOD1(dataToImage, std::vector<double>(const std::vector<double> &));
}; };
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
using MockEntropy_sptr = std::shared_ptr<MockEntropy>; using MockEntropy_sptr = std::shared_ptr<MockEntropy>;
class MaxentCalculatorTest : public CxxTest::TestSuite { class MaxentCalculatorTest : public CxxTest::TestSuite {
......
...@@ -25,7 +25,7 @@ namespace MonteCarloTesting { ...@@ -25,7 +25,7 @@ namespace MonteCarloTesting {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class MockRNG final : public Mantid::Kernel::PseudoRandomNumberGenerator { class MockRNG final : public Mantid::Kernel::PseudoRandomNumberGenerator {
public: public:
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_METHOD0(nextValue, double()); MOCK_METHOD0(nextValue, double());
MOCK_METHOD2(nextValue, double(double, double)); MOCK_METHOD2(nextValue, double(double, double));
MOCK_METHOD2(nextInt, int(int, int)); MOCK_METHOD2(nextInt, int(int, int));
...@@ -36,7 +36,7 @@ public: ...@@ -36,7 +36,7 @@ public:
MOCK_METHOD2(setRange, void(const double, const double)); MOCK_METHOD2(setRange, void(const double, const double));
MOCK_CONST_METHOD0(min, double()); MOCK_CONST_METHOD0(min, double());
MOCK_CONST_METHOD0(max, double()); MOCK_CONST_METHOD0(max, double());
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -72,7 +72,7 @@ createEventWorkspace(const int numberspectra, const int nDistrubutedEvents, ...@@ -72,7 +72,7 @@ createEventWorkspace(const int numberspectra, const int nDistrubutedEvents,
return retVal; return retVal;
} }
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
/* /*
This type is an IEventWorkspace, but not an EventWorkspace. This type is an IEventWorkspace, but not an EventWorkspace.
...@@ -115,7 +115,7 @@ private: ...@@ -115,7 +115,7 @@ private:
}; };
} }
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
//===================================================================================== //=====================================================================================
// Functional Tests // Functional Tests
......
...@@ -16,14 +16,14 @@ using namespace testing; ...@@ -16,14 +16,14 @@ using namespace testing;
namespace { namespace {
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
class MockProgressBase : public Mantid::Kernel::ProgressBase { class MockProgressBase : public Mantid::Kernel::ProgressBase {
public: public:
MOCK_METHOD1(doReport, void(const std::string &)); MOCK_METHOD1(doReport, void(const std::string &));
}; };
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
} }
class FindSXPeaksHelperTest : public CxxTest::TestSuite { class FindSXPeaksHelperTest : public CxxTest::TestSuite {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
namespace Mantid { namespace Mantid {
namespace Crystal { namespace Crystal {
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
// Mock Background strategy // Mock Background strategy
class MockBackgroundStrategy : public BackgroundStrategy { class MockBackgroundStrategy : public BackgroundStrategy {
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
} }
}; };
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
} }
} }
......
...@@ -33,7 +33,7 @@ IPeaksWorkspace_sptr make_peaks_workspace(const V3D &hklPeak) { ...@@ -33,7 +33,7 @@ IPeaksWorkspace_sptr make_peaks_workspace(const V3D &hklPeak) {
return peakWS; return peakWS;
} }
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
// Mock Background strategy // Mock Background strategy
class MockIMDIterator : public IMDIterator { class MockIMDIterator : public IMDIterator {
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
MOCK_CONST_METHOD1(isWithinBounds, bool(size_t)); MOCK_CONST_METHOD1(isWithinBounds, bool(size_t));
}; };
} }
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
class PeakBackgroundTest : public CxxTest::TestSuite { class PeakBackgroundTest : public CxxTest::TestSuite {
public: public:
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Includes // Includes
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#include "MantidCurveFitting/Functions/CrystalElectricField.h" #include "MantidCurveFitting/Functions/CrystalElectricField.h"
#include "MantidKernel/WarningSuppressions.h"
#include <algorithm> #include <algorithm>
#include <array> #include <array>
...@@ -14,12 +15,11 @@ namespace Functions { ...@@ -14,12 +15,11 @@ namespace Functions {
namespace { namespace {
#ifdef __clang__
// The missing braces warning is a false positive - // The missing braces warning is a false positive -
// https://llvm.org/bugs/show_bug.cgi?id=21629 // https://llvm.org/bugs/show_bug.cgi?id=21629
#pragma clang diagnostic push // clang-format off
#pragma clang diagnostic ignored "-Wmissing-braces" DIAG_OFF(missing-braces)
#endif // clang-format on
// Get a complex conjugate of the value returned by // Get a complex conjugate of the value returned by
// ComplexMatrix::operator(i,j) // ComplexMatrix::operator(i,j)
...@@ -636,9 +636,9 @@ void diagonalise(const ComplexFortranMatrix &hamiltonian, ...@@ -636,9 +636,9 @@ void diagonalise(const ComplexFortranMatrix &hamiltonian,
eigenvalues += -eshift; eigenvalues += -eshift;
} }
#ifdef __clang__ // clang-format off
#pragma clang diagnostic pop DIAG_OFF(missing-braces)
#endif // clang-format on
} // anonymous namespace } // anonymous namespace
......
...@@ -1287,7 +1287,7 @@ TMDE(void MDGridBox)::centroidSphere(API::CoordTransform &radiusTransform, ...@@ -1287,7 +1287,7 @@ TMDE(void MDGridBox)::centroidSphere(API::CoordTransform &radiusTransform,
} }
//----------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------
// clang-format off // clang-format off
GCC_DIAG_OFF(array-bounds) DIAG_OFF(array-bounds)
// clang-format on // clang-format on
/** Integrate the signal within a sphere; for example, to perform single-crystal /** Integrate the signal within a sphere; for example, to perform single-crystal
* peak integration. * peak integration.
...@@ -1493,7 +1493,7 @@ TMDE(void MDGridBox)::integrateCylinder( ...@@ -1493,7 +1493,7 @@ TMDE(void MDGridBox)::integrateCylinder(
delete[] boxMightTouch; delete[] boxMightTouch;
} }
// clang-format off // clang-format off
GCC_DIAG_ON(array-bounds) DIAG_ON(array-bounds)
// clang-format on // clang-format on
/** /**
......
...@@ -1347,7 +1347,7 @@ uint64_t MDHistoWorkspace::sumNContribEvents() const { ...@@ -1347,7 +1347,7 @@ uint64_t MDHistoWorkspace::sumNContribEvents() const {
* Get the Q frame system (if any) to use. * Get the Q frame system (if any) to use.
*/ */
// clang-format off // clang-format off
GCC_DIAG_OFF(strict-aliasing) DIAG_OFF(strict-aliasing)
// clang-format on // clang-format on
Kernel::SpecialCoordinateSystem Kernel::SpecialCoordinateSystem
MDHistoWorkspace::getSpecialCoordinateSystem() const { MDHistoWorkspace::getSpecialCoordinateSystem() const {
......
...@@ -492,9 +492,9 @@ public: ...@@ -492,9 +492,9 @@ public:
pBC(MDBox<MDLeanEvent<2>, 2>::getBoxController()) pBC(MDBox<MDLeanEvent<2>, 2>::getBoxController())
{} {}
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_CONST_METHOD0(getIsMasked, bool()); MOCK_CONST_METHOD0(getIsMasked, bool());
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
~MockMDBox() override { delete pBC; } ~MockMDBox() override { delete pBC; }
}; };
...@@ -570,10 +570,10 @@ public: ...@@ -570,10 +570,10 @@ public:
/// Mock Skipping Policy Type to inject. /// Mock Skipping Policy Type to inject.
class MockSkippingPolicy : public SkippingPolicy { class MockSkippingPolicy : public SkippingPolicy {
public: public:
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_CONST_METHOD0(keepGoing, bool()); MOCK_CONST_METHOD0(keepGoing, bool());
MOCK_METHOD0(Die, void()); MOCK_METHOD0(Die, void());
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
~MockSkippingPolicy() override { Die(); } ~MockSkippingPolicy() override { Die(); }
}; };
......
...@@ -47,12 +47,12 @@ private: ...@@ -47,12 +47,12 @@ private:
MockMDBox() MockMDBox()
: MDBox<MDLeanEvent<1>, 1>(new API::BoxController(1)), : MDBox<MDLeanEvent<1>, 1>(new API::BoxController(1)),
pBC(MDBox<MDLeanEvent<1>, 1>::getBoxController()) {} pBC(MDBox<MDLeanEvent<1>, 1>::getBoxController()) {}
GCC_DIAG_OFF_SUGGEST_OVERRIDE DIAG_OFF_SUGGEST_OVERRIDE
MOCK_CONST_METHOD0(getIsMasked, bool()); MOCK_CONST_METHOD0(getIsMasked, bool());
MOCK_METHOD0(mask, void()); MOCK_METHOD0(mask, void());
MOCK_METHOD0(unmask, void()); MOCK_METHOD0(unmask, void());
~MockMDBox() override { delete pBC; } ~MockMDBox() override { delete pBC; }
GCC_DIAG_ON_SUGGEST_OVERRIDE DIAG_ON_SUGGEST_OVERRIDE
}; };
// the sp to a box controller used as general reference to all tested // the sp to a box controller used as general reference to all tested
......
Supports Markdown
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