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