From fab9fa4bfbba0bfaf2e2654308f94a7e15547e4c Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 12 Nov 2013 20:29:03 +0200 Subject: [PATCH] New gcc warnings. --HG-- branch : develop --- Valentina.pro | 9 ++++++++- container/calculator.cpp | 2 ++ container/vcontainer.cpp | 2 ++ dialogs/dialogheight.cpp | 2 ++ dialogs/dialogincrements.cpp | 2 ++ dialogs/dialogtriangle.cpp | 2 ++ geometry/vspline.cpp | 10 ++++++---- main.cpp | 2 ++ mainwindow.cpp | 2 ++ tablewindow.cpp | 4 ++-- tools/drawTools/vtoolpointofcontact.cpp | 2 +- tools/drawTools/vtoolshoulderpoint.cpp | 2 +- tools/drawTools/vtooltriangle.cpp | 6 +++--- widgets/vtablegraphicsview.cpp | 4 ++++ 14 files changed, 39 insertions(+), 12 deletions(-) diff --git a/Valentina.pro b/Valentina.pro index 229bd92d1..13ee22a43 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -76,9 +76,16 @@ CONFIG(debug, debug|release){ QMAKE_CXXFLAGS += -isystem "/usr/include/qt5" -isystem "/usr/include/qt5/QtWidgets" \ -isystem "/usr/include/qt5/QtXml" -isystem "/usr/include/qt5/QtGui" \ -isystem "/usr/include/qt5/QtCore" -isystem "$$OUT_PWD/uic" -isystem "$$OUT_PWD/moc/" \ + -isystem "$$OUT_PWD/rcc/" \ -Og -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \ -Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self \ - -Wunreachable-code -gdwarf-3 + -Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \ + -Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k\ + -Winvalid-pch -Wunsafe-loop-optimizations -Wlong-long -Wmissing-format-attribute \ + -Wmissing-include-dirs -Wpacked -Wredundant-decls \ + -Wswitch-default -Wswitch-enum -Wuninitialized -Wunused-parameter -Wvariadic-macros \ + -Wlogical-op -Wnoexcept \ + -Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -gdwarf-3 }else{ # Release TARGET = $$RELEASE_TARGET diff --git a/container/calculator.cpp b/container/calculator.cpp index 1ba0a8477..b9667ae68 100644 --- a/container/calculator.cpp +++ b/container/calculator.cpp @@ -195,6 +195,8 @@ void Calculator::arith(QChar o, qreal *r, qreal *h) // for(t=*h-1; t>0; --t) // *r = (*r) * ex; break; + default: + break; } } diff --git a/container/vcontainer.cpp b/container/vcontainer.cpp index eee1923cc..5c7908b28 100644 --- a/container/vcontainer.cpp +++ b/container/vcontainer.cpp @@ -424,6 +424,8 @@ QVector VContainer::EkvPoint(const QLineF &line1, const QLineF &line2, points.append(bigLine1.p2()); return points; break; + default: + break; } return points; } diff --git a/dialogs/dialogheight.cpp b/dialogs/dialogheight.cpp index 5f3411532..10cb66285 100644 --- a/dialogs/dialogheight.cpp +++ b/dialogs/dialogheight.cpp @@ -125,6 +125,8 @@ void DialogHeight::ChoosedObject(qint64 id, const Scene::Scenes &type) this->show(); } break; + default: + break; } } } diff --git a/dialogs/dialogincrements.cpp b/dialogs/dialogincrements.cpp index 3a499d8f3..6066a09c9 100644 --- a/dialogs/dialogincrements.cpp +++ b/dialogs/dialogincrements.cpp @@ -499,6 +499,8 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) emit haveLiteChange(); } break; + default: + break; } } diff --git a/dialogs/dialogtriangle.cpp b/dialogs/dialogtriangle.cpp index 7e8a0015b..ad63163d5 100644 --- a/dialogs/dialogtriangle.cpp +++ b/dialogs/dialogtriangle.cpp @@ -100,6 +100,8 @@ void DialogTriangle::ChoosedObject(qint64 id, const Scene::Scenes &type) this->show(); } break; + default: + break; } } } diff --git a/geometry/vspline.cpp b/geometry/vspline.cpp index 2b6c19c6e..5e8d4c1d3 100644 --- a/geometry/vspline.cpp +++ b/geometry/vspline.cpp @@ -364,7 +364,7 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, // All collinear OR p1==p4 //---------------------- k = dx*dx + dy*dy; - if (k == 0) + if (k < 0.000000001) { d2 = CalcSqDistance(x1, y1, x2, y2); d3 = CalcSqDistance(x4, y4, x3, y3); @@ -468,7 +468,7 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, return; } - if (m_cusp_limit != 0.0) + if (m_cusp_limit > 0.0 || m_cusp_limit < 0.0) { if (da1 > m_cusp_limit) { @@ -517,7 +517,7 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, return; } - if (m_cusp_limit != 0.0) + if (m_cusp_limit > 0.0 || m_cusp_limit < 0.0) { if (da1 > m_cusp_limit) { @@ -573,7 +573,7 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, return; } - if (m_cusp_limit != 0.0) + if (m_cusp_limit > 0.0 || m_cusp_limit < 0.0) { if (da1 > m_cusp_limit) { @@ -591,6 +591,8 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, } } break; + default: + break; } // Continue subdivision diff --git a/main.cpp b/main.cpp index bc8d1598c..9e871793e 100644 --- a/main.cpp +++ b/main.cpp @@ -45,6 +45,8 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); abort(); + default: + break; } } diff --git a/mainwindow.cpp b/mainwindow.cpp index 21d895f9d..1ef3d6eba 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -775,6 +775,8 @@ void MainWindow::keyPressEvent ( QKeyEvent * event ) case Qt::Key_Escape: ArrowTool(); break; + default: + break; } QMainWindow::keyPressEvent ( event ); } diff --git a/tablewindow.cpp b/tablewindow.cpp index a704e91e3..655f6593d 100644 --- a/tablewindow.cpp +++ b/tablewindow.cpp @@ -330,7 +330,7 @@ void TableWindow::AddLength() void TableWindow::RemoveLength() { - if (sceneRect.height()<=currentScene->sceneRect().height()-100) + if (sceneRect.height() <= currentScene->sceneRect().height() - 100) { QRectF rect = currentScene->sceneRect(); rect.setHeight(rect.height()-toPixel(279)); @@ -341,7 +341,7 @@ void TableWindow::RemoveLength() rect = paper->rect(); rect.setHeight(rect.height()-toPixel(279)); paper->setRect(rect); - if (sceneRect.height()==currentScene->sceneRect().height()) + if (fabs(sceneRect.height() - currentScene->sceneRect().height()) < 0.01) { ui->actionRemove->setDisabled(true); } diff --git a/tools/drawTools/vtoolpointofcontact.cpp b/tools/drawTools/vtoolpointofcontact.cpp index b14f31e69..9a8cf807f 100644 --- a/tools/drawTools/vtoolpointofcontact.cpp +++ b/tools/drawTools/vtoolpointofcontact.cpp @@ -58,7 +58,7 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF ¢e s_x = secondPoint.x()-(qAbs(secondPoint.x()-firstPoint.x()))*s; s_y = secondPoint.y()-(qAbs(secondPoint.y()-firstPoint.y()))*s; distans = QLineF(center.x(), center.y(), s_x, s_y).length(); - if (ceil(distans*10) == ceil(radius*10)) + if (fabs(distans*10 - radius*10) < 0.1) { pArc.rx() = s_x; pArc.ry() = s_y; diff --git a/tools/drawTools/vtoolshoulderpoint.cpp b/tools/drawTools/vtoolshoulderpoint.cpp index 26e5d2762..ed7fd7bdf 100644 --- a/tools/drawTools/vtoolshoulderpoint.cpp +++ b/tools/drawTools/vtoolshoulderpoint.cpp @@ -59,7 +59,7 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li qDebug()<<"A3П2="< listSelectedItems = scene()->selectedItems(); if (listSelectedItems.size()>0)