From f3721d77067d4d0f81971a4bfb1bb135bf146d8a Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 26 Apr 2012 13:00:56 +0300 Subject: [PATCH] get rid of Q_*_EXPORT_INLINE macros > Girish: > We should be able to remove the macro completely today, > just mark all those functions as plain inline. > With Qt5, we don't have to worry about bc yet. this fixes "import attribute ignored" warnings on mingw with -fno-keep-inline-dllexport Change-Id: I616e5de7c8d59953ce03a316b941a439fae56298 Reviewed-by: Olivier Goffart --- src/corelib/global/qglobal.h | 52 ------------------------------------------- src/corelib/tools/qrect.h | 16 ++++++------- src/gui/painting/qmatrix.h | 14 ++++++------ src/gui/painting/qrgb.h | 18 +++++++-------- src/gui/painting/qtransform.h | 26 +++++++++++----------- 5 files changed, 37 insertions(+), 89 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 114857b..5f2445f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -634,58 +634,6 @@ class QDataStream; # endif #endif -// Functions marked as Q_GUI_EXPORT_INLINE were exported and inlined by mistake. -// Compilers like MinGW complain that the import attribute is ignored. -#if defined(Q_CC_MINGW) -# if defined(QT_BUILD_CORE_LIB) -# define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline -# else -# define Q_CORE_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_GUI_LIB) -# define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline -# else -# define Q_GUI_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_WIDGETS_LIB) -# define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline -# else -# define Q_WIDGETS_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_PLATFORMSUPPORT_LIB) -# define Q_PLATFORMSUPPORT_EXPORT_INLINE Q_PLATFORMSUPPORT_EXPORT inline -# else -# define Q_PLATFORMSUPPORT_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_PRINTSUPPORT_LIB) -# define Q_PRINTSUPPORT_EXPORT_INLINE Q_PRINTSUPPORT_EXPORT inline -# else -# define Q_PRINTSUPPORT_EXPORT_INLINE inline -# endif -# if defined(QT_BUILD_COMPAT_LIB) -# define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline -# else -# define Q_COMPAT_EXPORT_INLINE inline -# endif -#elif defined(Q_CC_RVCT) -// we force RVCT not to export inlines by passing --visibility_inlines_hidden -// so we need to just inline it, rather than exporting and inlining -// note: this affects the contents of the DEF files (ie. these functions do not appear) -# define Q_CORE_EXPORT_INLINE inline -# define Q_GUI_EXPORT_INLINE inline -# define Q_WIDGETS_EXPORT_INLINE inline -# define Q_PLATFORMSUPPORT_EXPORT_INLINE inline -# define Q_PRINTSUPPORT_EXPORT_INLINE inline -# define Q_COMPAT_EXPORT_INLINE inline -#else -# define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline -# define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline -# define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline -# define Q_PLATFORMSUPPORT_EXPORT_INLINE Q_PLATFORMSUPPORT_EXPORT inline -# define Q_PRINTSUPPORT_EXPORT_INLINE Q_PRINTSUPPORT_EXPORT inline -# define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline -#endif - /* No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols for Qt's internal unit tests. If you want slower loading times and more diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h index 1186cf1..ff318db 100644 --- a/src/corelib/tools/qrect.h +++ b/src/corelib/tools/qrect.h @@ -144,8 +144,8 @@ public: QT_DEPRECATED QRect intersect(const QRect &r) const { return intersected(r); } #endif - friend Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator==(const QRect &, const QRect &); - friend Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator!=(const QRect &, const QRect &); + friend Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &); + friend Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &); private: int x1; @@ -155,8 +155,8 @@ private: }; Q_DECLARE_TYPEINFO(QRect, Q_MOVABLE_TYPE); -Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator==(const QRect &, const QRect &); -Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator!=(const QRect &, const QRect &); +Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &); +Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &); /***************************************************************************** @@ -544,8 +544,8 @@ public: QT_DEPRECATED QRectF intersect(const QRectF &r) const { return intersected(r); } #endif - friend Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator==(const QRectF &, const QRectF &); - friend Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator!=(const QRectF &, const QRectF &); + friend Q_DECL_CONSTEXPR inline bool operator==(const QRectF &, const QRectF &); + friend Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &, const QRectF &); Q_DECL_CONSTEXPR inline QRect toRect() const; QRect toAlignedRect() const; @@ -558,8 +558,8 @@ private: }; Q_DECLARE_TYPEINFO(QRectF, Q_MOVABLE_TYPE); -Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator==(const QRectF &, const QRectF &); -Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator!=(const QRectF &, const QRectF &); +Q_DECL_CONSTEXPR inline bool operator==(const QRectF &, const QRectF &); +Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &, const QRectF &); /***************************************************************************** diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index 7acc962..00eec33 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -137,19 +137,19 @@ private: Q_DECLARE_TYPEINFO(QMatrix, Q_MOVABLE_TYPE); // mathematical semantics -Q_GUI_EXPORT_INLINE QPoint operator*(const QPoint &p, const QMatrix &m) +inline QPoint operator*(const QPoint &p, const QMatrix &m) { return m.map(p); } -Q_GUI_EXPORT_INLINE QPointF operator*(const QPointF &p, const QMatrix &m) +inline QPointF operator*(const QPointF &p, const QMatrix &m) { return m.map(p); } -Q_GUI_EXPORT_INLINE QLineF operator*(const QLineF &l, const QMatrix &m) +inline QLineF operator*(const QLineF &l, const QMatrix &m) { return m.map(l); } -Q_GUI_EXPORT_INLINE QLine operator*(const QLine &l, const QMatrix &m) +inline QLine operator*(const QLine &l, const QMatrix &m) { return m.map(l); } -Q_GUI_EXPORT_INLINE QPolygon operator *(const QPolygon &a, const QMatrix &m) +inline QPolygon operator *(const QPolygon &a, const QMatrix &m) { return m.map(a); } -Q_GUI_EXPORT_INLINE QPolygonF operator *(const QPolygonF &a, const QMatrix &m) +inline QPolygonF operator *(const QPolygonF &a, const QMatrix &m) { return m.map(a); } -Q_GUI_EXPORT_INLINE QRegion operator *(const QRegion &r, const QMatrix &m) +inline QRegion operator *(const QRegion &r, const QMatrix &m) { return m.map(r); } Q_GUI_EXPORT QPainterPath operator *(const QPainterPath &p, const QMatrix &m); diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h index 6d046be..dd59069 100644 --- a/src/gui/painting/qrgb.h +++ b/src/gui/painting/qrgb.h @@ -53,31 +53,31 @@ typedef unsigned int QRgb; // RGB triplet const QRgb RGB_MASK = 0x00ffffff; // masks RGB values -Q_GUI_EXPORT_INLINE int qRed(QRgb rgb) // get red part of RGB +inline int qRed(QRgb rgb) // get red part of RGB { return ((rgb >> 16) & 0xff); } -Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb) // get green part of RGB +inline int qGreen(QRgb rgb) // get green part of RGB { return ((rgb >> 8) & 0xff); } -Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb) // get blue part of RGB +inline int qBlue(QRgb rgb) // get blue part of RGB { return (rgb & 0xff); } -Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb) // get alpha part of RGBA +inline int qAlpha(QRgb rgb) // get alpha part of RGBA { return rgb >> 24; } -Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)// set RGB value +inline QRgb qRgb(int r, int g, int b)// set RGB value { return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } -Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)// set RGBA value +inline QRgb qRgba(int r, int g, int b, int a)// set RGBA value { return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } -Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)// convert R,G,B to gray 0..255 +inline int qGray(int r, int g, int b)// convert R,G,B to gray 0..255 { return (r*11+g*16+b*5)/32; } -Q_GUI_EXPORT_INLINE int qGray(QRgb rgb) // convert RGB to gray 0..255 +inline int qGray(QRgb rgb) // convert RGB to gray 0..255 { return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); } -Q_GUI_EXPORT_INLINE bool qIsGray(QRgb rgb) +inline bool qIsGray(QRgb rgb) { return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); } QT_END_NAMESPACE diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 2e56da1..9fd713d 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -361,34 +361,34 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QTransform &); /****** end stream functions *******************/ // mathematical semantics -Q_GUI_EXPORT_INLINE QPoint operator*(const QPoint &p, const QTransform &m) +inline QPoint operator*(const QPoint &p, const QTransform &m) { return m.map(p); } -Q_GUI_EXPORT_INLINE QPointF operator*(const QPointF &p, const QTransform &m) +inline QPointF operator*(const QPointF &p, const QTransform &m) { return m.map(p); } -Q_GUI_EXPORT_INLINE QLineF operator*(const QLineF &l, const QTransform &m) +inline QLineF operator*(const QLineF &l, const QTransform &m) { return m.map(l); } -Q_GUI_EXPORT_INLINE QLine operator*(const QLine &l, const QTransform &m) +inline QLine operator*(const QLine &l, const QTransform &m) { return m.map(l); } -Q_GUI_EXPORT_INLINE QPolygon operator *(const QPolygon &a, const QTransform &m) +inline QPolygon operator *(const QPolygon &a, const QTransform &m) { return m.map(a); } -Q_GUI_EXPORT_INLINE QPolygonF operator *(const QPolygonF &a, const QTransform &m) +inline QPolygonF operator *(const QPolygonF &a, const QTransform &m) { return m.map(a); } -Q_GUI_EXPORT_INLINE QRegion operator *(const QRegion &r, const QTransform &m) +inline QRegion operator *(const QRegion &r, const QTransform &m) { return m.map(r); } -Q_GUI_EXPORT_INLINE QPainterPath operator *(const QPainterPath &p, const QTransform &m) +inline QPainterPath operator *(const QPainterPath &p, const QTransform &m) { return m.map(p); } -Q_GUI_EXPORT_INLINE QTransform operator *(const QTransform &a, qreal n) +inline QTransform operator *(const QTransform &a, qreal n) { QTransform t(a); t *= n; return t; } -Q_GUI_EXPORT_INLINE QTransform operator /(const QTransform &a, qreal n) +inline QTransform operator /(const QTransform &a, qreal n) { QTransform t(a); t /= n; return t; } -Q_GUI_EXPORT_INLINE QTransform operator +(const QTransform &a, qreal n) +inline QTransform operator +(const QTransform &a, qreal n) { QTransform t(a); t += n; return t; } -Q_GUI_EXPORT_INLINE QTransform operator -(const QTransform &a, qreal n) +inline QTransform operator -(const QTransform &a, qreal n) { QTransform t(a); t -= n; return t; } QT_END_NAMESPACE QT_END_HEADER -#endif +#endif // QTRANSFORM_H -- 2.7.4