diff --git a/common.pri b/common.pri index 43c450566..c96667d56 100644 --- a/common.pri +++ b/common.pri @@ -238,7 +238,7 @@ GCC_DEBUG_CXXFLAGS += \ -Wmissing-include-dirs \ -Wpacked \ -Wredundant-decls \ - -Winline \ +# -Winline \ -Winvalid-pch \ -Wunsafe-loop-optimizations \ -Wlong-long \ @@ -427,7 +427,7 @@ CLANG_DEBUG_CXXFLAGS += \ -Winherited-variadic-ctor \ -Winit-self \ -Winitializer-overrides \ - -Winline \ +# -Winline \ -Wint-conversion \ -Wint-conversions \ -Wint-to-pointer-cast \ @@ -641,7 +641,7 @@ ICC_DEBUG_CXXFLAGS += \ -Weffc++ \ -Wextra-tokens \ -Wformat \ - #-Winline \ +# -Winline \ -Wmain \ -Wmissing-declarations \ -Wmissing-prototypes \ diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 0f35cfabe..fd4b07c3e 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -79,25 +79,25 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con Q_UNUSED(context) // Why on earth didn't Qt want to make failed signal/slot connections qWarning? - if ((type == QtDebugMsg) && msg.contains("::connect")) + if ((type == QtDebugMsg) && msg.contains(QStringLiteral("::connect"))) { type = QtWarningMsg; } -#if !defined(V_NO_DEBUG) +#if !defined(V_NO_ASSERT) // I have decided to hide this annoing message for release builds. - if ((type == QtWarningMsg) && msg.contains("setGeometryDp: Unable to set geometry")) + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("setGeometry: Unable to set geometry"))) { type = QtDebugMsg; } -#endif //!defined(V_NO_DEBUG) +#endif //!defined(V_NO_ASSERT) #if defined(Q_OS_MAC) # if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) && QT_VERSION < QT_VERSION_CHECK(5, 7, 0) // Try hide very annoying, Qt related, warnings in Mac OS X // QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton) // https://bugreports.qt.io/browse/QTBUG-42846 - if ((type == QtWarningMsg) && msg.contains("QNSView")) + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QNSView"))) { type = QtDebugMsg; } @@ -106,7 +106,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con // Hide Qt bug 'Assertion when reading an icns file' // https://bugreports.qt.io/browse/QTBUG-45537 // Remove after Qt fix will be released - if ((type == QtWarningMsg) && msg.contains("QICNSHandler::read()")) + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QICNSHandler::read()"))) { type = QtDebugMsg; } @@ -115,7 +115,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con // this is another one that doesn't make sense as just a debug message. pretty serious // sign of a problem // http://www.developer.nokia.com/Community/Wiki/QPainter::begin:Paint_device_returned_engine_%3D%3D_0_(Known_Issue) - if ((type == QtDebugMsg) && msg.contains("QPainter::begin") && msg.contains("Paint device returned engine")) + if ((type == QtDebugMsg) && msg.contains(QStringLiteral("QPainter::begin")) + && msg.contains(QStringLiteral("Paint device returned engine"))) { type = QtWarningMsg; } @@ -123,8 +124,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con // This qWarning about "Cowardly refusing to send clipboard message to hung application..." // is something that can easily happen if you are debugging and the application is paused. // As it is so common, not worth popping up a dialog. - if ((type == QtWarningMsg) && QString(msg).contains("QClipboard::event") - && QString(msg).contains("Cowardly refusing")) + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event")) + && msg.contains(QStringLiteral("Cowardly refusing"))) { type = QtDebugMsg; } diff --git a/src/app/tape/tape.pro b/src/app/tape/tape.pro index 75325edc0..cbe7f04af 100644 --- a/src/app/tape/tape.pro +++ b/src/app/tape/tape.pro @@ -257,46 +257,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wundefined-reinterpret-cast \ - -Wmissing-prototypes # rcc folder - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -311,6 +272,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols DEFINES += V_NO_DEBUG } else { diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index a0b5e2d67..ca3e7feb5 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -2002,7 +2002,7 @@ void TMainWindow::ShowHeaderUnits(QTableWidget *table, int column, const QString SCASSERT(table != nullptr); QString header = table->horizontalHeaderItem(column)->text(); - const int index = header.indexOf(QLatin1Literal("(")); + const int index = header.indexOf(QLatin1String("(")); if (index != -1) { header.remove(index-1, 100); @@ -2026,7 +2026,7 @@ void TMainWindow::SetCurrentFile(const QString &fileName) if (curFile.isEmpty()) { shownName = tr("untitled"); - mType == MeasurementsType::Standard ? shownName += QLatin1Literal(".vst") : shownName += QLatin1Literal(".vit"); + mType == MeasurementsType::Standard ? shownName += QLatin1String(".vst") : shownName += QLatin1String(".vit"); ui->lineEditPathToFile->setText(tr("")); ui->lineEditPathToFile->setToolTip(tr("File was not saved yet.")); ui->lineEditPathToFile->setCursorPosition(0); @@ -2055,7 +2055,7 @@ void TMainWindow::SetCurrentFile(const QString &fileName) #if defined(Q_OS_MAC) static QIcon fileIcon = QIcon(QApplication::applicationDirPath() + - QLatin1Literal("/../Resources/measurements.icns")); + QLatin1String("/../Resources/measurements.icns")); QIcon icon; if (not curFile.isEmpty()) { diff --git a/src/app/tape/warnings.pri b/src/app/tape/warnings.pri new file mode 100644 index 000000000..9a4697481 --- /dev/null +++ b/src/app/tape/warnings.pri @@ -0,0 +1,54 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wundefined-reinterpret-cast \ + -Wmissing-prototypes # rcc folder +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index a50edb882..a263c0b5f 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -75,25 +75,25 @@ Q_DECL_CONSTEXPR auto DAYS_TO_KEEP_LOGS = 3; inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { // Why on earth didn't Qt want to make failed signal/slot connections qWarning? - if ((type == QtDebugMsg) && msg.contains("::connect")) + if ((type == QtDebugMsg) && msg.contains(QStringLiteral("::connect"))) { type = QtWarningMsg; } -#if !defined(V_NO_DEBUG) +#if !defined(V_NO_ASSERT) // I have decided to hide this annoing message for release builds. - if ((type == QtWarningMsg) && msg.contains("setGeometryDp: Unable to set geometry")) + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("setGeometry: Unable to set geometry"))) { type = QtDebugMsg; } -#endif //!defined(V_NO_DEBUG) +#endif //!defined(V_NO_ASSERT) #if defined(Q_OS_MAC) # if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) && QT_VERSION < QT_VERSION_CHECK(5, 7, 0) // Try hide very annoying, Qt related, warnings in Mac OS X // QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton) // https://bugreports.qt.io/browse/QTBUG-42846 - if ((type == QtWarningMsg) && msg.contains("QNSView")) + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QNSView"))) { type = QtDebugMsg; } @@ -102,7 +102,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con // Hide Qt bug 'Assertion when reading an icns file' // https://bugreports.qt.io/browse/QTBUG-45537 // Remove after Qt fix will be released - if ((type == QtWarningMsg) && msg.contains("QICNSHandler::read()")) + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QICNSHandler::read()"))) { type = QtDebugMsg; } @@ -111,7 +111,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con // this is another one that doesn't make sense as just a debug message. pretty serious // sign of a problem // http://www.developer.nokia.com/Community/Wiki/QPainter::begin:Paint_device_returned_engine_%3D%3D_0_(Known_Issue) - if ((type == QtDebugMsg) && msg.contains("QPainter::begin") && msg.contains("Paint device returned engine")) + if ((type == QtDebugMsg) && msg.contains(QStringLiteral("QPainter::begin")) + && msg.contains(QStringLiteral("Paint device returned engine"))) { type = QtWarningMsg; } @@ -119,8 +120,8 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con // This qWarning about "Cowardly refusing to send clipboard message to hung application..." // is something that can easily happen if you are debugging and the application is paused. // As it is so common, not worth popping up a dialog. - if ((type == QtWarningMsg) && QString(msg).contains("QClipboard::event") - && QString(msg).contains("Cowardly refusing")) + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("QClipboard::event")) + && msg.contains(QStringLiteral("Cowardly refusing"))) { type = QtDebugMsg; } @@ -132,7 +133,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con const bool isGuiThread = instance && (QThread::currentThread() == instance->thread()); { - QString debugdate = "[" + QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss"); + QString debugdate = "[" + QDateTime::currentDateTime().toString(QStringLiteral("yyyy.MM.dd hh:mm:ss")); switch (type) { diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index b786d92b7..99e9ba304 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -43,11 +43,11 @@ //must be the same order as PaperSizeTemplate constants const DialogLayoutSettings::FormatsVector DialogLayoutSettings::pageFormatNames = - DialogLayoutSettings::FormatsVector () << QLatin1Literal("A0") - << QLatin1Literal("A1") - << QLatin1Literal("A2") - << QLatin1Literal("A3") - << QLatin1Literal("A4") + DialogLayoutSettings::FormatsVector () << QLatin1String("A0") + << QLatin1String("A1") + << QLatin1String("A2") + << QLatin1String("A3") + << QLatin1String("A4") << QApplication::translate("DialogLayoutSettings", "Letter") << QApplication::translate("DialogLayoutSettings", "Legal") << QApplication::translate("DialogLayoutSettings", "Roll 24in") diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index 380067988..3e6415850 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -67,7 +67,7 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget * ui->lineEditFileName->setValidator( new QRegExpValidator(QRegExp(baseFilenameRegExp), this)); #endif - const QString mask = fileName+QLatin1Literal("_"); + const QString mask = fileName+QLatin1String("_"); if (VApplication::IsGUIMode()) { ui->lineEditFileName->setText(mask); @@ -299,15 +299,15 @@ bool DialogSaveLayout::TestPdf() QVector> DialogSaveLayout::InitAvailFormats() { QVector> list; - list.append(std::make_pair(tr("Svg files (*.svg)"), QLatin1Literal(".svg"))); - list.append(std::make_pair(tr("PDF files (*.pdf)"), QLatin1Literal(".pdf"))); - list.append(std::make_pair(tr("Images (*.png)"), QLatin1Literal(".png"))); - list.append(std::make_pair(tr("Wavefront OBJ (*.obj)"), QLatin1Literal(".obj"))); + list.append(std::make_pair(tr("Svg files (*.svg)"), QLatin1String(".svg"))); + list.append(std::make_pair(tr("PDF files (*.pdf)"), QLatin1String(".pdf"))); + list.append(std::make_pair(tr("Images (*.png)"), QLatin1String(".png"))); + list.append(std::make_pair(tr("Wavefront OBJ (*.obj)"), QLatin1String(".obj"))); if (SupportPSTest()) { - list.append(std::make_pair(tr("PS files (*.ps)"), QLatin1Literal(".ps"))); - list.append(std::make_pair(tr("EPS files (*.eps)"), QLatin1Literal(".eps"))); + list.append(std::make_pair(tr("PS files (*.ps)"), QLatin1String(".ps"))); + list.append(std::make_pair(tr("EPS files (*.eps)"), QLatin1String(".eps"))); } - list.append(std::make_pair(tr("DXF files (*.dxf)"), QLatin1Literal(".dxf"))); + list.append(std::make_pair(tr("DXF files (*.dxf)"), QLatin1String(".dxf"))); return list; } diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index cb16125a6..03e8cbb00 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3020,7 +3020,7 @@ bool MainWindow::SavePattern(const QString &fileName, QString &error) const bool result = doc->SaveDocument(fileName, error); if (result) { - if (tempInfo.suffix() != QLatin1Literal("autosave")) + if (tempInfo.suffix() != QLatin1String("autosave")) { setCurrentFile(fileName); helpLabel->setText(tr("File saved")); @@ -4419,7 +4419,7 @@ QString MainWindow::GetPatternFileName() { shownName = StrippedName(curFile); } - shownName += QLatin1Literal("[*]"); + shownName += QLatin1String("[*]"); return shownName; } @@ -4437,10 +4437,10 @@ QString MainWindow::GetMeasurementFileName() if(mChanges) { - shownName += QLatin1Literal("*"); + shownName += QLatin1String("*"); } - shownName += QLatin1Literal("]"); + shownName += QLatin1String("]"); return shownName; } } @@ -4460,7 +4460,7 @@ void MainWindow::UpdateWindowTitle() #if defined(Q_OS_MAC) static QIcon fileIcon = QIcon(QApplication::applicationDirPath() + - QLatin1Literal("/../Resources/Valentina.icns")); + QLatin1String("/../Resources/Valentina.icns")); QIcon icon; if (not curFile.isEmpty()) { diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index a1b4d8e53..7ea4ffdd0 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -979,7 +979,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr #ifdef Q_OS_WIN printer->setOutputFileName(outputFileName); #else - printer->setOutputFileName(outputFileName + QLatin1Literal(".pdf")); + printer->setOutputFileName(outputFileName + QLatin1String(".pdf")); #endif #ifdef Q_OS_MAC diff --git a/src/app/valentina/valentina.pro b/src/app/valentina/valentina.pro index ede57e369..7c2a33e5c 100644 --- a/src/app/valentina/valentina.pro +++ b/src/app/valentina/valentina.pro @@ -67,52 +67,10 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - -isystem "$${OUT_PWD}/../../libs/vtools/$${UI_DIR}" \ # For VTools UI files - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - -isystem "$${OUT_PWD}/../../libs/vtools/$${UI_DIR}" \ # For VTools UI files - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wmissing-prototypes \ - -Wundefined-reinterpret-cast - } - *-icc-*{ - QMAKE_CXXFLAGS+= \ - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - -isystem "$${OUT_PWD}/../../libs/vtools/$${UI_DIR}" \ # For VTools UI files - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ - QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. } } @@ -128,6 +86,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols DEFINES += V_NO_DEBUG } else { diff --git a/src/app/valentina/warnings.pri b/src/app/valentina/warnings.pri new file mode 100644 index 000000000..2e87a116f --- /dev/null +++ b/src/app/valentina/warnings.pri @@ -0,0 +1,57 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + -isystem "$${OUT_PWD}/../../libs/vtools/$${UI_DIR}" \ # For VTools UI files + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + -isystem "$${OUT_PWD}/../../libs/vtools/$${UI_DIR}" \ # For VTools UI files + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wmissing-prototypes \ + -Wundefined-reinterpret-cast +} + +*-icc-*{ + QMAKE_CXXFLAGS+= \ + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + -isystem "$${OUT_PWD}/../../libs/vtools/$${UI_DIR}" \ # For VTools UI files + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 901a8045a..0fb139822 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -355,7 +355,7 @@ bool VPattern::SaveDocument(const QString &fileName, QString &error) const } const bool saved = VAbstractPattern::SaveDocument(fileName, error); - if (saved && QFileInfo(fileName).suffix() != QLatin1Literal("autosave")) + if (saved && QFileInfo(fileName).suffix() != QLatin1String("autosave")) { modified = false; } diff --git a/src/libs/fervor/fervor.pro b/src/libs/fervor/fervor.pro index 7281ebb51..63eaae37e 100644 --- a/src/libs/fervor/fervor.pro +++ b/src/libs/fervor/fervor.pro @@ -48,37 +48,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -93,6 +63,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/libs/fervor/fvupdater.cpp b/src/libs/fervor/fvupdater.cpp index 946412ab0..b8646397b 100644 --- a/src/libs/fervor/fvupdater.cpp +++ b/src/libs/fervor/fvupdater.cpp @@ -339,13 +339,13 @@ bool FvUpdater::xmlParseFeed() if (m_xml.isStartElement()) { - if (m_xml.name() == QLatin1Literal("item")) + if (m_xml.name() == QLatin1String("item")) { xmlEnclosureUrl.clear(); xmlEnclosureVersion.clear(); xmlEnclosurePlatform.clear(); } - else if (m_xml.name() == QLatin1Literal("enclosure")) + else if (m_xml.name() == QLatin1String("enclosure")) { const QXmlStreamAttributes attribs = m_xml.attributes(); const QString fervorPlatform = QStringLiteral("fervor:platform"); @@ -381,7 +381,7 @@ bool FvUpdater::xmlParseFeed() } else if (m_xml.isEndElement()) { - if (m_xml.name() == QLatin1Literal("item")) + if (m_xml.name() == QLatin1String("item")) { // That's it - we have analyzed a single and we'll stop // here (because the topmost is the most recent one, and thus diff --git a/src/libs/fervor/warnings.pri b/src/libs/fervor/warnings.pri new file mode 100644 index 000000000..8bd738583 --- /dev/null +++ b/src/libs/fervor/warnings.pri @@ -0,0 +1,45 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/ifc/ifc.pro b/src/libs/ifc/ifc.pro index aa213c227..b115a0547 100644 --- a/src/libs/ifc/ifc.pro +++ b/src/libs/ifc/ifc.pro @@ -56,43 +56,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wmissing-prototypes \ - -Wundefined-reinterpret-cast - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -107,6 +71,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/libs/ifc/warnings.pri b/src/libs/ifc/warnings.pri new file mode 100644 index 000000000..be993a88e --- /dev/null +++ b/src/libs/ifc/warnings.pri @@ -0,0 +1,51 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wmissing-prototypes \ + -Wundefined-reinterpret-cast +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/ifc/xml/vabstractconverter.cpp b/src/libs/ifc/xml/vabstractconverter.cpp index 079da3610..3f057de70 100644 --- a/src/libs/ifc/xml/vabstractconverter.cpp +++ b/src/libs/ifc/xml/vabstractconverter.cpp @@ -57,7 +57,7 @@ void VAbstractConverter::Convert() } QString error; - const QString backupFileName = fileName + QLatin1Literal(".backup"); + const QString backupFileName = fileName + QLatin1String(".backup"); if (SafeCopy(fileName, backupFileName, error) == false) { const QString errorMsg(tr("Error creating a backup file: %1.").arg(error)); diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 74f8fcce2..19d3f5d7e 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -164,7 +164,7 @@ QStringList VAbstractPattern::ListMeasurements() const const QList tValues = tokens.values(); for (int j = 0; j < tValues.size(); ++j) { - if (tValues.at(j) == QLatin1Literal("-")) + if (tValues.at(j) == QLatin1String("-")) { continue; } @@ -1232,11 +1232,11 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag) element = createElement(TagGradation); QDomElement heights = createElement(TagHeights); - heights.setAttribute(AttrAll, QLatin1Literal("true")); + heights.setAttribute(AttrAll, QLatin1String("true")); element.appendChild(heights); QDomElement sizes = createElement(TagSizes); - sizes.setAttribute(AttrAll, QLatin1Literal("true")); + sizes.setAttribute(AttrAll, QLatin1String("true")); element.appendChild(sizes); break; } diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index 0a44f9841..11eaef7cc 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -771,7 +771,7 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q qt_ntfs_permission_lookup++; // turn checking on #endif /*Q_OS_WIN32*/ - QTemporaryFile destFile(destination + QLatin1Literal(".XXXXXX")); + QTemporaryFile destFile(destination + QLatin1String(".XXXXXX")); destFile.setAutoRemove(false); if (not destFile.open()) { diff --git a/src/libs/ifc/xml/vdomdocument.h b/src/libs/ifc/xml/vdomdocument.h index 4972d7796..6c51cacee 100644 --- a/src/libs/ifc/xml/vdomdocument.h +++ b/src/libs/ifc/xml/vdomdocument.h @@ -139,9 +139,7 @@ template */ inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const T &value) const { - QString val = QString().setNum(value); - val = val.replace(",", "."); - domElement.setAttribute(name, val); + domElement.setAttribute(name, QString().setNum(value).replace(QLatin1String(","), QLatin1String("."))); } //--------------------------------------------------------------------------------------------------------------------- @@ -156,16 +154,7 @@ inline void VDomDocument::SetAttribute(QDomElement &domElement, const Q template <> inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const bool &value) const { - QString string; - if (value) - { - string = "true"; - } - else - { - string = "false"; - } - domElement.setAttribute(name, string); + domElement.setAttribute(name, value ? QStringLiteral("true") : QStringLiteral("false")); } //--------------------------------------------------------------------------------------------------------------------- @@ -173,14 +162,8 @@ template <> inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const MeasurementsType &value) const { - if (value == MeasurementsType::Standard) - { - domElement.setAttribute(name, "standard"); - } - else - { - domElement.setAttribute(name, "individual"); - } + domElement.setAttribute(name, value == MeasurementsType::Standard ? QStringLiteral("standard") : + QStringLiteral("individual")); } #ifdef Q_CC_GNU diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 1f937c29b..819a98d47 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -181,7 +181,7 @@ void VPatternConverter::ApplyPatches() catch (VException &e) { QString error; - const QString backupFileName = fileName + QLatin1Literal(".backup"); + const QString backupFileName = fileName + QLatin1String(".backup"); if (SafeCopy(backupFileName, fileName, error) == false) { const QString errorMsg(tr("Error restoring backup file: %1.").arg(error)); @@ -896,7 +896,7 @@ void VPatternConverter::ParseModelingToV0_2_4(const QDomElement &modeling) QDomElement node = modeling.firstChild().toElement(); while (not node.isNull()) { - if (node.tagName() == QLatin1Literal("tools")) + if (node.tagName() == QLatin1String("tools")) { const quint32 toolId = node.attribute(QStringLiteral("id")).toUInt(); QVector children; diff --git a/src/libs/ifc/xml/vvitconverter.cpp b/src/libs/ifc/xml/vvitconverter.cpp index adbc1a058..94c317b49 100644 --- a/src/libs/ifc/xml/vvitconverter.cpp +++ b/src/libs/ifc/xml/vvitconverter.cpp @@ -110,7 +110,7 @@ void VVITConverter::ApplyPatches() catch (VException &e) { QString error; - const QString backupFileName = fileName + QLatin1Literal(".backup"); + const QString backupFileName = fileName + QLatin1String(".backup"); if (SafeCopy(backupFileName, fileName, error) == false) { const QString errorMsg(tr("Error restoring backup file: %1.").arg(error)); diff --git a/src/libs/ifc/xml/vvstconverter.cpp b/src/libs/ifc/xml/vvstconverter.cpp index 56b428588..37136c3f9 100644 --- a/src/libs/ifc/xml/vvstconverter.cpp +++ b/src/libs/ifc/xml/vvstconverter.cpp @@ -104,7 +104,7 @@ void VVSTConverter::ApplyPatches() catch (VException &e) { QString error; - const QString backupFileName = fileName + QLatin1Literal(".backup"); + const QString backupFileName = fileName + QLatin1String(".backup"); if (SafeCopy(backupFileName, fileName, error) == false) { const QString errorMsg(tr("Error restoring backup file: %1.").arg(error)); diff --git a/src/libs/qmuparser/qmuparser.pro b/src/libs/qmuparser/qmuparser.pro index 026c57a4f..3982eeb7b 100644 --- a/src/libs/qmuparser/qmuparser.pro +++ b/src/libs/qmuparser/qmuparser.pro @@ -65,34 +65,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -107,6 +80,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noStripDebugSymbols { # do nothing } else { diff --git a/src/libs/qmuparser/warnings.pri b/src/libs/qmuparser/warnings.pri new file mode 100644 index 000000000..5e56557c8 --- /dev/null +++ b/src/libs/qmuparser/warnings.pri @@ -0,0 +1,42 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vdxf/vdxf.pro b/src/libs/vdxf/vdxf.pro index 7155fcaf7..311cf10bc 100644 --- a/src/libs/vdxf/vdxf.pro +++ b/src/libs/vdxf/vdxf.pro @@ -43,34 +43,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -85,6 +58,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/libs/vdxf/warnings.pri b/src/libs/vdxf/warnings.pri new file mode 100644 index 000000000..5e56557c8 --- /dev/null +++ b/src/libs/vdxf/warnings.pri @@ -0,0 +1,42 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vformat/vformat.pro b/src/libs/vformat/vformat.pro index e75fc6c3d..3c62a9720 100644 --- a/src/libs/vformat/vformat.pro +++ b/src/libs/vformat/vformat.pro @@ -49,34 +49,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -91,6 +64,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/libs/vformat/warnings.pri b/src/libs/vformat/warnings.pri new file mode 100644 index 000000000..5e56557c8 --- /dev/null +++ b/src/libs/vformat/warnings.pri @@ -0,0 +1,42 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vgeometry/vgeometry.pro b/src/libs/vgeometry/vgeometry.pro index 327e1d802..524c6379f 100644 --- a/src/libs/vgeometry/vgeometry.pro +++ b/src/libs/vgeometry/vgeometry.pro @@ -45,34 +45,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -87,6 +60,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/libs/vgeometry/warnings.pri b/src/libs/vgeometry/warnings.pri new file mode 100644 index 000000000..5e56557c8 --- /dev/null +++ b/src/libs/vgeometry/warnings.pri @@ -0,0 +1,42 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vlayout/vlayout.pro b/src/libs/vlayout/vlayout.pro index 5380d9df3..0a77c8638 100644 --- a/src/libs/vlayout/vlayout.pro +++ b/src/libs/vlayout/vlayout.pro @@ -48,48 +48,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and - # want them in the global list. Compromise decision is to delete them from the local list. - QMAKE_CXXFLAGS -= \ - -Wlong-long \ - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wundefined-reinterpret-cast \ - -Wmissing-prototypes # rcc folder - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -104,6 +63,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + QMAKE_CXXFLAGS -= -O2 # Disable default optimization level QMAKE_CXXFLAGS += -O3 # For vlayout library enable speed optimizations diff --git a/src/libs/vlayout/warnings.pri b/src/libs/vlayout/warnings.pri new file mode 100644 index 000000000..a3e5bcdf5 --- /dev/null +++ b/src/libs/vlayout/warnings.pri @@ -0,0 +1,56 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and + # want them in the global list. Compromise decision is to delete them from the local list. + QMAKE_CXXFLAGS -= \ + -Wlong-long \ + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wundefined-reinterpret-cast \ + -Wmissing-prototypes # rcc folder +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vmisc/projectversion.cpp b/src/libs/vmisc/projectversion.cpp index 89d73c2cd..ab620ce3f 100644 --- a/src/libs/vmisc/projectversion.cpp +++ b/src/libs/vmisc/projectversion.cpp @@ -44,13 +44,13 @@ QString compilerString() #if defined(Q_CC_INTEL) // must be before GNU, Clang and MSVC because ICC/ICL claim to be them QString iccCompact; #ifdef __INTEL_CLANG_COMPILER - iccCompact = QLatin1Literal("Clang"); + iccCompact = QLatin1String("Clang"); #elif defined(__INTEL_MS_COMPAT_LEVEL) - iccCompact = QLatin1Literal("Microsoft"); + iccCompact = QLatin1String("Microsoft"); #elif defined(__GNUC__) - iccCompact = QLatin1Literal("GCC"); + iccCompact = QLatin1String("GCC"); #else - iccCompact = QLatin1Literal("no"); + iccCompact = QLatin1String("no"); #endif QString iccVersion; if (__INTEL_COMPILER >= 1300) diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index 14f52abb0..c8e7ea71f 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -79,6 +79,12 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv) // Connect this slot with VApplication::aboutToQuit. Settings()->sync(); }); + +#if !defined(V_NO_ASSERT) + // Ignore SSL-related warnings + // See issue #528: Error: QSslSocket: cannot resolve SSLv2_client_method. + qputenv("QT_LOGGING_RULES", "qt.network.ssl.warning=false"); +#endif //!defined(V_NO_ASSERT) } //--------------------------------------------------------------------------------------------------------------------- @@ -102,12 +108,12 @@ QString VAbstractApplication::translationsPath(const QString &locale) const QString mainPath; if (locale.isEmpty()) { - mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath; + mainPath = QApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath; } else { - mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath + QLatin1Literal("/") - + locale + QLatin1Literal(".lproj"); + mainPath = QApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath + QLatin1String("/") + + locale + QLatin1String(".lproj"); } QDir dirBundle(mainPath); if (dirBundle.exists()) diff --git a/src/libs/vmisc/vlockguard.h b/src/libs/vmisc/vlockguard.h index bb87e26aa..a266ff2a4 100644 --- a/src/libs/vmisc/vlockguard.h +++ b/src/libs/vmisc/vlockguard.h @@ -156,10 +156,10 @@ bool VLockGuard::TryLock(const QString &lockName, int stale, int timeou #if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) - lockFile = lockName + QLatin1Literal(".lock"); + lockFile = lockName + QLatin1String(".lock"); #if defined(Q_OS_UNIX) QFileInfo info(lockFile); - lockFile = info.absolutePath() + QLatin1Literal("/.") + info.fileName(); + lockFile = info.absolutePath() + QLatin1String("/.") + info.fileName(); #endif lock.reset(new QLockFile(lockFile)); diff --git a/src/libs/vmisc/vmisc.pro b/src/libs/vmisc/vmisc.pro index a674a672f..3f5ccb29b 100644 --- a/src/libs/vmisc/vmisc.pro +++ b/src/libs/vmisc/vmisc.pro @@ -51,39 +51,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wmissing-prototypes - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -102,12 +70,13 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols - DEFINES += V_NO_DEBUG + # do nothing } else { - noCrashReports{ - DEFINES += V_NO_DEBUG - } !macx:!win32-msvc*{ # Turn on debug symbols in release mode on Unix systems. # On Mac OS X temporarily disabled. TODO: find way how to strip binary file. diff --git a/src/libs/vmisc/warnings.pri b/src/libs/vmisc/warnings.pri new file mode 100644 index 000000000..e94434007 --- /dev/null +++ b/src/libs/vmisc/warnings.pri @@ -0,0 +1,47 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wmissing-prototypes +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vobj/predicates.cpp b/src/libs/vobj/predicates.cpp index 0e08ed674..b46aa05a3 100644 --- a/src/libs/vobj/predicates.cpp +++ b/src/libs/vobj/predicates.cpp @@ -498,6 +498,10 @@ qreal estimate(int elen, qreal *e) return Q; } +#if defined(Q_CC_GNU) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif qreal incircleadapt(qreal *pa, qreal *pb, qreal *pc, qreal *pd, qreal permanent) { INEXACT qreal adx, bdx, cdx, ady, bdy, cdy; @@ -1031,6 +1035,9 @@ qreal incircleadapt(qreal *pa, qreal *pb, qreal *pc, qreal *pd, qreal permanent) return finnow[finlength - 1]; } +#if defined(Q_CC_GNU) + #pragma GCC diagnostic pop +#endif qreal incircle(qreal *pa, qreal *pb, qreal *pc, qreal *pd) { diff --git a/src/libs/vobj/vobj.pro b/src/libs/vobj/vobj.pro index 7008b2559..bee46b371 100644 --- a/src/libs/vobj/vobj.pro +++ b/src/libs/vobj/vobj.pro @@ -43,34 +43,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -85,6 +58,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/libs/vobj/warnings.pri b/src/libs/vobj/warnings.pri new file mode 100644 index 000000000..5e56557c8 --- /dev/null +++ b/src/libs/vobj/warnings.pri @@ -0,0 +1,42 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vpatterndb/vpatterndb.pro b/src/libs/vpatterndb/vpatterndb.pro index 28d254840..9460a67d6 100644 --- a/src/libs/vpatterndb/vpatterndb.pro +++ b/src/libs/vpatterndb/vpatterndb.pro @@ -46,34 +46,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -88,6 +61,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/libs/vpatterndb/warnings.pri b/src/libs/vpatterndb/warnings.pri new file mode 100644 index 000000000..5e56557c8 --- /dev/null +++ b/src/libs/vpatterndb/warnings.pri @@ -0,0 +1,42 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vpropertyexplorer/vpropertyexplorer.pro b/src/libs/vpropertyexplorer/vpropertyexplorer.pro index 36302808b..a5eff9e62 100644 --- a/src/libs/vpropertyexplorer/vpropertyexplorer.pro +++ b/src/libs/vpropertyexplorer/vpropertyexplorer.pro @@ -63,45 +63,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - # Key -isystem disable checking errors in system headers. - $$GCC_DEBUG_CXXFLAGS \ # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wswitch-default - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wundefined-reinterpret-cast - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. @@ -116,6 +78,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + !macx:!win32-msvc*{ noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing diff --git a/src/libs/vpropertyexplorer/warnings.pri b/src/libs/vpropertyexplorer/warnings.pri new file mode 100644 index 000000000..fcf8e2aeb --- /dev/null +++ b/src/libs/vpropertyexplorer/warnings.pri @@ -0,0 +1,52 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + # Key -isystem disable checking errors in system headers. + $$GCC_DEBUG_CXXFLAGS \ # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wswitch-default + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wundefined-reinterpret-cast +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vtools/dialogs/tools/dialogalongline.cpp b/src/libs/vtools/dialogs/tools/dialogalongline.cpp index 117e03e1a..3b0f14df4 100644 --- a/src/libs/vtools/dialogs/tools/dialogalongline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogalongline.cpp @@ -179,7 +179,7 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type) line->RefreshGeometry(); if (buildMidpoint) { - SetFormula(currentLength + QLatin1Literal("/2")); + SetFormula(currentLength + QLatin1String("/2")); } prepare = true; this->setModal(true); diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp index 2262796f8..29d1df0ed 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp +++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp @@ -640,7 +640,7 @@ bool DialogDetail::DetailIsValid() const QByteArray byteArray; QBuffer buffer(&byteArray); pixmap.save(&buffer, "PNG"); - QString url = QString(" "); + QString url = QString(" "); if(CreateDetail().ContourPoints(data).count() < 3) { diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index d025c97d3..9355f8ca7 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -934,6 +934,6 @@ void DialogSplinePath::ShowPointIssue(const QString &pName) } else { - item->setText(pName + QLatin1Literal("(!)")); + item->setText(pName + QLatin1String("(!)")); } } diff --git a/src/libs/vtools/vtools.pro b/src/libs/vtools/vtools.pro index fe30de8e8..0041fa51d 100644 --- a/src/libs/vtools/vtools.pro +++ b/src/libs/vtools/vtools.pro @@ -53,42 +53,7 @@ INCLUDEPATH += $$PWD/../vpatterndb CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ -# -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wundefined-reinterpret-cast - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -103,6 +68,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/libs/vtools/warnings.pri b/src/libs/vtools/warnings.pri new file mode 100644 index 000000000..ac67d588c --- /dev/null +++ b/src/libs/vtools/warnings.pri @@ -0,0 +1,50 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ +# -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wundefined-reinterpret-cast +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/libs/vwidgets/vwidgets.pro b/src/libs/vwidgets/vwidgets.pro index 8eb426b73..8dd99831c 100644 --- a/src/libs/vwidgets/vwidgets.pro +++ b/src/libs/vwidgets/vwidgets.pro @@ -45,39 +45,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wundefined-reinterpret-cast - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -92,6 +60,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/libs/vwidgets/warnings.pri b/src/libs/vwidgets/warnings.pri new file mode 100644 index 000000000..9c68dfe1c --- /dev/null +++ b/src/libs/vwidgets/warnings.pri @@ -0,0 +1,47 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wundefined-reinterpret-cast +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/test/ParserTest/ParserTest.pro b/src/test/ParserTest/ParserTest.pro index bd360e7f6..0a7a88068 100644 --- a/src/test/ParserTest/ParserTest.pro +++ b/src/test/ParserTest/ParserTest.pro @@ -51,34 +51,7 @@ $$enable_ccache() CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. - - # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and - # want them in global list. Compromise decision delete them from local list. - QMAKE_CXXFLAGS -= \ - -Wmissing-prototypes - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -90,6 +63,10 @@ CONFIG(debug, debug|release){ !win32-msvc*:CONFIG += silent DEFINES += QT_NO_DEBUG_OUTPUT + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/test/ParserTest/warnings.pri b/src/test/ParserTest/warnings.pri new file mode 100644 index 000000000..9f37c06ac --- /dev/null +++ b/src/test/ParserTest/warnings.pri @@ -0,0 +1,42 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and + # want them in global list. Compromise decision delete them from local list. + QMAKE_CXXFLAGS -= \ + -Wmissing-prototypes +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} diff --git a/src/test/ValentinaTest/ValentinaTest.pro b/src/test/ValentinaTest/ValentinaTest.pro index 360fb8853..8c7272185 100644 --- a/src/test/ValentinaTest/ValentinaTest.pro +++ b/src/test/ValentinaTest/ValentinaTest.pro @@ -92,41 +92,7 @@ DEFINES += TS_DIR=\\\"$${PWD}/../../../share/translations\\\" CONFIG(debug, debug|release){ # Debug mode unix { - #Turn on compilers warnings. - *-g++{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. - - noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer - # do nothing - } else { - #gcc’s 4.8.0 Address Sanitizer - #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer - QMAKE_LFLAGS += -fsanitize=address - } - } - clang*{ - QMAKE_CXXFLAGS += \ - # Key -isystem disable checking errors in system headers. - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$CLANG_DEBUG_CXXFLAGS \ # See common.pri for more details. - -Wno-gnu-zero-variadic-macro-arguments\ # See macros QSKIP - } - *-icc-*{ - QMAKE_CXXFLAGS += \ - -isystem "$${OUT_PWD}/$${UI_DIR}" \ - -isystem "$${OUT_PWD}/$${MOC_DIR}" \ - -isystem "$${OUT_PWD}/$${RCC_DIR}" \ - $$ICC_DEBUG_CXXFLAGS - } + include(warnings.pri) } else { *-g++{ QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. @@ -140,6 +106,10 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -fno-omit-frame-pointer # Need for exchndl.dll } + checkWarnings{ + unix:include(warnings.pri) + } + noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { diff --git a/src/test/ValentinaTest/abstracttest.cpp b/src/test/ValentinaTest/abstracttest.cpp index a54d1b1b2..aca37f533 100644 --- a/src/test/ValentinaTest/abstracttest.cpp +++ b/src/test/ValentinaTest/abstracttest.cpp @@ -55,7 +55,7 @@ QString AbstractTest::ValentinaPath() const { const QString path = QStringLiteral("/../../../app/valentina/bin/valentina"); #ifdef Q_OS_WIN - return QApplication::applicationDirPath() + path + QLatin1Literal(".exe"); + return QApplication::applicationDirPath() + path + QLatin1String(".exe"); #else return QApplication::applicationDirPath() + path; #endif @@ -66,7 +66,7 @@ QString AbstractTest::TapePath() const { const QString path = QStringLiteral("/../../../app/tape/bin/tape"); #ifdef Q_OS_WIN - return QApplication::applicationDirPath() + path + QLatin1Literal(".exe"); + return QApplication::applicationDirPath() + path + QLatin1String(".exe"); #else return QApplication::applicationDirPath() + path; #endif diff --git a/src/test/ValentinaTest/tst_measurementregexp.cpp b/src/test/ValentinaTest/tst_measurementregexp.cpp index f71d54a91..0cafa210c 100644 --- a/src/test/ValentinaTest/tst_measurementregexp.cpp +++ b/src/test/ValentinaTest/tst_measurementregexp.cpp @@ -431,7 +431,7 @@ int TST_MeasurementRegExp::LoadMeasurements(const QString &checkedSystem, const const QString path = TranslationsPath(); const QString file = QString("measurements_%1_%2.qm").arg(checkedSystem).arg(checkedLocale); - if (QFileInfo(path+QLatin1Literal("/")+file).size() <= 34) + if (QFileInfo(path+QLatin1String("/")+file).size() <= 34) { const QString message = QString("Translation for system = %1 and locale = %2 is empty. \nFull path: %3/%4") .arg(checkedSystem) @@ -482,7 +482,7 @@ int TST_MeasurementRegExp::LoadVariables(const QString &checkedLocale) const QString path = TranslationsPath(); const QString file = QString("valentina_%1.qm").arg(checkedLocale); - if (QFileInfo(path+QLatin1Literal("/")+file).size() <= 34) + if (QFileInfo(path+QLatin1String("/")+file).size() <= 34) { const QString message = QString("Translation variables for locale = %1 is empty. \nFull path: %2/%3") .arg(checkedLocale) @@ -660,7 +660,7 @@ void TST_MeasurementRegExp::CheckUnderlineExists() const while (i != data.constEnd()) { const QString translated = trMs->InternalVarToUser(i.key()); - if ((translated.right(1) == QLatin1Literal("_")) != i.value()) + if ((translated.right(1) == QLatin1String("_")) != i.value()) { const QString message = QString("String '%1' doesn't contain underline. Original string is '%2'") .arg(translated).arg(i.key()); @@ -676,11 +676,11 @@ void TST_MeasurementRegExp::CheckInternalVaribleRegExp() const const QString regex = QStringLiteral("(.){1,}_(.){1,}$"); foreach(const QString &var, builInVariables) { - const QString sourceRegex = QLatin1Literal("^") + var + regex; + const QString sourceRegex = QLatin1String("^") + var + regex; const QRegularExpression sourceRe(sourceRegex); const QString translated = trMs->InternalVarToUser(var); - const QString translationRegex = QLatin1Literal("^") + translated + regex; + const QString translationRegex = QLatin1String("^") + translated + regex; const QRegularExpression translationRe(translationRegex); const QStringList originalNames = AllGroupNames() + builInFunctions + builInVariables; diff --git a/src/test/ValentinaTest/tst_qmuparsererrormsg.cpp b/src/test/ValentinaTest/tst_qmuparsererrormsg.cpp index b2dbcaffe..89fe8ce07 100644 --- a/src/test/ValentinaTest/tst_qmuparsererrormsg.cpp +++ b/src/test/ValentinaTest/tst_qmuparsererrormsg.cpp @@ -212,6 +212,6 @@ void TST_QmuParserErrorMsg::CheckStrings(int code, bool tok, bool pos) const QString translated = (*msg)[code]; const QString message = QString("String: '%1'.").arg(translated); - QVERIFY2((translated.indexOf(QLatin1Literal("$TOK$")) != -1) == tok, qUtf8Printable(message)); - QVERIFY2((translated.indexOf(QLatin1Literal("$POS$")) != -1) == pos, qUtf8Printable(message)); + QVERIFY2((translated.indexOf(QLatin1String("$TOK$")) != -1) == tok, qUtf8Printable(message)); + QVERIFY2((translated.indexOf(QLatin1String("$POS$")) != -1) == pos, qUtf8Printable(message)); } diff --git a/src/test/ValentinaTest/tst_tstranslation.cpp b/src/test/ValentinaTest/tst_tstranslation.cpp index 8015a8b2a..1e789e98f 100644 --- a/src/test/ValentinaTest/tst_tstranslation.cpp +++ b/src/test/ValentinaTest/tst_tstranslation.cpp @@ -116,7 +116,7 @@ void TST_TSTranslation::CheckEmptyToolButton() continue; } - if (source == QLatin1Literal("...")) + if (source == QLatin1String("...")) { const QDomElement translationTag = message.firstChildElement(TagTranslation); if (translationTag.hasAttribute(AttrType)) @@ -210,7 +210,7 @@ void TST_TSTranslation::CheckPlaceMarkerExist() for (int i = 1; i <= 99; ++i) { - const QString marker = QLatin1Literal("%") + QString().setNum(i); + const QString marker = QLatin1String("%") + QString().setNum(i); const bool sourceMark = source.indexOf(marker) != -1; if (sourceMark) { @@ -218,8 +218,8 @@ void TST_TSTranslation::CheckPlaceMarkerExist() if (sourceMarkCount != i) { const QString message = QString("In source string '%1' was missed place marker ") - .arg(source) + QLatin1Literal("'%") + QString().setNum(sourceMarkCount) + - QLatin1Literal("'."); + .arg(source) + QLatin1String("'%") + QString().setNum(sourceMarkCount) + + QLatin1String("'."); QFAIL(qUtf8Printable(message)); } } @@ -231,8 +231,8 @@ void TST_TSTranslation::CheckPlaceMarkerExist() if (translationMarkCount != i) { const QString message = QString("In translation string '%1' was missed place marker ") - .arg(translation) + QLatin1Literal("'%") + QString().setNum(translationMarkCount) + - QLatin1Literal("'."); + .arg(translation) + QLatin1String("'%") + QString().setNum(translationMarkCount) + + QLatin1String("'."); QFAIL(qUtf8Printable(message)); } } @@ -241,8 +241,8 @@ void TST_TSTranslation::CheckPlaceMarkerExist() { const QString message = QString("Compare to source string in the translation string '%1' was missed place marker ") - .arg(translation) + QLatin1Literal("'%") + QString().setNum(sourceMarkCount) + - QLatin1Literal("'."); + .arg(translation) + QLatin1String("'%") + QString().setNum(sourceMarkCount) + + QLatin1String("'."); QFAIL(qUtf8Printable(message)); } } diff --git a/src/test/ValentinaTest/tst_valentinacommandline.cpp b/src/test/ValentinaTest/tst_valentinacommandline.cpp index a9c7283f7..b1885dd11 100644 --- a/src/test/ValentinaTest/tst_valentinacommandline.cpp +++ b/src/test/ValentinaTest/tst_valentinacommandline.cpp @@ -51,7 +51,7 @@ void TST_ValentinaCommandLine::init() } if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() + - QLatin1Literal("tst_valentina"), + QLatin1String("tst_valentina"), QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder)) { QFAIL("Fail to prepare test files for testing."); @@ -66,7 +66,7 @@ void TST_ValentinaCommandLine::init() } if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() + - QLatin1Literal("tst_valentina_collection"), + QLatin1String("tst_valentina_collection"), QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder)) { QFAIL("Fail to prepare collection files for testing."); @@ -199,25 +199,25 @@ void TST_ValentinaCommandLine::TestMode_data() const QTest::newRow("Issue #256. Correct individual measurements.")<< "issue_256.val" << QString("--test;;-m;;%1").arg(tmp + QDir::separator() + - QLatin1Literal("issue_256_correct.vit")) + QLatin1String("issue_256_correct.vit")) << true << V_EX_OK; QTest::newRow("Issue #256. Wrong individual measurements.")<< "issue_256.val" << QString("--test;;-m;;%1").arg(tmp + QDir::separator() + - QLatin1Literal("issue_256_wrong.vit")) + QLatin1String("issue_256_wrong.vit")) << false << V_EX_NOINPUT; QTest::newRow("Issue #256. Correct standard measurements.")<< "issue_256.val" << QString("--test;;-m;;%1").arg(tmp + QDir::separator() + - QLatin1Literal("issue_256_correct.vst")) + QLatin1String("issue_256_correct.vst")) << true << V_EX_OK; QTest::newRow("Issue #256. Wrong standard measurements.")<< "issue_256.val" << QString("--test;;-m;;%1").arg(tmp + QDir::separator() + - QLatin1Literal("issue_256_wrong.vst")) + QLatin1String("issue_256_wrong.vst")) << false << V_EX_NOINPUT; @@ -254,7 +254,7 @@ void TST_ValentinaCommandLine::TestOpenCollection_data() const QTest::addColumn("exitCode"); const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder; - const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1Literal("GOST_man_ru.vst")); + const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("GOST_man_ru.vst")); const QString keyTest = QStringLiteral("--test"); QTest::newRow("bra") << "bra.val" << keyTest << true << V_EX_OK; diff --git a/src/test/ValentinaTest/warnings.pri b/src/test/ValentinaTest/warnings.pri new file mode 100644 index 000000000..3d7b19eed --- /dev/null +++ b/src/test/ValentinaTest/warnings.pri @@ -0,0 +1,49 @@ +#Turn on compilers warnings. +*-g++{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } + + noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer + # do nothing + } else { + #gcc’s 4.8.0 Address Sanitizer + #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ + QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer + QMAKE_LFLAGS += -fsanitize=address + } +} + +clang*{ + QMAKE_CXXFLAGS += \ + # Key -isystem disable checking errors in system headers. + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$CLANG_DEBUG_CXXFLAGS \ # See common.pri for more details. + -Wno-gnu-zero-variadic-macro-arguments\ # See macros QSKIP + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +} + +*-icc-*{ + QMAKE_CXXFLAGS += \ + -isystem "$${OUT_PWD}/$${UI_DIR}" \ + -isystem "$${OUT_PWD}/$${MOC_DIR}" \ + -isystem "$${OUT_PWD}/$${RCC_DIR}" \ + $$ICC_DEBUG_CXXFLAGS + + checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings + QMAKE_CXXFLAGS += -Werror + } +}