summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-01-25 00:04:42 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-01-29 13:42:07 +0000
commit1749c1dd425fdba82eb0f1a0761c4c3d71d55319 (patch)
tree3802e5a6837e318a224e8a235a2ddd77ef9a3994
parent7b5ba56b0ab55fcaf79fbf9aad70bf767c938e15 (diff)
Centralize use of __attribute__((noinline))
There are currently only two users, but I have patches in the pipeline which mark some other function noinline, so proavtively centralize the ifdef'ery involved. Change-Id: I1f02351fdc903d4e026089e12b8a976ed6a8d603 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/global/qglobal.h8
-rw-r--r--src/corelib/tools/qbytearray.cpp8
-rw-r--r--src/corelib/tools/qstring.cpp6
3 files changed, 11 insertions, 11 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index e368cf0d96..863e499667 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -485,6 +485,14 @@ typedef qptrdiff qintptr;
# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)
#endif
+#ifdef Q_CC_MSVC
+# define Q_NEVER_INLINE __declspec(noinline)
+#elif defined(Q_CC_GNU)
+# define Q_NEVER_INLINE __attribute__((noinline))
+#else
+# define Q_NEVER_INLINE
+#endif
+
//defines the type for the WNDPROC on windows
//the alignment needs to be forced for sse2 to not crash with mingw
#if defined(Q_OS_WIN)
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index f3844cf58d..7f6dab38c0 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -2761,15 +2761,11 @@ QByteArray QByteArray::mid(int pos, int len) const
\sa toUpper(), {8-bit Character Comparisons}
*/
-// noinline so that the compiler won't inline the function in each of
+// prevent the compiler from inlining the function in each of
// toLower and toUpper when the only difference is the table being used
// (even with constant propagation, there's no gain in performance).
template <typename T>
-#ifdef Q_CC_MSVC
-__declspec(noinline)
-#elif defined(Q_CC_GNU)
-__attribute__((noinline))
-#endif
+Q_NEVER_INLINE
static QByteArray toCase_template(T &input, const uchar * table)
{
// find the first bad character in input
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 4589d76279..50184f4696 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -5559,11 +5559,7 @@ struct CasefoldTraits
};
template <typename Traits, typename T>
-#ifdef Q_CC_MSVC
-__declspec(noinline)
-#elif defined(Q_CC_GNU)
-__attribute__((noinline))
-#endif
+Q_NEVER_INLINE
static QString detachAndConvertCase(T &str, QStringIterator it)
{
QString s = qMove(str); // will copy if T is const QString