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

Update all clang & gcc warnings to macros

parent 6aeec190
#ifndef TCP_EVENT_STREAM_DEFS_H
#define TCP_EVENT_STREAM_DEFS_H
#include "MantidKernel/WarningSuppressions.h"
#include <cstdint>
#include <cstring>
#include <ctime>
#include <vector>
// to ignore warnings when comparing header versions
#if defined(__GNUC__) && !(defined(__INTEL_COMPILER))
#pragma GCC diagnostic ignored "-Wtype-limits"
#elif defined(_WIN32)
// clang-format off
DIAG_OFF(type-limits)
// clang-format on
#if defined(_WIN32)
#pragma warning(disable : 4296)
#endif
......@@ -49,10 +52,10 @@ struct TCPStreamEventHeader {
TCPStreamEventHeader(uint32_t type_)
: marker1(marker), marker2(marker), version(current_version),
length(sizeof(TCPStreamEventHeader)), type(type_) {}
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"
#endif
// clang-format off
DIAG_OFF(autological-compare)
// clang-format on
bool isValid() const {
return marker1 == marker && marker2 == marker &&
length >= sizeof(TCPStreamEventHeader) &&
......@@ -60,9 +63,10 @@ struct TCPStreamEventHeader {
minorVersion() >= TCPStreamEventHeader::minor_version &&
type != InvalidStream;
}
#if __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(autological-compare)
// clang-format on
static const uint32_t major_version =
1; ///< starts at 1, then incremented whenever layout of this or further
/// packets changes in a non backward compatible way
......@@ -190,4 +194,8 @@ struct TCPStreamEventDataSE {
};
}
}
// clang-format off
DIAG_ON(type-limits)
// clang-format on
#endif /* TCP_EVENT_STREAM_DEFS_H */
......@@ -22,7 +22,7 @@
// Avoid compiler warnings on gcc from unused static constants in
// isisds_command.h
// clang-format off
GCC_DIAG_OFF(unused-variable)
DIAG_OFF(unused-variable)
// clang-format on
#endif
#include "DAE/idc.h"
......
......@@ -20,7 +20,7 @@
// Avoid compiler warnings on gcc from unused static constants in
// isisds_command.h
// clang-format off
GCC_DIAG_OFF(unused-variable)
DIAG_OFF(unused-variable)
// clang-format on
#endif
#include "DAE/idc.h"
......
......@@ -14,13 +14,17 @@
#include "MantidLiveData/Exception.h"
#include "MantidLiveData/Kafka/KafkaTopicSubscriber.h"
GCC_DIAG_OFF(conversion)
// clang-format off
DIAG_OFF(conversion)
// clang-format on
#include "private/Schema/ba57_run_info_generated.h"
#include "private/Schema/df12_det_spec_map_generated.h"
#include "private/Schema/ev42_events_generated.h"
#include "private/Schema/f142_logdata_generated.h"
#include "private/Schema/is84_isis_events_generated.h"
GCC_DIAG_ON(conversion)
// clang-format off
DIAG_ON(conversion)
// clang-format on
using namespace Mantid::Types;
......
......@@ -8,13 +8,17 @@
#include "MantidTypes/Core/DateAndTime.h"
#include <gmock/gmock.h>
GCC_DIAG_OFF(conversion)
// clang-format off
DIAG_OFF(conversion)
// clang-format on
#include "Kafka/private/Schema/ba57_run_info_generated.h"
#include "Kafka/private/Schema/df12_det_spec_map_generated.h"
#include "Kafka/private/Schema/ev42_events_generated.h"
#include "Kafka/private/Schema/f142_logdata_generated.h"
#include "Kafka/private/Schema/is84_isis_events_generated.h"
GCC_DIAG_ON(conversion)
// clang-format off
DIAG_ON(conversion)
// clang-format on
#include <ctime>
......@@ -29,7 +33,7 @@ public:
std::unique_ptr<Mantid::LiveData::IKafkaStreamSubscriber>;
using IKafkaStreamSubscriber_ptr = Mantid::LiveData::IKafkaStreamSubscriber *;
GCC_DIAG_OFF_SUGGEST_OVERRIDE
DIAG_OFF_SUGGEST_OVERRIDE
// GMock cannot mock non-copyable return types so we resort to a small
// adapter method. Users have to use EXPECT_CALL(subscribe_) instead
MOCK_CONST_METHOD2(subscribe_, IKafkaStreamSubscriber_ptr(
......@@ -50,7 +54,7 @@ public:
return std::unique_ptr<Mantid::LiveData::IKafkaStreamSubscriber>(
this->subscribe_(s, offset, option));
}
GCC_DIAG_ON_SUGGEST_OVERRIDE
DIAG_ON_SUGGEST_OVERRIDE
};
// -----------------------------------------------------------------------------
......
......@@ -12,12 +12,13 @@
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "MantidGeometry/MDGeometry/MDHistoDimensionBuilder.h"
#include "MantidKernel/ListValidator.h"
#include "MantidKernel/make_unique.h"
#include "MantidKernel/Matrix.h"
#include "MantidKernel/Memory.h"
#include "MantidKernel/ThreadScheduler.h"
#include "MantidKernel/Timer.h"
#include "MantidKernel/V3D.h"
#include "MantidKernel/WarningSuppressions.h"
#include "MantidKernel/make_unique.h"
namespace Mantid {
namespace MDAlgorithms {
......@@ -482,12 +483,11 @@ std::vector<float> LoadSQW2::calculateDimLimitsFromData() {
return dimLimits;
}
#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
/**
* Create the Q MDHistoDimension for the output frame and given information
* from the file
......@@ -540,9 +540,10 @@ LoadSQW2::createQDimension(size_t index, float dimMin, float dimMax,
return builder.create();
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(missing-braces)
// clang-format on
/**
* Create an energy dimension
......
......@@ -34,7 +34,7 @@ using namespace Mantid::MDAlgorithms;
using Mantid::coord_t;
class BinMDTest : public CxxTest::TestSuite {
GCC_DIAG_OFF_SUGGEST_OVERRIDE
DIAG_OFF_SUGGEST_OVERRIDE
private:
// Helper class. Mock Implicit function.
class MockImplicitFunction : public Mantid::Geometry::MDImplicitFunction {
......@@ -45,7 +45,7 @@ private:
std::string getName() const override { return "MockImplicitFunction"; }
MOCK_CONST_METHOD0(toXMLString, std::string());
};
GCC_DIAG_ON_SUGGEST_OVERRIDE
DIAG_ON_SUGGEST_OVERRIDE
// Helper class. Builds mock implicit functions.
class MockImplicitFunctionBuilder
: public Mantid::API::ImplicitFunctionBuilder {
......
......@@ -19,7 +19,7 @@ using namespace Mantid::DataObjects;
using namespace Mantid::MDAlgorithms;
using namespace testing;
GCC_DIAG_OFF_SUGGEST_OVERRIDE
DIAG_OFF_SUGGEST_OVERRIDE
class MockBinaryOperationMD : public BinaryOperationMD {
public:
......@@ -35,7 +35,7 @@ public:
Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar));
void exec() override { BinaryOperationMD::exec(); }
};
GCC_DIAG_ON_SUGGEST_OVERRIDE
DIAG_ON_SUGGEST_OVERRIDE
class BinaryOperationMDTest : public CxxTest::TestSuite {
public:
// This pair of boilerplate methods prevent the suite being created statically
......
......@@ -9,7 +9,7 @@
using namespace Mantid::MDAlgorithms;
using namespace testing;
GCC_DIAG_OFF_SUGGEST_OVERRIDE
DIAG_OFF_SUGGEST_OVERRIDE
class MockBooleanBinaryOperationMD : public BooleanBinaryOperationMD {
public:
MOCK_METHOD0(initExtraProperties, void());
......@@ -17,7 +17,7 @@ public:
void(Mantid::DataObjects::MDHistoWorkspace_sptr,
Mantid::DataObjects::MDHistoWorkspace_const_sptr));
};
GCC_DIAG_ON_SUGGEST_OVERRIDE
DIAG_ON_SUGGEST_OVERRIDE
class BooleanBinaryOperationMDTest : public CxxTest::TestSuite {
public:
void test_basics() {
......
......@@ -8,8 +8,9 @@
#include "MantidAPI/Run.h"
#include "MantidAPI/Sample.h"
#include "MantidGeometry/Crystal/OrientedLattice.h"
#include "MantidMDAlgorithms/LoadSQW2.h"
#include "MantidKernel/WarningSuppressions.h"
#include "MantidKernel/make_unique.h"
#include "MantidMDAlgorithms/LoadSQW2.h"
#include <Poco/TemporaryFile.h>
......@@ -189,12 +190,9 @@ private:
}
}
#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
DimensionProperties getExpectedDimProperties(std::string outputFrame,
DataType dtype) {
DimensionProperties expected;
......@@ -235,9 +233,9 @@ private:
return expected;
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(missing-braces)
// clang-format on
void checkExperimentInfoAsExpected(const IMDEventWorkspace &outputWS) {
TS_ASSERT_EQUALS(2, outputWS.getNumExperimentInfo());
......
......@@ -101,7 +101,6 @@ public:
auto &Azimuthal = tws->getColVector<double>("Azimuthal");
auto &detDir = tws->getColVector<Kernel::V3D>("DetDirections");
TS_ASSERT(&detDir[0]);
TS_ASSERT_EQUALS(nVal, detDir.size());
for (size_t i = 0; i < nVal; i++) {
......
......@@ -23,11 +23,11 @@ using namespace testing;
class MockUnaryOperationMD : public UnaryOperationMD {
public:
GCC_DIAG_OFF_SUGGEST_OVERRIDE
DIAG_OFF_SUGGEST_OVERRIDE
MOCK_METHOD1(execEvent, void(Mantid::API::IMDEventWorkspace_sptr));
MOCK_METHOD0(checkInputs, void());
MOCK_METHOD1(execHisto, void(Mantid::DataObjects::MDHistoWorkspace_sptr));
GCC_DIAG_ON_SUGGEST_OVERRIDE
DIAG_ON_SUGGEST_OVERRIDE
void exec() override { UnaryOperationMD::exec(); }
};
......
......@@ -58,14 +58,13 @@ using declarePropertyType3 = void (*)(boost::python::object &,
using declarePropertyType4 = void (*)(boost::python::object &,
const std::string &,
const boost::python::object &, const int);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
// clang-format off
DIAG_OFF(unknown-pragmas)
DIAG_OFF(unused-local-typdef)
// Ignore -Wconversion warnings coming from boost::python
// Seen with GCC 7.1.1 and Boost 1.63.0
GCC_DIAG_OFF(conversion)
DIAG_OFF(conversion)
// clang-format on
// Overload types
BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType1_Overload,
PythonAlgorithm::declarePyAlgProperty, 2, 3)
......@@ -73,10 +72,11 @@ BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType2_Overload,
PythonAlgorithm::declarePyAlgProperty, 3, 6)
BOOST_PYTHON_FUNCTION_OVERLOADS(declarePropertyType3_Overload,
PythonAlgorithm::declarePyAlgProperty, 4, 5)
GCC_DIAG_ON(conversion)
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(conversion)
DIAG_ON(unknown-pragmas)
DIAG_ON(unused-local-typdef)
// clang-format on
/**
* Map a CancelException to a Python KeyboardInterupt
* @param exc A cancel exception to translate. Unused here as the message is
......
......@@ -82,7 +82,7 @@ list getDescriptors(AlgorithmFactoryImpl &self, bool includeHidden) {
std::recursive_mutex PYALG_REGISTER_MUTEX;
// clang-format off
GCC_DIAG_OFF(cast-qual)
DIAG_OFF(cast-qual)
// clang-format on
/**
......@@ -118,24 +118,25 @@ void subscribe(AlgorithmFactoryImpl &self, const boost::python::object &obj) {
// from the FileLoaderRegistry
FileLoaderRegistry::Instance().unsubscribe(descr.first, descr.second);
}
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
// clang-format off
DIAG_OFF(unknown-pragmas)
DIAG_OFF(unused-local-typdef)
// Ignore -Wconversion warnings coming from boost::python
// Seen with GCC 7.1.1 and Boost 1.63.0
GCC_DIAG_OFF(conversion)
DIAG_OFF(conversion)
// clang-format on
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(existsOverloader, exists, 1, 2)
GCC_DIAG_ON(conversion)
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(conversion)
DIAG_ON(unknown-pragmas)
DIAG_ON(unused-local-typdef)
// clang-format on
///@endcond
}
// clang-format off
GCC_DIAG_ON(cast-qual)
DIAG_ON(cast-qual)
// clang-format on
void export_AlgorithmFactory() {
......
......@@ -56,24 +56,24 @@ boost::python::list runningInstancesOf(AlgorithmManagerImpl &self,
///@cond
//------------------------------------------------------------------------------------------------------
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
// clang-format off
DIAG_OFF(unknown-pragmas)
DIAG_OFF(unused-local-typdef)
// Ignore -Wconversion warnings coming from boost::python
// Seen with GCC 7.1.1 and Boost 1.63.0
GCC_DIAG_OFF(conversion)
DIAG_OFF(conversion)
// clang-format on
/// Define overload generators
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(create_overloads,
AlgorithmManagerImpl::create, 1, 2)
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(createUnmanaged_overloads,
AlgorithmManagerImpl::createUnmanaged, 1,
2)
GCC_DIAG_ON(conversion)
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(conversion)
DIAG_ON(unknown-pragmas)
DIAG_ON(unused-local-typdef)
// clang-format on
///@endcond
}
......
......@@ -29,21 +29,20 @@ GET_POINTER_SPECIALIZATION(Axis)
namespace {
//------------------------------- Overload macros ---------------------------
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
// clang-format off
DIAG_OFF(unknown-pragmas)
DIAG_OFF(unused-local-typdef)
// Ignore -Wconversion warnings coming from boost::python
// Seen with GCC 7.1.1 and Boost 1.63.0
GCC_DIAG_OFF(conversion)
DIAG_OFF(conversion)
// clang-format on
// Overloads for operator() function which has 1 optional argument
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Axis_getValue, Axis::getValue, 1, 2)
GCC_DIAG_ON(conversion)
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(conversion)
DIAG_ON(unknown-pragmas)
DIAG_ON(unused-local-typdef)
// clang-format on
/**
* Extract the axis values as a sequence. A numpy array is used if the
* data is numerical or a simple python list is used if the data is a string
......
......@@ -19,18 +19,18 @@ using getParameterType2 =
using setParameterType2 = void (CompositeFunction::*)(const std::string &,
const double &, bool);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
GCC_DIAG_OFF(conversion)
// clang-format off
DIAG_OFF(unknown-pragmas)
DIAG_OFF(unused-local-typdef)
DIAG_OFF(conversion)
// clang-format on
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setParameterType2_Overloads,
setParameter, 2, 3)
GCC_DIAG_ON(conversion)
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(conversion)
DIAG_ON(unknown-pragmas)
DIAG_ON(unused-local-typdef)
// clang-format on
} // namespace
void export_CompositeFunction() {
......
......@@ -18,21 +18,21 @@ using namespace boost::python;
GET_POINTER_SPECIALIZATION(ExperimentInfo)
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
// clang-format off
DIAG_OFF(unknown-pragmas)
DIAG_OFF(unused-local-typdef)
// Ignore -Wconversion warnings coming from boost::python
// Seen with GCC 7.1.1 and Boost 1.63.0
GCC_DIAG_OFF(conversion)
DIAG_OFF(conversion)
// clang-format on
/// Overload generator for getInstrumentFilename
BOOST_PYTHON_FUNCTION_OVERLOADS(getInstrumentFilename_Overload,
ExperimentInfo::getInstrumentFilename, 1, 2)
GCC_DIAG_ON(conversion)
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(conversion)
DIAG_ON(unknown-pragmas)
DIAG_ON(unused-local-typdef)
// clang-format on
void export_ExperimentInfo() {
register_ptr_to_python<boost::shared_ptr<ExperimentInfo>>();
......
......@@ -9,19 +9,19 @@ using Mantid::API::FileFinderImpl;
using namespace boost::python;
namespace {
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
// clang-format off
DIAG_OFF(unknown-pragmas)
DIAG_OFF(unused-local-typdef)
// Ignore -Wconversion warnings coming from boost::python
// Seen with GCC 7.1.1 and Boost 1.63.0
GCC_DIAG_OFF(conversion)
DIAG_OFF(conversion)
// clang-format on
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getFullPathOverloader, getFullPath, 1, 2)
GCC_DIAG_ON(conversion)
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(conversion)
DIAG_ON(unknown-pragmas)
DIAG_ON(unused-local-typdef)
// clang-format on
}
void export_FileFinder() {
......
......@@ -50,14 +50,13 @@ double getError(IFunction &self, std::string const &name) {
// -- Set property overloads --
// setProperty(index,value,explicit)
using setParameterType1 = void (IFunction::*)(size_t, const double &, bool);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif
// clang-format off
DIAG_OFF(unknown-pragmas)
DIAG_OFF(unused-local-typdef)
// Ignore -Wconversion warnings coming from boost::python
// Seen with GCC 7.1.1 and Boost 1.63.0
GCC_DIAG_OFF(conversion)
DIAG_OFF(conversion)
// clang-format on
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setParameterType1_Overloads,
setParameter, 2, 3)
// setProperty(index,value,explicit)
......@@ -74,10 +73,11 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(fix_Overloads, fix, 1, 2)
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(fixAll_Overloads, fixAll, 0, 1)
using removeTieByName = void (IFunction::*)(const std::string &);
GCC_DIAG_ON(conversion)
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// clang-format off
DIAG_ON(conversion)
DIAG_ON(unknown-pragmas)
DIAG_ON(unused-local-typdef)
// clang-format on
///@endcond
}
......
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