Bug 308357

Summary: Fails to build on arm due to qreal/double mismatch in embedded kdchart
Product: [Frameworks and Libraries] massif-visualizer Reporter: Scott Kitterman <kde>
Component: generalAssignee: Massif Visualizer developers <massif-visualizer>
Status: RESOLVED FIXED    
Severity: major CC: kde
Priority: NOR    
Version: 0.3   
Target Milestone: 0.2   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Scott Kitterman 2012-10-14 06:13:59 UTC
qreal != double on arm architectures, so code that assume it is won't build:

/build/buildd/massif-visualizer-0.3/kdchart/src/KDChartAbstractDiagram_p.h: In member function 'void KDChart::AbstractDiagram::Private::paintDataValueText(const KDChart::AbstractDiagram*, QPainter*, const KDChart::DataValueAttributes&, const QPointF&, QString, bool, bool, QRectF*)':
/build/buildd/massif-visualizer-0.3/kdchart/src/KDChartAbstractDiagram_p.h:305:37: warning: variable 'alignBottomLeft' set but not used [-Wunused-but-set-variable]
/build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp: In member function 'virtual const QPair<QPointF, QPointF> KDChart::StackedPlotter::calculateDataBoundaries() const':
/build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp:86:43: error: no matching function for call to 'qMin(double&, const qreal&)'
/build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp:86:43: note: candidate is:
In file included from /usr/include/qt4/QtCore/qnamespace.h:45:0,
                 from /usr/include/qt4/QtCore/qobjectdefs.h:45,
                 from /usr/include/qt4/QtCore/qobject.h:47,
                 from /usr/include/qt4/QtCore/QObject:1,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartAbstractCoordinatePlane.h:27,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartCartesianCoordinatePlane.h:27,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartAbstractCartesianDiagram.h:27,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartPlotter.h:31,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartPlotter_p.h:38,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.h:31,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp:28:
/usr/include/qt4/QtCore/qglobal.h:1213:34: note: template<class T> const T& qMin(const T&, const T&)
/usr/include/qt4/QtCore/qglobal.h:1213:34: note:   template argument deduction/substitution failed:
/build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp:86:43: note:   deduced conflicting types for parameter 'const T' ('double' and 'qreal {aka float}')
/build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp:87:43: error: no matching function for call to 'qMax(double&, const qreal&)'
/build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp:87:43: note: candidate is:
In file included from /usr/include/qt4/QtCore/qnamespace.h:45:0,
                 from /usr/include/qt4/QtCore/qobjectdefs.h:45,
                 from /usr/include/qt4/QtCore/qobject.h:47,
                 from /usr/include/qt4/QtCore/QObject:1,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartAbstractCoordinatePlane.h:27,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartCartesianCoordinatePlane.h:27,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartAbstractCartesianDiagram.h:27,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartPlotter.h:31,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartPlotter_p.h:38,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.h:31,
                 from /build/buildd/massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp:28:
Here's the fix:

Index: massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp
===================================================================
--- massif-visualizer-0.3.orig/kdchart/src/KDChartStackedPlotter_p.cpp  2011-11-06 17:45:56.000000000 -0500
+++ massif-visualizer-0.3/kdchart/src/KDChartStackedPlotter_p.cpp       2012-10-14 02:06:56.383367363 -0400
@@ -83,8 +83,8 @@
             // take in account all stacked values
             yMin = qMin( qMin( yMin, negativeStackedValues ), stackedValues );
             yMax = qMax( qMax( yMax, negativeStackedValues ), stackedValues );
-            xMin = qMin( xMin, xPoint.key );
-            xMax = qMax( xMax, xPoint.key );
+            xMin = qMin( qreal(xMin), xPoint.key );
+            xMax = qMax( qreal(xMax), xPoint.key );
         }
     }


Reproducible: Always
Comment 1 Milian Wolff 2014-06-29 20:46:50 UTC
Git commit e2c581231a8f9ce6717922b306e755fe672f0bf2 by Milian Wolff.
Committed on 29/06/2014 at 20:46.
Pushed by mwolff into branch 'master'.

Fix compile on arm.

M  +2    -2    kdchart/src/KDChartStackedPlotter_p.cpp

http://commits.kde.org/massif-visualizer/e2c581231a8f9ce6717922b306e755fe672f0bf2