Commit c1f7406d authored by David Fairbrother's avatar David Fairbrother
Browse files

Remove unmatched suppressions

These are various places where cppcheck now understands c++-17, or we
have improve our code
parent a36138ea
......@@ -387,7 +387,7 @@ void CorrectTOFAxis::averageL2AndEPP(const API::SpectrumInfo &spectrumInfo, doub
double eppSum = 0;
size_t n = 0;
const auto indexCount = static_cast<int64_t>(m_workspaceIndices.size());
// cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for if (m_eppTable->threadSafe())
reduction(+: n, l2Sum, eppSum))
for (int64_t i = 0; i < indexCount; ++i) {
......
......@@ -616,7 +616,7 @@ void CreateGroupingWorkspace::exec() {
sortnames = true;
GroupNames = "";
int maxRecurseDepth = this->getProperty("MaxRecursionDepth");
// cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for schedule(dynamic, 1) )
for (int num = 0; num < 300; ++num) {
PARALLEL_START_INTERUPT_REGION
......
......@@ -371,7 +371,7 @@ void DiffractionFocussing2::execEvent() {
int chunkSize = 200;
int end = (totalHistProcess / chunkSize) + 1;
// cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for schedule(dynamic, 1) )
for (int wiChunk = 0; wiChunk < end; wiChunk++) {
PARALLEL_START_INTERUPT_REGION
......
......@@ -990,9 +990,6 @@ int FindPeaks::findPeakBackground(const MatrixWorkspace_sptr &input, int spectru
// Local check whether FindPeakBackground gives a reasonable value
vecpeakrange.resize(2);
/// @todo Remove this cppcheck suppression when #13950 is fixed
// cppcheck-suppress knownConditionTrueFalse
if (fitresult > 0) {
// Use FitPeakBackgroud's result
size_t i_peakmin, i_peakmax;
......
......@@ -850,7 +850,6 @@ std::vector<std::shared_ptr<FitPeaksAlgorithm::PeakFitResult>> FitPeaks::fitPeak
const int nThreads = FrameworkManager::Instance().getNumOMPThreads();
size_t chunkSize = num_fit_result / nThreads;
// cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for schedule(dynamic, 1) )
for (int ithread = 0; ithread < nThreads; ithread++) {
PARALLEL_START_INTERUPT_REGION
......
......@@ -1071,7 +1071,7 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesParallel(const map<size_t,
}
// Create event filters/splitters in parallel
// cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for schedule(dynamic, 1) )
for (int i = 0; i < numThreads; ++i) {
PARALLEL_START_INTERUPT_REGION
......
......@@ -533,7 +533,7 @@ void PDCalibration::exec() {
// Scan the table containing the fit parameters for every peak, retrieve the
// parameters for peaks that were successfully fitting, then use this info
// to obtain difc, difa, and tzero for each pixel
// cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for schedule(dynamic, 1))
for (int wkspIndex = 0; wkspIndex < NUMHIST; ++wkspIndex) {
PARALLEL_START_INTERUPT_REGION
......
......@@ -452,7 +452,7 @@ public:
const auto &yValues = outWS->histogram(i).y();
for (size_t j = 0; j < yValues.size(); ++j) {
if (specOutInfo.isMonitor(i))
// cppcheck-suppress syntaxError
TS_ASSERT_DELTA(yValues[j], double(j + 1) / 15.0, 1e-12)
else
TS_ASSERT_DELTA(yValues[j], 2.0 / 15.0, 1e-12)
......
......@@ -82,7 +82,7 @@ void SCDCalibratePanels::exec() {
MyPanels.insert("East");
MyPanels.insert("West");
int maxRecurseDepth = 4;
// cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for schedule(dynamic, 1) )
for (int num = 1; num < 64; ++num) {
PARALLEL_START_INTERUPT_REGION
......
......@@ -377,7 +377,7 @@ void CreateChunkingFromInstrument::exec() {
// search the instrument for the bank names
int maxRecurseDepth = this->getProperty(PARAM_MAX_RECURSE);
map<string, vector<string>> grouping;
// cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for schedule(dynamic, 1) )
for (int num = 0; num < maxBankNum; ++num) {
PARALLEL_START_INTERUPT_REGION
......
......@@ -871,7 +871,7 @@ void FilterEventsByLogValuePreNexus::procEvents(DataObjects::EventWorkspace_sptr
g_log.information() << "Processing input event preNexus by " << numThreads << " threads"
<< " in " << numBlocks << " blocks. "
<< "\n";
// cppcheck-suppress syntaxError
PRAGMA_OMP( parallel for schedule(dynamic, 1) if (m_parallelProcessing) )
for (int i = 0; i < int(numThreads); i++) {
// This is the partial workspace we are about to create (if in parallel)
......
......@@ -718,7 +718,7 @@ void LoadEventPreNexus2::procEvents(DataObjects::EventWorkspace_sptr &workspace)
partWorkspaces.resize(numThreads);
buffers.resize(numThreads);
eventVectors = new EventVector_pt *[numThreads];
// cppcheck-suppress syntaxError
PRAGMA_OMP( parallel for if (parallelProcessing) )
for (int i = 0; i < int(numThreads); i++) {
// This is the partial workspace we are about to create (if in parallel)
......
......@@ -518,7 +518,6 @@ const std::string LoadRKH::readUnit(const std::string &line) {
// however to use is safely other checks would be required that would impair
// readability, therefore in this case the unlikely performance hit is
// accepted.
// cppcheck-suppress stlIfStrFind
if (unit.find('(') != 0 || unit.find(')') != unit.size()) {
std::string qCode = std::to_string(SaveRKH::Q_CODE);
if (symbol == qCode && theQuantity == "q" &&
......
......@@ -906,7 +906,6 @@ int ISISRAW::vmstime(char *timbuf, int len, time_t time_value) {
* get time in VMS format 01-JAN-1970 00:00:00
*/
size_t i, n;
// cppcheck-suppress redundantAssignment
struct tm *tmstruct = nullptr;
#ifdef MS_VISUAL_STUDIO
errno_t err = localtime_s(tmstruct, &time_value);
......
......@@ -100,7 +100,6 @@ std::map<std::string, std::string> SaveDiffCal::validateInputs() {
*/
void SaveDiffCal::writeDoubleFieldFromTable(H5::Group &group, const std::string &name) {
auto column = m_calibrationWS->getColumn(name);
// cppcheck-suppress compareBoolExpressionWithInt
// Retrieve only the first m_numValues, not necessarily the whole column
auto data = column->numeric_fill<>(m_numValues);
H5Util::writeArray1D(group, name, data);
......
......@@ -136,7 +136,7 @@ bool SaveReflectometryAscii::includeQResolution() const {
* @param firstColumn :: true if the value is the first column in the output
*/
template <typename T> void SaveReflectometryAscii::outputval(const T &val, bool firstColumn) {
// cppcheck-suppress syntaxError
if constexpr (std::is_floating_point<T>::value) {
if (std::isinf(val))
return outputval("inf", firstColumn);
......
......@@ -946,13 +946,13 @@ void EventList::setSortOrder(const EventSortType order) const { this->order = or
/** Sort events by TOF in one thread */
void EventList::sortTof() const {
// nothing to do
if (this->order == TOF_SORT) // cppcheck-suppress identicalConditionAfterEarlyExit
if (this->order == TOF_SORT)
return;
// Avoid sorting from multiple threads
std::lock_guard<std::mutex> _lock(m_sortMutex);
// If the list was sorted while waiting for the lock, return.
if (this->order == TOF_SORT) // cppcheck-suppress identicalConditionAfterEarlyExit
if (this->order == TOF_SORT)
return;
switch (eventType) {
......@@ -1012,13 +1012,13 @@ void EventList::sortTimeAtSample(const double &tofFactor, const double &tofShift
// --------------------------------------------------------------------------
/** Sort events by Frame */
void EventList::sortPulseTime() const {
if (this->order == PULSETIME_SORT) // cppcheck-suppress identicalConditionAfterEarlyExit
return; // nothing to do
if (this->order == PULSETIME_SORT)
return; // nothing to do
// Avoid sorting from multiple threads
std::lock_guard<std::mutex> _lock(m_sortMutex);
// If the list was sorted while waiting for the lock, return.
if (this->order == PULSETIME_SORT) // cppcheck-suppress identicalConditionAfterEarlyExit
if (this->order == PULSETIME_SORT)
return;
// Perform sort.
......@@ -1042,13 +1042,13 @@ void EventList::sortPulseTime() const {
* (the absolute time)
*/
void EventList::sortPulseTimeTOF() const {
if (this->order == PULSETIMETOF_SORT) // cppcheck-suppress identicalConditionAfterEarlyExit
return; // already ordered
if (this->order == PULSETIMETOF_SORT)
return; // already ordered
// Avoid sorting from multiple threads
std::lock_guard<std::mutex> _lock(m_sortMutex);
// If the list was sorted while waiting for the lock, return.
if (this->order == PULSETIMETOF_SORT) // cppcheck-suppress identicalConditionAfterEarlyExit
if (this->order == PULSETIMETOF_SORT)
return;
switch (eventType) {
......
......@@ -1237,7 +1237,6 @@ std::string ConfigServiceImpl::getDirectoryOfExecutable() const {
std::string ConfigServiceImpl::getPathToExecutable() const {
std::string execpath;
const size_t LEN(1024);
// cppcheck-suppress variableScope
char pBuf[LEN];
#ifdef _WIN32
......
......@@ -65,7 +65,6 @@ typedef struct {
int ver_minor;
int pid;
int access_type; /* 0 =dae, 1 = crpt */
// cppcheck-suppress unusedStructMember
int pad[1];
char user[32];
char host[64];
......
......@@ -190,7 +190,7 @@ void ApplyDetailedBalanceMD::applyDetailedBalance(typename Mantid::DataObjects::
// Add the boxes in parallel. They should be spread out enough on each
// core to avoid stepping on each other.
// cppcheck-suppress syntaxError
PRAGMA_OMP( parallel for if (!ws->isFileBacked()))
for (int i = 0; i < numBoxes; ++i) {
PARALLEL_START_INTERUPT_REGION
......
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