diff --git a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp index c34398fbd..9707c11a7 100644 --- a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp +++ b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp @@ -290,7 +290,7 @@ QGroupBox *TapeConfigurationPage::GradationGroup() { defSizeCombo->setCurrentIndex(index); } - connect(defHeightCombo, static_cast(&QComboBox::currentIndexChanged), this, + connect(defHeightCombo, static_cast(&QComboBox::currentIndexChanged), DefGradationChanged); gradationLayout->addRow(defSizeLabel, defSizeCombo); diff --git a/src/app/tape/tape.pro b/src/app/tape/tape.pro index cc66b7ee3..f12b0dfc9 100644 --- a/src/app/tape/tape.pro +++ b/src/app/tape/tape.pro @@ -376,6 +376,15 @@ DEPENDPATH += $$PWD/../../libs/fervor win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/fervor/$${DESTDIR}/fervor.lib else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/fervor/$${DESTDIR}/libfervor.a +# IFC static library (depend on QMuParser, VMisc) +unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc + +INCLUDEPATH += $$PWD/../../libs/ifc +DEPENDPATH += $$PWD/../../libs/ifc + +win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib +else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a + #VMisc static library unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR}/ -lvmisc @@ -394,15 +403,6 @@ DEPENDPATH += $$PWD/../../libs/vgeometry win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a -# IFC static library (depend on QMuParser) -unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc - -INCLUDEPATH += $$PWD/../../libs/ifc -DEPENDPATH += $$PWD/../../libs/ifc - -win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib -else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a - # VLayout static library unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR}/ -lvlayout diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index adc491a72..49e2a18a4 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -1734,10 +1734,11 @@ void TMainWindow::SetupMenu() for (int i = 0; i < MaxRecentFiles; ++i) { - recentFileActs[i] = new QAction(this); - connect(recentFileActs[i], &QAction::triggered, this, [this]() + QAction *action = new QAction(this); + recentFileActs[i] = action; + connect(action, &QAction::triggered, [action, this]() { - if (auto action = qobject_cast(sender())) + if (action) { const QString filePath = action->data().toString(); if (not filePath.isEmpty()) @@ -2783,6 +2784,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu) //--------------------------------------------------------------------------------------------------------------------- bool TMainWindow::IgnoreLocking(int error, const QString &path) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) QMessageBox::StandardButton answer = QMessageBox::Abort; if (not qApp->IsTestMode()) { @@ -2844,6 +2846,11 @@ bool TMainWindow::IgnoreLocking(int error, const QString &path) return false; } return true; +#else + Q_UNUSED(error); + Q_UNUSED(path); + return true;// On older Qt lock assumed always taken. Allow user to ignore warning. +#endif // QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index e193e4b58..dfb7dcb9e 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3612,11 +3612,12 @@ void MainWindow::CreateActions() //Actions for recent files loaded by a main window application. for (int i = 0; i < MaxRecentFiles; ++i) { - recentFileActs[i] = new QAction(this); - recentFileActs[i]->setVisible(false); - connect(recentFileActs[i], &QAction::triggered, this, [this]() + QAction *action = new QAction(this); + action->setVisible(false); + recentFileActs[i] = action; + connect(recentFileActs[i], &QAction::triggered, [action, this]() { - if (QAction *action = qobject_cast(sender())) + if (action) { const QString filePath = action->data().toString(); if (not filePath.isEmpty()) @@ -4524,6 +4525,7 @@ void MainWindow::UpdateWindowTitle() //--------------------------------------------------------------------------------------------------------------------- bool MainWindow::IgnoreLocking(int error, const QString &path) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) QMessageBox::StandardButton answer = QMessageBox::Abort; if (VApplication::IsGUIMode()) { @@ -4586,6 +4588,11 @@ bool MainWindow::IgnoreLocking(int error, const QString &path) return false; } return true; +#else + Q_UNUSED(error); + Q_UNUSED(path); + return true;// On older Qt lock assumed always taken. Allow user to ignore warning. +#endif // QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vdxf/dxflib/dl_writer_ascii.cpp b/src/libs/vdxf/dxflib/dl_writer_ascii.cpp index 06a3d465e..5f4e51839 100644 --- a/src/libs/vdxf/dxflib/dl_writer_ascii.cpp +++ b/src/libs/vdxf/dxflib/dl_writer_ascii.cpp @@ -67,6 +67,9 @@ void DL_WriterA::dxfReal(int gc, double value) const char str[256]; QT_WARNING_PUSH QT_WARNING_DISABLE_MSVC(4996) +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 408 +QT_WARNING_DISABLE_GCC("-Wformat") +#endif if (version==DL_Codes::AC1009_MIN) { sprintf(str, "%.6lf", value); diff --git a/src/libs/vmisc/abstracttest.h b/src/libs/vmisc/abstracttest.h index 35d3566c5..009de142a 100644 --- a/src/libs/vmisc/abstracttest.h +++ b/src/libs/vmisc/abstracttest.h @@ -41,10 +41,18 @@ template class QVector; #include #endif /* Q_CC_MSVC */ +#ifdef __GNUC__ +#define V_UNUSED __attribute__ ((unused)) +#else +#define V_UNUSED +#endif + // Return codes for testing run application -static const auto TST_EX_BIN = -1; // Can't find binary. -static const auto TST_EX_TIME_OUT = -2; // The operation timed out or an error occurred. -static const auto TST_EX_CRASH = -3; // Program crashed. +static const auto V_UNUSED TST_EX_BIN = -1; // Can't find binary. +static const auto V_UNUSED TST_EX_TIME_OUT = -2; // The operation timed out or an error occurred. +static const auto V_UNUSED TST_EX_CRASH = -3; // Program crashed. + +#undef V_UNUSED enum ErrorState {ErrorLoad = 0, ErrorInstall, ErrorSize, NoError}; diff --git a/src/libs/vmisc/backport/qsavefile.cpp b/src/libs/vmisc/backport/qsavefile.cpp index efd5cb06c..f97e36cf3 100644 --- a/src/libs/vmisc/backport/qsavefile.cpp +++ b/src/libs/vmisc/backport/qsavefile.cpp @@ -47,7 +47,7 @@ #include QSaveFilePrivate::QSaveFilePrivate() - : tempFile(0), error(QFile::NoError) + : fileName(), tempFile(0), error(QFile::NoError) { } @@ -256,7 +256,7 @@ bool QSaveFile::open(OpenMode mode) Cannot be called. Call commit() instead. */ -void QSaveFile::close() +Q_NORETURN void QSaveFile::close() { qFatal("QSaveFile::close called"); } diff --git a/src/libs/vmisc/backport/qsavefile_p.h b/src/libs/vmisc/backport/qsavefile_p.h index 27f4c1d48..e070ba03b 100644 --- a/src/libs/vmisc/backport/qsavefile_p.h +++ b/src/libs/vmisc/backport/qsavefile_p.h @@ -69,6 +69,8 @@ public: QTemporaryFile *tempFile; QFile::FileError error; +private: + Q_DISABLE_COPY(QSaveFilePrivate) }; #endif // QT_VERSION < QT_VERSION_CHECK(5, 1, 0) diff --git a/src/libs/vmisc/debugbreak.h b/src/libs/vmisc/debugbreak.h index 7ca85c896..7391a5154 100644 --- a/src/libs/vmisc/debugbreak.h +++ b/src/libs/vmisc/debugbreak.h @@ -42,11 +42,11 @@ extern "C" { enum { /* gcc optimizers consider code after __builtin_trap() dead. * Making __builtin_trap() unsuitable for breaking into the debugger */ - DEBUG_BREAK_PREFER_BUILTIN_TRAP_TO_SIGTRAP = 0, + DEBUG_BREAK_PREFER_BUILTIN_TRAP_TO_SIGTRAP = 0 }; #if defined(__i386__) || defined(__x86_64__) -enum { HAVE_TRAP_INSTRUCTION = 1, }; +enum { HAVE_TRAP_INSTRUCTION = 1 }; __attribute__((gnu_inline, always_inline)) __inline__ static void trap_instruction(void) { @@ -81,7 +81,7 @@ __inline__ static void trap_instruction(void) */ } #elif defined(__arm__) && !defined(__thumb__) -enum { HAVE_TRAP_INSTRUCTION = 1, }; +enum { HAVE_TRAP_INSTRUCTION = 1 }; __attribute__((gnu_inline, always_inline)) __inline__ static void trap_instruction(void) { @@ -92,7 +92,7 @@ __inline__ static void trap_instruction(void) * as Thumb mode */ } #elif defined(__aarch64__) -enum { HAVE_TRAP_INSTRUCTION = 1, }; +enum { HAVE_TRAP_INSTRUCTION = 1 }; __attribute__((gnu_inline, always_inline)) __inline__ static void trap_instruction(void) { @@ -101,7 +101,7 @@ __inline__ static void trap_instruction(void) __asm__ volatile(".inst 0xd4200000"); } #else -enum { HAVE_TRAP_INSTRUCTION = 0, }; +enum { HAVE_TRAP_INSTRUCTION = 0 }; #endif __attribute__((gnu_inline, always_inline)) diff --git a/src/libs/vmisc/vlockguard.h b/src/libs/vmisc/vlockguard.h index 48576827c..c6864ac52 100644 --- a/src/libs/vmisc/vlockguard.h +++ b/src/libs/vmisc/vlockguard.h @@ -45,7 +45,7 @@ #define PEDANT_COMPILER ,lock(nullptr) #else #define PEDANT_COMPILER -#warning To have lock-file support you must use Qt 5.1+. Expect collissions when run 2 copies of the program. +#pragma message("To have lock-file support you must use Qt 5.1+. Expect collissions when run 2 copies of the program.") #endif /*@brief @@ -188,6 +188,10 @@ bool VLockGuard::TryLock(const QString &lockName, int stale, int timeou SetFileAttributesW(lockFile.toStdWString().c_str(), FILE_ATTRIBUTE_HIDDEN); #endif } +#else + Q_UNUSED(lockName); + Q_UNUSED(stale); + Q_UNUSED(timeout); #endif return res; } diff --git a/src/libs/vmisc/vsysexits.h b/src/libs/vmisc/vsysexits.h index 198f1c020..dc92c11be 100644 --- a/src/libs/vmisc/vsysexits.h +++ b/src/libs/vmisc/vsysexits.h @@ -31,40 +31,53 @@ #include -static const auto V_EX_OK = 0; /*Indicate the successful exit.*/ +#ifdef __GNUC__ +#define V_UNUSED __attribute__ ((unused)) +#else +#define V_UNUSED +#endif -static const auto V_EX_USAGE = 64; /*The command was used incorrectly, e.g., with the wrong number of - arguments, a bad flag, a bad syntax in a parameter, or whatever.*/ +static const auto V_UNUSED V_EX_OK = 0; /*Indicate the successful exit.*/ -static const auto V_EX_DATAERR = 65; /*The input data was incorrect in some way. This should only be used for - user's data and not system files.*/ +static const auto V_UNUSED V_EX_USAGE = 64; /*The command was used incorrectly, e.g., with the wrong number of + arguments, a bad flag, a bad syntax in a parameter, or whatever.*/ -static const auto V_EX_NOINPUT = 66; /*An input file (not a system file) did not exist or was not readable.*/ +static const auto V_UNUSED V_EX_DATAERR = 65; /*The input data was incorrect in some way. This should only be + used for user's data and not system files.*/ -static const auto V_EX_UNAVAILABLE = 69; /*A service is unavailable. This can occur if a support program or file - does not exist. This can also be used as a catchall message when - something you wanted to do doesn't work, but you don't know why.*/ +static const auto V_UNUSED V_EX_NOINPUT = 66; /*An input file (not a system file) did not exist or was not + readable.*/ -static const auto V_EX_SOFTWARE = 70; /*An internal software error has been detected. This should be limited to - nonoperating operating system related errors as possible.*/ +static const auto V_UNUSED V_EX_UNAVAILABLE = 69; /*A service is unavailable. This can occur if a support program or + file does not exist. This can also be used as a catchall message + when something you wanted to do doesn't work, but you don't know + why.*/ -static const auto V_EX_OSERR = 71; /*An operating system error has been detected. This is intended to be - used for such things as ``cannot fork'', ``cannot create pipe'', or the - like. It includes things like getuid returning a user that does not exist - in the passwd file.*/ +static const auto V_UNUSED V_EX_SOFTWARE = 70; /*An internal software error has been detected. This should be + limited to nonoperating operating system related errors as + possible.*/ -static const auto V_EX_OSFILE = 72; /*Some system file (e.g., /etc/passwd, /var/run/utmp, etc.) does not exist, - cannot be opened, or has some sort of error (e.g., syntax error).*/ +static const auto V_UNUSED V_EX_OSERR = 71; /*An operating system error has been detected. This is intended to be + used for such things as ``cannot fork'', ``cannot create pipe'', or + the like. It includes things like getuid returning a user that does + not exist in the passwd file.*/ -static const auto V_EX_CANTCREAT = 73; /*A (user specified) output file cannot be created.*/ +static const auto V_UNUSED V_EX_OSFILE = 72; /*Some system file (e.g., /etc/passwd, /var/run/utmp, etc.) does not + exist, cannot be opened, or has some sort of error (e.g., syntax + error).*/ -static const auto V_EX_IOERR = 74; /*An error occurred while doing I/O on some file.*/ +static const auto V_UNUSED V_EX_CANTCREAT = 73; /*A (user specified) output file cannot be created.*/ -static const auto V_EX_NOPERM = 77; /*You did not have sufficient permission to perform the operation. This - is not intended for file system problems, which should use EX_NOINPUT or - EX_CANTCREAT, but rather for higher level permissions.*/ +static const auto V_UNUSED V_EX_IOERR = 74; /*An error occurred while doing I/O on some file.*/ -static const auto V_EX_CONFIG = 78; /*Something was found in an unconfigured or misconfigured state.*/ +static const auto V_UNUSED V_EX_NOPERM = 77; /*You did not have sufficient permission to perform the operation. + This is not intended for file system problems, which should use + EX_NOINPUT or EX_CANTCREAT, but rather for higher level + permissions.*/ + +static const auto V_UNUSED V_EX_CONFIG = 78; /*Something was found in an unconfigured or misconfigured state.*/ + +#undef V_UNUSED //--------------------------------------------------------------------------------------------------------------------- inline QTextStream& vStdErr() diff --git a/src/libs/vobj/predicates.cpp b/src/libs/vobj/predicates.cpp index ef144ec51..97ad3a0ac 100644 --- a/src/libs/vobj/predicates.cpp +++ b/src/libs/vobj/predicates.cpp @@ -113,7 +113,11 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_MSVC(4701) QT_WARNING_DISABLE_GCC("-Wold-style-cast") QT_WARNING_DISABLE_GCC("-Wfloat-equal") +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") +#else +QT_WARNING_DISABLE_GCC("-Wuninitialized") +#endif /* On some machines, the exact arithmetic routines might be defeated by the */ /* use of internal extended precision floating-point registers. Sometimes */ diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index 8e8c56dc9..192e8e9af 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -239,7 +239,7 @@ QString VDrawTool::ObjectName(quint32 id) const { try { - return VAbstractTool::data.GeometricObject(id)->name(); + return data.GeometricObject(id)->name(); } catch (const VExceptionBadId &e) { diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 0b7f7e6c2..f46ef6172 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -1053,7 +1053,12 @@ quint32 VToolUnionDetails::TakeNextId(QVector &children) quint32 idChild = NULL_ID; if (not children.isEmpty()) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) idChild = children.takeFirst(); +#else + idChild = children.first(); + children.remove(0); +#endif } else { diff --git a/src/libs/vtools/visualization/line/vistoolrotation.cpp b/src/libs/vtools/visualization/line/vistoolrotation.cpp index 885a58c63..2101cfb46 100644 --- a/src/libs/vtools/visualization/line/vistoolrotation.cpp +++ b/src/libs/vtools/visualization/line/vistoolrotation.cpp @@ -271,7 +271,7 @@ QGraphicsPathItem *VisToolRotation::GetCurve(quint32 i, const QColor &color) template int VisToolRotation::AddCurve(qreal angle, const QPointF &origin, quint32 id, int i) { - const QSharedPointer curve = Visualization::data->GeometricObject(id); + const QSharedPointer curve = Visualization::data->template GeometricObject(id); ++i; QGraphicsPathItem *path = GetCurve(i, supportColor2); diff --git a/src/test/ValentinaTest/ValentinaTest.pro b/src/test/ValentinaTest/ValentinaTest.pro index ab9dec109..c72e37346 100644 --- a/src/test/ValentinaTest/ValentinaTest.pro +++ b/src/test/ValentinaTest/ValentinaTest.pro @@ -137,6 +137,15 @@ DEPENDPATH += $$PWD/../../libs/vpatterndb win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a +# IFC static library (depend on QMuParser, VMisc) +unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc + +INCLUDEPATH += $$PWD/../../libs/ifc +DEPENDPATH += $$PWD/../../libs/ifc + +win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib +else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a + #VMisc static library unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR}/ -lvmisc @@ -155,15 +164,6 @@ DEPENDPATH += $$PWD/../../libs/vgeometry win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a -# IFC static library (depend on QMuParser) -unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc - -INCLUDEPATH += $$PWD/../../libs/ifc -DEPENDPATH += $$PWD/../../libs/ifc - -win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib -else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a - # VLayout static library unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR} -lvlayout