Remove Q_ALWAYS_INLINE from frequently-used functions

MSVC is too stupid for them. Not only will it not inline those functions
if they are in a __declspec(dllimport) class, it will also print an
annoying Level 4 warning:

 function 'function' marked as __forceinline not inlined

Task-number: QTBUG-57811
Task-number: QTBUG-55042
Change-Id: I0b48fc8e90304e0dacc3fffd14e8a346d18a9e0c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Thiago Macieira 2017-09-28 14:19:59 -07:00
parent 7d6c168a73
commit bd4506fe5b
3 changed files with 18 additions and 24 deletions

View File

@ -165,37 +165,31 @@ Q_SIGNALS:
public: public:
#if QT_HAS_INCLUDE(<chrono>) || defined(Q_QDOC) #if QT_HAS_INCLUDE(<chrono>) || defined(Q_QDOC)
Q_ALWAYS_INLINE
void setInterval(std::chrono::milliseconds value) void setInterval(std::chrono::milliseconds value)
{ {
setInterval(int(value.count())); setInterval(int(value.count()));
} }
Q_ALWAYS_INLINE
std::chrono::milliseconds intervalAsDuration() const std::chrono::milliseconds intervalAsDuration() const
{ {
return std::chrono::milliseconds(interval()); return std::chrono::milliseconds(interval());
} }
Q_ALWAYS_INLINE
std::chrono::milliseconds remainingTimeAsDuration() const std::chrono::milliseconds remainingTimeAsDuration() const
{ {
return std::chrono::milliseconds(remainingTime()); return std::chrono::milliseconds(remainingTime());
} }
Q_ALWAYS_INLINE
static void singleShot(std::chrono::milliseconds value, const QObject *receiver, const char *member) static void singleShot(std::chrono::milliseconds value, const QObject *receiver, const char *member)
{ {
singleShot(int(value.count()), receiver, member); singleShot(int(value.count()), receiver, member);
} }
Q_ALWAYS_INLINE
static void singleShot(std::chrono::milliseconds value, Qt::TimerType timerType, const QObject *receiver, const char *member) static void singleShot(std::chrono::milliseconds value, Qt::TimerType timerType, const QObject *receiver, const char *member)
{ {
singleShot(int(value.count()), timerType, receiver, member); singleShot(int(value.count()), timerType, receiver, member);
} }
Q_ALWAYS_INLINE
void start(std::chrono::milliseconds value) void start(std::chrono::milliseconds value)
{ {
start(int(value.count())); start(int(value.count()));

View File

@ -256,21 +256,21 @@ public:
# define Q_REQUIRED_RESULT # define Q_REQUIRED_RESULT
# define Q_REQUIRED_RESULT_pushed # define Q_REQUIRED_RESULT_pushed
# endif # endif
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toLower() const & Q_REQUIRED_RESULT QByteArray toLower() const &
{ return toLower_helper(*this); } { return toLower_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toLower() && Q_REQUIRED_RESULT QByteArray toLower() &&
{ return toLower_helper(*this); } { return toLower_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toUpper() const & Q_REQUIRED_RESULT QByteArray toUpper() const &
{ return toUpper_helper(*this); } { return toUpper_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toUpper() && Q_REQUIRED_RESULT QByteArray toUpper() &&
{ return toUpper_helper(*this); } { return toUpper_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray trimmed() const & Q_REQUIRED_RESULT QByteArray trimmed() const &
{ return trimmed_helper(*this); } { return trimmed_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray trimmed() && Q_REQUIRED_RESULT QByteArray trimmed() &&
{ return trimmed_helper(*this); } { return trimmed_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray simplified() const & Q_REQUIRED_RESULT QByteArray simplified() const &
{ return simplified_helper(*this); } { return simplified_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray simplified() && Q_REQUIRED_RESULT QByteArray simplified() &&
{ return simplified_helper(*this); } { return simplified_helper(*this); }
# ifdef Q_REQUIRED_RESULT_pushed # ifdef Q_REQUIRED_RESULT_pushed
# pragma pop_macro("Q_REQUIRED_RESULT") # pragma pop_macro("Q_REQUIRED_RESULT")

View File

@ -414,25 +414,25 @@ public:
# define Q_REQUIRED_RESULT # define Q_REQUIRED_RESULT
# define Q_REQUIRED_RESULT_pushed # define Q_REQUIRED_RESULT_pushed
# endif # endif
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toLower() const & Q_REQUIRED_RESULT QString toLower() const &
{ return toLower_helper(*this); } { return toLower_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toLower() && Q_REQUIRED_RESULT QString toLower() &&
{ return toLower_helper(*this); } { return toLower_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toUpper() const & Q_REQUIRED_RESULT QString toUpper() const &
{ return toUpper_helper(*this); } { return toUpper_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toUpper() && Q_REQUIRED_RESULT QString toUpper() &&
{ return toUpper_helper(*this); } { return toUpper_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toCaseFolded() const & Q_REQUIRED_RESULT QString toCaseFolded() const &
{ return toCaseFolded_helper(*this); } { return toCaseFolded_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toCaseFolded() && Q_REQUIRED_RESULT QString toCaseFolded() &&
{ return toCaseFolded_helper(*this); } { return toCaseFolded_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString trimmed() const & Q_REQUIRED_RESULT QString trimmed() const &
{ return trimmed_helper(*this); } { return trimmed_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString trimmed() && Q_REQUIRED_RESULT QString trimmed() &&
{ return trimmed_helper(*this); } { return trimmed_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString simplified() const & Q_REQUIRED_RESULT QString simplified() const &
{ return simplified_helper(*this); } { return simplified_helper(*this); }
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString simplified() && Q_REQUIRED_RESULT QString simplified() &&
{ return simplified_helper(*this); } { return simplified_helper(*this); }
# ifdef Q_REQUIRED_RESULT_pushed # ifdef Q_REQUIRED_RESULT_pushed
# pragma pop_macro("Q_REQUIRED_RESULT") # pragma pop_macro("Q_REQUIRED_RESULT")