Right way to suppress GCC warning Wstrict-overflow for method QVector::move().

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-09-29 17:13:30 +03:00
parent 8de6fc4473
commit be614ad9f8
3 changed files with 14 additions and 10 deletions

View File

@ -307,17 +307,12 @@ void DialogFinalMeasurements::MoveUp()
return; return;
} }
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wstrict-overflow")
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
Move(m_measurements, row, row-1); Move(m_measurements, row, row-1);
#else #else
m_measurements.move(row, row-1); m_measurements.move(row, row-1);
#endif #endif
QT_WARNING_POP
UpdateTree(); UpdateTree();
ui->tableWidget->selectRow(row-1); ui->tableWidget->selectRow(row-1);
@ -333,17 +328,12 @@ void DialogFinalMeasurements::MoveDown()
return; return;
} }
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wstrict-overflow")
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
Move(m_measurements, row, row+1); Move(m_measurements, row, row+1);
#else #else
m_measurements.move(row, row+1); m_measurements.move(row, row+1);
#endif #endif
QT_WARNING_POP
UpdateTree(); UpdateTree();
ui->tableWidget->selectRow(row+1); ui->tableWidget->selectRow(row+1);

View File

@ -29,8 +29,16 @@
#ifndef DIALOGFINALMEASUREMENTS_H #ifndef DIALOGFINALMEASUREMENTS_H
#define DIALOGFINALMEASUREMENTS_H #define DIALOGFINALMEASUREMENTS_H
#include "../vmisc/diagnostic.h"
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wstrict-overflow")
// suppress warning Wstrict-overflow because of method QVector::move()
#include <QDialog> #include <QDialog>
QT_WARNING_POP
#include "../vmisc/vtablesearch.h" #include "../vmisc/vtablesearch.h"
#include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vcontainer.h"
#include "../xml/vpattern.h" #include "../xml/vpattern.h"

View File

@ -29,6 +29,8 @@
#ifndef DIAGNOSTIC_H #ifndef DIAGNOSTIC_H
#define DIAGNOSTIC_H #define DIAGNOSTIC_H
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
/* /*
@ -85,6 +87,10 @@
# define QT_WARNING_DISABLE_GCC(text) # define QT_WARNING_DISABLE_GCC(text)
#endif #endif
#else
#include <qcompilerdetection.h>
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#endif // DIAGNOSTIC_H #endif // DIAGNOSTIC_H