From be614ad9f8b0e24b5dbda90971261181eb8f1898 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 29 Sep 2017 17:13:30 +0300 Subject: [PATCH] Right way to suppress GCC warning Wstrict-overflow for method QVector::move(). --HG-- branch : develop --- src/app/valentina/dialogs/dialogfinalmeasurements.cpp | 10 ---------- src/app/valentina/dialogs/dialogfinalmeasurements.h | 8 ++++++++ src/libs/vmisc/diagnostic.h | 6 ++++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp index c61d048f4..eaa611c55 100644 --- a/src/app/valentina/dialogs/dialogfinalmeasurements.cpp +++ b/src/app/valentina/dialogs/dialogfinalmeasurements.cpp @@ -307,17 +307,12 @@ void DialogFinalMeasurements::MoveUp() return; } -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wstrict-overflow") - #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) Move(m_measurements, row, row-1); #else m_measurements.move(row, row-1); #endif -QT_WARNING_POP - UpdateTree(); ui->tableWidget->selectRow(row-1); @@ -333,17 +328,12 @@ void DialogFinalMeasurements::MoveDown() return; } -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wstrict-overflow") - #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) Move(m_measurements, row, row+1); #else m_measurements.move(row, row+1); #endif -QT_WARNING_POP - UpdateTree(); ui->tableWidget->selectRow(row+1); diff --git a/src/app/valentina/dialogs/dialogfinalmeasurements.h b/src/app/valentina/dialogs/dialogfinalmeasurements.h index a4aa725be..4056acd53 100644 --- a/src/app/valentina/dialogs/dialogfinalmeasurements.h +++ b/src/app/valentina/dialogs/dialogfinalmeasurements.h @@ -29,8 +29,16 @@ #ifndef 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 +QT_WARNING_POP + #include "../vmisc/vtablesearch.h" #include "../vpatterndb/vcontainer.h" #include "../xml/vpattern.h" diff --git a/src/libs/vmisc/diagnostic.h b/src/libs/vmisc/diagnostic.h index 7acf70cc7..d5fef607a 100644 --- a/src/libs/vmisc/diagnostic.h +++ b/src/libs/vmisc/diagnostic.h @@ -29,6 +29,8 @@ #ifndef DIAGNOSTIC_H #define DIAGNOSTIC_H +#include + #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) /* @@ -85,6 +87,10 @@ # define QT_WARNING_DISABLE_GCC(text) #endif +#else + +#include + #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // DIAGNOSTIC_H