From 64a7ac344ee324d47b96b411482b666cc619633f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 28 Jun 2013 13:15:13 -0700 Subject: Deal with unused functions, as found by the Intel compiler Use Q_DECL_UNUSED for the one that is possibly unused (we have two overloads so that one gets selected): qglobal.cpp(2069): warning #177: function "::fromstrerror_helper(int, const QByteArray &)" was declared but never referenced Remove functions really not used: qbezier.cpp(153): warning #177: function "findInflections" was declared but never referenced qbezier.cpp(534): warning #177: function "splitBezierAt" was declared but never referenced qpathclipper.cpp(1039): warning #177: function "midPoint" was declared but never referenced qpainter.cpp(119): warning #177: function "check_gradient" was declared but never referenced qdockarealayout.cpp(2580): warning #177: function "qMin(int, int, int)" was declared but never referenced qmainwindowlayout.cpp(1019): warning #177: function "validateDockWidgetArea" was declared but never referenced qgraphicsanchorlayout_p.cpp(670): warning #177: function "checkAdd" was declared but never referenced qcups.cpp(481): warning #177: function "paperSize2String" was declared but never referenced complexwidgets.cpp(373): warning #177: function "removeInvisibleWidgetsFromList" was declared but never referenced Change-Id: I1e5558e206b04edea381442030dc69536198d966 Reviewed-by: Frederik Gladhorn Reviewed-by: Robin Burchell --- src/corelib/global/qglobal.cpp | 4 +- src/gui/painting/qbezier.cpp | 55 ---------------------- src/gui/painting/qpathclipper.cpp | 10 ---- src/plugins/accessible/widgets/complexwidgets.cpp | 12 ----- src/printsupport/kernel/qcups.cpp | 9 ---- .../graphicsview/qgraphicsanchorlayout_p.cpp | 14 ------ src/widgets/widgets/qdockarealayout.cpp | 1 - src/widgets/widgets/qmainwindowlayout.cpp | 13 ----- 8 files changed, 2 insertions(+), 116 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index c085dbaa4d..bcd0d06777 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2066,11 +2066,11 @@ namespace { // version in portable code. However, it's impossible to do that if // _GNU_SOURCE is defined so we use C++ overloading to decide what to do // depending on the return type - static inline QString fromstrerror_helper(int, const QByteArray &buf) + static inline Q_DECL_UNUSED QString fromstrerror_helper(int, const QByteArray &buf) { return QString::fromLocal8Bit(buf); } - static inline QString fromstrerror_helper(const char *str, const QByteArray &) + static inline Q_DECL_UNUSED QString fromstrerror_helper(const char *str, const QByteArray &) { return QString::fromLocal8Bit(str); } diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 6cef7cc501..2762560da7 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -150,33 +150,6 @@ static inline int quadraticRoots(qreal a, qreal b, qreal c, } } -static inline bool findInflections(qreal a, qreal b, qreal c, - qreal *t1 , qreal *t2, qreal *tCups) -{ - qreal r1 = 0, r2 = 0; - - short rootsCount = quadraticRoots(a, b, c, &r1, &r2); - - if (rootsCount >= 1) { - if (r1 < r2) { - *t1 = r1; - *t2 = r2; - } else { - *t1 = r2; - *t2 = r1; - } - if (!qFuzzyIsNull(a)) - *tCups = qreal(0.5) * (-b / a); - else - *tCups = 2; - - return true; - } - - return false; -} - - void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold) const { QBezier beziers[10]; @@ -531,34 +504,6 @@ static QDebug operator<<(QDebug dbg, const QBezier &bz) } #endif -static inline void splitBezierAt(const QBezier &bez, qreal t, - QBezier *left, QBezier *right) -{ - left->x1 = bez.x1; - left->y1 = bez.y1; - - left->x2 = bez.x1 + t * ( bez.x2 - bez.x1 ); - left->y2 = bez.y1 + t * ( bez.y2 - bez.y1 ); - - left->x3 = bez.x2 + t * ( bez.x3 - bez.x2 ); // temporary holding spot - left->y3 = bez.y2 + t * ( bez.y3 - bez.y2 ); // temporary holding spot - - right->x3 = bez.x3 + t * ( bez.x4 - bez.x3 ); - right->y3 = bez.y3 + t * ( bez.y4 - bez.y3 ); - - right->x2 = left->x3 + t * ( right->x3 - left->x3); - right->y2 = left->y3 + t * ( right->y3 - left->y3); - - left->x3 = left->x2 + t * ( left->x3 - left->x2 ); - left->y3 = left->y2 + t * ( left->y3 - left->y2 ); - - left->x4 = right->x1 = left->x3 + t * (right->x2 - left->x3); - left->y4 = right->y1 = left->y3 + t * (right->y2 - left->y3); - - right->x4 = bez.x4; - right->y4 = bez.y4; -} - qreal QBezier::length(qreal error) const { qreal length = qreal(0.0); diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 2702b56e73..243c99e671 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -1036,16 +1036,6 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const return result; } -static inline QPointF midPoint(const QWingedEdge &list, int ei) -{ - const QPathEdge *ep = list.edge(ei); - Q_ASSERT(ep); - - const QPointF a = *list.vertex(ep->first); - const QPointF b = *list.vertex(ep->second); - return a + 0.5 * (b - a); -} - QWingedEdge::TraversalStatus QWingedEdge::findInsertStatus(int vi, int ei) const { const QPathVertex *vp = vertex(vi); diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp index 9dbf7d7e0f..819ef6923f 100644 --- a/src/plugins/accessible/widgets/complexwidgets.cpp +++ b/src/plugins/accessible/widgets/complexwidgets.cpp @@ -370,18 +370,6 @@ QStringList QAccessibleComboBox::keyBindingsForAction(const QString &/*actionNam #endif // QT_NO_COMBOBOX -static inline void removeInvisibleWidgetsFromList(QWidgetList *list) -{ - if (!list || list->isEmpty()) - return; - - for (int i = 0; i < list->count(); ++i) { - QWidget *widget = list->at(i); - if (!widget->isVisible()) - list->removeAt(i); - } -} - #ifndef QT_NO_SCROLLAREA // ======================= QAccessibleAbstractScrollArea ======================= QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget) diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp index d2deee1db3..49a97e327c 100644 --- a/src/printsupport/kernel/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -478,15 +478,6 @@ static inline QPrinter::PaperSize string2PaperSize(const char *name) return QPrinter::Custom; } -static inline const char *paperSize2String(QPrinter::PaperSize size) -{ - for (int i = 0; i < QPrinter::NPageSize; ++i) { - if (size == named_sizes_map[i].size) - return named_sizes_map[i].name; - } - return 0; -} - QList QCUPSSupport::getCupsPrinterPaperSizes(int cupsPrinterIndex) { QList result; diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp index e281e4a7a3..93fb968d69 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp @@ -660,20 +660,6 @@ Qt::AnchorPoint QGraphicsAnchorLayoutPrivate::oppositeEdge(Qt::AnchorPoint edge) } -/*! - * \internal - * - * helper function in order to avoid overflowing anchor sizes - * the returned size will never be larger than FLT_MAX - * - */ -inline static qreal checkAdd(qreal a, qreal b) -{ - if (FLT_MAX - b < a) - return FLT_MAX; - return a + b; -} - /*! \internal diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index ca831f5a39..ac061e7071 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2577,7 +2577,6 @@ void QDockAreaLayout::remove(const QList &path) docks[index].remove(path.mid(1)); } -static inline int qMin(int i1, int i2, int i3) { return qMin(i1, qMin(i2, i3)); } static inline int qMax(int i1, int i2, int i3) { return qMax(i1, qMax(i2, i3)); } void QDockAreaLayout::getGrid(QVector *_ver_struct_list, diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index cfeb0e2c67..92a1274d7c 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -1016,19 +1016,6 @@ void QMainWindowLayout::toggleToolBarsVisible() #ifndef QT_NO_DOCKWIDGET -static inline void validateDockWidgetArea(Qt::DockWidgetArea &area) -{ - switch (area) { - case Qt::LeftDockWidgetArea: - case Qt::RightDockWidgetArea: - case Qt::TopDockWidgetArea: - case Qt::BottomDockWidgetArea: - break; - default: - area = Qt::LeftDockWidgetArea; - } -} - static QInternal::DockPosition toDockPos(Qt::DockWidgetArea area) { switch (area) { -- cgit v1.2.3